Skip to content

Commit

Permalink
task(crypto): Support receiving stable identifier for MSC4147
Browse files Browse the repository at this point in the history
  • Loading branch information
andybalaam committed Dec 16, 2024
1 parent 34ea42a commit 5bc353e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl<'a> SenderDataFinder<'a> {
room_key_event: &'a DecryptedRoomKeyEvent,
) -> Result<SenderData, SessionDeviceKeysCheckError> {
// Does the to-device message contain the device_keys property from MSC4147?
if let Some(sender_device_keys) = &room_key_event.device_keys {
if let Some(sender_device_keys) = &room_key_event.sender_device_keys {
// Yes: use the device keys to continue.

// Validate the signature of the DeviceKeys supplied.
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/olm/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,6 @@ mod tests {
// DecryptedOlmV1Event
let event: DecryptedOlmV1Event<DummyEventContent> =
serde_json::from_str(&bob_session_result.plaintext).unwrap();
assert_eq!(event.device_keys.unwrap(), alice.device_keys());
assert_eq!(event.sender_device_keys.unwrap(), alice.device_keys());
}
}
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/store/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ macro_rules! cryptostore_integration_tests {
recipient_keys: OlmV1Keys {
ed25519: account.identity_keys().ed25519,
},
device_keys: None,
sender_device_keys: None,
content: SecretSendContent::new(id.to_owned(), secret.to_owned()),
};

Expand Down
12 changes: 6 additions & 6 deletions crates/matrix-sdk-crypto/src/types/events/olm_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ impl AnyDecryptedOlmEvent {
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(),
AnyDecryptedOlmEvent::RoomKey(e) => e.sender_device_keys.as_ref(),
AnyDecryptedOlmEvent::ForwardedRoomKey(e) => e.sender_device_keys.as_ref(),
AnyDecryptedOlmEvent::SecretSend(e) => e.sender_device_keys.as_ref(),
AnyDecryptedOlmEvent::Dummy(e) => e.sender_device_keys.as_ref(),
}
}
}
Expand All @@ -177,7 +177,7 @@ where
pub recipient_keys: OlmV1Keys,
/// The device keys if supplied as per MSC4147
#[serde(rename = "org.matrix.msc4147.device_keys")]
pub device_keys: Option<DeviceKeys>,
pub sender_device_keys: Option<DeviceKeys>,
/// The type of the event.
pub content: C,
}
Expand All @@ -201,7 +201,7 @@ impl<C: EventType + Debug + Sized + Serialize> DecryptedOlmV1Event<C> {
recipient: recipient.to_owned(),
keys: OlmV1Keys { ed25519: key },
recipient_keys: OlmV1Keys { ed25519: key },
device_keys,
sender_device_keys: device_keys,
content,
}
}
Expand Down

0 comments on commit 5bc353e

Please sign in to comment.