* fix members loaded on intitial sync
* Update test to use KeyResponder
* Use E2EKeyResponder
* code review
* better comment
* fix test
* post merge fix
* fix imports
* refactoring, better names
* code review
* clean tests
* Cleanups per review comments
* fix test
* Apply suggestions from code review
---------
Co-authored-by: Richard van der Hoff <richard@matrix.org>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add current version of the rust-sdk and vodozemac
* Return OlmVersion in `CryptoApi#getVersion` for old crypto
* Add `Olm` prefix
* Fix documentation
* Review changes
* Handle backup secret gossip
* use getSecretsFromInbox
* add gossip test
* use delete secret API
* fix logger
* better comment and cleaning
* free the pkSigning
* fix typo
* add missing mocks
* improve coverage
* better var name
* quick refactoring
* add more tests
* Review, format and comments
* refactor move more logic to backup.ts
* poll secret inbox
* missing mock
* Update src/rust-crypto/rust-crypto.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Update src/rust-crypto/rust-crypto.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Update src/rust-crypto/rust-crypto.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Update src/rust-crypto/backup.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Update src/rust-crypto/rust-crypto.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* code review
* fix comment
* remove comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* quick factorise
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Support MatrixClient-specific loggers.
Signed-off-by: Patrick Cloke <clokep@patrick.cloke.us>
* Use client-specific logger in client.ts.
Signed-off-by: Patrick Cloke <clokep@patrick.cloke.us>
* Log `fetch` requests to the per-client logger
* Use client-specific logger in rust-crypto
* `RustBackupManager.getActiveBackupVersion`: check that backup is enabled
The previous check on `isBackupEnabled` was a no-op
* Fix log spam on shieldless events
* Reduce log spam about tracking users
* Reduce log spam about decrypting events
Logging the entire event is excessive
* 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>
* `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>
* 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>
* 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>
* implement `VerificationRequest.pending`
* Implement `VerificationRequest.timeout`
* Rust crypto: allow using a memory store (#3536)
* Rust crypto: allow using a memory store
It turns out that, for some usecases (in particular, "bot users" for cypress
tests), we don't need persistent storage and an in-memory store will be fine.
* Rust crypto: use a memory store for the unit tests
* Return uploaded keys from `/keys/query`
* Basic implementation of SAS verification in Rust
* Update the `verifier` *before* emitting `erificationRequestEvent.Change`
* remove dead code
A couple of tests were waiting for a request that wasn't happening, so timing
out after 1.5 seconds. Let's avoid the extra slowth.
(This was introduced by changes in
https://github.com/matrix-org/matrix-js-sdk/pull/3487, but the changes in this
PR do no harm anyway)
* Element-R: wait for OlmMachine on startup
Previously, if you called `CryptoApi.getUserDeviceInfo()` before the first
`/sync` request happened, it would return an empty list, which made a bunch of
the tests racy. Add a hack to get the OlmMachine to think about its device
lists during startup.
* add a test
* Stub implementation of `isCrossSigningReady`
* Stub implementation of `isSecretStorageReady`
* add tests to meet quality gate
* factor out common
* Remove accidentally-added file
* Element-R: implement `{get,set}TrustCrossSignedDevices`
A precursor to https://github.com/vector-im/element-web/issues/25092
* Pull out new `DeviceVerificationStatus`
Define a new base class to replace `DeviceTrustLevel`. The intention is to have
a cleaner interface which is easier to expose from the new crypto impl
* Define, and implement, a new `CryptoApi.getDeviceVerificationStatus`
This is similar to `checkDeviceTrust`, which we're deprecating, but:
* is `async`, meaning we can implement it in Rust
* Returns a `DeviceVerificationStatus` instead of a `DeviceTrustLevel`
* Returns `null` rather than "not verified" if the device is unknown
* add some tests
* Export DeviceVerificationStatus as a proper class
... so that we can instantiate it in tests
* Send one time key count and unused fallback keys for rust-crypto
* Add tests
* Remove useless type in promise return
* Add test for one time key upload
* Fix rust-crypto.spec.ts tests
* Remove unneeded code in test
* Add key upload request test
* Fix tests