Description
Implement a new matrix-js-sdk/rust-crypto/VerificationRequest
which wraps matrix_sdk_crypto::VerificationRequest
and implements the VerificationRequest
interface defined in #24983.
- Figure out how to map from
VerificationRequest::changes
to anEventEmitter
. One solution:- Add a
registerOnChangeCallback
to theVerificationRequest
class exported bymatrix-sdk-crypto-js
, which starts a thread to poll the changes stream and calls the callback (as we do forOlmMachine::register_room_key_updated_callback
) - in the wrapping class’s constructor, call
registerOnChangeCallback
with a function that calls.emit
.
This assumes that the stream gets closed when the VerificationRequest is dropped (so that the polling thread closes). Confirm this actually happens.
- Add a
- Once an
m.key.verification.ready
is sent or received, amatrix_sdk_crypto::Verification
(one ofmatrix_sdk_crypto::Sas
ormatrix_sdk_crypto::QrVerification
) is created (which maps ontoVerificationBase
in the js-sdk). Fire a notification into the js-sdk when this transition happens (depends on crypto-js: Expose a newTransitioned
state inVerificationRequest
matrix-org/matrix-rust-sdk#1894), and also arrange for events to be propagated from theVerification
.
I think this will be hard to unit test:
- We could mock out the rust class, but then we would only be testing a few glue methods
- Using a real
matrix-sdk-crypto-js::VerificationRequest
requires us to instantiate all theOlmMachine
machinery, so we may as well use an integ test
So let’s rely on the integration tests?