Skip to content

improve event format description of m.room.encrypted events#2413

Open
gewitternacht wants to merge 8 commits into
matrix-org:mainfrom
gewitternacht:encrypted-event-format
Open

improve event format description of m.room.encrypted events#2413
gewitternacht wants to merge 8 commits into
matrix-org:mainfrom
gewitternacht:encrypted-event-format

Conversation

@gewitternacht

@gewitternacht gewitternacht commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

The current description for the format of the content of m.room.encrypted Olm/Megolm events (see https://spec.matrix.org/v1.19/client-server-api/#molmv1curve25519-aes-sha2 and https://spec.matrix.org/v1.19/client-server-api/#mmegolmv1aes-sha2) is rather confusing, which I'm trying to improve by fixing the following issues (as discussed with @richvdh and @andybalaam):

  • we can only really define the format of content, any properties like type alongside content are already fixed by how events look like (which is why they are now mentioned in the accompanying text)
  • importantly, events also have a sender property alongside content, which wasn't present in the JSON snippet before, but is referenced further below
  • the old placeholders for body contained "payload", which is a very overloaded term
  • the description of ciphertext wasn't really correct
  • for Megolm, a reference to the message format was missing

Pull Request Checklist

Preview: https://pr2413--matrix-spec-previews.netlify.app

Signed-off-by: Johanna Stuber <johannas@element.io>
@gewitternacht
gewitternacht requested review from a team and zecakeh as code owners July 13, 2026 15:46
Signed-off-by: Johanna Stuber <johannas@element.io>
Signed-off-by: Johanna Stuber <johannas@element.io>
Signed-off-by: Johanna Stuber <johannas@element.io>
Signed-off-by: Johanna Stuber <johannas@element.io>

@andybalaam andybalaam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, with one comment.

Comment thread content/client-server-api/modules/end_to_end_encryption.md
Signed-off-by: Johanna Stuber <johannas@element.io>
@richvdh

richvdh commented Jul 15, 2026

Copy link
Copy Markdown
Member

(I've added some links to the existing spec to the PR description, for my own reference, and the benefit for future archaeologists)

@richvdh richvdh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! A couple of comments.

Comment thread content/client-server-api/modules/end_to_end_encryption.md Outdated
Comment thread content/client-server-api/modules/end_to_end_encryption.md Outdated
Comment thread content/client-server-api/modules/end_to_end_encryption.md
the form:
Note that when the event is received from the server, it will have additional
properties alongside the `content` property, including a `type` (with a value
of `m.room.encrypted`) and a `sender` property. In `content`, `ciphertext`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
of `m.room.encrypted`) and a `sender` property. In `content`, `ciphertext`
of `m.room.encrypted`) and a `sender` property. (See [Room event format](#room-event-format).)
Within `content`, `ciphertext`

maybe?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to above: will Megolm-encrypted events always use the ClientEvent format, or could there be instances where the properties alongside content are different ones?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if the spec makes it explicit, but Megolm is only designed for use on room events, so in this case, yes such events will always use the ClientEvent format.

Comment thread content/client-server-api/modules/event_replacements.md Outdated
gewitternacht and others added 2 commits July 20, 2026 10:51
Signed-off-by: Johanna Stuber <johannas@element.io>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
@richvdh
richvdh requested review from richvdh and removed request for richvdh July 20, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants