matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

Crypto: Support recognising a clearText vs a decrypted to-device event

Open BillCarsonFr opened this issue 7 months ago • 1 comments

Draft: Depends on a new wasm-bindings version https://github.com/matrix-org/matrix-rust-sdk-crypto-wasm/pull/226

Notes for reviewer: Since the integration of the rust-sdk it was not possible to make the difference between a succesfully decrypted toDevice event and a clearText toDevice. With the new bindings it is now possible.

This PR integrates this change. The existing MatrixEvent end-points like isEncrypted(), getClearContent(), isDecryptionFailure are now expected to work properly for to-device events.

As for now the SDK is not returning and EncryptionInfo or OlmError, so some of other MatrixEvent will not work fully (getSenderKey(), decryptionFailureReason()).

Not sure what is really needed on all the existing code for MatrixEvent, or what could be removed (like all the deprecated DecryptionFailureCodes, the claimedEd25519Key, etc.., and a lots of things are megolm specific) Maybe a dedicated MatrixToDevice event?

Checklist

  • [ ] Tests written for new code (and old code if feasible).
  • [ ] New or updated public/exported symbols have accurate TSDoc documentation.
  • [ ] Linter and other CI checks pass.
  • [ ] Sign-off given on the changes (see CONTRIBUTING.md).

BillCarsonFr avatar May 13 '25 07:05 BillCarsonFr

Also: I factored out some of the duplication between the two sync implementations in https://github.com/matrix-org/matrix-js-sdk/pull/4863. It would be good to land that first.

richvdh avatar Jun 04 '25 21:06 richvdh

Closed in favor of https://github.com/matrix-org/matrix-js-sdk/pull/4891

BillCarsonFr avatar Jun 30 '25 13:06 BillCarsonFr