* Make it easier to mock call memberships for specific user IDs
* Allow sending notification events when starting a call
* rename notify -> notification
* replace `joining` concept with `ownMembership`
* introduce new `m.rtc.notification` event alongside `m.call.notify`
* send new notification event alongside the deprecated one
* Test for new notification event type
* update relation string to match msc
* review
* fix doc errors
* fix tests + format
* remove anything decline related
---------
Co-authored-by: Timo <toger5@hotmail.de>
* Add `DebugLogger` type for logging matrix-js-sdk to `debug`
* unit tests for DebugLogger
* Use `DebugLogger` in some tests
* Use `DebugLogger` in rust-crypto.spec
* test-utils: silence some logging
* refactor: New encryption manager BasicEncryptionManager for todevice
fixup: bad do not commit
* fix: ToDevice transport not setting the sent_ts
* test: BasicEncryptionManager add statistics tests
* code review
* feat: Encryption manager just reshare on new joiner
* refactor: Rename BasicEncryptionManger to RTCEncryptionManager
* fixup: RTC experimental todevice should use new encryption mgr
* fixup: use proper logger hierarchy
* fixup: RTC rollout first key asap even if no members to send to
* fixup: RTC add test for first key use
* fixup! emitting outbound key before anyone registered
* fix: quick patch for transport switch, need test
* test: RTC encryption manager, add test for transport switch
* post rebase fix
* Remove bad corepack commit
* review: cleaning, renaming
* review: cleaning and renaming
* stop using root logger in favor of a parent logger
* post merge fix broken test
* remove corepack again
* fix reverted changes after a merge
* review: Properly deprecate getEncryptionKeys
* review: rename ensureMediaKeyDistribution to ensureKeyDistribution
* review: use OutdatedKeyFilter instead of KeyBuffer
* Use client logger for `RustBackupManager`
* use client logger in `CrossSigningIdentity`
* use client logger in `OutgoingRequestProcessor`
* RoomEncryptor: use correct logger for logDuration
use the logger for this specific event, rather than the more general one for the room
* Use client logger in `RoomEncryptor`
* Use client logger for sync
Use the logger attached to the MatrixClient when writing log messages out of
the sync api. This helps figure out what's going on when multiple clients are
running in the same JS environment.
* Use client logger for to-device message queue
* Use client logger in `PushProcessor.rewriteDefaultRules`
* use client logger in `ServerCapabilities`
* Mark global `logger` as deprecated
* crypto: Add new ClientEvent.ReceivedToDeviceMessage
refactor rename ProcessedToDeviceEvent to ReceivedToDeviceEvent
* fix: Restore legacy isEncrypted() for to-device messages
* Update test for new preprocessToDeviceMessages API
* quick fix on doc
* quick update docs and renaming
* review: Better doc and names for OlmEncryptionInfo
* review: Remove IToDeviceMessage alias and only keep IToDeviceEvent
* review: improve comments of processToDeviceMessages
* review: pass up encrypted event when no crypto callbacks
* review: use single payload for ReceivedToDeviceMessage
* fix linter
* review: minor comment update
* Remove `LegacyMemberhsipManager`
* remove tests from rtc session
Those tests were only run with the legacy membership manager and are redundant with the memberhsip manager test spec.
* fix tests
* dont use non existing TestManager anymore
* remove fails for legacy
* fix another test
* Allow customizing the IndexedDB database prefix used by Rust crypto.
Related to #3974
Signed-off-by: Patrick Cloke <clokep@patrick.cloke.us>
* Rename argument
---------
Signed-off-by: Patrick Cloke <clokep@patrick.cloke.us>
* First pass implementation
* fix naming/docs
* apply lint
* Add test for existing behaviour
* Add happy path tests
* Fix bug identified by tests
* ... and this is why we add negative tests too
* Add some sanity tests
* Apply linter
* Ensure we send spec-compliant filter strings by stripping out null values
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add test
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Allow the embedded client to work without UpdateState version
* Test that RoomWidgetClient can receive state without update_state
* add sliding sync test
* sliding sync receive test
* review
* add doc comment
---------
Co-authored-by: Timo <toger5@hotmail.de>
* Check for `unknown variant` on to-device sending and fallback to room event encryption.
* fix tests
* fix error js-sdk api type
* Change logger from debug to warn for unsupported to-device transport and improve error message comments
* also add case for not supported
This will be send by the driver in case we sent an encrypted to-device but do not have support of that.
---------
Co-authored-by: Robin <robin@robin.town>
* Remove redundant sendDelayedEventAction
We do already have the state `hasMemberEvent` that allows to distinguish the two cases. No need to create two dedicated actions.
* fix missing return
* Make membership manager an event emitter to inform about status updates.
- deprecate isJoined (replaced by isActivated)
- move Interface types to types.ts
* add tests for status updates.
* lint
* test "reschedules delayed leave event" in case the delayed event gets canceled
* review
* fix types
* prettier
* fix legacy membership manager
* remove deprecated jitter.
* use non deprecated config fields (keep deprecated fields as fallback)
* update tests to test non deprecated names
* make local NewMembershipManager variable names consistent with config
* make LegacyMembershipManger local variables consistent with config
* comments and rename `networkErrorLocalRetryMs` -> `networkErrorRetryMs`
* review
* Switch from defer to Promise.withResolvers
As supported by the outgoing LTS version (v22) which has 99% support of ES2024
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Deprecate defer instead of killing it
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Knip
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate based on review
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate based on review
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate based on review
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve coverage
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
The condition was inverted here, but the tests were passing because
they didn't add enough expiry time for the token expiry to be over
the threshold.
Fix the condition and tests, add another test and generally add a
bunch of comments so hopefully this is less confusing for the next
person.
Fixes https://github.com/element-hq/element-web/issues/29858
* Refactor how token refreshing works to be more resilient
1. ensure we do use the new token if it is not explicitly inhibited by the caller
2. eagerly refresh token if we know it is expired
3. allow refreshing a token multiple times if e.g. on bad connection or the environment has been slept and sufficient time has passed since the last refresh attempt
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add exponential backoff
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Ensure no timing effects on `authedRequest` method call
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Stabilise MSC3765
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
* Remove unstable content and hardcode property name
---------
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
* use methodFactory extensions from the rootLogger in child loggers.
* use simple method factory copy AND `childLogger.setLevel(childLogger.getLevel());`
This is the important part that actually registers the new methods.
* add comments and find a way to make it clearer that the types are correct.
* review
* additionally fix MatrixRTCSessionManager being initialized before the extension is in place.
* Add comment to clarify order of log extensions and creating childs.
* review
* Set "loglevel" min version to guarantee access to `logger.rebuild`
* Fix token refresh racing with other requests and not using new token
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* MatrixRTC: ToDevice distribution for media stream keys
* test: Add RTC to device transport test
* lint
* fix key indexing
* fix indexing take two
- use correct value for: `onEncryptionKeysChanged`
- only update `latestGeneratedKeyIndex` for "this user" key
* test: add test for join config `useExperimentalToDeviceTransport`
* update test to fail without the fixed encryption key index
* review
* review (dave)
---------
Co-authored-by: Timo <toger5@hotmail.de>
* refactor: extract RoomKeyTransport class for key distribution
* refact: Call key transport, pass the target recipients to sendKey
* update IKeyTransport interface to event emitter.
* fix not subscribing to KeyTransportEvents in the EncryptionManager + cleanup
* fix one test and broken bits needed for the test (mostly statistics wrangling)
* fix tests
* add back decryptEventIfNeeded
* move and fix room transport tests
* dedupe isMyMembership
* move type declarations around to be at more reasonable places
* remove deprecated `onMembershipUpdate`
* fix imports
* only start keytransport when session is joined
* use makeKey to reduce test loc
* fix todo comment -> note comment
---------
Co-authored-by: Timo <toger5@hotmail.de>
* Remove redundant sendDelayedEventAction
We do already have the state `hasMemberEvent` that allows to distinguish the two cases. No need to create two dedicated actions.
* fix missing return
* Make membership manager an event emitter to inform about status updates.
- deprecate isJoined (replaced by isActivated)
- move Interface types to types.ts
* add tests for status updates.
* lint
* test "reschedules delayed leave event" in case the delayed event gets canceled
* review
* fix types
* prettier
* fix legacy membership manager
* Abstract logout-causing error type from tokenRefreshFunction calls
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add test
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve PushProcessor::getPushRuleGlobRegex
Fix cache key not taking non-pattern parameters into account
Use lookarounds to ensure the word boundary isn't treated as part of the match
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Export push processor method for converting matrix glob to regexp
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Export pushProcessor from MatrixClient
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add capturing group around pattern match
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve comment
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>