refactor: extract CryptoFacade, introduce RoomMemberCache#10
Merged
ThomasHalwax merged 19 commits intomainfrom Mar 20, 2026
Merged
refactor: extract CryptoFacade, introduce RoomMemberCache#10ThomasHalwax merged 19 commits intomainfrom
ThomasHalwax merged 19 commits intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ershipChanged callbacks
…dler and key sharing
* required for invitations
…l back to cached data" This reverts commit 9fe742b.
This values goes into the "via" array that is required for space -> child relationship https://spec.matrix.org/v1.17/client-server-api/#mspacechild-relationship
The parameter was passed through the entire call chain (project → crypto-facade → crypto) but never used — the algorithm is hardcoded to MegolmV1AesSha2 via RoomSettings. Also fixed sync-gated-content unit tests: mocks used wrong property name (cryptoManager instead of crypto) and wrong method (setRoomEncryption instead of registerRoom), so the encryption registration path was never actually tested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The CryptoManager was directly injected into TimelineAPI, CommandAPI, and Project — each module contained its own copy of the crypto orchestration ceremony. This violated separation of concerns and made the code fragile and hard to maintain.
Changes
CryptoFacade (
src/crypto-facade.mjs)RoomMemberCache (
src/room-members.mjs)API Changes
optionswithonSyncResponseanddecryptEventcallbacks instead of a crypto objectmemberCache(RoomMemberCache) as second parameter; optionalencryptEventin optionsmemberCacheandcryptooptions object withisEnabled,registerRoom,shareHistoricalKeysprocessOutgoingCryptoRequests()removed (moved to facade)Principles Applied
E2E Tests
All test files updated for the new API signatures. Test logic and assertions unchanged.