* 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
* Refactor key backup recovery to prepare for rust
* rust backup restore support
* map decryption errors correctly from rust
* query backup on fail to decrypt
* Refactor key backup recovery to prepare for rust
* rust backup restore support
* map decryption errors correctly from rust
* Move export out of old crypto to api with re-export
* extract base64 utility
* add tests for base64 util
* more efficient regex
* fix typo
* use different vector for bob
* missing import
* Group tests for decryption errors
* Do not map unneeded rust error for now
* 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
* 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>
* Revert "Ensure we don't overinflate the total notification count (#3634)"
This reverts commit fd0c4a7f56.
* Fix wrong handling of encrypted rooms when loading them from sync accumulator
* Tidy up code, removing sections which didn't make any difference
* Add test
* 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>
* Add `CryptoApi.setDeviceVerified`
I need a way to mark devices as trusted for the backup tests.
* More tests
* Simplify E2EKeyResponder.addDeviceKeys
The user and device IDs are in the test data, so no need to pass them in
* Clean up key backup integration test
Make it use the CryptoApi rather than legacy `MatrixClient.crypto`, and use a
pre-signed backup instead of requiring a "blindlySignAnything" method.
* run megolm-backup tests on both crypto stacks
* avoid internal backupManager
* replace deprecated TestClient with fetchMock
* add stop() api to BackupManager for clean shutdown
* fix merge
* code review cleaning
* lint
* Address review comments
* Remove unused `TestClient.expectKeyBackupQuery`
* clean up imports
---------
Co-authored-by: Richard van der Hoff <richard@matrix.org>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* 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
* Support for showing QR codes
* Emit `VerificationRequestEvent.Change` events when the verifier changes
* Minor integ test tweaks
* Handle transitions from QR code display to SAS
* Fix naming
* Add a test for `ShowQrCodeCallbacks.cancel`
* 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
* Simplify `MatrixClient::setPowerLevel` API
While making it more resilient to causing issues like nuking room state
* Handle edge case
* Fix tests
* Add test coverage
* 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
* Pass `supportedVerificationMethods` into `VerificationRequest`
... so that the application can later call `accept()` and we know what to send.
* Implement `VerificationRequest.accept`
* Implement `VerificationRequest.declining`
* Update src/rust-crypto/verification.ts
* integ tests: factor out some utility methods
* Add `VerificationRequest.startVerification` to replace `beginKeyVerification`
The rust SDK ties together creating the verifier and sending the
`m.key.verification.start` message, so we need to combine
`.beginKeyVerification` and `.verify`.
* add some unit tests
* More slow test fixes
* Create a new event type for verification requests
Previous PRs (https://github.com/matrix-org/matrix-js-sdk/pull/3449, etc) have
pulled out an interface from the `VerificationRequest` class, but applications
registering for the `CryptoEvent.VerificationRequest` event could still be
expecting a fully-fledged class rather than the interface.
To handle this without breaking backwards compat, add a new event type that
carries the interface, not the class.