* Support stable identifier m.room_key_bundle
* Support stable identifier m.shared_history
* Test that checks isRoomKeyBundleMessage works for stable and unstable identifiers
* Replace similar tests with use of it.each
* push backup key to other verified devices when we reset backup
* handle receiving pushed backup keys
- make sure that backup gets enabled after we receive a pushed key that
matches the current, valid backup
* apply requested changes from review
* tests: Refactor history sharing tests using `setupClients` helper
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
* tests: Use separate destructors for test clients
---------
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
* feat: Only share history if room history visibility is shared
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
* docs: Update documentation for `InviteOpts.shareEncryptedHistory`
* tests: Ensure shared history respects current history visibility
This commit additionally modifies `expectSendRoomEvent` to remove
the matcher on success, since fetchmock takes a while to do this
automatically.
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
---------
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
* Store rooms pending key bundles in the CryptoStore
Replace the in-memory storage of which rooms are waiting for a key bundle with
permanent storage in the crypto store.
* Clear pending-key-bundle flag on malformed bundles
If we cannot import the key bundle, there is no point trying again another
time: we may as well clear the flag either way.
* Factor out some helpers in history sharing integ test
* Do not accept key bundles for rooms we joined more than 24h ago
Per discussion in crypto-internal.
* Clear pending key bundle data when we leave a room
* Resume key-bundle import on restart
* Clear pending-key-bundle flag on rooms that we joined ages ago
* fixup! Clear pending-key-bundle flag on malformed bundles
* Update dependency @matrix-org/matrix-sdk-crypto-wasm to v18
* Adapt to breaking changes in rust-sdk wasm bindings
* more types fixes
* types fixes for tests
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Richard van der Hoff <richard@matrix.org>
* cleanup: Remove deprecated rtc room key transport
* fix: rtc statistics are managed by transport directly
* mark as readonly
* cleanup do not use deprecated `room`
* doc: Add missing param doc
* fixup: add back test wrongly removed
When multiple m.replace edits arrive concurrently, getLastReplacement()
may block on decryption. If an older edit's decryption completes after a
newer edit has already been applied, the older async result overwrites
the target event with stale content.
Add a monotonic update counter (replacementUpdateId) and centralise all
replacement updates through updateTargetEventReplacement(). The method
captures the counter before awaiting and discards the result if a newer
update has started in the meantime.
This race is especially pronounced in encrypted rooms with rapid
streaming-style edits, where variable decryption timing causes
out-of-order promise resolution.
* Fix reactive display name disambiguation
When a room member changes their display name, recalculate the disambiguation flag for all other members who share (or previously shared) that display name. This ensures that the 'disambiguate' flag is updated reactively when display name conflicts appear or are resolved.
Fixeselement-hq/element-web#468Fixeselement-hq/element-web#4795Fixeselement-hq/element-web#31551
Signed-off-by: aditya-cherukuru <cherukuru.aditya01@gmail.com>
* Refactor: move disambiguation logic per review feedback
- Added updateDisambiguation() method to RoomMember for direct disambiguation recalculation
- Moved affected display name tracking to setStateEvents() instead of updateDisplayNameCache()
- Removed setMembershipEvent() hack, now calls updateDisambiguation() directly
Signed-off-by: aditya-cherukuru <cherukuru.aditya01@gmail.com>
* Exclude processed members from disambiguation loop
Signed-off-by: aditya-cherukuru <cherukuru.aditya01@gmail.com>
---------
Signed-off-by: aditya-cherukuru <cherukuru.aditya01@gmail.com>
* Support additional_creators in upgradeRoom (MSC4289)
Signed-off-by: Andy Balaam <andy.balaam@matrix.org>
* Remove unneeded undefined in type definition
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Andy Balaam <andy.balaam@matrix.org>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Recalculate room name on loading members
Because if it's a DM room, loading members might change the room name
* Swap other userA / userB constants
* Typo
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Add support for stable OAuth2.0 aware feature from MSC3824
* Use stable name internally
* Mark DELEGATED_OIDC_COMPATIBILITY as
* Add tsdoc config for @alias JSDoc modifier
* Give RoomWidgetClient the ability to send and receive sticky events
* linter
* Fix existing tests
* Add tests for sticky event support in embedded clients
* Update sticky event widget capability identifiers
In matrix-widget-api 0.16.1 they are updated to use the new unstable prefix from MSC4407.
* Explicitly require matrix-widget-api ≥ 1.16.1
* remove TODO comment
* simplify type lint checks
This is needed for EW donwstream tests. Otherwise it will through:
Error: matrix-js-sdk/src/embedded.ts(417,21): error TS2345: Argument of
type 'string | number | boolean | string[]' is not assignable to
parameter of type 'number'.
---------
Co-authored-by: Timo K <toger5@hotmail.de>
* Skip unwritten tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Tidy jest fake timers
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove unnecessary sessionStorage mock
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve types
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve async assertions
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve error assertions
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve object assertions
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove assertion testing unclear mock
This test failed when ran individually, same as after the clearAllMocks call
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Avoid awaiting non-thenables
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Pass nop function when stubbing out console, vitest won't accept it any other way
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove unnecessary mock which causes tests to fail after updating fetch-mock & fix typo
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix mistaken assertions not testing all values in array
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix hidden non-running tests in room.spec.ts
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Update fetch-mock-jest to @fetch-mock/jest
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Make knip happier
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Make knip happier 2.0
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Switch from Jest to Vitest
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix CI
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove unnecessary fake timers
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Update vite
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Revert irrelevant changes
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix coverage spec paths
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix slow test reporter
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix bad merge conflict resolution
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix babel config
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Skip unwritten tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Tidy jest fake timers
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove unnecessary sessionStorage mock
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve types
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve async assertions
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve error assertions
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve object assertions
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove assertion testing unclear mock
This test failed when ran individually, same as after the clearAllMocks call
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Avoid awaiting non-thenables
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Pass nop function when stubbing out console, vitest won't accept it any other way
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove unnecessary mock which causes tests to fail after updating fetch-mock & fix typo
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix mistaken assertions not testing all values in array
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix hidden non-running tests in room.spec.ts
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Update fetch-mock-jest to @fetch-mock/jest
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Make knip happier
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Make knip happier 2.0
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Delint
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>
* Skip unwritten tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Tidy jest fake timers
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove unnecessary sessionStorage mock
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve types
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve async assertions
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve error assertions
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve object assertions
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove assertion testing unclear mock
This test failed when ran individually, same as after the clearAllMocks call
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Avoid awaiting non-thenables
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Pass nop function when stubbing out console, vitest won't accept it any other way
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove unnecessary mock which causes tests to fail after updating fetch-mock & fix typo
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix mistaken assertions not testing all values in array
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix hidden non-running tests in room.spec.ts
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Use normal base64 encoding for RTC backend identities
MSC4195 has been updated to specify that normal (non-URL-safe) base64 is the correct encoding for LiveKit participant identities.
* Test RTC backend identity computation
* Update dependency @matrix-org/matrix-sdk-crypto-wasm to v17
* Remove references to `ShieldStateCode.SentInClear`
This was never used, and is no longer exported, by rust-sdk-crypto-wasm, so we
need to remove references to it.
* Add `MatrixEvent.getKeyForwardingUser`
Expose information about keys forwarded via MSC4286, via a new method on
`MatrixEvent`.
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Update dependency @matrix-org/matrix-sdk-crypto-wasm to v17
* Remove references to `ShieldStateCode.SentInClear`
This was never used, and is no longer exported, by rust-sdk-crypto-wasm, so we
need to remove references to it.
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Richard van der Hoff <richard@matrix.org>
* deprecate membershipID -> memberId & memberId -> stateKey in membership
manager
The membership manager used the memberId label for the stateKey. But
only the StickymembershipManager really has a configurable memberId.
* participantId -> callMembershipIdentityParts
The participantId is a termonology from livekit. We do not want it in
here! We want the js-sdk to be mostly transport agnostic. We do the
transition from the identity parts to the acutal livekit identity in
Element call (`sha256(userId+deviceId+memberId)`)
* update tests
* Expose `kind` to decide if we use the hashed or non hashed livekit
participants.
* expose delayId from the matrixRTCSession for delayed event delegation.
* rename if to mapKey
* backandId computation as part of the js-sdk
* review valere
* valr + timo keysWithoutMatchingRTCMembership
* fix legacy encryption manager
* fix doc issue
* fix doc
* fix imports
* Encryption Manager needs own rtcBackendIdentity to use
The encryption manager needs to signal our own key fast, cannot wait for remote echo of rtc membership. So it needs to be able to compute the rtcBackendIdentity
* fix test
* Remove double `useHashedRtcBackendIdentity` assignment. rename
variables.
* little improvements This stops the usage from the matrix event outside
the CallMemerbship constructor.
* fix logger import
* Add back deprecated API for compat
* Make change to CallMembership constructor backward compatible
* more backward compatible
---------
Co-authored-by: Valere <bill.carson@valrsoft.com>
* Make token refresher init itself lazily
It needs a network connection to do the init, so this would fail if
a client tried to do it at startup with no internet, causing the token
to just never be refreshed.
This just changes the API (compatibly) to do the init lazily.
The promise is kept is retain backwards compat, it can be removed
later.
* Make deviceId protected
* Fix tests