Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d3c839a
feat(event cache): Add a method to access the linked chunk mutably
poljar Sep 26, 2025
8103b9c
feat(event cache): Create the redecryptor
poljar Sep 24, 2025
f2cc6c6
test(redecryptor): Add a test to show that the redecryptor works
poljar Sep 26, 2025
e934235
feat(redecryptor): Rejigger things so we can relisten to the room key…
poljar Oct 2, 2025
5c3bca8
doc(event cache): Document the redecryptor
poljar Oct 2, 2025
4ed2393
feat(event cache): Enable the redecryptor in the event cache
poljar Sep 25, 2025
a2f89e8
feat: Redecryptor start to send out redecryptor reports
poljar Oct 7, 2025
621d936
feat(redecryptor): Let the redecryptor listen to room key withheld up…
poljar Oct 10, 2025
3a0a5b9
feat(redecryptor): Use the room to redecrypt events
poljar Oct 10, 2025
7e98858
feat(redecryptor): More precise logs for the redecryption attempts
poljar Oct 16, 2025
4109fdd
feat(redecryptor): Post-process the events once they are replaced
poljar Oct 16, 2025
4a519bd
test(redecryptor): More tests for the redecryptor
poljar Oct 16, 2025
4c4cd41
test(timeline): Workarounds to get the timeline tests passing
poljar Oct 15, 2025
d7d4730
docs(redecryptor): Document the redecryptor a bit more
poljar Oct 15, 2025
d2eab60
fix(event-cache): Limit the visibility of room_linked_chunk_mut a bit…
poljar Nov 12, 2025
84a21a4
fix(event-cache): Don't hold on to the event cache locks as long when…
poljar Nov 12, 2025
3ad7062
chore(redecryptor): Use relative imports more often
poljar Nov 12, 2025
717f016
docs(redecryptor): Add some docs to the Redecryptor struct itself
poljar Nov 12, 2025
952c5af
chore(redecryptor): Time how long it takes to replace UTDs
poljar Nov 12, 2025
f9c23b3
refactor(redecryptor): Use an abort handle to manage the redecryption…
poljar Nov 12, 2025
38df621
chore(event-cache): Limit the visibility of post_process_new_events
poljar Nov 12, 2025
2e9e9ae
chore(redecryptor): Ensure the upgrade_event_cache method is inlined
poljar Nov 12, 2025
913ebe9
docs(redecryptor): Clarify that we're talking about the UI timeline i…
poljar Nov 12, 2025
0d08ed0
refactor(redecryptor): Add some type aliases for the event ID/event t…
poljar Nov 12, 2025
9508675
fix(redecryptor): Early return if we don't have any events to process
poljar Nov 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/matrix-sdk-ui/src/timeline/tests/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,17 @@ async fn test_retry_edit_decryption() {
assert!(msg.is_edited());
assert_eq!(msg.body(), "This is Error");

let item =
assert_next_matches_with_timeout!(stream, VectorDiff::Set { index: 0, value } => value);

// TODO: We receive this update twice, since the event cache decrypts things as
// well as the timeline.
assert_matches!(item.encryption_info(), Some(_));
assert_matches!(item.latest_edit_json(), Some(_));
assert_let!(Some(msg) = item.content().as_message());
assert!(msg.is_edited());
assert_eq!(msg.body(), "This is Error");

// (There are no more items)
assert_pending!(stream);
}
Expand Down
32 changes: 32 additions & 0 deletions crates/matrix-sdk/src/event_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ use crate::{

mod deduplicator;
mod pagination;
#[cfg(feature = "e2e-encryption")]
mod redecryptor;
mod room;

pub use pagination::{RoomPagination, RoomPaginationStatus};
#[cfg(feature = "e2e-encryption")]
pub use redecryptor::{DecryptionRetryRequest, RedecryptorReport};
pub use room::{RoomEventCache, RoomEventCacheSubscriber, ThreadEventCacheUpdate};

/// An error observed in the [`EventCache`].
Expand Down Expand Up @@ -148,6 +152,10 @@ pub struct EventCacheDropHandles {

/// The task used to automatically shrink the linked chunks.
auto_shrink_linked_chunk_task: JoinHandle<()>,

/// The task used to automatically redecrypt UTDs.
#[cfg(feature = "e2e-encryption")]
_redecryptor: redecryptor::Redecryptor,
}

impl fmt::Debug for EventCacheDropHandles {
Expand Down Expand Up @@ -200,6 +208,9 @@ impl EventCache {
linked_chunk_update_sender.clone(),
)));

#[cfg(feature = "e2e-encryption")]
let redecryption_channels = redecryptor::RedecryptorChannels::new();

Self {
inner: Arc::new(EventCacheInner {
client,
Expand All @@ -213,6 +224,8 @@ impl EventCache {
_thread_subscriber_task: thread_subscriber_task,
#[cfg(feature = "experimental-search")]
_search_indexing_task: search_indexing_task,
#[cfg(feature = "e2e-encryption")]
redecryption_channels,
thread_subscriber_receiver,
}),
}
Expand Down Expand Up @@ -257,10 +270,26 @@ impl EventCache {
auto_shrink_receiver,
));

#[cfg(feature = "e2e-encryption")]
let redecryptor = {
let receiver = self
.inner
.redecryption_channels
.decryption_request_receiver
.lock()
.take()
.expect("We should have initialized the channel an subscribing should happen only once");

redecryptor::Redecryptor::new(Arc::downgrade(&self.inner), receiver)
};


Arc::new(EventCacheDropHandles {
listen_updates_task,
ignore_user_list_update_task,
auto_shrink_linked_chunk_task,
#[cfg(feature = "e2e-encryption")]
_redecryptor: redecryptor,
})
});

Expand Down Expand Up @@ -840,6 +869,9 @@ struct EventCacheInner {
/// This is helpful for tests to coordinate that a new thread subscription
/// has been sent or not.
thread_subscriber_receiver: Receiver<()>,

#[cfg(feature = "e2e-encryption")]
redecryption_channels: redecryptor::RedecryptorChannels,
}

type AutoShrinkChannelPayload = OwnedRoomId;
Expand Down
Loading
Loading