Skip to content

Commit cac1067

Browse files
committed
crypto: withhold outgoing messages to unsigned dehydrated devices
Per #4313, we should not send outgoing messages to dehydrated devices that are not signed by the current pinned/verified identity.
1 parent e9c5096 commit cac1067

7 files changed

+750
-19
lines changed

crates/matrix-sdk-crypto/src/identities/device.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ impl Device {
481481

482482
/// Whether or not the device is a dehydrated device.
483483
pub fn is_dehydrated(&self) -> bool {
484-
self.inner.device_keys.dehydrated.unwrap_or(false)
484+
self.inner.is_dehydrated()
485485
}
486486
}
487487

@@ -966,6 +966,11 @@ impl DeviceData {
966966
pub fn first_time_seen_ts(&self) -> MilliSecondsSinceUnixEpoch {
967967
self.first_time_seen_ts
968968
}
969+
970+
/// True if this device is an MSC3814 dehydrated device.
971+
pub fn is_dehydrated(&self) -> bool {
972+
self.device_keys.dehydrated.unwrap_or(false)
973+
}
969974
}
970975

971976
impl TryFrom<&DeviceKeys> for DeviceData {

0 commit comments

Comments
 (0)