Skip to content

Commit

Permalink
Fix issues after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Anderas committed Mar 10, 2023
1 parent 801428f commit 4b95afe
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bindings/matrix-sdk-crypto-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ mod uniffi_types {
RequestVerificationResult, StartSasResult, Verification, VerificationRequest,
},
BackupKeys, CrossSigningKeyExport, CrossSigningStatus, DecryptedEvent, EncryptionSettings,
RoomKeyCounts,
EventEncryptionAlgorithm, RoomKeyCounts, RoomSettings,
};
}

Expand Down
6 changes: 3 additions & 3 deletions bindings/matrix-sdk-crypto-ffi/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ impl OlmMachine {
/// set_room_only_allow_trusted_devices) methods.
pub fn get_room_settings(
&self,
room_id: &str,
room_id: String,
) -> Result<Option<RoomSettings>, CryptoStoreError> {
let room_id = RoomId::parse(room_id)?;
let settings = self
Expand All @@ -587,7 +587,7 @@ impl OlmMachine {
/// available variants
pub fn set_room_algorithm(
&self,
room_id: &str,
room_id: String,
algorithm: EventEncryptionAlgorithm,
) -> Result<(), CryptoStoreError> {
let room_id = RoomId::parse(room_id)?;
Expand All @@ -614,7 +614,7 @@ impl OlmMachine {
/// set_only_allow_trusted_devices) method.
pub fn set_room_only_allow_trusted_devices(
&self,
room_id: &str,
room_id: String,
only_allow_trusted_devices: bool,
) -> Result<(), CryptoStoreError> {
let room_id = RoomId::parse(room_id)?;
Expand Down
5 changes: 5 additions & 0 deletions bindings/matrix-sdk-crypto-ffi/src/olm.udl
Original file line number Diff line number Diff line change
Expand Up @@ -467,3 +467,8 @@ dictionary PickledInboundGroupSession {
boolean imported;
boolean backed_up;
};

dictionary RoomSettings {
EventEncryptionAlgorithm algorithm;
boolean only_allow_trusted_devices;
};
5 changes: 4 additions & 1 deletion crates/matrix-sdk-crypto/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,10 @@ impl Store {
///
/// Any users not already on the list are flagged as awaiting a key query.
/// Users that were already in the list are unaffected.
pub(crate) async fn update_tracked_users(&self, users: impl Iterator<Item = &UserId>) -> Result<()> {
pub(crate) async fn update_tracked_users(
&self,
users: impl Iterator<Item = &UserId>,
) -> Result<()> {
self.load_tracked_users().await?;

let mut store_updates = Vec::new();
Expand Down
19 changes: 9 additions & 10 deletions crates/matrix-sdk-indexeddb/src/crypto_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ impl IndexeddbCryptoStore {
db.create_object_store(keys::SECRET_REQUESTS_BY_INFO)?;

db.create_object_store(keys::BACKUP_KEYS)?;

} else if old_version < 1.1 {
// We changed how we store inbound group sessions, the key used to
// be a trippled of `(room_id, sender_key, session_id)` now it's a
Expand Down Expand Up @@ -550,10 +549,10 @@ impl_crypto_store! {
}

if !room_settings_changes.is_empty() {
let settings_store = tx.object_store(KEYS::ROOM_SETTINGS)?;
let settings_store = tx.object_store(keys::ROOM_SETTINGS)?;

for (room_id, settings) in &room_settings_changes {
let key = self.encode_key(KEYS::ROOM_SETTINGS, room_id);
let key = self.encode_key(keys::ROOM_SETTINGS, room_id);
let value = self.serialize_value(&settings)?;
settings_store.put_key_val(&key, &value)?;
}
Expand Down Expand Up @@ -973,11 +972,11 @@ impl_crypto_store! {
}

async fn get_room_settings(&self, room_id: &RoomId) -> Result<Option<RoomSettings>> {
let key = self.encode_key(KEYS::ROOM_SETTINGS, room_id);
let key = self.encode_key(keys::ROOM_SETTINGS, room_id);
Ok(self
.inner
.transaction_on_one_with_mode(KEYS::ROOM_SETTINGS, IdbTransactionMode::Readonly)?
.object_store(KEYS::ROOM_SETTINGS)?
.transaction_on_one_with_mode(keys::ROOM_SETTINGS, IdbTransactionMode::Readonly)?
.object_store(keys::ROOM_SETTINGS)?
.get(&key)?
.await?
.map(|v| self.deserialize_value(v))
Expand All @@ -987,8 +986,8 @@ impl_crypto_store! {
async fn get_custom_value(&self, key: &str) -> Result<Option<Vec<u8>>> {
Ok(self
.inner
.transaction_on_one_with_mode(KEYS::CORE, IdbTransactionMode::Readonly)?
.object_store(KEYS::CORE)?
.transaction_on_one_with_mode(keys::CORE, IdbTransactionMode::Readonly)?
.object_store(keys::CORE)?
.get(&JsValue::from_str(key))?
.await?
.map(|v| self.deserialize_value(v))
Expand All @@ -998,8 +997,8 @@ impl_crypto_store! {
async fn set_custom_value(&self, key: &str, value: Vec<u8>) -> Result<()> {
self
.inner
.transaction_on_one_with_mode(KEYS::CORE, IdbTransactionMode::Readwrite)?
.object_store(KEYS::CORE)?
.transaction_on_one_with_mode(keys::CORE, IdbTransactionMode::Readwrite)?
.object_store(keys::CORE)?
.put_key_val(&JsValue::from_str(key), &self.serialize_value(&value)?)?;
Ok(())
}
Expand Down

0 comments on commit 4b95afe

Please sign in to comment.