-
Notifications
You must be signed in to change notification settings - Fork 261
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
crypto: Provide EncryptionState to hold reasons why events were UTD #4053
crypto: Provide EncryptionState to hold reasons why events were UTD #4053
Conversation
23f7827
to
b3e0a96
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4053 +/- ##
==========================================
- Coverage 84.55% 84.54% -0.01%
==========================================
Files 266 266
Lines 28449 28462 +13
==========================================
+ Hits 24054 24064 +10
- Misses 4395 4398 +3 ☔ View full report in Codecov by Sentry. |
I'll make a couple of tweaks to this PR |
pub enum EncryptionState { | ||
Unencrypted, | ||
Decrypted(EncryptionInfo), | ||
Utd(UtdReason), |
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.
We should probably use the existing UnableToDecryptInfo
here (and add a "reason" to it).
189fda7
to
90d6cbe
Compare
Reorder these so that they make a little more sense
90d6cbe
to
7613f2c
Compare
Having poked at this for a while, I'm not convinced it's the correct approach; or if it is, we need to think more carefully about how it fits into the existing implementation. A number of concerns arise:
|
FWIW, from the discussion I had, this is not happening in the rust sdk. Any event from any sources gets decrypted (at least attempt) |
Responding to the preliminary question before reviewing anything:
If this is in the public API, other consumers of the SDK may serialize and deserialize it, so it's a breaking change in that case. |
Eventually, yes. But before that happens, the event still exists as a |
This is wrong, it turns out: |
Having discussed this a bit with the rust team, the concern was raised that the types proposed allow for a conflict in state between Instead: it was proposed to replace enum TimelineFoo {
Utd {
event: Raw<EncryptedEvent>,
cause: UtdCause,
},
PlainText {
event: Raw<T>,
}
Decrypted {
event: Raw<T>,
info: EncryptionInfo,
}
} (better name needed, obvs) We should also update |
superceded by #4082 |
Part of #4048
Preparation for surfacing the reason why messages were unable to decrypt: this change is intended to have no effect yet, but introduces an
EncryptionState
type that we will begin to populate in later PRs.QUESTION: this will break deserialising existing
TimelineEvent
s andSyncTimelineEvents
. I think we don't persist them, so this is fine. Right?