@@ -792,14 +792,19 @@ Key requests
792792
793793When a device is missing keys to decrypt messages, it can request the keys by
794794sending `m.room_key_request `_ to-device messages to other devices with
795- ``action `` set to ``request ``. If a device wishes to share the keys with that
796- device, it can forward the keys to the first device by sending an encrypted
797- `m.forwarded_room_key `_ to-device message. The first device should then send an
798- `m.room_key_request `_ to-device message with ``action `` set to
799- ``request_cancellation `` to the other devices that it had originally sent the key
800- request to; a device that receives a ``request_cancellation `` should disregard any
801- previously-received ``request `` message with the same ``request_id `` and
802- ``requesting_device_id ``.
795+ ``action `` set to ``request ``.
796+
797+ If a device wishes to share the keys with that device, it can forward the keys
798+ to the first device by sending an encrypted `m.forwarded_room_key `_ to-device
799+ message. The first device should then send an `m.room_key_request `_ to-device
800+ message with ``action `` set to ``request_cancellation `` to the other devices
801+ that it had originally sent the key request to; a device that receives a
802+ ``request_cancellation `` should disregard any previously-received ``request ``
803+ message with the same ``request_id `` and ``requesting_device_id ``.
804+
805+ If a device does not wish to share keys with that device, it can indicate this
806+ by sending an `m.room_key.withheld `_ to-device message, as described in
807+ `Reporting that decryption keys are withheld `_.
803808
804809.. NOTE ::
805810
@@ -1333,6 +1338,31 @@ Example response:
13331338 }
13341339 }
13351340
1341+ Reporting that decryption keys are withheld
1342+ -------------------------------------------
1343+
1344+ When sending an encrypted event to a room, a client can signal to other devices
1345+ in that room that it is not sending them the keys needed to decrypt the event.
1346+ In this way, the receiving client can indicate to the user why it cannot
1347+ decrypt the event, rather than just showing a generic error message.
1348+
1349+ In the same way, when one device requests keys from another using `Key
1350+ requests `_, the device from which the key is being requested may want to tell
1351+ the requester that it is purposely not sharing the key.
1352+
1353+ If Alice withholds a megolm session from Bob for some messages in a room, and
1354+ then later on decides to allow Bob to decrypt later messages, she can send Bob
1355+ the megolm session, ratcheted up to the point at which she allows Bob to
1356+ decrypt the messages. If Bob logs into a new device and uses key sharing to
1357+ obtain the decryption keys, the new device will be sent the megolm sessions
1358+ that have been ratcheted up. Bob's old device can include the reason that the
1359+ session was initially not shared by including a ``withheld `` property in the
1360+ ``m.forwarded_room_key `` message that is an object with the ``code `` and
1361+ ``reason `` properties from the ``m.room_key.withheld `` message.
1362+
1363+ {{m_room_key_withheld_event}}
1364+
1365+
13361366.. References
13371367
13381368 .. _ed25519 : http://ed25519.cr.yp.to/
0 commit comments