-
Notifications
You must be signed in to change notification settings - Fork 354
crypto: Simplify PrivateCrossSigningIdentity::with_account
#5654
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
Conversation
ba1c321 to
f38695e
Compare
CodSpeed Performance ReportMerging #5654 will not alter performanceComparing Summary
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5654 +/- ##
==========================================
- Coverage 88.34% 88.34% -0.01%
==========================================
Files 354 354
Lines 97098 97093 -5
Branches 97098 97093 -5
==========================================
- Hits 85780 85772 -8
- Misses 7265 7268 +3
Partials 4053 4053 ☔ View full report in Codecov by Sentry. |
andybalaam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just starting to write a rant about how with_account should not exist and then I read your second commit. Enthusiastic support here.
| - [**breaking**] Remove `matrix_sdk_crypto::olm::PrivateCrossSigningIdentity::with_account`. Applications should instead use `matrix_sdk_crypto::olm::Account::bootstrap_cross_signing` which has identical behaviour. | ||
| `PrivateCrossSigningIdentity::for_account` is added for test situations where the upload requests are not required. | ||
| ([#5654](https://github.com/matrix-org/matrix-rust-sdk/pull/5654)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not a public method, as such this can't be a breaking change.
Do we now need to expose a public function for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not a public method, as such this can't be a breaking change.
ohhh it was pub(crate), I missed that. And no, we don't need a public function. Let me have another go at this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poljar I've made the new method pub(crate), and removed the changelog entry.
It turns out that creating a cross-signing identity *without* the upload requests is a very common thing to do, especially in tests. We can simplify some code by factoring it out as a new helper.
This was now only used in one place, and I think it makes more sense to inline it into olm::Account than leave it in `PrivateCrossSigningIdentity`.
d09ecb4 to
0002ea4
Compare
PrivateCrossSigningIdentity::with_accountis called in lots of places where we end up throwing away most of its work. Indeed, there is only one place that actually uses the results (olm::Account::bootstrap_cross_signing).It makes more sense to me to replace it with something similar, and hoist the remaining functionality up to
bootstrap_cross_signing.