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

refactor(crypto): Simplify the verification object constructors #632

Merged
merged 2 commits into from
May 5, 2022

Conversation

poljar
Copy link
Contributor

@poljar poljar commented May 4, 2022

This patch moves all the important identities that we need for verification into the already existing IdentitiesBeingVerified struct.

It adds a method to get those identities to the store, and streamlines our to-device and in-room verification constructors.

This is the first part of #399 and incidentally fixes a bug where the started_from_request flag wouldn't be set correctly for in-room verifications. The buggy constructor has been removed.

This patch moves all the important identities that we need for
verification into the already existing IdentitiesBeingVerified struct.

It adds a method to get those identities to the store, and streamlines
our to-device and in-room verification constructors.
@poljar poljar requested a review from a team May 4, 2022 11:59
@codecov-commenter
Copy link

Codecov Report

Merging #632 (2a5f170) into main (b2273ab) will increase coverage by 0.29%.
The diff coverage is 87.75%.

@@            Coverage Diff             @@
##             main     #632      +/-   ##
==========================================
+ Coverage   74.18%   74.47%   +0.29%     
==========================================
  Files         101      101              
  Lines       15369    15539     +170     
==========================================
+ Hits        11401    11573     +172     
+ Misses       3968     3966       -2     
Impacted Files Coverage Δ
crates/matrix-sdk-crypto/src/identities/device.rs 73.36% <ø> (ø)
crates/matrix-sdk-crypto/src/identities/user.rs 66.00% <ø> (+0.99%) ⬆️
...atrix-sdk-crypto/src/verification/sas/inner_sas.rs 49.22% <ø> (+1.35%) ⬆️
...tes/matrix-sdk-crypto/src/verification/requests.rs 54.30% <78.94%> (-2.70%) ⬇️
...rates/matrix-sdk-crypto/src/verification/qrcode.rs 70.94% <79.16%> (+0.31%) ⬆️
crates/matrix-sdk-crypto/src/verification/mod.rs 64.84% <90.90%> (+1.17%) ⬆️
...ates/matrix-sdk-crypto/src/verification/machine.rs 76.47% <100.00%> (-1.61%) ⬇️
...ates/matrix-sdk-crypto/src/verification/sas/mod.rs 80.09% <100.00%> (-0.76%) ⬇️
...atrix-sdk-crypto/src/verification/sas/sas_state.rs 87.32% <100.00%> (-0.07%) ⬇️
crates/matrix-sdk/src/error.rs 17.85% <0.00%> (-1.38%) ⬇️
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b2273ab...2a5f170. Read the comment docs.

Copy link
Collaborator

@jplatte jplatte left a comment

Choose a reason for hiding this comment

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

Might also make sense to turn the boolean into a dedicated enum, but those calls have definitely become more readable than before this PR, so no need to block it on that.

@poljar
Copy link
Contributor Author

poljar commented May 5, 2022

Might also make sense to turn the boolean into a dedicated enum, but those calls have definitely become more readable than before this PR, so no need to block it on that.

Sure, I'm not closing #399 yet. There's plenty of more cleanup this part of the code should receive.

@poljar poljar merged commit 3a4656c into main May 5, 2022
@poljar poljar deleted the poljar/cleanup-verification-constructors branch May 5, 2022 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants