Skip to content

Commit

Permalink
Retrieve oldest one-time key with each select
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Nov 8, 2024
1 parent cd7a9df commit 0d0dba6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion userapi/storage/postgres/one_time_keys_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const deleteOneTimeKeySQL = "" +
"DELETE FROM keyserver_one_time_keys WHERE user_id = $1 AND device_id = $2 AND algorithm = $3 AND key_id = $4"

const selectKeyByAlgorithmSQL = "" +
"SELECT key_id, key_json FROM keyserver_one_time_keys WHERE user_id = $1 AND device_id = $2 AND algorithm = $3 LIMIT 1"
"SELECT key_id, key_json FROM keyserver_one_time_keys WHERE user_id = $1 AND device_id = $2 AND algorithm = $3 ORDER BY ts_added_secs ASC LIMIT 1"

const deleteOneTimeKeysSQL = "" +
"DELETE FROM keyserver_one_time_keys WHERE user_id = $1 AND device_id = $2"
Expand Down

0 comments on commit 0d0dba6

Please sign in to comment.