crypto: Hold on to the private identity in the store.
parent
cb95f576a5
commit
34bec59389
|
@ -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<Box<dyn CryptoStore>> = 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,
|
||||
);
|
||||
|
|
|
@ -721,8 +721,8 @@ mod test {
|
|||
let account = ReadOnlyAccount::new(&user_id, &alice_device_id());
|
||||
let store: Arc<Box<dyn CryptoStore>> = 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<Box<dyn CryptoStore>> = 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(
|
||||
|
|
|
@ -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<DeviceIdBox> = Arc::new(device_id);
|
||||
let outbound_group_sessions = Arc::new(DashMap::new());
|
||||
let users_for_key_claim = Arc::new(DashMap::new());
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -98,6 +98,7 @@ pub type Result<T> = std::result::Result<T, CryptoStoreError>;
|
|||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct Store {
|
||||
user_id: Arc<UserId>,
|
||||
identity: Arc<Mutex<PrivateCrossSigningIdentity>>,
|
||||
inner: Arc<Box<dyn CryptoStore>>,
|
||||
verification_machine: VerificationMachine,
|
||||
}
|
||||
|
@ -130,11 +131,13 @@ pub struct DeviceChanges {
|
|||
impl Store {
|
||||
pub fn new(
|
||||
user_id: Arc<UserId>,
|
||||
identity: Arc<Mutex<PrivateCrossSigningIdentity>>,
|
||||
store: Arc<Box<dyn CryptoStore>>,
|
||||
verification_machine: VerificationMachine,
|
||||
) -> Self {
|
||||
Self {
|
||||
user_id,
|
||||
identity,
|
||||
inner: store,
|
||||
verification_machine,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue