Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for scanning QR codes during verification, with Rust crypto #3565

Merged
merged 5 commits into from Jul 11, 2023

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Jul 10, 2023

Before I change displaying QR codes, I need an end-to-end test for it. And before I can write an end-to-end test for it, I need to be able to scan QR codes. So here is support in the js-sdk for scanning QR codes. It will only work with Rust crypto, but that's enough for a Cypress test, and Rust is the future.

Suggest review commit-by-commit.


Here's what your changelog entry will look like:

✨ Features

  • Add support for scanning QR codes during verification, with Rust crypto (#3565).

@richvdh richvdh added the T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements label Jul 10, 2023
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.
@richvdh richvdh force-pushed the rav/element-r/38_scan_qr_code branch from a1f8ab7 to 5d2f7bc Compare July 10, 2023 13:31
*
* If `undefined`, we will offer all the methods supported by the Rust SDK.
*/
public supportedVerificationMethods: string[] | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a breaking change, any reason to not use a getter+setter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't a public class, so it's not a breaking change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What makes it not public? Where is it marked as internal or experimental?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just not exported through index.ts or browser-index.ts (ie, the public interface of the js-sdk).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither are a bunch of the things necessary to use the SDK so I don't think that's the rule. (Namely the Typed EventEmitter events which are necessary to set up listeners0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither are a bunch of the things necessary to use the SDK so I don't think that's the rule. (Namely the Typed EventEmitter events which are necessary to set up listeners0.

Not quite sure what you're referring to, but anything not being exported through index.js that we expect clients to be able to refer to is very definitely a bug.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure what you're referring to

#3506

Copy link
Member Author

@richvdh richvdh Jul 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes well, that's a bug, and there's the issue to track it. Great.

The point remains that (a) if anybody has tried using rust crypto at all outside the react-sdk I will eat my hat; (b) even if they have, using RustCrypto or RustVerificationRequest directly is an application bug. I won't obfuscate this API just to support someone relying on the internals of the library in this way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3574 then, if my argument isn't convincing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now an @internal class.

@@ -56,17 +56,18 @@ export class RustVerificationRequest
public constructor(
private readonly inner: RustSdkCryptoJs.VerificationRequest,
private readonly outgoingRequestProcessor: OutgoingRequestProcessor,
private readonly supportedVerificationMethods: string[] | undefined,
private readonly supportedVerificationMethods: string[],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a breaking change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

src/rust-crypto/verification.ts Outdated Show resolved Hide resolved
@germain-gg germain-gg removed their request for review July 10, 2023 14:35
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-0

@richvdh richvdh requested review from a team and florianduros and removed request for a team July 10, 2023 21:02
@richvdh richvdh added this pull request to the merge queue Jul 11, 2023
Merged via the queue into develop with commit 9db6ce1 Jul 11, 2023
23 of 24 checks passed
@richvdh richvdh deleted the rav/element-r/38_scan_qr_code branch July 11, 2023 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants