Skip to content

Element-R: login-and-verify tranche 2: rust-backed implemention of VerificationRequest #25316

Closed
matrix-org/matrix-js-sdk
#3490
@richvdh

Description

@richvdh

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 an EventEmitter. One solution:
    • Add a registerOnChangeCallback to the VerificationRequest class exported by matrix-sdk-crypto-js, which starts a thread to poll the changes stream and calls the callback (as we do for OlmMachine::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.
  • Once an m.key.verification.ready is sent or received, a matrix_sdk_crypto::Verification (one of matrix_sdk_crypto::Sas or matrix_sdk_crypto::QrVerification) is created (which maps onto VerificationBase in the js-sdk). Fire a notification into the js-sdk when this transition happens (depends on crypto-js: Expose a new Transitioned state in VerificationRequest matrix-org/matrix-rust-sdk#1894), and also arrange for events to be propagated from the Verification.

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 the OlmMachine machinery, so we may as well use an integ test
    So let’s rely on the integration tests?

Metadata

Metadata

Assignees

Labels

A-Element-RIssues affecting the port of Element's crypto layer to RustT-TaskTasks for the team like planning

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions