From 37823df7535829b969567de809dcc8dbcabbfa62 Mon Sep 17 00:00:00 2001 From: Skye Elliot Date: Wed, 25 Feb 2026 12:33:39 +0000 Subject: [PATCH] feat(crypto): Add `room_id` to `RoomPendingKeyBundleDetails` --- crates/matrix-sdk-crypto/src/store/integration_tests.rs | 1 + crates/matrix-sdk-crypto/src/store/mod.rs | 1 + crates/matrix-sdk-crypto/src/store/types.rs | 5 +++++ crates/matrix-sdk/src/encryption/tasks.rs | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/matrix-sdk-crypto/src/store/integration_tests.rs b/crates/matrix-sdk-crypto/src/store/integration_tests.rs index 72aa653ec..ef3c99cfd 100644 --- a/crates/matrix-sdk-crypto/src/store/integration_tests.rs +++ b/crates/matrix-sdk-crypto/src/store/integration_tests.rs @@ -1416,6 +1416,7 @@ macro_rules! cryptostore_integration_tests { rooms_pending_key_bundle: HashMap::from([( test_room.to_owned(), Some(RoomPendingKeyBundleDetails { + room_id: test_room.to_owned(), invite_accepted_at: timestamp, inviter: test_user.to_owned(), }), diff --git a/crates/matrix-sdk-crypto/src/store/mod.rs b/crates/matrix-sdk-crypto/src/store/mod.rs index 63364f423..08a273d12 100644 --- a/crates/matrix-sdk-crypto/src/store/mod.rs +++ b/crates/matrix-sdk-crypto/src/store/mod.rs @@ -1857,6 +1857,7 @@ impl Store { rooms_pending_key_bundle: HashMap::from([( room_id.to_owned(), Some(RoomPendingKeyBundleDetails { + room_id: room_id.to_owned(), invite_accepted_at, inviter: inviter.to_owned(), }), diff --git a/crates/matrix-sdk-crypto/src/store/types.rs b/crates/matrix-sdk-crypto/src/store/types.rs index 94f680238..7661f692d 100644 --- a/crates/matrix-sdk-crypto/src/store/types.rs +++ b/crates/matrix-sdk-crypto/src/store/types.rs @@ -555,6 +555,11 @@ impl From<&StoredRoomKeyBundleData> for RoomKeyBundleInfo { /// invite (and so should accept a room key bundle if we receive one). #[derive(Debug, Clone, Serialize, Deserialize)] pub struct RoomPendingKeyBundleDetails { + /// The ID of the room associated with this entry, used to track and + /// enumerate all such rooms during the startup process. This enables the + /// client to resume importing after a crash. + pub room_id: OwnedRoomId, + /// A timestamp remembering when we observed the user accepting an invite /// using this client. pub invite_accepted_at: MilliSecondsSinceUnixEpoch, diff --git a/crates/matrix-sdk/src/encryption/tasks.rs b/crates/matrix-sdk/src/encryption/tasks.rs index 8ff2d63c4..6aa39203e 100644 --- a/crates/matrix-sdk/src/encryption/tasks.rs +++ b/crates/matrix-sdk/src/encryption/tasks.rs @@ -508,7 +508,7 @@ impl BundleReceiverTask { // If we don't have any invite acceptance details, then this client wasn't the // one that accepted the invite. - let Ok(Some(RoomPendingKeyBundleDetails { invite_accepted_at, inviter })) = + let Ok(Some(RoomPendingKeyBundleDetails { invite_accepted_at, inviter, .. })) = room.client.base_client().get_pending_key_bundle_details_for_room(room.room_id()).await else { debug!("Not accepting key bundle as there are no recorded invite acceptance details");