* Update dependency oidc-client-ts to v3
* Update jwt-decode so that oidc-client-ts doesn't run its own and thus we can mock
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Merge
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Sort package.json
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Ensure oidc-client-ts 3.0.1 to drop crypto-js
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>
* ignore memberships of users that are not in the call
Signed-off-by: Timo K <toger5@hotmail.de>
* recompute memberships on room member change.
Signed-off-by: Timo K <toger5@hotmail.de>
* fix Tests and add test for left member
Signed-off-by: Timo K <toger5@hotmail.de>
* fix event type
Signed-off-by: Timo K <toger5@hotmail.de>
* fix import desaster
Signed-off-by: Timo K <toger5@hotmail.de>
* fix mocks
Signed-off-by: Timo K <toger5@hotmail.de>
---------
Signed-off-by: Timo K <toger5@hotmail.de>
* Add utility to check for non migrated legacy db
* code review changes
* add unit tests for existsAndIsNotMigrated
* ensure indexeddb is clean for each state
* Rust crypto: handle the SAS verifier being replaced
* lint
* make changes from review
* apply changes from code review
* remove useless assertions
* wrap acceptance inside a try-catch, and factor out acceptance into a function
* fix bugs
* we don't actually need the .accept variable
* move setInner to inside SAS class, and rename to replaceInner
* use defer to avoid using a closure
* lint
* prettier
* use the right name
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* combine onChangeCallback with onChange
* apply changes from review
* add test for QR code verification, and try changing order in onChange
* lint
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Make MSC3906 implementation compatible with Rust Crypto
* Verify using CryptoApi but no cross-signing (yet)
* Use new crossSignDevice() function
* Mock crossSignDevice() function
* Fix type of parameter in mock
* review: cleaning
* review: Remove unneeded defensive coding
* review: fix outdated documentation
* QR login: review, cleaning
* QR login | review: use getSafeUserId
---------
Co-authored-by: Valere <bill.carson@valrsoft.com>
* add expire_ts compatibility to matrixRTC
Signed-off-by: Timo K <toger5@hotmail.de>
* add expire_ts
Signed-off-by: Timo K <toger5@hotmail.de>
* rename expire_ts -> expires_ts
Signed-off-by: Timo K <toger5@hotmail.de>
* allow events without `expires`
Signed-off-by: Timo K <toger5@hotmail.de>
* fix test for expires_ts
Signed-off-by: Timo K <toger5@hotmail.de>
* comment clarification
Signed-off-by: Timo K <toger5@hotmail.de>
* add comment where one needs to use the origin_server_ts
Signed-off-by: Timo K <toger5@hotmail.de>
* add additional expires_ts tests
Signed-off-by: Timo K <toger5@hotmail.de>
* fix fake timer
Signed-off-by: Timo K <toger5@hotmail.de>
* change priority order to favor expires
Signed-off-by: Timo K <toger5@hotmail.de>
---------
Signed-off-by: Timo K <toger5@hotmail.de>
* rust-crypto: allow reporting failures when restoring keys
* add test and catch more invalid keys
* remove checks for room_id and session_id as they are guaranteed to be set
* remove obsolete comment
* crypto.spec: make `keyResponder` a local var
it is never used between functions, so making it external was confusing
* Persist encryption state to the rust room list.
* `MatrixClient.shouldEncryptEventForRoom`: fix for rust crypto
Previously, we were not bothering to ask the Rust Crypto stack if it thought we
should be encrypting for a given room. This adds a new method to `CryptoApi`,
wires it up for legacy and Rust crypto, and calls it.
* Tests for persistent room list
* Replace `pendingEventEncryption` with a Set
We don't actually need the promise, so no need to save it.
This also fixes a resource leak, where we would leak a Promise and a HashMap
entry on each encrypted event.
* Convert `encryptEventIfNeeded` to async function
This means that it will always return a promise, so `encryptAndSendEvent` can't
tell if we are actually encrypting or not. Hence, also move the
`updatePendingEventStatus` into `encryptEventIfNeeded`.
* Simplify `encryptAndSendEvent`
Rewrite this as async.
* Factor out `MatrixClient.shouldEncryptEventForRoom`
* Inline a call to `isRoomEncrypted`
I want to deprecate this thing
... and replace a lot of calls to `MatrixClient.isRoomEncrypted` with it.
This is a lesser check (since it can be tricked by servers withholding the
state event), but for most cases it is sufficient. At the end of the day, if
the server witholds the state, the room is pretty much bricked anyway. The one
thing we *mustn't* do is allow users to send *unencrypted* events to the room.
* Support optional MSC3860 redirects
See `allow_redirect` across the media endpoints: https://spec.matrix.org/v1.9/client-server-api/#client-behaviour-7
* Update the tests
* Appease the linter
* Add test to appease SonarCloud
* Only add `allow_redirect` if the parameter is specified rather than defaulting to `false`
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* ElementR | backup: call expensive `roomKeyCounts` less often
* review: Improve doc
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* review: Improve loop
* review: Add comment regarding slightly outdated remaining count
* Review: doc fix typo
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* review: refactor code order, count after doing the request
* review: Missing await on sleep for limit exceeded
* review: Comment | add a note for when performance drops
* Backup: add upload loop test for rust
* test: quick fix backup loop tests
* test: quick fix imports backup loop tests
* review: improve comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Review improve comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Review: Clean and improve tests
* fix: wrong test name
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Decrypt and Import full backups in chunk with progress
* backup chunk decryption jsdoc
* Review: fix capitalization
* review: better var name
* review: fix better iterate on object
* review: extract utility function
* review: Improve test, ensure mock calls
* review: Add more test for decryption or import failures
* Review: fix typo
Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
---------
Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
* Fix `CryptoStore.countEndToEndSessions`
This was apparently never tested, and was implemented incorrectly.
* Add `CryptoStore.countEndToEndInboundGroupSessions`
* Emit events to indicate migration progress
* Use a `StoreHandle` to init OlmMachine
This will be faster if we need to prepare the store.
* Include "needsBackup" flag in inbound group session batches
* On startup, import data from libolm cryptostore
* ISessionExtended -> SessionExtended
* `getOwnDeviceKeys`: use `olmMachine.identityKeys`
This is simpler, and doesn't rely on us having done a device query to work.
* Factor out `requestKeyBackupVersion` utility
* Factor out `makeMatrixHttpApi` function
* Convert `initRustCrypto` to take a params object
* Improve logging in startup
... to help figure out what is taking so long.
* Send authenticated /versions request
Implements [MSC4026](https://github.com/matrix-org/matrix-spec-proposals/pull/4026).
I believe this probably is as simple as this: it will mean that the versions
response can obviously change after logging in, but since the client is
constructed again with an access token, this should just work (?)
A remaining question is whether this needs to be optional. Opening the PR
to prompt the discussion. Apps might not expect it, but it's just the same
auth that we're sending to other endpoints on the same server.
* Fix tests
* Clear /versions cache on access token set
* Remove m.thread filter from relations API call
We used MSC3981 to pass the recurse param to the /relations
endpoint so that we could get relations to events in a thread, but
we kept the rel_type filter on (as m.thread) so no second-order relations
would ever have been returned (a nested thread isn't a thing).
This removes the filter and does some filtering on the client side to
remove any events that shouldn't live in the threaded timeline (ie.
non-thread relations to the thread root event).
This should help fix stuck unreads because it will avoid the event that
the receipt refers to going missing (but only on HSes that support MSC3981).
For https://github.com/vector-im/element-web/issues/26718
* Fix import cycle
* Remove params from expected calls in tests to match
* Unused import
* Comment explaining the purpose of RoomList
* Fix incorrect return type declaration on RoomList.getRoomEncryption
* Move RoomList out of MatrixClient, into legacy Crypto
* Initialise RoomList inside Crypto.init to allow us to await it
* initial commit
* new interation test
* more comments
* fix test, quick refactor on request version
* cleaning and logs
* fix type
* cleaning
* remove delegate stuff
* remove events and use timer mocks
* fix import
* ts ignore in tests
* Quick cleaning
* code review
* Use Errors instead of Results
* cleaning
* review
* remove forceCheck as not useful
* bad naming
* inline pauseLoop
* mark as paused in finally
* code review
* post merge fix
* rename KeyDownloadRateLimit
* use same config in loop and pass along
* don't back up keys that we got from backup
* lint
* lint again
* remove key source struct and add function for importing from backup
* apply changes from review
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Test whether an event not in a room's timeline causes notification count increase
Commited separately to demonstrate test failing before.
* Don't fix up notification counts if event isn't in the room
As explained by the comment, hopefully.
* Fix other test
* Add CallNotifyEvent to support matrix rtc ringing
Signed-off-by: Timo K <toger5@hotmail.de>
* test SessionId
Signed-off-by: Timo K <toger5@hotmail.de>
* docs + sessionId->callId
Signed-off-by: Timo K <toger5@hotmail.de>
---------
Signed-off-by: Timo K <toger5@hotmail.de>