* Update dependency typescript to v5.6.2
* Fix TS errors
* Update minimal version of TS to `5.4.2` since the code is not compliant with an older version.
* Review fixes
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Florian Duros <florian.duros@ormaz.fr>
Co-authored-by: Florian Duros <florianduros@element.io>
* Implement `UserVerificationStatus.needsUserApproval`
Expose the `identityNeedsUserApproval` flag from the rust crypto crate.
* Add CryptoApi.pinCurrentUserIdentity
Expose `pinCurrentMasterKey` from the rust crypto api.
* Test data: add second cross-signing key for Bob
* Add tests for verification status
* Don't share full key history for RTC per-participant encryption
Also record stats for how many keys have been sent/received and age of those received
* Update src/matrixrtc/MatrixRTCSession.ts
Co-authored-by: Robin <robin@robin.town>
* Add comment about why we track total age of events
---------
Co-authored-by: Robin <robin@robin.town>
* Retry event decryption failures on first failure
* Suggestion from code review
Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
---------
Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
* Use origin server timestamp for calculating group call membership expiry
* Fix tests
* Docs
* Refactor comments to reflect that the logic hasn't changed
* Make comment maintainable
* Fix up merge
* Fix test
* Handle MatrixRTC encryption keys arriving out of order
* Apply suggestions from code review
Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
* Suggestion from code review
---------
Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
* Resend MatrixRTC encryption keys if a membership has changed
* JSDoc
* Update src/matrixrtc/MatrixRTCSession.ts
Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
* Add note about using Set. symmetricDifference() when available
* Always store latest fingerprints
Should reduce unnecessary retransmits
* Refactor
---------
Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
* Fix hashed ID server lookups with no Olm
It used the hash function from Olm (presumably to work cross-platform)
but subtle crypto is available on node nowadays so we can just use
that.
Refactor existing code that did this out to a common function, add
tests.
* Test the code when crypto is available
* Test case of no crypto available
* Move digest file to src to get it out of the way of the olm / e2e stuff
* Fix import
* Fix error string & doc
* subtle crypto, not webcrypto
* Extract the base64 part
* Fix test
* Move test file too
* Add more doc
* Fix imports
and use them for more reliable MatrixRTC session membership events.
Also implement "parent" delayed events, which were in a previous version
of the MSC and may be reintroduced or be part of a new MSC later.
NOTE: Still missing is support for sending encrypted delayed events.
* Restructure eventsPendingKey to remove sender key
For withheld notices, we don't necessarily receive the sender key, so we'll
jhave to do without it.
* Re-decrypt events when we receive a withheld notice
* Extend test to cover late-arriving withheld notices
* update unit tests
* Update all non-major dependencies
* Prettier
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix types for widget API update
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove the compare function from utils
and change the one use of it to just intantiate a collator and use
it.
This was marked as internal module so this shouldn't be a breaking change.
Of course, react-sdk was using it.
Requires: https://github.com/matrix-org/matrix-react-sdk/pull/12782
* Add simple not-a-perf-test test
* recalculate repeatedly
otherwise we aren't testing anything different
* Use fewer members as it was making the test take a bit too long
* Inline subtlecrypto shim
The presence of this thing just makes code more confusing.
* Remove pre-node-20 webcrypto hack
Until node 20.0, the webcrypto API lived at `crypto.webCrypto`. It's now
available at the same place as in web -- `globalThis.crypto`.
See: https://nodejs.org/docs/latest-v20.x/api/webcrypto.html#web-crypto-api
* oidc auth test: Clean up mocking
THe previous reset code wasn't really resetting the right thing. Let's just
re-init `window.crypto` on each test.
* Remove `crypto` shim
This isn't very useful any more.
* Fix room state being updated with old (now overwritten) state and emitting for those updates.
* remove timestamp condition
Add configuration for toStartOfTimeline
* fix timeline tests
* only skip event adding if event_id and replaces_state is set.
* fix room tests
* test skipping insertion
* rename back to lastStateEvent
* store if a state is at the start of a timeline in the RoomState class
* make `isStartTimelineState` a `public readonly` and fix condition.
* Add ability to choose how many timeline events to sync when peeking.
* Add a test that covers the new method parameter.
* Formatting.
---------
Co-authored-by: Joel <joel.garplind+github@gmail.com>
* Prefix the user+device state key if needed
No need to prefix it for rooms that use MSC3779.
Otherwise, prefix it to bypass the auth rule for state events with keys
starting with @.
* Use RegExp.exec() method instead
Sonar typescript:S6594
* Split nested ternary operator into method
Sonar typescript:S3358
* Add test coverage
* Use legacy call membership if anyone else is
* Convert nullish to boolean
* Update tests
* Lint
* Use computed decision to use legacy events or not
* Check if discovered legacy sessions are ongoing
* Lint
* Lint again
* Increase test coverage
* Fetch capabilities in the background
& keep them up to date
* Add missed await
* Replace some more runAllTimers
and round down the wait time for sanity
* Remove double comment
* Typo
* Add a method back that will fetch capabilities if they're not already there
* Add tests
* Catch exception here too
* Add test for room version code
* Use server name instead of homeserver url to allow well-known lookups during QR OIDC reciprocation
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>
* Iterate
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>
* Add via parameter for MSC4156
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
* Always include both parameters
* Fix tests
---------
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
* Refactor to preferred and active foci.
Signed-off-by: Timo K <toger5@hotmail.de>
* make the sdk compatible with MSC4143 but still be backwards compatible
* comment fixes
* also fallback to legacy if the current member event is legacy
* use XOR types
* use EitherAnd
* make livekit Foucs types simpler
* review
* fix tests
* test work
* more review + more tests
* remove unnecassary await that is in conflict with the comment
* make joinRoomSession sync
* Update src/matrixrtc/MatrixRTCSession.ts
Co-authored-by: Andrew Ferrazzutti <af_0_af@hotmail.com>
* review
* fix
* test
* review
* review
* comment clarification
* typo
---------
Signed-off-by: Timo K <toger5@hotmail.de>
Co-authored-by: Andrew Ferrazzutti <af_0_af@hotmail.com>
* Add crypto methods for OIDC QR code login
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve test
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Revert test due to hang inside Rust.
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Update test name
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Update test name
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
https://github.com/dumbmatter/fakeIndexedDB/pull/93 causes a bunch
of tests to start failing because the fake timers need running in
order for fake indexeddb to work. It also seems to cause failures
to bleed between tests somehow if fake timers are enabled/disabled.
This keeps all the fake timer tests in one suite and all the others
in another, which appears to work.
This should allow https://github.com/matrix-org/matrix-js-sdk/pull/4224
to be merged.
* Don't run migration for Rust crypto if the legacy store is empty
Fixes https://github.com/element-hq/element-web/issues/27447
* Add copyright for the TypeScript files in legacy DB dumps
* Provide a type for the accountPickle we check for before migration
* Remove redundant backup response
This is unused
* Simplify keys response
* Downgrade log message.
---------
Co-authored-by: Richard van der Hoff <richard@matrix.org>
Slightly more involved than normal because it requires us to pass a backup version into OlmMachine.importBackedUpRoomKeys.
On the other hand we can now re-enable the test that was disabled in #4214 due to matrix-org/matrix-rust-sdk#3447Fixes: element-hq/element-web#27165
* `initRustCrypto`: allow app to pass in the store key directly
... instead of using the pickleKey. This allows us to avoid a slow PBKDF
operation.
* Fix link in doc-comment