Compare commits

...

6 commits

Author SHA1 Message Date
Mathieu Velten da8b1f5be5
Merge b47858b981 into f9dec5dc92 2026-07-16 20:38:46 +04:00
gewitternacht f9dec5dc92
Fix typesetting of symbols in Olm/Megolm spec (#2421)
Some checks are pending
Spec / 🔎 Validate OpenAPI specifications (push) Waiting to run
Spec / 🔎 Check Event schema examples (push) Waiting to run
Spec / 🔎 Check OpenAPI definitions examples (push) Waiting to run
Spec / 🔎 Check JSON Schemas inline examples (push) Waiting to run
Spec / ⚙️ Calculate baseURL for later jobs (push) Waiting to run
Spec / 🐍 Build OpenAPI definitions (push) Blocked by required conditions
Spec / 📢 Run towncrier for changelog (push) Waiting to run
Spec / 📖 Build the spec (push) Blocked by required conditions
Spec / 🔎 Validate generated HTML (push) Blocked by required conditions
Spec / 📖 Build the historical backup spec (push) Blocked by required conditions
Spec / Create release (push) Blocked by required conditions
Spell Check / Spell Check with Typos (push) Waiting to run
* properly typeset symbols in Olm/Megolm message format tables

Signed-off-by: Johanna Stuber <johannas@element.io>

* use \mathit in Olm spec analogously to Megolm spec

Signed-off-by: Johanna Stuber <johannas@element.io>

* add newsfragment

Signed-off-by: Johanna Stuber <johannas@element.io>

* fix typo

Signed-off-by: Johanna Stuber <johannas@element.io>

---------

Signed-off-by: Johanna Stuber <johannas@element.io>
2026-07-16 11:55:30 -04:00
Johannes Marbach 16b04f9d6c
Add further normative language in mutual rooms server behaviour (#2407)
* Add further normative language in mutual rooms server behaviour

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>

* Avoid superfluous MUST

Co-authored-by: Hubert Chathi <hubertc@matrix.org>

---------

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
Co-authored-by: Hubert Chathi <hubertc@matrix.org>
2026-07-16 11:18:09 -04:00
Kim Brose 966109da49
Clarify that clients must avoid producing ambiguous matrix.to URIs (#2396)
Some checks are pending
Spec / 🔎 Validate OpenAPI specifications (push) Waiting to run
Spec / 🔎 Check Event schema examples (push) Waiting to run
Spec / 🔎 Check OpenAPI definitions examples (push) Waiting to run
Spec / 🔎 Check JSON Schemas inline examples (push) Waiting to run
Spec / ⚙️ Calculate baseURL for later jobs (push) Waiting to run
Spec / 🐍 Build OpenAPI definitions (push) Blocked by required conditions
Spec / 📢 Run towncrier for changelog (push) Waiting to run
Spec / 📖 Build the spec (push) Blocked by required conditions
Spec / 🔎 Validate generated HTML (push) Blocked by required conditions
Spec / 📖 Build the historical backup spec (push) Blocked by required conditions
Spec / Create release (push) Blocked by required conditions
Spell Check / Spell Check with Typos (push) Waiting to run
2026-07-15 17:43:19 +00:00
gewitternacht e2b879d13d
Rename OlmPayload -> OlmPlaintext to avoid confusion with Olm message Payload Bytes (#2418)
Some checks are pending
Spec / 🔎 Validate OpenAPI specifications (push) Waiting to run
Spec / 🔎 Check Event schema examples (push) Waiting to run
Spec / 🔎 Check OpenAPI definitions examples (push) Waiting to run
Spec / 🔎 Check JSON Schemas inline examples (push) Waiting to run
Spec / ⚙️ Calculate baseURL for later jobs (push) Waiting to run
Spec / 🐍 Build OpenAPI definitions (push) Blocked by required conditions
Spec / 📢 Run towncrier for changelog (push) Waiting to run
Spec / 📖 Build the spec (push) Blocked by required conditions
Spec / 🔎 Validate generated HTML (push) Blocked by required conditions
Spec / 📖 Build the historical backup spec (push) Blocked by required conditions
Spec / Create release (push) Blocked by required conditions
Spell Check / Spell Check with Typos (push) Waiting to run
Signed-off-by: Johanna Stuber <johannas@element.io>
2026-07-15 10:41:01 +01:00
Mathieu Velten b47858b981
Add 413 error to /sendToDevice 2026-03-20 17:32:14 +01:00
12 changed files with 46 additions and 31 deletions

View file

@ -0,0 +1 @@
Clarify that clients must avoid producing ambiguous matrix.to URIs. Contributed by @HarHarLinks.

View file

@ -0,0 +1 @@
Add further normative language in mutual rooms server behaviour.

View file

@ -0,0 +1 @@
Rename OlmPayload to OlmPlaintext to avoid confusion with Olm message Payload Bytes.

View file

@ -0,0 +1 @@
Fix typesetting of some symbols in the Olm/Megolm spec.

View file

@ -887,20 +887,22 @@ https://matrix.to/#/<identifier>/<extra parameter>?<additional arguments>
The identifier may be a room ID, room alias, or user ID. The The identifier may be a room ID, room alias, or user ID. The
extra parameter is only used in the case of permalinks where an event ID extra parameter is only used in the case of permalinks where an event ID
is referenced. The matrix.to URI, when referenced, must always start is referenced. The matrix.to URI, when referenced, MUST always start
with `https://matrix.to/#/` followed by the identifier. with `https://matrix.to/#/` followed by the identifier.
The `<additional arguments>` and the preceding question mark are The `<additional arguments>` and the preceding question mark are
optional and only apply in certain circumstances, documented below. OPTIONAL and only apply in certain circumstances, documented below.
Clients should not rely on matrix.to URIs falling back to a web server Clients SHOULD NOT rely on matrix.to URIs falling back to a web server
if accessed and instead should perform some sort of action within the if accessed and instead SHOULD perform some sort of action within the
client. For example, if the user were to click on a matrix.to URI for a client. For example, if the user were to click on a matrix.to URI for a
room alias, the client may open a view for the user to participate in room alias, the client MAY open a view for the user to participate in
the room. the room.
The components of the matrix.to URI (`<identifier>` and The components of the matrix.to URI (`<identifier>` and
`<extra parameter>`) MUST be percent-encoded as per RFC 3986. `<extra parameter>`) MUST be percent-encoded as per RFC 3986.
Failure to do so will result in downstream software misinterpreting
the links as invalid/not turning them into clickable links in UI.
Examples of matrix.to URIs are: Examples of matrix.to URIs are:

View file

@ -1762,12 +1762,9 @@ Messages with type 1 can only be decrypted with an existing session. If
there is no matching session, the client must treat this as an invalid there is no matching session, the client must treat this as an invalid
message. message.
The plaintext payload is of the form: The plaintext corresponding to the "Cipher-Text" in an an [Olm message](/olm-megolm/olm/#normal-messages) is of the form:
{{% definition path="api/client-server/definitions/olm_payload" %}} {{% definition path="api/client-server/definitions/olm_plaintext" %}}
The type and content of the plaintext message event are given in the
payload.
If a client has multiple sessions established with another device, it If a client has multiple sessions established with another device, it
should use the session from which it last received and successfully should use the session from which it last received and successfully

View file

@ -6,9 +6,9 @@
#### Server behaviour #### Server behaviour
The server may decide that the response to this endpoint is too large, and only return a The server MAY decide that the response to this endpoint is too large, and only return a
subset of the results. In this case, the server should populate the optional field `next_batch` subset of the results. In this case, the server populates the optional field `next_batch`
with an [opaque identifier](/appendices/#opaque-identifiers). The client may then supply with an [opaque identifier](/appendices/#opaque-identifiers). The client can then supply
the identifier as the `from` query parameter in a subsequent request, along with the original the identifier as the `from` query parameter in a subsequent request, along with the original
`user_id`, to fetch the next batch of responses. This will continue until the server no longer `user_id`, to fetch the next batch of responses. This will continue until the server no longer
inserts `next_batch`, meaning there are no further results. inserts `next_batch`, meaning there are no further results.

View file

@ -257,8 +257,8 @@ consists of the following key-value pairs:
**Name**|**Tag**|**Type**|**Meaning** **Name**|**Tag**|**Type**|**Meaning**
:-----:|:-----:|:-----:|:-----: :-----:|:-----:|:-----:|:-----:
Message-Index|0x08|Integer|The index of the ratchet, i Message-Index|0x08|Integer|The index of the ratchet, \(i\).
Cipher-Text|0x12|String|The cipher-text, Xi, of the message Cipher-Text|0x12|String|The cipher-text of the message, \(X_i\).
Within the payload, integers are encoded using a variable length encoding. Each Within the payload, integers are encoded using a variable length encoding. Each
integer is encoded as a sequence of bytes with the high bit set followed by a integer is encoded as a sequence of bytes with the high bit set followed by a

View file

@ -17,12 +17,12 @@ side of an \(=\) it means that the output is split.
When this document uses \(\operatorname{ECDH}\left(K_A,K_B\right)\) it means When this document uses \(\operatorname{ECDH}\left(K_A,K_B\right)\) it means
that each party computes a Diffie-Hellman agreement using their private key that each party computes a Diffie-Hellman agreement using their private key
and the remote party's public key. and the remote party's public key.
So party \(A\) computes \(\operatorname{ECDH}\left(K_B^{public},K_A^{private}\right)\) So party \(A\) computes \(\operatorname{ECDH}\left(K_B^{\mathit{public}},K_A^{\mathit{private}}\right)\)
and party \(B\) computes \(\operatorname{ECDH}\left(K_A^{public},K_B^{private}\right)\). and party \(B\) computes \(\operatorname{ECDH}\left(K_A^{\mathit{public}},K_B^{\mathit{private}}\right)\).
Where this document uses \(\operatorname{HKDF}\left(salt,IKM,info,L\right)\) it Where this document uses \(\operatorname{HKDF}\left(\mathit{salt},\mathit{IKM},\mathit{info},L\right)\) it
refers to the [HMAC-based key derivation function][] with a salt value of refers to the [HMAC-based key derivation function][] with a salt value of
\(salt\), input key material of \(IKM\), context string \(info\), \(\mathit{salt}\), input key material of \(\mathit{IKM}\), context string \(\mathit{info}\),
and output keying material length of \(L\) bytes. and output keying material length of \(L\) bytes.
## The Olm Algorithm ## The Olm Algorithm
@ -226,9 +226,9 @@ significant bits are stored in the first byte.
**Name**|**Tag**|**Type**|**Meaning** **Name**|**Tag**|**Type**|**Meaning**
:-----:|:-----:|:-----:|:-----: :-----:|:-----:|:-----:|:-----:
Ratchet-Key|0x0A|String|The public part of the ratchet key, Ti, of the message Ratchet-Key|0x0A|String|The public part of the ratchet key of the message, \(T_i\).
Chain-Index|0x10|Integer|The chain index, j, of the message Chain-Index|0x10|Integer|The chain index of the message, \(j\).
Cipher-Text|0x22|String|The cipher-text, Xi,j, of the message Cipher-Text|0x22|String|The cipher-text of the message, \(X_{i,j}\).
The length of the MAC is determined by the authenticated encryption algorithm The length of the MAC is determined by the authenticated encryption algorithm
being used. (Olm version 1 uses [HMAC-SHA-256][], truncated to 8 bytes). The being used. (Olm version 1 uses [HMAC-SHA-256][], truncated to 8 bytes). The
@ -251,9 +251,9 @@ The payload uses the same key-value format as for normal messages.
**Name**|**Tag**|**Type**|**Meaning** **Name**|**Tag**|**Type**|**Meaning**
:-----:|:-----:|:-----:|:-----: :-----:|:-----:|:-----:|:-----:
One-Time-Key|0x0A|String|The public part of Bob's single-use key, Eb. One-Time-Key|0x0A|String|The public part of Bob's single-use key, \(E_B\).
Base-Key|0x12|String|The public part of Alice's single-use key, Ea. Base-Key|0x12|String|The public part of Alice's single-use key, \(E_A\).
Identity-Key|0x1A|String|The public part of Alice's identity key, Ia. Identity-Key|0x1A|String|The public part of Alice's identity key, \(I_A\).
Message|0x22|String|An embedded Olm message with its own version and MAC. Message|0x22|String|An embedded Olm message with its own version and MAC.
## Olm Authenticated Encryption ## Olm Authenticated Encryption
@ -268,13 +268,13 @@ message key using [HKDF-SHA-256][] using the default salt and an info of
\[ \[
\begin{aligned} \begin{aligned}
AES\_KEY_{i,j}\;\parallel\;HMAC\_KEY_{i,j}\;\parallel\;AES\_IV_{i,j} \mathit{AES\_KEY}_{i,j}\;\parallel\;\mathit{HMAC\_KEY}_{i,j}\;\parallel\;\mathit{AES\_IV}_{i,j}
&= \operatorname{HKDF}\left(0,M_{i,j},\text{``OLM\_KEYS"},80\right) &= \operatorname{HKDF}\left(0,M_{i,j},\text{``OLM\_KEYS"},80\right)
\end{aligned} \end{aligned}
\] \]
The plain-text is encrypted with AES-256, using the key \(AES\_KEY_{i,j}\) The plain-text is encrypted with AES-256, using the key \(\mathit{AES\_KEY}_{i,j}\)
and the IV \(AES\_IV_{i,j}\) to give the cipher-text, \(X_{i,j}\). and the IV \(\mathit{AES\_IV}_{i,j}\) to give the cipher-text, \(X_{i,j}\).
Then the entire message (including the Version Byte and all Payload Bytes) are Then the entire message (including the Version Byte and all Payload Bytes) are
passed through [HMAC-SHA-256][]. The first 8 bytes of the MAC are appended to the message. passed through [HMAC-SHA-256][]. The first 8 bytes of the MAC are appended to the message.

View file

@ -14,9 +14,9 @@
type: object type: object
title: OlmPayload title: OlmPlaintext
description: |- description: |-
The plaintext payload of an event encrypted using Olm. The plaintext of an event encrypted using Olm.
properties: properties:
type: type:
type: string type: string

View file

@ -82,6 +82,18 @@ paths:
examples: examples:
response: response:
value: {} value: {}
"413":
description: At least one device message is too large to fit in a single EDU.
content:
application/json:
schema:
$ref: definitions/errors/error.yaml
examples:
response:
value: {
"errcode": "M_TOO_LARGE",
"error": "device message to @test:example.com too large to fit in a single EDU"
}
tags: tags:
- Send-to-Device messaging - Send-to-Device messaging
servers: servers:

View file

@ -13,7 +13,7 @@ description: |-
[Olm](/client-server-api/#molmv1curve25519-aes-sha2). [Olm](/client-server-api/#molmv1curve25519-aes-sha2).
The `sender_device_keys` property in the [Olm The `sender_device_keys` property in the [Olm
plaintext](/client-server-api/#definition-olmpayload) MUST be plaintext](/client-server-api/#definition-olmplaintext) MUST be
populated. Recipients SHOULD ignore `m.room_key_bundle` messages which omit populated. Recipients SHOULD ignore `m.room_key_bundle` messages which omit
them. them.
properties: properties: