Skip to content

Conversation

kaylendog
Copy link
Contributor

Adds support for MSC3414-esque encrypted state events.

  • Updates matrix-sdk-crypto-wasm to 15.3.0 which includes support for encrypting state events.
  • Adds an MatrixClient.enableEncryptedStateEvents flag to configure top-level behaviour.
  • Modifies MatrixClient.sendStateEvent to call into the WASM SDK if encryption is enabled.
  • Adds MatrixEvent.getWireStateKey, analagous to MatrixEvent.getWireContent.

This can be split into multiple PRs for ease of reviewing if required!

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

@richvdh
Copy link
Member

richvdh commented Sep 12, 2025

Please don't put words like "feat" in titles of matrix-js-sdk PRs: such titles end up the changelog, and although implementing this has indeed been quite a feat, it doesn't do to brag about it ;)

(also https://richvdh.org/conventional-commits-considered-harmful.html but that's beside the point)

@kaylendog kaylendog changed the title feat: Implement experimental encrypted state events. Implement experimental encrypted state events. Sep 12, 2025
Copy link
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

Looking good - a few smallish points to work through together.

Copy link
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

All good, thanks!

@andybalaam andybalaam added this pull request to the merge queue Sep 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 23, 2025
@andybalaam
Copy link
Member

andybalaam commented Sep 23, 2025

@kaylendog the "downstream" checks failed, meaning when we compile Element Web with this change something went wrong.

The error is:

Error: matrix-js-sdk/src/client.ts(6642,96): error TS2322: Type 'StateEvents[K]' is not assignable to type 'IContent | undefined'.
  Type 'StateEvents[K]' is not assignable to type 'IContent'.
Error: src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx(177,83): error TS2345: Argument of type '{ algorithm: "m.megolm.v1.aes-sha2"; }' is not assignable to parameter of type 'RoomEncryptionEventContent'.
  Property '"io.element.msc3414.encrypt_state_events"' is missing in type '{ algorithm: "m.megolm.v1.aes-sha2"; }' but required in type 'RoomEncryptionEventContent'.
error Command failed with exit code 2.

(From https://github.com/matrix-org/matrix-js-sdk/actions/runs/17948535831/job/51041145148 , accessed via the "Details" link above.)

I think this is a valid error: your new property should definitely be optional, so events from clients that don't support it still work ok.

@kaylendog
Copy link
Contributor Author

All fixed!

@andybalaam
Copy link
Member

Awesome, please rebase and force-push and I'll merge

@andybalaam andybalaam added this pull request to the merge queue Sep 24, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 24, 2025
@andybalaam andybalaam added this pull request to the merge queue Sep 24, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 24, 2025
@andybalaam andybalaam added this pull request to the merge queue Sep 24, 2025
Merged via the queue into matrix-org:develop with commit a08a273 Sep 24, 2025
28 checks passed
@kaylendog kaylendog deleted the kaylendog/msc3414 branch September 24, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants