diff --git a/crates/matrix-sdk-crypto/src/machine/mod.rs b/crates/matrix-sdk-crypto/src/machine/mod.rs index 45f84918c32..cd0cf50b205 100644 --- a/crates/matrix-sdk-crypto/src/machine/mod.rs +++ b/crates/matrix-sdk-crypto/src/machine/mod.rs @@ -1109,7 +1109,11 @@ impl OlmMachine { decrypted: &mut OlmDecryptionInfo, changes: &mut Changes, ) -> OlmResult<()> { - debug!("Received a decrypted to-device event"); + debug!( + sender_device_keys = + ?decrypted.result.event.sender_device_keys().map(|k| (k.curve25519_key(), k.ed25519_key())), + "Received a decrypted to-device event", + ); match &*decrypted.result.event { AnyDecryptedOlmEvent::RoomKey(e) => { diff --git a/crates/matrix-sdk-crypto/src/olm/group_sessions/inbound.rs b/crates/matrix-sdk-crypto/src/olm/group_sessions/inbound.rs index 51b774fe28c..e6ae7458bba 100644 --- a/crates/matrix-sdk-crypto/src/olm/group_sessions/inbound.rs +++ b/crates/matrix-sdk-crypto/src/olm/group_sessions/inbound.rs @@ -489,7 +489,10 @@ impl InboundGroupSession { #[cfg(not(tarpaulin_include))] impl fmt::Debug for InboundGroupSession { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("InboundGroupSession").field("session_id", &self.session_id()).finish() + f.debug_struct("InboundGroupSession") + .field("session_id", &self.session_id()) + .field("sender_data", &self.sender_data) + .finish() } } diff --git a/crates/matrix-sdk-crypto/src/types/events/olm_v1.rs b/crates/matrix-sdk-crypto/src/types/events/olm_v1.rs index 0ecf19c2268..dc33fffdae7 100644 --- a/crates/matrix-sdk-crypto/src/types/events/olm_v1.rs +++ b/crates/matrix-sdk-crypto/src/types/events/olm_v1.rs @@ -148,6 +148,17 @@ impl AnyDecryptedOlmEvent { AnyDecryptedOlmEvent::Dummy(e) => e.content.event_type(), } } + + /// The sender's device keys, if supplied in the message as per MSC4147 + pub fn sender_device_keys(&self) -> Option<&DeviceKeys> { + match self { + AnyDecryptedOlmEvent::Custom(_) => None, + AnyDecryptedOlmEvent::RoomKey(e) => e.device_keys.as_ref(), + AnyDecryptedOlmEvent::ForwardedRoomKey(e) => e.device_keys.as_ref(), + AnyDecryptedOlmEvent::SecretSend(e) => e.device_keys.as_ref(), + AnyDecryptedOlmEvent::Dummy(e) => e.device_keys.as_ref(), + } + } } /// An `m.olm.v1.curve25519-aes-sha2` decrypted to-device event.