diff --git a/matrix_sdk_crypto/src/machine.rs b/matrix_sdk_crypto/src/machine.rs index 6bbbce33..5d05dd4a 100644 --- a/matrix_sdk_crypto/src/machine.rs +++ b/matrix_sdk_crypto/src/machine.rs @@ -164,7 +164,7 @@ impl OlmMachine { /// * `device_id` - The unique id of the device that owns this machine. pub async fn new_with_default_store>( user_id: &UserId, - device_id: &str, + device_id: &DeviceId, path: P, passphrase: &str, ) -> StoreResult { diff --git a/matrix_sdk_crypto/src/memory_stores.rs b/matrix_sdk_crypto/src/memory_stores.rs index 7cf6351c..72d91395 100644 --- a/matrix_sdk_crypto/src/memory_stores.rs +++ b/matrix_sdk_crypto/src/memory_stores.rs @@ -140,7 +140,7 @@ pub struct UserDevices { impl UserDevices { /// Get the specific device with the given device id. - pub fn get(&self, device_id: &str) -> Option { + pub fn get(&self, device_id: &DeviceId) -> Option { self.entries.get(device_id).cloned() } @@ -180,7 +180,7 @@ impl DeviceStore { } /// Get the device with the given device_id and belonging to the given user. - pub fn get(&self, user_id: &UserId, device_id: &str) -> Option { + pub fn get(&self, user_id: &UserId, device_id: &DeviceId) -> Option { self.entries .get(user_id) .and_then(|m| m.get(device_id).map(|d| d.value().clone())) @@ -189,7 +189,7 @@ impl DeviceStore { /// Remove the device with the given device_id and belonging to the given user. /// /// Returns the device if it was removed, None if it wasn't in the store. - pub fn remove(&self, user_id: &UserId, device_id: &str) -> Option { + pub fn remove(&self, user_id: &UserId, device_id: &DeviceId) -> Option { self.entries .get(user_id) .and_then(|m| m.remove(device_id)) diff --git a/matrix_sdk_crypto/src/store/sqlite.rs b/matrix_sdk_crypto/src/store/sqlite.rs index 44feb951..5d69e466 100644 --- a/matrix_sdk_crypto/src/store/sqlite.rs +++ b/matrix_sdk_crypto/src/store/sqlite.rs @@ -66,7 +66,7 @@ impl SqliteStore { /// * `path` - The path where the database file should reside in. pub async fn open>( user_id: &UserId, - device_id: &str, + device_id: &DeviceId, path: P, ) -> Result { SqliteStore::open_helper(user_id, device_id, path, None).await @@ -88,7 +88,7 @@ impl SqliteStore { /// the encryption keys. pub async fn open_with_passphrase>( user_id: &UserId, - device_id: &str, + device_id: &DeviceId, path: P, passphrase: &str, ) -> Result { @@ -109,7 +109,7 @@ impl SqliteStore { async fn open_helper>( user_id: &UserId, - device_id: &str, + device_id: &DeviceId, path: P, passphrase: Option>, ) -> Result { @@ -804,7 +804,7 @@ mod test { use super::{Account, CryptoStore, InboundGroupSession, RoomId, Session, SqliteStore, TryFrom}; static USER_ID: &str = "@example:localhost"; - static DEVICE_ID: &str = "DEVICEID"; + static DEVICE_ID: &DeviceId = "DEVICEID"; async fn get_store(passphrase: Option<&str>) -> (SqliteStore, tempfile::TempDir) { let tmpdir = tempdir().unwrap();