* Element-R: use the pickleKey to encrypt the crypto store
`pickleKey` is a passphrase set by the application for this express purpose.
* update tests
* fix tests, again
* Emit a `UserTrustStatusChanged` when user identity is updated
* Remove redundant `onCrossSigningKeysImport` callback
This now happens as a side-effect of importing the keys.
* bump to alpha release of matrix-rust-sdk-crypto-wasm
* fixup! Remove redundant `onCrossSigningKeysImport` callback
* Fix potential delay in sending out requests from the rust SDK
There was a potential race which could cause us to be very slow to send out
pending HTTP requests, particularly when handling a user verification. Add some
resiliece to make sure we handle it correctly.
* add comments
* Add a unit test
---------
Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
* Refactor key backup recovery to prepare for rust
* rust backup restore support
* Move export out of old crypto to api with re-export
* extract base64 utility
* add tests for base64 util
* more efficient regex
* fix typo
* Add hacky option to disable the actual calling part of group calls.
So we can try using livekit instead.
* Put LiveKit info into the `m.call` state event (#3522)
* Put LK info into state
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* Update to the new way the LK service works
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
---------
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* Send 'contentLoaded' event
As per comment, so we can start digging ourselves out of the widget
API hole we're currently in.
* Add comment on updating the livekit service URL
* Appease CI on `livekit` branch (#3566)
* Update codeowners on `livekit` branch (#3567)
* add getOpenIdToken to embedded client backend
Signed-off-by: Timo K <toger5@hotmail.de>
* add test and update comment
Signed-off-by: Timo K <toger5@hotmail.de>
* Merge `develop` into `livekit` (#3569)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: RiotRobot <releases@riot.im>
Co-authored-by: Florian Duros <florianduros@element.io>
Co-authored-by: Kerry <kerrya@element.io>
Co-authored-by: David Baker <dbkr@users.noreply.github.com>
Co-authored-by: Erik Johnston <erik@matrix.org>
Co-authored-by: Valere <bill.carson@valrsoft.com>
Co-authored-by: Hubert Chathi <hubertc@matrix.org>
Close IDB database before deleting it to prevent spurious unexpected close errors (#3478)
Fix export type `GeneratedSecretStorageKey` (#3479)
Fix order of things in `crypto-api.ts` (#3491)
Fix bug where switching media caused media in subsequent calls to fail (#3489)
fixes (#3515)
fix the integ tests, where #3509 etc fix the unit tests.
fix breakage on node 16 (#3527)
Fix an instance of failed to decrypt error when an in flight `/keys/query` fails. (#3486)
Fix `TypedEventEmitter::removeAllListeners(void)` not working (#3561)
* Revert "Merge `develop` into `livekit`" (#3572)
* Don't update calls with no livekit URL & expose method to update it instead
and generally simplify a bit: change it to a single string rather than
an array of structs.
* Fix other instances of passing focusInfo / livekit url
* Add temporary setter
* WIP refactor for removing m.call events
* Always remember rtcsessions since we need to only have one instance
* Fix tests
* Fix import loop
* Fix more cyclic imports & tests
* Test session joining
* Attempt to make tests happy
* Always leave calls in the tests to clean up
* comment + desperate attempt to work out what's failing
* More test debugging
* Okay, so these ones are fine?
* Stop more timers and hopefully have happy tests
* Test no rejoin
* Test malformed m.call.member events
* Test event emitting
and also move some code to a more sensible place in the file
* Test getActiveFoci()
* Test event emitting (and also fix it)
* Test membership updating & pruning on join
* Test getOldestMembership()
* Test member event renewal
* Don't start the rtc manager until the client has synced
Then we can initialise from the state once it's completed.
* Fix type
* Remove listeners added in constructor
* Stop the client here too
* Stop the client here also also
* ARGH. Disable tests to work out which one is causing the exception
* Disable everything
* Re-jig to avoid setting listeners in the constructor
and re-enable tests
* No need to rename this anymore
* argh, remove the right listener
* Is it this test???
* Re-enable some tests
* Try mocking getRooms to return something valid
* Re-enable other tests
* Give up trying to get the tests to work sensibly and deal with getRooms() returning nothing
* Oops, don't enable the ones that were skipped before
* One more try at the sensible way
* Didn't work, go back to the hack way.
* Log when we manage to send the member event update
* Support `getOpenIdToken()` in embedded mode (#3676)
* Call `sendContentLoaded()` (#3677)
* Start MatrixRTC in embedded mode (#3679)
* Reschedule the membership event check
* Bump widget api version
* Add mock for sendContentLoaded()
* More log detail
* Fix tests
and also better assert because the tests were passing undefined which
was considered fine because we were only checking for null.
* Simplify updateCallMembershipEvent a bit
* Split up updateCallMembershipEvent some more
* Typo
Co-authored-by: Daniel Abramov <inetcrack2@gmail.com>
* Expand comment
* Add comment
* More comments
* Better comment
* Sesson
* Rename some variables
* Comment
* Remove unused method
* Wrap updatecallMembershipEvent so it only runs one at a time
* Do another update if another one is triggered while the update happens
* Make triggerCallMembershipEventUpdate async
* Fix test & some missed timer removals
* Mark session manager as unstable
---------
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
Signed-off-by: Timo K <toger5@hotmail.de>
Co-authored-by: Šimon Brandner <simon.bra.ag@gmail.com>
Co-authored-by: Timo K <toger5@hotmail.de>
Co-authored-by: Timo <16718859+toger5@users.noreply.github.com>
Co-authored-by: Daniel Abramov <inetcrack2@gmail.com>
Reading the test "should fire stateUpdated callback with error when a
request fails" it looks like this would always cause an infinite loop
between doRequest and statusUpdated calls. I don't know why this wasn't
a problem until we updated Jest to v29.5.4, but after that point it was.
This change should fix the test failures for the Jest upgrade PR:
https://github.com/matrix-org/matrix-js-sdk/pull/3670 .
* Emit a `UserTrustStatusChanged` when user identity is updated
* Remove redundant `onCrossSigningKeysImport` callback
This now happens as a side-effect of importing the keys.
* bump to alpha release of matrix-rust-sdk-crypto-wasm
* fixup! Remove redundant `onCrossSigningKeysImport` callback
* `RustCrypto.getCrossSigningStatus`: check the client is not stopped
Better error handling for the case that a call to `MatrixClient.stop` happens
while the call to `getCrossSigningStatus` (or `isCrossSigningReady`) is in
flight.
* fix up tsdoc
* WIP `CryptoApi.getStoredCrossSigningForUser`
* Fix QRCode
* Add docs and rename
* Add tests for `RustCrossSigningInfo.ts`
* Do `/keys/query` instead of using `UserIdentity`
* Review changes
* Get rid of `CrossSigningInfo`
* Merge `hasCrossSigningKeysForUser` into `userHasCrossSigningKeys`
* Apply suggestions from code review
* More review comments
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Co-authored-by: Richard van der Hoff <richard@matrix.org>
* Use sender instead of content.creator field on m.room.create events
* Restore room_version fields in fixtures
* Add test case for undefined sender scenario
* Add `CryptoApi.requestVerificationDM`
* Fix RoomMessageRequest url
* Review changes
* Merge fixes
* Add BOB test data
* `requestVerificationDM` test works against old crypto (encrypted verification request)
* Update test data
* Implement `CryptoApi.checkKeyBackup`
* Deprecate `MatrixClient.enableKeyBackup`.
* fix integ test
* more tests
* Implement keybackup loop
* cleaning
* update matrix-sdk-crypto-wasm to 1.2.1
* fix lint
* avoid real timer stuff
* Simplify test
* post merge lint fix
* revert change on yarn.lock
* code review
* Generate test data for exported keys
* code review cleaning
* cleanup legacy backup loop
* Update spec/test-utils/test-data/generate-test-data.py
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Update spec/test-utils/test-data/generate-test-data.py
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* update yarn.lock for new wasm bindings
---------
Co-authored-by: Richard van der Hoff <richard@matrix.org>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Process all verification event
* Add test for `isVerificationEvent`
* Review changes
* Remove null comparison and add doc to remote echo
* review changes
* Ensure we don't overinflate the total notification count
By correctly comparing push rules before & after decryption
* DRY the code
* Testsssss
* Update tests
* stub backupmanager
* Implement `CryptoApi.getActiveSessionBackupVersion`
* Revert unnecessary change
we can do this later, once we have better test coverage
* more test coverage
---------
Co-authored-by: Richard van der Hoff <richard@matrix.org>
These tests have broken on Node.js 18.17.0.
This is due to Node.js adopting an updated version of the URL parser, in which
the internal `Symbol(query)` property is populated lazily.
We shouldn't be relying on the internal state of the URL object anyway. Let's
just compare the stringified copy.
* Ensure non-thread relations to a thread root are actually in both timelines
* Make thread in sendReceipt & sendReadReceipt explicit rather than guessing it
* Apply suggestions from code review
* Fix Room::eventShouldLiveIn to better match Synapse to diverging ideas of notifications
* Update read receipt sending behaviour to align with Synapse
* Fix tests
* Fix thread rel type
* Simple request logging with status and duration
* remove url params from logs
* superfluous toString()
* Add tests
* Apply suggestions from code review
* update snapshots
* update log format
* Apply suggestions from code review
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* update snapshot
---------
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Co-authored-by: Richard van der Hoff <richard@matrix.org>
* Offer `m.qr_code.scan.v1` verification method by default
Normally, the application specifies the supported verification methods when
creating the MatrixClient (and matrix-react-sdk does so). If the application
leaves it unset, then the idea is that the js-sdk offers all known verification
methods.
However, by default, the rust-sdk doesn't specify `m.qr_code.scan.v1`. So
basically, we need to set our own list of supported methods, rather than
relying on the rust-sdk's defaults.
* Factor out base class from `RustSASVerifier`
* Implement QR code scanning
* Update src/rust-crypto/verification.ts
* use oidc-client-ts during oidc discovery
* export new type for auth config
* deprecate generateAuthorizationUrl in favour of generateOidcAuthorizationUrl
* testing util for oidc configurations
* test generateOidcAuthorizationUrl
* lint
* test discovery
* dont pass whole client wellknown to oidc validation funcs
* add nonce
* use oidc-client-ts for oidc response
* validate user state and update tests
* use oidc-client-ts for code exchange
* use oidc-client-ts in completing auth grant
* use client userState for homeserver
* more comments
* use oidc-client-ts during oidc discovery
* export new type for auth config
* deprecate generateAuthorizationUrl in favour of generateOidcAuthorizationUrl
* testing util for oidc configurations
* test generateOidcAuthorizationUrl
* lint
* test discovery
* dont pass whole client wellknown to oidc validation funcs
* add nonce
* use client userState for homeserver