diff --git a/matrix_sdk_crypto/src/device.rs b/matrix_sdk_crypto/src/device.rs index ce9e8ece..029703d8 100644 --- a/matrix_sdk_crypto/src/device.rs +++ b/matrix_sdk_crypto/src/device.rs @@ -131,11 +131,18 @@ impl Device { self.trust_state.load(Ordering::Relaxed) } - /// Is the device locally marked trusted. + /// Is the device locally marked as trusted. pub fn is_trusted(&self) -> bool { self.trust_state() == TrustState::Verified } + /// Is the device locally marked as blacklisted. + /// + /// Blacklisted devices won't receive any group sessions. + pub fn is_blacklisted(&self) -> bool { + self.trust_state() == TrustState::BlackListed + } + /// Set the trust state of the device to the given state. /// /// Note: This should only done in the cryptostore where the trust state can diff --git a/matrix_sdk_crypto/src/machine.rs b/matrix_sdk_crypto/src/machine.rs index 2176b2f4..d17c2bed 100644 --- a/matrix_sdk_crypto/src/machine.rs +++ b/matrix_sdk_crypto/src/machine.rs @@ -1014,7 +1014,9 @@ impl OlmMachine { for user_id in users { for device in self.store.get_user_devices(user_id).await?.devices() { - devices.push(device.clone()); + if !device.is_blacklisted() { + devices.push(device.clone()); + } } }