@@ -118,9 +118,13 @@ must include the public part of the device's Ed25519 key, and must be
118
118
signed by that key, as described in [ Signing
119
119
JSON] ( /appendices/#signing-json ) .
120
120
121
- One-time keys are also uploaded to the homeserver using the
121
+ One-time and fallback keys are also uploaded to the homeserver using the
122
122
[ ` /keys/upload ` ] ( /client-server-api/#post_matrixclientv3keysupload ) API.
123
123
124
+ {{% added-in v="1.2" %}} Fallback keys are simply one-time keys which get
125
+ used when the device has run out of one-time keys. They are not consumed
126
+ once used, but should be replaced when additional one-time keys are uploaded.
127
+
124
128
Devices must store the private part of each key they upload. They can
125
129
discard the private part of a one-time key when they receive a message
126
130
using that key. However it's possible that a one-time key given out by a
@@ -129,6 +133,24 @@ never know that it can discard the key. Therefore a device could end up
129
133
trying to store too many private keys. A device that is trying to store
130
134
too many private keys may discard keys starting with the oldest.
131
135
136
+ {{% boxes/warning %}}
137
+ Fallback keys are used to prevent one-time key exhaustion when devices
138
+ are offline/unable to upload additional keys, though can also be used
139
+ to initiate replay attacks.
140
+ {{% /boxes/warning %}}
141
+
142
+ {{% boxes/warning %}}
143
+ Clients should not store the private half of fallback keys indefinitely
144
+ to avoid situations where attackers can decrypt past messages sent using
145
+ that fallback key.
146
+
147
+ Instead, clients should keep the private keys for at most 2 fallback keys:
148
+ the current, unused, fallback key and the key immediately preceding it.
149
+ Once the client is reasonably certain it has received all messages that
150
+ used the old fallback key, such as after an hour since the last message,
151
+ it should remove that fallback key.
152
+ {{% /boxes/warning %}}
153
+
132
154
##### Tracking the device list for a user
133
155
134
156
Before Alice can send an encrypted message to Bob, she needs a list of
@@ -345,6 +367,11 @@ A homeserver should rate-limit the number of one-time keys that a given
345
367
user or remote server can claim. A homeserver should discard the public
346
368
part of a one time key once it has given that key to another user.
347
369
370
+ {{% added-in v="1.2" %}} If the device has run out of one-time keys which
371
+ can be claimed, the homeserver will return the fallback key (if one was
372
+ uploaded). Fallback keys are not deleted once used and should be replaced
373
+ by the device when they are able to upload more one-time keys.
374
+
348
375
#### Device verification
349
376
350
377
Before Alice sends Bob encrypted data, or trusts data received from him,
@@ -1604,10 +1631,23 @@ It also adds a `one_time_keys_count` property. Note the spelling
1604
1631
difference with the ` one_time_key_counts ` property in the
1605
1632
[ ` /keys/upload ` ] ( /client-server-api/#post_matrixclientv3keysupload ) response.
1606
1633
1607
- | Parameter | Type | Description |
1608
- | ----------------------------| --------------------| ------------------------------------------------------------------------------------------------------------------------|
1609
- | device_lists | DeviceLists | Optional. Information on e2e device updates. Note: only present on an incremental sync. |
1610
- | device_one_time_keys_count | {string: integer} | Optional. For each key algorithm, the number of unclaimed one-time keys currently held on the server for this device. |
1634
+
1635
+ {{% added-in v="1.2" %}} Finally, a ` device_unused_fallback_key_types ` property
1636
+ is added to list the key algorithms which * have not* been used in a
1637
+ [ ` /keys/claim ` ] ( /client-server-api/#post_matrixclientv3keysclaim ) response.
1638
+ When a previously uploaded fallback key's algorithm is missing from this
1639
+ list, the device should upload a replacement key alongside any necessary
1640
+ one-time keys to avoid the fallback key's further usage. This property
1641
+ is required for inclusion, though previous versions of the specification
1642
+ did not have it. In addition to ` /versions ` , this can be a way to identify
1643
+ the server's support for fallback keys.
1644
+
1645
+
1646
+ | Parameter | Type | Description |
1647
+ | ----------------------------------| --------------------| ------------------------------------------------------------------------------------------------------------------------|
1648
+ | device_lists | DeviceLists | Optional. Information on e2e device updates. Note: only present on an incremental sync. |
1649
+ | device_one_time_keys_count | {string: integer} | Optional. For each key algorithm, the number of unclaimed one-time keys currently held on the server for this device. |
1650
+ | device_unused_fallback_key_types | [ string] | ** Required.** The unused fallback key algorithms. |
1611
1651
1612
1652
` DeviceLists `
1613
1653
0 commit comments