From 7451bd2ab623b536d20e0e65cac00875f378d7ac Mon Sep 17 00:00:00 2001 From: Skye Elliot Date: Wed, 10 Dec 2025 16:54:23 +0000 Subject: [PATCH 1/6] feat: Add `forwarder` and `forwarder_device` to `EncryptionInfo`. Signed-off-by: Skye Elliot --- .../event_cache/store/integration_tests.rs | 2 + .../src/deserialized_responses.rs | 39 +++++++++++++++++-- crates/matrix-sdk-crypto/src/machine/mod.rs | 25 ++++++++++-- crates/matrix-sdk-crypto/src/olm/account.rs | 2 + .../controller/decryption_retry_task.rs | 2 + .../matrix-sdk-ui/src/timeline/tests/edit.rs | 2 + .../integration/encryption/shared_history.rs | 6 +++ 7 files changed, 71 insertions(+), 7 deletions(-) diff --git a/crates/matrix-sdk-base/src/event_cache/store/integration_tests.rs b/crates/matrix-sdk-base/src/event_cache/store/integration_tests.rs index 40329522028..cf57ed88f23 100644 --- a/crates/matrix-sdk-base/src/event_cache/store/integration_tests.rs +++ b/crates/matrix-sdk-base/src/event_cache/store/integration_tests.rs @@ -79,6 +79,8 @@ pub fn make_test_event_with_event_id( let encryption_info = Arc::new(EncryptionInfo { sender: (*ALICE).into(), sender_device: None, + forwarder: None, + forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "1337".to_owned(), sender_claimed_keys: Default::default(), diff --git a/crates/matrix-sdk-common/src/deserialized_responses.rs b/crates/matrix-sdk-common/src/deserialized_responses.rs index a0211abc79d..f316acb5a04 100644 --- a/crates/matrix-sdk-common/src/deserialized_responses.rs +++ b/crates/matrix-sdk-common/src/deserialized_responses.rs @@ -328,6 +328,17 @@ pub struct EncryptionInfo { /// The device ID of the device that sent us the event, note this is /// untrusted data unless `verification_state` is `Verified` as well. pub sender_device: Option, + /// If the keys for this message shared-on-invite as part of an + /// [MSC4268] key bundle, the ID of the user who sent them to us. + /// + /// [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268 + pub forwarder: Option, + /// If the keys for this message were shared-on-invite as part of an + /// [MSC4268] key bundle, the ID of the device from which they were + /// sent. + /// + /// [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268 + pub forwarder_device: Option, /// Information about the algorithm that was used to encrypt the event. pub algorithm_info: AlgorithmInfo, /// The verification state of the device that sent us the event, note this @@ -361,14 +372,23 @@ impl<'de> Deserialize<'de> for EncryptionInfo { struct Helper { pub sender: OwnedUserId, pub sender_device: Option, + pub forwarder: Option, + pub forwarder_device: Option, pub algorithm_info: AlgorithmInfo, pub verification_state: VerificationState, #[serde(rename = "session_id")] pub old_session_id: Option, } - let Helper { sender, sender_device, algorithm_info, verification_state, old_session_id } = - Helper::deserialize(deserializer)?; + let Helper { + sender, + sender_device, + forwarder, + forwarder_device, + algorithm_info, + verification_state, + old_session_id, + } = Helper::deserialize(deserializer)?; let algorithm_info = match algorithm_info { AlgorithmInfo::MegolmV1AesSha2 { curve25519_key, sender_claimed_keys, session_id } => { @@ -382,7 +402,14 @@ impl<'de> Deserialize<'de> for EncryptionInfo { other => other, }; - Ok(EncryptionInfo { sender, sender_device, algorithm_info, verification_state }) + Ok(EncryptionInfo { + sender, + sender_device, + forwarder, + forwarder_device, + algorithm_info, + verification_state, + }) } } @@ -1617,6 +1644,8 @@ mod tests { encryption_info: Arc::new(EncryptionInfo { sender: user_id!("@sender:example.com").to_owned(), sender_device: None, + forwarder: None, + forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "xxx".to_owned(), sender_claimed_keys: Default::default(), @@ -2041,6 +2070,8 @@ mod tests { let info = EncryptionInfo { sender: user_id!("@alice:localhost").to_owned(), sender_device: Some(device_id!("ABCDEFGH").to_owned()), + forwarder: None, + forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "curvecurvecurve".into(), sender_claimed_keys: Default::default(), @@ -2062,6 +2093,8 @@ mod tests { encryption_info: Arc::new(EncryptionInfo { sender: user_id!("@sender:example.com").to_owned(), sender_device: Some(device_id!("ABCDEFGHIJ").to_owned()), + forwarder: None, + forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "xxx".to_owned(), sender_claimed_keys: BTreeMap::from([ diff --git a/crates/matrix-sdk-crypto/src/machine/mod.rs b/crates/matrix-sdk-crypto/src/machine/mod.rs index 6b3cb8db975..fa793277092 100644 --- a/crates/matrix-sdk-crypto/src/machine/mod.rs +++ b/crates/matrix-sdk-crypto/src/machine/mod.rs @@ -1136,6 +1136,8 @@ impl OlmMachine { EncryptionInfo { sender: self.inner.user_id.clone(), sender_device: Some(self.inner.device_id.clone()), + forwarder: None, + forwarder_device: None, algorithm_info, verification_state: VerificationState::Verified, } @@ -2016,11 +2018,26 @@ impl OlmMachine { let (verification_state, device_id) = self.get_room_event_verification_state(session, sender).await?; - let sender = sender.to_owned(); - Ok(Arc::new(EncryptionInfo { - sender, - sender_device: device_id, + sender: sender.to_owned(), + sender_device: device_id.clone(), + forwarder: session.forwarder_data.as_ref().and_then(|data| data.user_id()), + forwarder_device: session.forwarder_data.as_ref().and_then(|data| match data { + SenderData::SenderUnverified(known_sender_data) + | SenderData::SenderVerified(known_sender_data) => { + known_sender_data.device_id.clone() + } + _ => { + // TODO: Should this return an error? + warn!( + sender_id = ?sender, + device_id = ?device_id, + session_id = session.session_id(), + "Invalid sender verification state for forwarded session" + ); + None + } + }), algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: session.sender_key().to_base64(), sender_claimed_keys: session diff --git a/crates/matrix-sdk-crypto/src/olm/account.rs b/crates/matrix-sdk-crypto/src/olm/account.rs index 30edc4fea37..a0bdd2aad3c 100644 --- a/crates/matrix-sdk-crypto/src/olm/account.rs +++ b/crates/matrix-sdk-crypto/src/olm/account.rs @@ -1704,6 +1704,8 @@ impl Account { EncryptionInfo { sender: sender_id.to_owned(), sender_device: sender_device.as_ref().map(|d| d.device_id().to_owned()), + forwarder: None, + forwarder_device: None, algorithm_info: AlgorithmInfo::OlmV1Curve25519AesSha2 { curve25519_public_key_base64: sender_key.to_base64(), }, diff --git a/crates/matrix-sdk-ui/src/timeline/controller/decryption_retry_task.rs b/crates/matrix-sdk-ui/src/timeline/controller/decryption_retry_task.rs index 211841491d7..80dda67859b 100644 --- a/crates/matrix-sdk-ui/src/timeline/controller/decryption_retry_task.rs +++ b/crates/matrix-sdk-ui/src/timeline/controller/decryption_retry_task.rs @@ -296,6 +296,8 @@ mod tests { encryption_info: Some(Arc::new(EncryptionInfo { sender: owned_user_id!("@u:s.co"), sender_device: None, + forwarder: None, + forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "".to_owned(), sender_claimed_keys: BTreeMap::new(), diff --git a/crates/matrix-sdk-ui/src/timeline/tests/edit.rs b/crates/matrix-sdk-ui/src/timeline/tests/edit.rs index 4d6dcba969c..1743d2eb5f1 100644 --- a/crates/matrix-sdk-ui/src/timeline/tests/edit.rs +++ b/crates/matrix-sdk-ui/src/timeline/tests/edit.rs @@ -163,6 +163,8 @@ async fn test_edit_updates_encryption_info() { let mut encryption_info = Arc::new(EncryptionInfo { sender: (*ALICE).into(), sender_device: None, + forwarder: None, + forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "123".to_owned(), sender_claimed_keys: BTreeMap::new(), diff --git a/crates/matrix-sdk/tests/integration/encryption/shared_history.rs b/crates/matrix-sdk/tests/integration/encryption/shared_history.rs index 84fe576311c..9fb35cb8fe7 100644 --- a/crates/matrix-sdk/tests/integration/encryption/shared_history.rs +++ b/crates/matrix-sdk/tests/integration/encryption/shared_history.rs @@ -195,6 +195,12 @@ async fn test_shared_history_out_of_order() { .await .expect("Bob should be able to fetch the event Alice has sent"); + let encryption_info = event.encryption_info().expect("Event did not have encryption info"); + + // Check Bob stored information about the key forwarder. + assert_eq!(encryption_info.forwarder, Some(alice_user_id.to_owned())); + assert_eq!(encryption_info.forwarder_device, Some(alice_device_id.to_owned())); + assert_decrypted_message_eq!( event, "It's a secret to everybody", From abc80ffe95ebcac2eb277f90ce56a9149499b181 Mon Sep 17 00:00:00 2001 From: Skye Elliot Date: Thu, 11 Dec 2025 10:22:46 +0000 Subject: [PATCH 2/6] tests(common): Update snapshots to include `forwarder`. --- crates/matrix-sdk-common/src/deserialized_responses.rs | 2 ++ ...eserialized_responses__tests__encryption_info_migration.snap | 2 ++ .../src/snapshots/snapshot_test_encryption_info.snap | 2 ++ .../src/snapshots/snapshot_test_sync_timeline_event.snap | 2 ++ 4 files changed, 8 insertions(+) diff --git a/crates/matrix-sdk-common/src/deserialized_responses.rs b/crates/matrix-sdk-common/src/deserialized_responses.rs index f316acb5a04..6fc9596c853 100644 --- a/crates/matrix-sdk-common/src/deserialized_responses.rs +++ b/crates/matrix-sdk-common/src/deserialized_responses.rs @@ -1686,6 +1686,8 @@ mod tests { "encryption_info": { "sender": "@sender:example.com", "sender_device": null, + "forwarder": null, + "forwarder_device": null, "algorithm_info": { "MegolmV1AesSha2": { "curve25519_key": "xxx", diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__encryption_info_migration.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__encryption_info_migration.snap index 51377c846b8..6cbfc529898 100644 --- a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__encryption_info_migration.snap +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__encryption_info_migration.snap @@ -5,6 +5,8 @@ expression: deserialized { "sender": "@alice:localhost", "sender_device": "ABCDEFGH", + "forwarder": null, + "forwarder_device": null, "algorithm_info": { "MegolmV1AesSha2": { "curve25519_key": "curvecurvecurve", diff --git a/crates/matrix-sdk-common/src/snapshots/snapshot_test_encryption_info.snap b/crates/matrix-sdk-common/src/snapshots/snapshot_test_encryption_info.snap index ed209f9e0cb..a6135ebb08d 100644 --- a/crates/matrix-sdk-common/src/snapshots/snapshot_test_encryption_info.snap +++ b/crates/matrix-sdk-common/src/snapshots/snapshot_test_encryption_info.snap @@ -5,6 +5,8 @@ expression: info { "sender": "@alice:localhost", "sender_device": "ABCDEFGH", + "forwarder": null, + "forwarder_device": null, "algorithm_info": { "MegolmV1AesSha2": { "curve25519_key": "curvecurvecurve", diff --git a/crates/matrix-sdk-common/src/snapshots/snapshot_test_sync_timeline_event.snap b/crates/matrix-sdk-common/src/snapshots/snapshot_test_sync_timeline_event.snap index c4ece33c750..40e7dc15e73 100644 --- a/crates/matrix-sdk-common/src/snapshots/snapshot_test_sync_timeline_event.snap +++ b/crates/matrix-sdk-common/src/snapshots/snapshot_test_sync_timeline_event.snap @@ -16,6 +16,8 @@ expression: "serde_json::to_value(&room_event).unwrap()" "session_id": "mysessionid112" } }, + "forwarder": null, + "forwarder_device": null, "sender": "@sender:example.com", "sender_device": "ABCDEFGHIJ", "verification_state": "Verified" From 0ee914e9a366f5db51adf73f0f2d579a7c6a10c0 Mon Sep 17 00:00:00 2001 From: Skye Elliot Date: Fri, 19 Dec 2025 15:11:14 +0000 Subject: [PATCH 3/6] feat: Introduce `ForwarderInfo` to simplify separate fields. --- .../event_cache/store/integration_tests.rs | 1 - .../src/deserialized_responses.rs | 35 +++++++------------ crates/matrix-sdk-crypto/src/machine/mod.rs | 29 ++++++--------- crates/matrix-sdk-crypto/src/olm/account.rs | 1 - .../controller/decryption_retry_task.rs | 1 - .../matrix-sdk-ui/src/timeline/tests/edit.rs | 1 - .../integration/encryption/shared_history.rs | 5 +-- 7 files changed, 26 insertions(+), 47 deletions(-) diff --git a/crates/matrix-sdk-base/src/event_cache/store/integration_tests.rs b/crates/matrix-sdk-base/src/event_cache/store/integration_tests.rs index cf57ed88f23..aaf3154ff23 100644 --- a/crates/matrix-sdk-base/src/event_cache/store/integration_tests.rs +++ b/crates/matrix-sdk-base/src/event_cache/store/integration_tests.rs @@ -80,7 +80,6 @@ pub fn make_test_event_with_event_id( sender: (*ALICE).into(), sender_device: None, forwarder: None, - forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "1337".to_owned(), sender_claimed_keys: Default::default(), diff --git a/crates/matrix-sdk-common/src/deserialized_responses.rs b/crates/matrix-sdk-common/src/deserialized_responses.rs index 6fc9596c853..86fc92c0c5b 100644 --- a/crates/matrix-sdk-common/src/deserialized_responses.rs +++ b/crates/matrix-sdk-common/src/deserialized_responses.rs @@ -319,6 +319,15 @@ pub enum AlgorithmInfo { }, } +/// Represents information about a forwarder in the context of encryption. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ForwarderInfo { + /// The user ID of the forwarder. + pub user_id: OwnedUserId, + /// The device ID of the forwarder. + pub device_id: OwnedDeviceId, +} + /// Struct containing information on how an event was decrypted. #[derive(Clone, Debug, PartialEq, Serialize)] pub struct EncryptionInfo { @@ -328,17 +337,11 @@ pub struct EncryptionInfo { /// The device ID of the device that sent us the event, note this is /// untrusted data unless `verification_state` is `Verified` as well. pub sender_device: Option, - /// If the keys for this message shared-on-invite as part of an - /// [MSC4268] key bundle, the ID of the user who sent them to us. - /// - /// [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268 - pub forwarder: Option, /// If the keys for this message were shared-on-invite as part of an - /// [MSC4268] key bundle, the ID of the device from which they were - /// sent. + /// [MSC4268] key bundle, information about the forwarder. /// /// [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268 - pub forwarder_device: Option, + pub forwarder: Option, /// Information about the algorithm that was used to encrypt the event. pub algorithm_info: AlgorithmInfo, /// The verification state of the device that sent us the event, note this @@ -372,8 +375,7 @@ impl<'de> Deserialize<'de> for EncryptionInfo { struct Helper { pub sender: OwnedUserId, pub sender_device: Option, - pub forwarder: Option, - pub forwarder_device: Option, + pub forwarder: Option, pub algorithm_info: AlgorithmInfo, pub verification_state: VerificationState, #[serde(rename = "session_id")] @@ -384,7 +386,6 @@ impl<'de> Deserialize<'de> for EncryptionInfo { sender, sender_device, forwarder, - forwarder_device, algorithm_info, verification_state, old_session_id, @@ -402,14 +403,7 @@ impl<'de> Deserialize<'de> for EncryptionInfo { other => other, }; - Ok(EncryptionInfo { - sender, - sender_device, - forwarder, - forwarder_device, - algorithm_info, - verification_state, - }) + Ok(EncryptionInfo { sender, sender_device, forwarder, algorithm_info, verification_state }) } } @@ -1645,7 +1639,6 @@ mod tests { sender: user_id!("@sender:example.com").to_owned(), sender_device: None, forwarder: None, - forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "xxx".to_owned(), sender_claimed_keys: Default::default(), @@ -2073,7 +2066,6 @@ mod tests { sender: user_id!("@alice:localhost").to_owned(), sender_device: Some(device_id!("ABCDEFGH").to_owned()), forwarder: None, - forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "curvecurvecurve".into(), sender_claimed_keys: Default::default(), @@ -2096,7 +2088,6 @@ mod tests { sender: user_id!("@sender:example.com").to_owned(), sender_device: Some(device_id!("ABCDEFGHIJ").to_owned()), forwarder: None, - forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "xxx".to_owned(), sender_claimed_keys: BTreeMap::from([ diff --git a/crates/matrix-sdk-crypto/src/machine/mod.rs b/crates/matrix-sdk-crypto/src/machine/mod.rs index fa793277092..bcfd9088813 100644 --- a/crates/matrix-sdk-crypto/src/machine/mod.rs +++ b/crates/matrix-sdk-crypto/src/machine/mod.rs @@ -26,7 +26,7 @@ use matrix_sdk_common::deserialized_responses::WithheldCode; use matrix_sdk_common::{ BoxFuture, deserialized_responses::{ - AlgorithmInfo, DecryptedRoomEvent, DeviceLinkProblem, EncryptionInfo, + AlgorithmInfo, DecryptedRoomEvent, DeviceLinkProblem, EncryptionInfo, ForwarderInfo, ProcessedToDeviceEvent, ToDeviceUnableToDecryptInfo, ToDeviceUnableToDecryptReason, UnableToDecryptInfo, UnableToDecryptReason, UnsignedDecryptionResult, UnsignedEventLocation, VerificationLevel, VerificationState, @@ -1137,7 +1137,6 @@ impl OlmMachine { sender: self.inner.user_id.clone(), sender_device: Some(self.inner.device_id.clone()), forwarder: None, - forwarder_device: None, algorithm_info, verification_state: VerificationState::Verified, } @@ -2020,23 +2019,15 @@ impl OlmMachine { Ok(Arc::new(EncryptionInfo { sender: sender.to_owned(), - sender_device: device_id.clone(), - forwarder: session.forwarder_data.as_ref().and_then(|data| data.user_id()), - forwarder_device: session.forwarder_data.as_ref().and_then(|data| match data { - SenderData::SenderUnverified(known_sender_data) - | SenderData::SenderVerified(known_sender_data) => { - known_sender_data.device_id.clone() - } - _ => { - // TODO: Should this return an error? - warn!( - sender_id = ?sender, - device_id = ?device_id, - session_id = session.session_id(), - "Invalid sender verification state for forwarded session" - ); - None - } + sender_device: device_id, + forwarder: session.forwarder_data.as_ref().and_then(|data| { + // Per the comment on `KnownSenderData::device_id`, we should never encounter a + // `None` value here, but must still deal with an `Optional` for backwards + // compatibility. The approach below allows us to avoid unwrapping. + data.device_id().map(|device_id| ForwarderInfo { + device_id: device_id.to_owned(), + user_id: data.user_id().to_owned(), + }) }), algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: session.sender_key().to_base64(), diff --git a/crates/matrix-sdk-crypto/src/olm/account.rs b/crates/matrix-sdk-crypto/src/olm/account.rs index a0bdd2aad3c..88c43c973f8 100644 --- a/crates/matrix-sdk-crypto/src/olm/account.rs +++ b/crates/matrix-sdk-crypto/src/olm/account.rs @@ -1705,7 +1705,6 @@ impl Account { sender: sender_id.to_owned(), sender_device: sender_device.as_ref().map(|d| d.device_id().to_owned()), forwarder: None, - forwarder_device: None, algorithm_info: AlgorithmInfo::OlmV1Curve25519AesSha2 { curve25519_public_key_base64: sender_key.to_base64(), }, diff --git a/crates/matrix-sdk-ui/src/timeline/controller/decryption_retry_task.rs b/crates/matrix-sdk-ui/src/timeline/controller/decryption_retry_task.rs index 80dda67859b..68fa53bb0ed 100644 --- a/crates/matrix-sdk-ui/src/timeline/controller/decryption_retry_task.rs +++ b/crates/matrix-sdk-ui/src/timeline/controller/decryption_retry_task.rs @@ -297,7 +297,6 @@ mod tests { sender: owned_user_id!("@u:s.co"), sender_device: None, forwarder: None, - forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "".to_owned(), sender_claimed_keys: BTreeMap::new(), diff --git a/crates/matrix-sdk-ui/src/timeline/tests/edit.rs b/crates/matrix-sdk-ui/src/timeline/tests/edit.rs index 1743d2eb5f1..7ffbc25948f 100644 --- a/crates/matrix-sdk-ui/src/timeline/tests/edit.rs +++ b/crates/matrix-sdk-ui/src/timeline/tests/edit.rs @@ -164,7 +164,6 @@ async fn test_edit_updates_encryption_info() { sender: (*ALICE).into(), sender_device: None, forwarder: None, - forwarder_device: None, algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { curve25519_key: "123".to_owned(), sender_claimed_keys: BTreeMap::new(), diff --git a/crates/matrix-sdk/tests/integration/encryption/shared_history.rs b/crates/matrix-sdk/tests/integration/encryption/shared_history.rs index 9fb35cb8fe7..5e4c694ad98 100644 --- a/crates/matrix-sdk/tests/integration/encryption/shared_history.rs +++ b/crates/matrix-sdk/tests/integration/encryption/shared_history.rs @@ -198,8 +198,9 @@ async fn test_shared_history_out_of_order() { let encryption_info = event.encryption_info().expect("Event did not have encryption info"); // Check Bob stored information about the key forwarder. - assert_eq!(encryption_info.forwarder, Some(alice_user_id.to_owned())); - assert_eq!(encryption_info.forwarder_device, Some(alice_device_id.to_owned())); + let forwarder_info = encryption_info.forwarder.as_ref().unwrap(); + assert_eq!(forwarder_info.user_id, alice_user_id); + assert_eq!(forwarder_info.device_id, alice_device_id); assert_decrypted_message_eq!( event, From 81cd48ef6d713b97df55635587c8b4d2065cea64 Mon Sep 17 00:00:00 2001 From: Skye Elliot Date: Fri, 19 Dec 2025 15:27:54 +0000 Subject: [PATCH 4/6] tests(common): Update tests for `EncryptionInfo`. --- crates/matrix-sdk-common/src/deserialized_responses.rs | 1 - ...deserialized_responses__tests__encryption_info_migration.snap | 1 - .../src/snapshots/snapshot_test_encryption_info.snap | 1 - .../src/snapshots/snapshot_test_sync_timeline_event.snap | 1 - 4 files changed, 4 deletions(-) diff --git a/crates/matrix-sdk-common/src/deserialized_responses.rs b/crates/matrix-sdk-common/src/deserialized_responses.rs index 86fc92c0c5b..42a5c35ddd8 100644 --- a/crates/matrix-sdk-common/src/deserialized_responses.rs +++ b/crates/matrix-sdk-common/src/deserialized_responses.rs @@ -1680,7 +1680,6 @@ mod tests { "sender": "@sender:example.com", "sender_device": null, "forwarder": null, - "forwarder_device": null, "algorithm_info": { "MegolmV1AesSha2": { "curve25519_key": "xxx", diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__encryption_info_migration.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__encryption_info_migration.snap index 6cbfc529898..61070b2b2b3 100644 --- a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__encryption_info_migration.snap +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__encryption_info_migration.snap @@ -6,7 +6,6 @@ expression: deserialized "sender": "@alice:localhost", "sender_device": "ABCDEFGH", "forwarder": null, - "forwarder_device": null, "algorithm_info": { "MegolmV1AesSha2": { "curve25519_key": "curvecurvecurve", diff --git a/crates/matrix-sdk-common/src/snapshots/snapshot_test_encryption_info.snap b/crates/matrix-sdk-common/src/snapshots/snapshot_test_encryption_info.snap index a6135ebb08d..e0ca8bf37ee 100644 --- a/crates/matrix-sdk-common/src/snapshots/snapshot_test_encryption_info.snap +++ b/crates/matrix-sdk-common/src/snapshots/snapshot_test_encryption_info.snap @@ -6,7 +6,6 @@ expression: info "sender": "@alice:localhost", "sender_device": "ABCDEFGH", "forwarder": null, - "forwarder_device": null, "algorithm_info": { "MegolmV1AesSha2": { "curve25519_key": "curvecurvecurve", diff --git a/crates/matrix-sdk-common/src/snapshots/snapshot_test_sync_timeline_event.snap b/crates/matrix-sdk-common/src/snapshots/snapshot_test_sync_timeline_event.snap index 40e7dc15e73..dc9010e36c8 100644 --- a/crates/matrix-sdk-common/src/snapshots/snapshot_test_sync_timeline_event.snap +++ b/crates/matrix-sdk-common/src/snapshots/snapshot_test_sync_timeline_event.snap @@ -17,7 +17,6 @@ expression: "serde_json::to_value(&room_event).unwrap()" } }, "forwarder": null, - "forwarder_device": null, "sender": "@sender:example.com", "sender_device": "ABCDEFGHIJ", "verification_state": "Verified" From 6406d265d299725f907d89d3de807eaaf92bf6ce Mon Sep 17 00:00:00 2001 From: Skye Elliot Date: Fri, 19 Dec 2025 15:38:19 +0000 Subject: [PATCH 5/6] docs: Improve comment. --- crates/matrix-sdk-common/src/deserialized_responses.rs | 3 ++- crates/matrix-sdk-crypto/CHANGELOG.md | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/matrix-sdk-common/src/deserialized_responses.rs b/crates/matrix-sdk-common/src/deserialized_responses.rs index 42a5c35ddd8..f00fff36b2b 100644 --- a/crates/matrix-sdk-common/src/deserialized_responses.rs +++ b/crates/matrix-sdk-common/src/deserialized_responses.rs @@ -319,7 +319,8 @@ pub enum AlgorithmInfo { }, } -/// Represents information about a forwarder in the context of encryption. +/// Struct containing information on the forwarder of the keys used to decrypt +/// an event. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ForwarderInfo { /// The user ID of the forwarder. diff --git a/crates/matrix-sdk-crypto/CHANGELOG.md b/crates/matrix-sdk-crypto/CHANGELOG.md index 92316bd08d6..e2e36446b7c 100644 --- a/crates/matrix-sdk-crypto/CHANGELOG.md +++ b/crates/matrix-sdk-crypto/CHANGELOG.md @@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file. ### Features +- Added a new field `forwarder` to `InboundGroupSession` of type `ForwarderData`, which stores + information about the forwarder of a session shared in a room key bundle under + [MSC4268](https://github.com/matrix-org/matrix-spec-proposals/pull/4268). + ([#5980])(https://github.com/matrix-org/matrix-rust-sdk/pull/5980) - The `OutboundGroupSession` and `OlmMachine` now return the `EncryptionInfo` used when encrypting raw events. ([#5936](https://github.com/matrix-org/matrix-rust-sdk/pull/5936)) From b85fc0d311da19566b7b831c0f0404b74f814bcc Mon Sep 17 00:00:00 2001 From: Skye Elliot Date: Fri, 19 Dec 2025 17:09:19 +0000 Subject: [PATCH 6/6] docs: Update CHANGELOGs --- crates/matrix-sdk-common/CHANGELOG.md | 2 ++ crates/matrix-sdk-crypto/CHANGELOG.md | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/matrix-sdk-common/CHANGELOG.md b/crates/matrix-sdk-common/CHANGELOG.md index 1a9cb7d7d22..034190daed9 100644 --- a/crates/matrix-sdk-common/CHANGELOG.md +++ b/crates/matrix-sdk-common/CHANGELOG.md @@ -14,6 +14,8 @@ All notable changes to this project will be documented in this file. ### Features +- Add field `forwarder` of type `ForwarderInfo` to `EncryptionInfo`, which which exposes information about the forwarder of the keys with which an event was encrypted if they were shared as part of an [MSC4268](https://github.com/matrix-org/matrix-spec-proposals/pull/4268) room key bundle. + ([#5945](https://github.com/matrix-org/matrix-rust-sdk/pull/5945)). - [**breaking**] Cross-process lock can be dirty. The `CrossProcess::try_lock_once` now returns a new type `CrossProcessResult`, which is an enum with `Clean`, `Dirty` or `Unobtained` variants. When the lock is dirty it means it's been acquired once, then acquired another time from another holder, so the current holder may want to refresh its internal state. ([#5672](https://github.com/matrix-org/matrix-rust-sdk/pull/5672)). diff --git a/crates/matrix-sdk-crypto/CHANGELOG.md b/crates/matrix-sdk-crypto/CHANGELOG.md index e2e36446b7c..21aaf2d6628 100644 --- a/crates/matrix-sdk-crypto/CHANGELOG.md +++ b/crates/matrix-sdk-crypto/CHANGELOG.md @@ -8,9 +8,7 @@ All notable changes to this project will be documented in this file. ### Features -- Added a new field `forwarder` to `InboundGroupSession` of type `ForwarderData`, which stores - information about the forwarder of a session shared in a room key bundle under - [MSC4268](https://github.com/matrix-org/matrix-spec-proposals/pull/4268). +- Added a new field `forwarder` to `InboundGroupSession` of type `ForwarderData`, which stores information about the forwarder of a session shared in a room key bundle under [MSC4268](https://github.com/matrix-org/matrix-spec-proposals/pull/4268). ([#5980])(https://github.com/matrix-org/matrix-rust-sdk/pull/5980) - The `OutboundGroupSession` and `OlmMachine` now return the `EncryptionInfo` used when encrypting raw events.