Skip to content

Commit ace94f0

Browse files
authored
Merge pull request #2132 from jimmycuadra/clarify-m.key.verification.start
Clarify the distinction between *m.key.verification.start* and its *m.sas.v1* variant.
2 parents 204601d + 8246383 commit ace94f0

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clarify the distinction between ``m.key.verification.start`` and its ``m.sas.v1`` variant.

event-schemas/schema/m.key.verification.start

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

55
description: |-
6-
Begins a key verification process. Typically sent as a `to-device`_ event.
6+
Begins a key verification process. Typically sent as a `to-device`_ event. The ``method``
7+
field determines the type of verification. The fields in the event will differ depending
8+
on the ``method``. This definition includes fields that are in common among all variants.
79
properties:
810
content:
911
properties:
@@ -26,7 +28,8 @@ properties:
2628
type: string
2729
description: |-
2830
Optional method to use to verify the other user's key with. Applicable
29-
when the ``method`` chosen only verifies one user's key.
31+
when the ``method`` chosen only verifies one user's key. This field will
32+
never be present if the ``method`` verifies keys both ways.
3033
required:
3134
- from_device
3235
- transaction_id

event-schemas/schema/m.key.verification.start$m.sas.v1

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

55
description: |-
6-
Begins a SAS key verification process. Typically sent as a `to-device`_ event.
6+
Begins a SAS key verification process using the ``m.sas.v1`` method. Typically sent as a `to-device`_ event.
77
properties:
88
content:
99
properties:
@@ -22,7 +22,7 @@ properties:
2222
type: string
2323
enum: ["m.sas.v1"]
2424
description: |-
25-
The verification method to use. Must be ``m.sas.v1``.
25+
The verification method to use.
2626
key_agreement_protocols:
2727
type: array
2828
description: |-

scripts/templating/matrix_templates/units.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,14 @@ def read_event_schema(self, filepath):
902902
"`m.room.message msgtypes`_."
903903
)
904904

905+
# method types for m.key.verification.start
906+
if schema["type"] == "m.key.verification.start":
907+
methods = Units.prop(
908+
json_schema, "properties/content/properties/method/enum"
909+
)
910+
if methods:
911+
schema["type_with_msgtype"] = schema["type"] + " (" + methods[0] + ")"
912+
905913
# Assign state key info if it has some
906914
if schema["typeof"] == "State Event":
907915
skey_desc = Units.prop(

0 commit comments

Comments
 (0)