Skip to content

Commit

Permalink
fixup! Remove Olm Session cache from the individual crypto store impl…
Browse files Browse the repository at this point in the history
…ementations
  • Loading branch information
poljar committed Aug 6, 2024
1 parent a1c37fc commit c4703c9
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions crates/matrix-sdk-indexeddb/src/crypto_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ impl IndexeddbCryptoStore {
let serializer = IndexeddbSerializer::new(store_cipher);
debug!("IndexedDbCryptoStore: opening main store {name}");
let db = open_and_upgrade_db(&name, &serializer).await?;
let session_cache = SessionStore::new();

Ok(Self {
name,
Expand Down Expand Up @@ -1744,44 +1743,6 @@ mod tests {
.expect("Can't create store without passphrase"),
}
}

#[async_test]
async fn cache_cleared_after_device_update() {
let store = get_store("cache_cleared_after_device_update", None, true).await;
// Given we created a session and saved it in the store
let (account, session) = cryptostore_integration_tests::get_account_and_session().await;
let sender_key = session.sender_key.to_base64();

store
.save_pending_changes(PendingChanges { account: Some(account.deep_clone()) })
.await
.expect("Can't save account");

let changes = Changes { sessions: vec![session.clone()], ..Default::default() };
store.save_changes(changes).await.unwrap();

store.session_cache.get(&sender_key).expect("We should have a session");

// When we save a new version of our device keys
store
.save_changes(Changes {
devices: DeviceChanges {
new: vec![DeviceData::from_account(&account)],
..Default::default()
},
..Default::default()
})
.await
.unwrap();

// Then the session is no longer in the cache
assert!(
store.session_cache.get(&sender_key).is_none(),
"Session should not be in the cache!"
);
}

cryptostore_integration_tests!();
}

#[cfg(all(test, target_arch = "wasm32"))]
Expand Down

0 comments on commit c4703c9

Please sign in to comment.