crypto: The device identity can be our own, so store the identity enum instead.

master
Damir Jelić 2020-08-19 14:43:49 +02:00
parent c2a386b889
commit c3e593d998
2 changed files with 5 additions and 19 deletions

View File

@ -38,7 +38,7 @@ use super::{Account, OlmMachine};
use crate::{
error::SignatureError,
store::Result as StoreResult,
user_identity::{OwnUserIdentity, UserIdentity},
user_identity::{OwnUserIdentity, UserIdentities},
verification::VerificationMachine,
verify_json, ReadOnlyUserDevices, Sas,
};
@ -62,7 +62,7 @@ pub struct Device {
pub(crate) inner: ReadOnlyDevice,
pub(crate) verification_machine: VerificationMachine,
pub(crate) own_identity: Option<OwnUserIdentity>,
pub(crate) device_owner_identity: Option<UserIdentity>,
pub(crate) device_owner_identity: Option<UserIdentities>,
}
impl Deref for Device {
@ -103,7 +103,7 @@ pub struct UserDevices {
pub(crate) inner: ReadOnlyUserDevices,
pub(crate) verification_machine: VerificationMachine,
pub(crate) own_identity: Option<OwnUserIdentity>,
pub(crate) device_owner_identity: Option<UserIdentity>,
pub(crate) device_owner_identity: Option<UserIdentities>,
}
impl UserDevices {

View File

@ -1431,14 +1431,7 @@ impl OlmMachine {
.flatten()
.map(|i| i.own().cloned())
.flatten();
let device_owner_identity = self
.store
.get_user_identity(user_id)
.await
.ok()
.flatten()
.map(|i| i.other().cloned())
.flatten();
let device_owner_identity = self.store.get_user_identity(user_id).await.ok().flatten();
Some(Device {
inner: device,
@ -1482,14 +1475,7 @@ impl OlmMachine {
.flatten()
.map(|i| i.own().cloned())
.flatten();
let device_owner_identity = self
.store
.get_user_identity(user_id)
.await
.ok()
.flatten()
.map(|i| i.other().cloned())
.flatten();
let device_owner_identity = self.store.get_user_identity(user_id).await.ok().flatten();
Ok(UserDevices {
inner: devices,