-
Notifications
You must be signed in to change notification settings - Fork 331
feat(sdk): Poll encryption state on sync event for up to 3 seconds. #5559
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
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5559 +/- ##
=======================================
Coverage 88.63% 88.64%
=======================================
Files 340 340
Lines 95102 95112 +10
Branches 95102 95112 +10
=======================================
+ Hits 84298 84308 +10
- Misses 6616 6617 +1
+ Partials 4188 4187 -1 ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #5559 will not alter performanceComparing Summary
|
Fixes Room::enable_encryption_inner to break out of polling the encryption state when it becomes known, rather than just encrypted.
Okay, now this makes sense to me but I would still like somebody from the crypto team to have a quick look. |
b4a0220
to
24502d2
Compare
// If encryption was enabled, return. | ||
#[cfg(not(feature = "experimental-encrypted-state-events"))] | ||
if res.is_ok() && self.inner.encryption_state().is_encrypted() { | ||
debug!("room successfully marked as encrypted"); | ||
return Ok(()); | ||
} | ||
|
||
self.client.state_store().save_changes(&changes).await?; | ||
self.set_room_info(room_info, RoomInfoNotableUpdateReasons::empty()); | ||
} else { | ||
// If encryption with state event encryption was enabled, return. | ||
#[cfg(feature = "experimental-encrypted-state-events")] | ||
if res.is_ok() && { | ||
if encrypted_state_events { | ||
self.inner.encryption_state().is_state_encrypted() | ||
} else { | ||
self.inner.encryption_state().is_encrypted() | ||
} | ||
} { | ||
debug!("room successfully marked as encrypted"); | ||
return Ok(()); | ||
} |
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 might belong in its own PR?
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.
you mean, separate the "poll for 3 seconds" part from the "make it support encrypted state" part? Yes, a separate PR would be optimal, but I think it's fine in practice.
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.
👍 lgtm
This fixes a small issue encountered while developing the integration test for encrypted state events. If the first sync response received from the server after enabling encryption does not contain the
m.room.encryption
event, the client will report the encryption state as unknown, even if the next sync response does contain the event.Room::enable_encryption_inner
to spin on the room encryption state, rather than bailing after the first sync response is received.Signed-off-by: Skye Elliot