fix(indexeddb): correctly encode Olm session keys

When we store an Olm session in the database, we encode the sender key and
session ID using the store cipher. That means that we also need to encode them
when we look them up, otherwise we won't find them.
This commit is contained in:
Richard van der Hoff
2023-01-31 15:59:22 +00:00
committed by GitHub
parent b9b00743c9
commit 5dbee7dcdc

View File

@@ -639,13 +639,7 @@ impl IndexeddbCryptoStore {
let account_info = self.get_account_info().ok_or(CryptoStoreError::AccountUnset)?;
if self.session_cache.get(sender_key).is_none() {
let range = sender_key.encode_to_range().map_err(|e| {
IndexeddbCryptoStoreError::DomException {
code: 0,
name: "IdbKeyRangeMakeError".to_owned(),
message: e,
}
})?;
let range = self.encode_to_range(KEYS::SESSION, sender_key)?;
let sessions: Vec<Session> = self
.inner
.transaction_on_one_with_mode(KEYS::SESSION, IdbTransactionMode::Readonly)?