crypto: Rename the UserDevicesWrap struct.
parent
de097d3ca0
commit
84c0311d80
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use matrix_sdk_base::{Device as BaseDevice, ReadOnlyDevice, UserDevicesWrap};
|
use matrix_sdk_base::{Device as BaseDevice, ReadOnlyDevice, UserDevices as BaseUserDevices};
|
||||||
use matrix_sdk_common::{
|
use matrix_sdk_common::{
|
||||||
api::r0::to_device::send_event_to_device::Request as ToDeviceRequest, identifiers::DeviceId,
|
api::r0::to_device::send_event_to_device::Request as ToDeviceRequest, identifiers::DeviceId,
|
||||||
};
|
};
|
||||||
|
@ -77,7 +77,7 @@ impl Device {
|
||||||
/// A read only view over all devices belonging to a user.
|
/// A read only view over all devices belonging to a user.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct UserDevices {
|
pub struct UserDevices {
|
||||||
pub(crate) inner: UserDevicesWrap,
|
pub(crate) inner: BaseUserDevices,
|
||||||
pub(crate) http_client: HttpClient,
|
pub(crate) http_client: HttpClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ use matrix_sdk_common::{
|
||||||
};
|
};
|
||||||
#[cfg(feature = "encryption")]
|
#[cfg(feature = "encryption")]
|
||||||
use matrix_sdk_crypto::{
|
use matrix_sdk_crypto::{
|
||||||
CryptoStore, CryptoStoreError, Device, OlmError, OlmMachine, Sas, UserDevicesWrap,
|
CryptoStore, CryptoStoreError, Device, OlmError, OlmMachine, Sas, UserDevices,
|
||||||
};
|
};
|
||||||
use zeroize::Zeroizing;
|
use zeroize::Zeroizing;
|
||||||
|
|
||||||
|
@ -1945,7 +1945,7 @@ impl BaseClient {
|
||||||
pub async fn get_user_devices(
|
pub async fn get_user_devices(
|
||||||
&self,
|
&self,
|
||||||
user_id: &UserId,
|
user_id: &UserId,
|
||||||
) -> StdResult<UserDevicesWrap, CryptoStoreError> {
|
) -> StdResult<UserDevices, CryptoStoreError> {
|
||||||
let olm = self.olm.lock().await;
|
let olm = self.olm.lock().await;
|
||||||
|
|
||||||
if let Some(olm) = olm.as_ref() {
|
if let Some(olm) = olm.as_ref() {
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub use state::{AllRooms, ClientState};
|
||||||
#[cfg(feature = "encryption")]
|
#[cfg(feature = "encryption")]
|
||||||
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
|
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
|
||||||
pub use matrix_sdk_crypto::{
|
pub use matrix_sdk_crypto::{
|
||||||
CryptoStoreError, Device, ReadOnlyDevice, Sas, TrustState, UserDevicesWrap,
|
CryptoStoreError, Device, ReadOnlyDevice, Sas, TrustState, UserDevices,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "messages")]
|
#[cfg(feature = "messages")]
|
||||||
|
|
|
@ -78,12 +78,12 @@ impl Device {
|
||||||
|
|
||||||
/// A read only view over all devices belonging to a user.
|
/// A read only view over all devices belonging to a user.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct UserDevicesWrap {
|
pub struct UserDevices {
|
||||||
pub(crate) inner: ReadOnlyUserDevices,
|
pub(crate) inner: ReadOnlyUserDevices,
|
||||||
pub(crate) verification_machine: VerificationMachine,
|
pub(crate) verification_machine: VerificationMachine,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UserDevicesWrap {
|
impl UserDevices {
|
||||||
/// Get the specific device with the given device id.
|
/// Get the specific device with the given device id.
|
||||||
pub fn get(&self, device_id: &DeviceId) -> Option<Device> {
|
pub fn get(&self, device_id: &DeviceId) -> Option<Device> {
|
||||||
self.inner.get(device_id).map(|d| Device {
|
self.inner.get(device_id).map(|d| Device {
|
||||||
|
|
|
@ -37,7 +37,7 @@ mod store;
|
||||||
mod user_identity;
|
mod user_identity;
|
||||||
mod verification;
|
mod verification;
|
||||||
|
|
||||||
pub use device::{Device, ReadOnlyDevice, TrustState, UserDevicesWrap};
|
pub use device::{Device, ReadOnlyDevice, TrustState, UserDevices};
|
||||||
pub use error::{MegolmError, OlmError};
|
pub use error::{MegolmError, OlmError};
|
||||||
pub use machine::{OlmMachine, OneTimeKeys};
|
pub use machine::{OlmMachine, OneTimeKeys};
|
||||||
pub use memory_stores::{DeviceStore, GroupSessionStore, ReadOnlyUserDevices, SessionStore};
|
pub use memory_stores::{DeviceStore, GroupSessionStore, ReadOnlyUserDevices, SessionStore};
|
||||||
|
|
|
@ -53,7 +53,7 @@ use matrix_sdk_common::{
|
||||||
#[cfg(feature = "sqlite_cryptostore")]
|
#[cfg(feature = "sqlite_cryptostore")]
|
||||||
use super::store::sqlite::SqliteStore;
|
use super::store::sqlite::SqliteStore;
|
||||||
use super::{
|
use super::{
|
||||||
device::{Device, ReadOnlyDevice, UserDevicesWrap},
|
device::{Device, ReadOnlyDevice, UserDevices},
|
||||||
error::{EventError, MegolmError, MegolmResult, OlmError, OlmResult},
|
error::{EventError, MegolmError, MegolmResult, OlmError, OlmResult},
|
||||||
olm::{
|
olm::{
|
||||||
Account, EncryptionSettings, GroupSessionKey, IdentityKeys, InboundGroupSession,
|
Account, EncryptionSettings, GroupSessionKey, IdentityKeys, InboundGroupSession,
|
||||||
|
@ -1367,10 +1367,10 @@ impl OlmMachine {
|
||||||
/// }
|
/// }
|
||||||
/// # });
|
/// # });
|
||||||
/// ```
|
/// ```
|
||||||
pub async fn get_user_devices(&self, user_id: &UserId) -> StoreResult<UserDevicesWrap> {
|
pub async fn get_user_devices(&self, user_id: &UserId) -> StoreResult<UserDevices> {
|
||||||
let devices = self.store.get_user_devices(user_id).await?;
|
let devices = self.store.get_user_devices(user_id).await?;
|
||||||
|
|
||||||
Ok(UserDevicesWrap {
|
Ok(UserDevices {
|
||||||
inner: devices,
|
inner: devices,
|
||||||
verification_machine: self.verification_machine.clone(),
|
verification_machine: self.verification_machine.clone(),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue