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

Simplify user verification state #1740

Merged
merged 2 commits into from
Mar 20, 2023
Merged

Simplify user verification state #1740

merged 2 commits into from
Mar 20, 2023

Conversation

Anderas
Copy link
Contributor

@Anderas Anderas commented Mar 16, 2023

Resolves https://github.com/matrix-org/internal-config/issues/1325

The SDK has previously relied on MXUserTrustLevel to determine whether any particular user is verified or not. It did so by distinguishing between "local" and "cross-signed" trust, where a user is considered verified if either one of those fields is true. This is however unnecessarily complex model, not used upcoming rust-crypto, and does not really make sense, given that "user verification" should only be possible via cross-signing, not by setting manual values.

To improve this, remove MXUserTrustLevel entirely and replace it with a simple isVerified boolean. This makes the API everywhere much simpler to use. As a downside, we have to deal with some amount of migration from the previous model (we use NSCoding to persist these values). To ensure correct migration, we will now store "version" property in MXCrossSigningInfo, which is used to decode the values correctly

Additionally replace NSProgress with MXTrustSummary when computing trustSummary for more than one user or device. Using NSProgress has worked okay, but it makes for some strange and clunky API (e.g. .fractionCompleted >= 0 instead of allAreTrusted).

@Anderas Anderas force-pushed the andy/user_trust branch 2 times, most recently from aed6ee7 to 1635415 Compare March 16, 2023 12:59
@Anderas Anderas requested review from a team and Velin92 and removed request for a team March 16, 2023 13:14
Copy link
Member

@Velin92 Velin92 left a comment

Choose a reason for hiding this comment

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

LGTM

@Anderas
Copy link
Contributor Author

Anderas commented Mar 16, 2023

@Velin92 added one more commit 1dafa92

@codecov
Copy link

codecov bot commented Mar 16, 2023

Codecov Report

Patch coverage: 72.02% and project coverage change: +0.02 🎉

Comparison is base (efdf2f4) 37.75% compared to head (1dafa92) 37.78%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1740      +/-   ##
===========================================
+ Coverage    37.75%   37.78%   +0.02%     
===========================================
  Files          615      616       +1     
  Lines        96889    96899      +10     
  Branches     41856    41867      +11     
===========================================
+ Hits         36580    36610      +30     
+ Misses       59261    59242      -19     
+ Partials      1048     1047       -1     
Impacted Files Coverage Δ
MatrixSDK/Crypto/MXCryptoV2.swift 13.78% <0.00%> (+0.15%) ⬆️
MatrixSDK/Crypto/Recovery/MXRecoveryService.m 2.33% <0.00%> (ø)
...SDK/Crypto/Verification/MXKeyVerificationManager.m 53.67% <0.00%> (+0.03%) ⬆️
...fication/Transactions/QRCode/MXQRCodeTransaction.m 0.00% <0.00%> (ø)
...e/CoreData/Models/MXUsersTrustLevelSummaryMO.swift 0.00% <0.00%> (ø)
MatrixSDKTests/MXRoomSummaryTrustTests.m 0.00% <0.00%> (ø)
MatrixSDK/Crypto/Trust/MXUsersTrustLevelSummary.m 23.68% <16.66%> (+1.18%) ⬆️
MatrixSDK/Crypto/MXCrypto.m 66.87% <27.27%> (-0.10%) ⬇️
MatrixSDKTests/MXCrossSigningVerificationTests.m 27.70% <33.33%> (-0.07%) ⬇️
...rossSigning/Data/MXCrossSigningInfoUnitTests.swift 88.63% <80.00%> (-11.37%) ⬇️
... and 12 more

... and 5 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Anderas Anderas merged commit 4fb70e6 into develop Mar 20, 2023
@Anderas Anderas deleted the andy/user_trust branch March 20, 2023 12:52
Anderas added a commit that referenced this pull request Mar 22, 2023
This reverts commit 4fb70e6, reversing
changes made to efdf2f4.
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.

2 participants