Add support for fallback keys #1710
No reviewers
Labels
No labels
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
Wont fix
old/ci/cd
old/rust
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
continuwuation/continuwuity!1710
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "eve/ackduck:I1228"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements: #1228
Fallback keys can be provided by client devices to be used in case the supply of one-time keys run out. The server will store one fallback key per user, per device, per algorithm. The server will keep track of whether this fallback has been used or not.
The /keys/claim endpoint now provides a fallback key if no one-time key is found
The /keys/upload endpoint now accepts fallback keys
The /sync endpoint now informs the client of the algorithms for which it has an unused fallback key in stock.
Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
I1228to Add support for fallback keys@ -643,0 +667,4 @@// There is one fallback key slot per user, per device, per algorithm// Therefore we use this as the DB key for this columnlet mut db_key = user_id.as_bytes().to_vec();db_key.push(0xFF);Pretty sure there's a nicer way to do this
Than writing the bytes by hand, you mean ? I just followed the way the surrounding code does it, I'm not fond of it either.
See the account data service for a nicer example. No need for raw_put
@Jade changed it to use serde instead of raw bytes (except for the prefix that I maybe have to write by hand (?) )
73e4a89246a8f015e319a8f015e319432c73040b432c73040b523939152fLooks good to me, just testing now
Works a charm, I think we should be good for merge. I'll wait for someone else to approve the DB code (cc @Jade)