crypto: Don't share group sessions with blacklisted devices.

master
Damir Jelić 2020-08-14 16:20:49 +02:00
parent 97ad060d4b
commit 664d8c239c
2 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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());
}
}
}