diff --git a/matrix_sdk/src/device.rs b/matrix_sdk/src/device.rs index a7958294..f8d3d1b3 100644 --- a/matrix_sdk/src/device.rs +++ b/matrix_sdk/src/device.rs @@ -14,7 +14,7 @@ use std::ops::Deref; -use matrix_sdk_base::{DeviceWrap, ReadOnlyDevice, UserDevicesWrap}; +use matrix_sdk_base::{Device as BaseDevice, ReadOnlyDevice, UserDevicesWrap}; use matrix_sdk_common::{ api::r0::to_device::send_event_to_device::Request as ToDeviceRequest, identifiers::DeviceId, }; @@ -24,7 +24,7 @@ use crate::{error::Result, http_client::HttpClient, Sas}; #[derive(Clone, Debug)] /// A device represents a E2EE capable client of an user. pub struct Device { - pub(crate) inner: DeviceWrap, + pub(crate) inner: BaseDevice, pub(crate) http_client: HttpClient, } diff --git a/matrix_sdk_base/src/client.rs b/matrix_sdk_base/src/client.rs index 655a8d41..5e6de190 100644 --- a/matrix_sdk_base/src/client.rs +++ b/matrix_sdk_base/src/client.rs @@ -53,7 +53,7 @@ use matrix_sdk_common::{ }; #[cfg(feature = "encryption")] use matrix_sdk_crypto::{ - CryptoStore, CryptoStoreError, DeviceWrap, OlmError, OlmMachine, Sas, UserDevicesWrap, + CryptoStore, CryptoStoreError, Device, OlmError, OlmMachine, Sas, UserDevicesWrap, }; use zeroize::Zeroizing; @@ -1904,7 +1904,7 @@ impl BaseClient { /// ``` #[cfg(feature = "encryption")] #[cfg_attr(feature = "docs", doc(cfg(encryption)))] - pub async fn get_device(&self, user_id: &UserId, device_id: &DeviceId) -> Option { + pub async fn get_device(&self, user_id: &UserId, device_id: &DeviceId) -> Option { let olm = self.olm.lock().await; olm.as_ref()?.get_device(user_id, device_id).await } diff --git a/matrix_sdk_base/src/lib.rs b/matrix_sdk_base/src/lib.rs index 90003ca3..2574a761 100644 --- a/matrix_sdk_base/src/lib.rs +++ b/matrix_sdk_base/src/lib.rs @@ -57,7 +57,7 @@ pub use state::{AllRooms, ClientState}; #[cfg(feature = "encryption")] #[cfg_attr(feature = "docs", doc(cfg(encryption)))] pub use matrix_sdk_crypto::{ - CryptoStoreError, DeviceWrap, ReadOnlyDevice, Sas, TrustState, UserDevicesWrap, + CryptoStoreError, Device, ReadOnlyDevice, Sas, TrustState, UserDevicesWrap, }; #[cfg(feature = "messages")] diff --git a/matrix_sdk_crypto/src/device.rs b/matrix_sdk_crypto/src/device.rs index 152e319f..c9aeecea 100644 --- a/matrix_sdk_crypto/src/device.rs +++ b/matrix_sdk_crypto/src/device.rs @@ -54,12 +54,12 @@ pub struct ReadOnlyDevice { #[derive(Debug, Clone)] /// A device represents a E2EE capable client of an user. -pub struct DeviceWrap { +pub struct Device { pub(crate) inner: ReadOnlyDevice, pub(crate) verification_machine: VerificationMachine, } -impl Deref for DeviceWrap { +impl Deref for Device { type Target = ReadOnlyDevice; fn deref(&self) -> &Self::Target { @@ -67,7 +67,7 @@ impl Deref for DeviceWrap { } } -impl DeviceWrap { +impl Device { /// Start a interactive verification with this `Device` /// /// Returns a `Sas` object and to-device request that needs to be sent out. @@ -85,8 +85,8 @@ pub struct UserDevicesWrap { impl UserDevicesWrap { /// Get the specific device with the given device id. - pub fn get(&self, device_id: &DeviceId) -> Option { - self.inner.get(device_id).map(|d| DeviceWrap { + pub fn get(&self, device_id: &DeviceId) -> Option { + self.inner.get(device_id).map(|d| Device { inner: d, verification_machine: self.verification_machine.clone(), }) @@ -98,10 +98,10 @@ impl UserDevicesWrap { } /// Iterator over all the devices of the user devices. - pub fn devices(&self) -> impl Iterator + '_ { + pub fn devices(&self) -> impl Iterator + '_ { let machine = self.verification_machine.clone(); - self.inner.devices().map(move |d| DeviceWrap { + self.inner.devices().map(move |d| Device { inner: d.clone(), verification_machine: machine.clone(), }) diff --git a/matrix_sdk_crypto/src/lib.rs b/matrix_sdk_crypto/src/lib.rs index 17a6cef9..933db0ef 100644 --- a/matrix_sdk_crypto/src/lib.rs +++ b/matrix_sdk_crypto/src/lib.rs @@ -37,7 +37,7 @@ mod store; mod user_identity; mod verification; -pub use device::{DeviceWrap, ReadOnlyDevice, TrustState, UserDevicesWrap}; +pub use device::{Device, ReadOnlyDevice, TrustState, UserDevicesWrap}; pub use error::{MegolmError, OlmError}; pub use machine::{OlmMachine, OneTimeKeys}; pub use memory_stores::{DeviceStore, GroupSessionStore, SessionStore, UserDevices}; diff --git a/matrix_sdk_crypto/src/machine.rs b/matrix_sdk_crypto/src/machine.rs index 9d0a5c47..c6015fdd 100644 --- a/matrix_sdk_crypto/src/machine.rs +++ b/matrix_sdk_crypto/src/machine.rs @@ -53,7 +53,7 @@ use matrix_sdk_common::{ #[cfg(feature = "sqlite_cryptostore")] use super::store::sqlite::SqliteStore; use super::{ - device::{DeviceWrap, ReadOnlyDevice, UserDevicesWrap}, + device::{Device, ReadOnlyDevice, UserDevicesWrap}, error::{EventError, MegolmError, MegolmResult, OlmError, OlmResult}, olm::{ Account, EncryptionSettings, GroupSessionKey, IdentityKeys, InboundGroupSession, @@ -1330,7 +1330,7 @@ impl OlmMachine { /// println!("{:?}", device); /// # }); /// ``` - pub async fn get_device(&self, user_id: &UserId, device_id: &DeviceId) -> Option { + pub async fn get_device(&self, user_id: &UserId, device_id: &DeviceId) -> Option { let device = self .store .get_device(user_id, device_id) @@ -1338,7 +1338,7 @@ impl OlmMachine { .ok() .flatten()?; - Some(DeviceWrap { + Some(Device { inner: device, verification_machine: self.verification_machine.clone(), })