@@ -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,32 @@ 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 optionally signal to
1345+ other devices in that room that it is not sending them the keys needed to
1346+ decrypt the event. In this way, the receiving client can indicate to the user
1347+ why it cannot decrypt the event, rather than just showing a generic error
1348+ message.
1349+
1350+ In the same way, when one device requests keys from another using `Key
1351+ requests `_, the device from which the key is being requested may want to tell
1352+ the requester that it is purposely not sharing the key.
1353+
1354+ If Alice withholds a megolm session from Bob for some messages in a room, and
1355+ then later on decides to allow Bob to decrypt later messages, she can send Bob
1356+ the megolm session, ratcheted up to the point at which she allows Bob to
1357+ decrypt the messages. If Bob logs into a new device and uses key sharing to
1358+ obtain the decryption keys, the new device will be sent the megolm sessions
1359+ that have been ratcheted up. Bob's old device can include the reason that the
1360+ session was initially not shared by including a ``withheld `` property in the
1361+ ``m.forwarded_room_key `` message that is an object with the ``code `` and
1362+ ``reason `` properties from the ``m.room_key.withheld `` message.
1363+
1364+ {{m_room_key_withheld_event}}
1365+
1366+
13361367.. References
13371368
13381369 .. _ed25519 : http://ed25519.cr.yp.to/
0 commit comments