crypto: Don't share group sessions with blacklisted devices.
parent
97ad060d4b
commit
664d8c239c
|
@ -131,11 +131,18 @@ impl Device {
|
||||||
self.trust_state.load(Ordering::Relaxed)
|
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 {
|
pub fn is_trusted(&self) -> bool {
|
||||||
self.trust_state() == TrustState::Verified
|
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.
|
/// Set the trust state of the device to the given state.
|
||||||
///
|
///
|
||||||
/// Note: This should only done in the cryptostore where the trust state can
|
/// Note: This should only done in the cryptostore where the trust state can
|
||||||
|
|
|
@ -1014,9 +1014,11 @@ impl OlmMachine {
|
||||||
|
|
||||||
for user_id in users {
|
for user_id in users {
|
||||||
for device in self.store.get_user_devices(user_id).await?.devices() {
|
for device in self.store.get_user_devices(user_id).await?.devices() {
|
||||||
|
if !device.is_blacklisted() {
|
||||||
devices.push(device.clone());
|
devices.push(device.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut requests = Vec::new();
|
let mut requests = Vec::new();
|
||||||
let key_content = session.as_json().await;
|
let key_content = session.as_json().await;
|
||||||
|
|
Loading…
Reference in New Issue