diff --git a/event-schemas/examples/v1/m.room.member b/event-schemas/examples/v1/m.room.member index a5ab79b5..4d7896f6 100644 --- a/event-schemas/examples/v1/m.room.member +++ b/event-schemas/examples/v1/m.room.member @@ -8,7 +8,15 @@ "token": "pc98", "public_key": "abc123", "key_validity_url": "https://magic.forest/verifykey", - "signature": "q1w2e3", + "signed": { + "mxid": "@alice:localhost", + "token": "pc98", + "signatures": { + "magic.forest": { + "ed25519:0": "poi098" + } + } + }, "sender": "@zun:zun.soft" } }, diff --git a/event-schemas/schema/v1/m.room.member b/event-schemas/schema/v1/m.room.member index 912f6cf3..e0ad673c 100644 --- a/event-schemas/schema/v1/m.room.member +++ b/event-schemas/schema/v1/m.room.member @@ -38,16 +38,32 @@ "type": "string", "description": "A base64-encoded ed25519 key with which token must be signed." }, - "signature": { - "type": "string", - "description": "A base64-encoded signature of token with public_key." + "signed": { + "type": "object", + "title": "signed", + "properties": { + "mxid": { + "type": "string", + "description": "The invited matrix user ID. Must be equal to the user_id property of the event." + }, + "token": { + "type": "string", + "description": "The token property of the containing third_party_invite object." + }, + "signatures": { + "type": "object", + "description": "A single signature from the verifying server, in the format specified by the Signing Events section.", + "title": "Signatures" + } + }, + "required": ["mxid", "signatures", "token"] }, "sender": { "type": "string", "description": "The matrix user ID of the user who send the invite which is being used." } }, - "required": ["token", "key_validity_url", "public_key", "signature", "sender"] + "required": ["token", "key_validity_url", "public_key", "sender", "signed"] } }, "required": ["membership"] diff --git a/specification/modules/third_party_invites.rst b/specification/modules/third_party_invites.rst index a9883db5..85538c31 100644 --- a/specification/modules/third_party_invites.rst +++ b/specification/modules/third_party_invites.rst @@ -36,7 +36,8 @@ A client asks a server to invite a user by their third party identifier. Server behaviour ---------------- -All homeservers MUST verify that sig(``token``, ``public_key``) = ``signature``. +All homeservers MUST verify the signature in the event's +``content.third_party_invite.signed`` object. If a client of the current homeserver is joining by an ``m.room.third_party_invite``, that homesever MUST validate that the public @@ -93,11 +94,11 @@ For example: When the third party user validates their identity, they are told about the invite, and ask their homeserver, H3, to join the room. - H3 validates that sign(``token``, ``public_key``) = ``signature``, and may check - ``key_validity_url``. + H3 validates the signature in the event's + ``content.third_party_invite.signed`` object. - H3 then asks H1 to join it to the room. H1 *must* validate that - sign(``token``, ``public_key``) = ``signature`` *and* check ``key_validity_url``. + H3 then asks H1 to join it to the room. H1 *must* validate the ``signed`` + property *and* check ``key_validity_url``. Having validated these things, H1 writes the join event to the room, and H3 begins participating in the room. H2 *must* accept this event.