diff --git a/matrix_sdk_crypto/src/identities/manager.rs b/matrix_sdk_crypto/src/identities/manager.rs index 993dd5a4..02a440a0 100644 --- a/matrix_sdk_crypto/src/identities/manager.rs +++ b/matrix_sdk_crypto/src/identities/manager.rs @@ -415,9 +415,10 @@ pub(crate) mod test { let user_id = Arc::new(user_id()); let account = ReadOnlyAccount::new(&user_id, &device_id()); let store: Arc> = Arc::new(Box::new(MemoryStore::new())); - let verification = VerificationMachine::new(account.clone(), identity, store); + let verification = VerificationMachine::new(account.clone(), identity.clone(), store); let store = Store::new( user_id.clone(), + identity, Arc::new(Box::new(MemoryStore::new())), verification, ); diff --git a/matrix_sdk_crypto/src/key_request.rs b/matrix_sdk_crypto/src/key_request.rs index ba98f62e..afb07840 100644 --- a/matrix_sdk_crypto/src/key_request.rs +++ b/matrix_sdk_crypto/src/key_request.rs @@ -721,8 +721,8 @@ mod test { let account = ReadOnlyAccount::new(&user_id, &alice_device_id()); let store: Arc> = Arc::new(Box::new(MemoryStore::new())); let identity = Arc::new(Mutex::new(PrivateCrossSigningIdentity::empty(bob_id()))); - let verification = VerificationMachine::new(account, identity, store.clone()); - let store = Store::new(user_id.clone(), store, verification); + let verification = VerificationMachine::new(account, identity.clone(), store.clone()); + let store = Store::new(user_id.clone(), identity, store, verification); KeyRequestMachine::new( user_id, @@ -739,8 +739,8 @@ mod test { let device = ReadOnlyDevice::from_account(&account).await; let store: Arc> = Arc::new(Box::new(MemoryStore::new())); let identity = Arc::new(Mutex::new(PrivateCrossSigningIdentity::empty(alice_id()))); - let verification = VerificationMachine::new(account, identity, store.clone()); - let store = Store::new(user_id.clone(), store, verification); + let verification = VerificationMachine::new(account, identity.clone(), store.clone()); + let store = Store::new(user_id.clone(), identity, store, verification); store.save_devices(&[device]).await.unwrap(); KeyRequestMachine::new( diff --git a/matrix_sdk_crypto/src/machine.rs b/matrix_sdk_crypto/src/machine.rs index e727e067..28eca41c 100644 --- a/matrix_sdk_crypto/src/machine.rs +++ b/matrix_sdk_crypto/src/machine.rs @@ -147,7 +147,12 @@ impl OlmMachine { let store = Arc::new(store); let verification_machine = VerificationMachine::new(account.clone(), user_identity.clone(), store.clone()); - let store = Store::new(user_id.clone(), store, verification_machine.clone()); + let store = Store::new( + user_id.clone(), + user_identity.clone(), + store, + verification_machine.clone(), + ); let device_id: Arc = Arc::new(device_id); let outbound_group_sessions = Arc::new(DashMap::new()); let users_for_key_claim = Arc::new(DashMap::new()); diff --git a/matrix_sdk_crypto/src/session_manager/sessions.rs b/matrix_sdk_crypto/src/session_manager/sessions.rs index 29af3b6f..8e18dfb7 100644 --- a/matrix_sdk_crypto/src/session_manager/sessions.rs +++ b/matrix_sdk_crypto/src/session_manager/sessions.rs @@ -354,12 +354,13 @@ mod test { let identity = Arc::new(Mutex::new(PrivateCrossSigningIdentity::empty( user_id.clone(), ))); - let verification = VerificationMachine::new(account.clone(), identity, store.clone()); + let verification = + VerificationMachine::new(account.clone(), identity.clone(), store.clone()); let user_id = Arc::new(user_id); let device_id = Arc::new(device_id); - let store = Store::new(user_id.clone(), store, verification); + let store = Store::new(user_id.clone(), identity, store, verification); let account = Account { inner: account, diff --git a/matrix_sdk_crypto/src/store/mod.rs b/matrix_sdk_crypto/src/store/mod.rs index b19e3b07..e5400081 100644 --- a/matrix_sdk_crypto/src/store/mod.rs +++ b/matrix_sdk_crypto/src/store/mod.rs @@ -98,6 +98,7 @@ pub type Result = std::result::Result; #[derive(Debug, Clone)] pub(crate) struct Store { user_id: Arc, + identity: Arc>, inner: Arc>, verification_machine: VerificationMachine, } @@ -130,11 +131,13 @@ pub struct DeviceChanges { impl Store { pub fn new( user_id: Arc, + identity: Arc>, store: Arc>, verification_machine: VerificationMachine, ) -> Self { Self { user_id, + identity, inner: store, verification_machine, }