mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Implement claiming one-time keys locally (#1210)
* Add API shape for claiming keys * Implement claiming one-time keys locally Fairly boring, nothing too special going on.
This commit is contained in:
parent
d76eb1b994
commit
1d72ce8b7a
10 changed files with 202 additions and 8 deletions
|
@ -23,6 +23,7 @@ import (
|
|||
|
||||
type KeyInternalAPI interface {
|
||||
PerformUploadKeys(ctx context.Context, req *PerformUploadKeysRequest, res *PerformUploadKeysResponse)
|
||||
// PerformClaimKeys claims one-time keys for use in pre-key messages
|
||||
PerformClaimKeys(ctx context.Context, req *PerformClaimKeysRequest, res *PerformClaimKeysResponse)
|
||||
QueryKeys(ctx context.Context, req *QueryKeysRequest, res *QueryKeysResponse)
|
||||
}
|
||||
|
@ -102,9 +103,17 @@ func (r *PerformUploadKeysResponse) KeyError(userID, deviceID string, err *KeyEr
|
|||
}
|
||||
|
||||
type PerformClaimKeysRequest struct {
|
||||
// Map of user_id to device_id to algorithm name
|
||||
OneTimeKeys map[string]map[string]string
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
type PerformClaimKeysResponse struct {
|
||||
// Map of user_id to device_id to algorithm:key_id to key JSON
|
||||
OneTimeKeys map[string]map[string]map[string]json.RawMessage
|
||||
// Map of remote server domain to error JSON
|
||||
Failures map[string]interface{}
|
||||
// Set if there was a fatal error processing this action
|
||||
Error *KeyError
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue