* 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>
This commit does two things:
* It puts the "minimum supported matrix version" from v1.5 back down to
v1.1. In other words, it is a partial revert of
https://github.com/matrix-org/matrix-js-sdk/pull/3970. (Partial, because we
don't need to update the tests.)
We're doing this largely because
https://github.com/matrix-org/matrix-js-sdk/pull/3970 was introduced without
a suitable announcement and deprecation policy. We haven't yet decided if
the js-sdk's spec support policy needs to change, or if we will re-introduce
this change in future in a more graceful manner.
* It increases the "maximum supported matrix version" from v1.5 up to
v1.9. Previously, the two concepts were tied together, but as discussed at
length in
https://github.com/matrix-org/matrix-js-sdk/issues/3915#issuecomment-1865221366,
this is incorrect.
Unfortunately, we have no real way of testing whether it is true that the
js-sdk actually works with a server which supports *only* v1.9, but as per
the comment above, we can't do much about that.
Fixes https://github.com/matrix-org/matrix-js-sdk/issues/3915.
* Fix new threads not appearing.
We try to update the thread roots when creating a thread, but a thread
can take some time to be ready after being created so we were calling it
too soon. Add a listener for the Update event to update the thread roots
once it's ready.
Fixes https://github.com/element-hq/element-web/issues/26799
* Don't recreate the event when we update
and also add a comment to the test
* Hopefully make sonarcloud happy
* 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
* #22606 Fix "Remove" button to users without "m.room.redaction" permission
This change makes the remove button NOT available to users without permissions
* Fix lint
Signed-off-by: Rashmit Pankhania <rashmitpankhania@gmail.com>
---------
Signed-off-by: Rashmit Pankhania <rashmitpankhania@gmail.com>
* `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
A method that we use for fetching recursive related events on homeservers
without MSC3981 support injects events into the timeline in timestamp
order using a special method on event-timeline-set. Injecting events using
this method could cause on-screen notifications because it incorrectly set
the 'liveEvent' flag to true if the events were added tio the live timeline.
These events are never live though as the point is that we're fetching them.
* 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
* Rust-crypto: fix `bootstrapCrossSigning` on second call
Currently, `bootstrapCrossSigning` raises an exception if it is called a second
time before secret storage is set up. It is easily fixed by checking that 4S is
set up before trying to export to 4S.
Also a few logging fixes while we're in the area.
* Factor out an `AccountDataAccumulator`
* Another test for bootstrapCrossSigning
* Bump `matrix-rust-sdk-crypto-wasm` to v3.2.0
* Reinstate timeout on `getUserDevices` call
Turns out that this used to have a timeout of 1 second in the wasm
bindings, which it no longer does. Reinstate it here.
MatrixClient API was exposing two methods that only worked for legacy crypto:
- getDeviceEd25519Key
- getDeviceCurve25519Key
=> These are used in the react-sdk for some functionality (rageshake, sentry, rendez-vous).
I have deprecated those calls from MatrixClient and created a new API in CryptoApi (where it belongs):
getOwnDeviceKeys(): Promise<OwnDeviceKeys>
If we call methods on `OlmMachine` after `MatrixClient.stopClient` is called,
we will end up with a "use of moved value" error. We can turn these into
something more useful with judicious use of `getOlmMachineOrThrow`.
Alternatively, we can sidestep the issue by bailing out sooner.
* Reduce console log spam
A couple of different things:
* Increase the `MaxListeners` setting on `MatrixClient` and `Thread`, so that
we don't get "possible EventEmitter leak" warnings
* Disable a couple of warnings/info lines that are just part of regular
operation and are logged in large volumes.
* another noisy log line
* Reinstate warning about receipts for missing events
Apparently this is being worked on