-
Notifications
You must be signed in to change notification settings - Fork 334
Make nonces lookuppable by client ids #2655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
services/brig/src/Brig/Data/Nonce.hs
Outdated
| insert :: PrepQuery W (Identity Nonce) () | ||
| insert = fromString $ "INSERT INTO client_nonce (nonce) VALUES (?) USING TTL " <> show ttl | ||
| insert :: PrepQuery W (Text, Nonce) () | ||
| insert = fromString $ "INSERT INTO nonce (key, nonce) VALUES (?) USING TTL " <> show ttl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| insert = fromString $ "INSERT INTO nonce (key, nonce) VALUES (?) USING TTL " <> show ttl | |
| insert = fromString $ "INSERT INTO nonce (key, nonce) VALUES (?, ?) USING TTL " <> show ttl |
|
This PR does not solve the problem that we need to change the API to somehow give us the After |
|
no need to discuss the destructive cassandra update, as (a) the |
|
If you want to make sure we don't store negative TTLs: ( |
| :> "nonce" | ||
| :> "clients" | ||
| :> CaptureClientId "client" | ||
| :> "nonce" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| key text PRIMARY KEY, | ||
| nonce uuid | ||
| ) WITH bloom_filter_fp_chance = 0.01 | ||
| user uuid, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks!
I was going to say that we wanted to avoid typing the key, but I can't think of a hypothetical use case where asking for a UserId doesn't make sense. So, good, I think.
|
|
||
| -- | Convert 'Word32' to 'Int32', with clipping if it doesn't fit. | ||
| word32ToInt32 :: Word32 -> Int32 | ||
| word32ToInt32 = fromIntegral . min (fromIntegral (maxBound @Int32)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know it's an impractical corner case in this context, but hum... can we use Range to make sure we don't run into this overflow?
https://wearezeta.atlassian.net/browse/FS-736 (the part where we need to change the way we store nonces)
Checklist
make git-add-cassandra-schemato update the cassandra schema documentation.