mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Key Backups (2/3) : Add E2E backup key tables (#1945)
* Add PUT key backup endpoints and glue them to PerformKeyBackup * Add tables for storing backup keys and glue them into the user API * Don't create tables whilst still WIPing * writer on sqlite please * Linting
This commit is contained in:
parent
a060df91e2
commit
b3754d68fc
12 changed files with 737 additions and 45 deletions
|
@ -50,13 +50,39 @@ type PerformKeyBackupRequest struct {
|
|||
AuthData json.RawMessage
|
||||
Algorithm string
|
||||
DeleteBackup bool // if true will delete the backup based on 'Version'.
|
||||
|
||||
// The keys to upload, if any. If blank, creates/updates/deletes key version metadata only.
|
||||
Keys struct {
|
||||
Rooms map[string]struct {
|
||||
Sessions map[string]KeyBackupSession `json:"sessions"`
|
||||
} `json:"rooms"`
|
||||
}
|
||||
}
|
||||
|
||||
// KeyBackupData in https://spec.matrix.org/unstable/client-server-api/#get_matrixclientr0room_keyskeysroomidsessionid
|
||||
type KeyBackupSession struct {
|
||||
FirstMessageIndex int `json:"first_message_index"`
|
||||
ForwardedCount int `json:"forwarded_count"`
|
||||
IsVerified bool `json:"is_verified"`
|
||||
SessionData json.RawMessage `json:"session_data"`
|
||||
}
|
||||
|
||||
// Internal KeyBackupData for passing to/from the storage layer
|
||||
type InternalKeyBackupSession struct {
|
||||
KeyBackupSession
|
||||
RoomID string
|
||||
SessionID string
|
||||
}
|
||||
|
||||
type PerformKeyBackupResponse struct {
|
||||
Error string // set if there was a problem performing the request
|
||||
BadInput bool // if set, the Error was due to bad input (HTTP 400)
|
||||
Exists bool // set to true if the Version exists
|
||||
Version string
|
||||
|
||||
Exists bool // set to true if the Version exists
|
||||
Version string // the newly created version
|
||||
|
||||
KeyCount int64 // only set if Keys were given in the request
|
||||
KeyETag string // only set if Keys were given in the request
|
||||
}
|
||||
|
||||
type QueryKeyBackupRequest struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue