Skip to content

Commit 830f80f

Browse files
authored
Merge pull request #1271 from uhoreg/add_verification_request_msgtype
add in-room m.key.verification.request msgtype
2 parents 82d2dd4 + f76ff36 commit 830f80f

File tree

7 files changed

+110
-14
lines changed

7 files changed

+110
-14
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add missing documentation for `m.key.verification.request` msgtype for in-room verification.

content/client-server-api/modules/end_to_end_encryption.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -434,31 +434,34 @@ shared by the other messages of that session.
434434

435435
In general, verification operates as follows:
436436

437-
- Alice requests a key verification with Bob by sending an
438-
`m.key.verification.request` event. This event indicates the verification
439-
methods that Alice's client supports. (Note that "Alice" and "Bob" may in
440-
fact be the same user, in the case where a user is verifying their own
441-
devices.)
437+
- Alice requests a key verification with Bob by sending a key verification
438+
request event. If the verification is being requested in a room, this will
439+
be an event with type [`m.room.message` and `msgtype:
440+
m.key.verification.request`](#mroommessagemkeyverificationrequest); if the verification is being requested using
441+
to-device messaging, this will be an event with type
442+
[`m.key.verification.request`](#mkeyverificationrequest). This event indicates the verification methods
443+
that Alice's client supports. (Note that "Alice" and "Bob" may in fact be the
444+
same user, in the case where a user is verifying their own devices.)
442445
- Bob's client prompts Bob to accept the key verification. When Bob accepts
443-
the verification, Bob's client sends an `m.key.verification.ready` event.
446+
the verification, Bob's client sends an [`m.key.verification.ready`](#mkeyverificationready) event.
444447
This event indicates the verification methods, corresponding to the
445448
verification methods supported by Alice's client, that Bob's client supports.
446449
- Alice's or Bob's devices allow their users to select one of the verification
447450
methods supported by both devices to use for verification. When Alice or Bob
448451
selects a verification method, their device begins the verification by
449-
sending an `m.key.verification.start` event, indicating the selected
452+
sending an [`m.key.verification.start`](#mkeyverificationstart) event, indicating the selected
450453
verification method. Note that if there is only one verification method in
451454
common between the devices then the receiver's device (Bob) can auto-select
452455
it.
453456
- Alice and Bob complete the verification as defined by the selected
454457
verification method. This could involve their clients exchanging messages,
455458
Alice and Bob exchanging information out-of-band, and/or Alice and Bob
456459
interacting with their devices.
457-
- Alice's and Bob's clients send `m.key.verification.done` events to indicate
460+
- Alice's and Bob's clients send [`m.key.verification.done`](#mkeyverificationdone) events to indicate
458461
that the verification was successful.
459462

460463
Verifications can be cancelled by either device at any time by sending an
461-
`m.key.verification.cancel` event with a `code` field that indicates the reason
464+
[`m.key.verification.cancel`](#mkeyverificationcancel) event with a `code` field that indicates the reason
462465
it was cancelled.
463466

464467
When using to-device messages, Alice may not know which of Bob's devices to
@@ -562,6 +565,8 @@ in this specification must be under the `m.key.verification` namespace
562565
and any other event types must be namespaced according to the Java
563566
package naming convention.
564567

568+
{{% event event="m.room.message$m.key.verification.request" title="`m.room.message` with `msgtype: m.key.verification.request`" %}}
569+
565570
{{% event event="m.key.verification.request" %}}
566571

567572
{{% event event="m.key.verification.ready" %}}

content/client-server-api/modules/instant_messaging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ optional keys, as outlined below. If a client cannot display the given
2929
instead.
3030

3131
Some message types support HTML in the event content that clients should
32-
prefer to display if available. Currently `m.text`, `m.emote`, and
33-
`m.notice` support an additional `format` parameter of
32+
prefer to display if available. Currently `m.text`, `m.emote`, `m.notice`,
33+
and `m.key.verification.request` support an additional `format` parameter of
3434
`org.matrix.custom.html`. When this field is present, a `formatted_body`
3535
with the HTML must be provided. The plain text version of the HTML
3636
should be provided in the `body`.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"event_id": "$143273582443PhrSn:example.org",
3+
"origin_server_ts": 1432735824653,
4+
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
5+
"sender": "@alice:example.org",
6+
"type": "m.room.message",
7+
"unsigned": {
8+
"age": 1234
9+
},
10+
"content": {
11+
"body": "Alice is requesting to verify your device, but your client does not support verification, so you may need to use a different verification method.",
12+
"from_device": "AliceDevice2",
13+
"methods": [
14+
"m.sas.v1"
15+
],
16+
"to": "@bob:example.org",
17+
"msgtype": "m.key.verification.request"
18+
}
19+
}

data/event-schemas/schema/m.key.verification.request.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ allOf:
33
- $ref: core-event-schema/event.yaml
44

55
description: |-
6-
Requests a key verification with another user's devices.
6+
Requests a key verification using to-device messaging. When requesting a key
7+
verification in a room, a `m.room.message` should be used, with
8+
[`m.key.verification.request`](#mroommessagemkeyverificationrequest) as msgtype.
79
properties:
810
content:
911
properties:
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
allOf:
3+
- $ref: core-event-schema/room_event.yaml
4+
description:
5+
Requests a key verification in a room. When requesting a key verification
6+
using to-device messaging, an event with type [`m.key.verification.request`](#mkeyverificationrequest)
7+
should be used.
8+
properties:
9+
content:
10+
properties:
11+
body:
12+
type: string
13+
description: |-
14+
A fallback message to alert users that their client does not support
15+
the key verification framework, and that they should use a different method
16+
to verify keys. For example, "Alice is requesting to verify keys with you.
17+
However, your client does not support this method, so you will need to use
18+
the legacy method of key verification."
19+
20+
Clients that do support the key verification framework should hide the body
21+
and instead present the user with an interface to accept or reject the key
22+
verification.
23+
format:
24+
description: |-
25+
The format used in the `formatted_body`. Currently only
26+
`org.matrix.custom.html` is supported.
27+
type: string
28+
formatted_body:
29+
description: |-
30+
The formatted version of the `body`. This is required if `format` is
31+
specified. As with the `body`, clients that do support the key
32+
verification framework should hide the formatted body and instead
33+
present the user with an interface to accept or reject the key
34+
verification.
35+
type: string
36+
from_device:
37+
type: string
38+
description: |-
39+
The device ID which is initiating the request.
40+
methods:
41+
type: array
42+
description: |-
43+
The verification methods supported by the sender.
44+
items:
45+
type: string
46+
to:
47+
description: |-
48+
The user that the verification request is intended for. Users who
49+
are not named in this field and who did not send this event should
50+
ignore all other events that have an `m.reference` relationship with
51+
this event.
52+
type: string
53+
msgtype:
54+
enum:
55+
- m.key.verification.request
56+
type: string
57+
required:
58+
- from_device
59+
- methods
60+
- msgtype
61+
- to
62+
type: object
63+
type:
64+
enum:
65+
- m.room.message
66+
type: string
67+
title: KeyVerification
68+
type: object

layouts/shortcodes/msgtypes.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
{{ $msgtypes := (slice "m.room.message$m.text" "m.room.message$m.emote" "m.room.message$m.notice" "m.room.message$m.image" "m.room.message$m.file") }}
1717

1818
{{/*
19-
It excludes `m.room.message$m.server_notice`
19+
It excludes `m.room.message$m.server_notice` and `m.room.message$m.key.verification.request`
20+
since they are in their own modules.
2021
*/}}
21-
{{ $excluded := slice "m.room.message$m.server_notice" }}
22+
{{ $excluded := slice "m.room.message$m.server_notice" "m.room.message$m.key.verification.request" }}
2223

2324
{{/*
2425
It then adds any other events that start with `m.room.message`.

0 commit comments

Comments
 (0)