mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 12:52:24 +03:00
Support for fallback keys (#3451)
Backports support for fallback keys from Harmony, which should make E2EE more reliable in the face of OTK exhaustion. Signed-off-by: Neil Alexander <git@neilalexander.dev> Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
c3d7a34c15
commit
78dbf21c5f
13 changed files with 446 additions and 20 deletions
|
@ -35,6 +35,7 @@ func DeviceOTKCounts(ctx context.Context, keyAPI api.SyncKeyAPI, userID, deviceI
|
|||
return queryRes.Error
|
||||
}
|
||||
res.DeviceListsOTKCount = queryRes.Count.KeyCount
|
||||
res.DeviceListsUnusedFallbackAlgorithms = queryRes.UnusedFallbackAlgorithms
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -350,13 +350,14 @@ type ToDeviceResponse struct {
|
|||
|
||||
// Response represents a /sync API response. See https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-sync
|
||||
type Response struct {
|
||||
NextBatch StreamingToken `json:"next_batch"`
|
||||
AccountData *ClientEvents `json:"account_data,omitempty"`
|
||||
Presence *ClientEvents `json:"presence,omitempty"`
|
||||
Rooms *RoomsResponse `json:"rooms,omitempty"`
|
||||
ToDevice *ToDeviceResponse `json:"to_device,omitempty"`
|
||||
DeviceLists *DeviceLists `json:"device_lists,omitempty"`
|
||||
DeviceListsOTKCount map[string]int `json:"device_one_time_keys_count,omitempty"`
|
||||
NextBatch StreamingToken `json:"next_batch"`
|
||||
AccountData *ClientEvents `json:"account_data,omitempty"`
|
||||
Presence *ClientEvents `json:"presence,omitempty"`
|
||||
Rooms *RoomsResponse `json:"rooms,omitempty"`
|
||||
ToDevice *ToDeviceResponse `json:"to_device,omitempty"`
|
||||
DeviceLists *DeviceLists `json:"device_lists,omitempty"`
|
||||
DeviceListsOTKCount map[string]int `json:"device_one_time_keys_count,omitempty"`
|
||||
DeviceListsUnusedFallbackAlgorithms []string `json:"device_unused_fallback_key_types"`
|
||||
}
|
||||
|
||||
func (r Response) MarshalJSON() ([]byte, error) {
|
||||
|
@ -419,6 +420,7 @@ func NewResponse() *Response {
|
|||
res.DeviceLists = &DeviceLists{}
|
||||
res.ToDevice = &ToDeviceResponse{}
|
||||
res.DeviceListsOTKCount = map[string]int{}
|
||||
res.DeviceListsUnusedFallbackAlgorithms = []string{}
|
||||
|
||||
return &res
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue