Struct matrix_sdk_crypto::store::Store
source · [−]pub struct Store { /* private fields */ }
Expand description
A wrapper for our CryptoStore trait object.
This is needed because we want to have a generic interface so we can store/restore objects that we can serialize. Since trait objects and generics don’t mix let the CryptoStore store strings and this wrapper adds the generic interface on top.
Implementations
sourceimpl Store
impl Store
sourcepub fn new(
user_id: Arc<UserId>,
identity: Arc<Mutex<PrivateCrossSigningIdentity>>,
store: Arc<dyn CryptoStore>,
verification_machine: VerificationMachine
) -> Self
pub fn new(
user_id: Arc<UserId>,
identity: Arc<Mutex<PrivateCrossSigningIdentity>>,
store: Arc<dyn CryptoStore>,
verification_machine: VerificationMachine
) -> Self
Create a new Store
sourcepub fn account(&self) -> &ReadOnlyAccount
pub fn account(&self) -> &ReadOnlyAccount
The Account associated with this store
sourcepub fn private_identity(&self) -> Arc<Mutex<PrivateCrossSigningIdentity>>
pub fn private_identity(&self) -> Arc<Mutex<PrivateCrossSigningIdentity>>
PrivateCrossSigningIdentity associated with this store
sourcepub async fn save_sessions(&self, sessions: &[Session]) -> Result<()>
pub async fn save_sessions(&self, sessions: &[Session]) -> Result<()>
Save the given Sessions to the store
sourcepub async fn device_display_name(
&self
) -> Result<Option<String>, CryptoStoreError>
pub async fn device_display_name(
&self
) -> Result<Option<String>, CryptoStoreError>
Get the display name of our own device.
sourcepub async fn get_readonly_device(
&self,
user_id: &UserId,
device_id: &DeviceId
) -> Result<Option<ReadOnlyDevice>>
pub async fn get_readonly_device(
&self,
user_id: &UserId,
device_id: &DeviceId
) -> Result<Option<ReadOnlyDevice>>
Get the read-only device associated with device_id
for user_id
sourcepub async fn get_readonly_devices_filtered(
&self,
user_id: &UserId
) -> Result<HashMap<OwnedDeviceId, ReadOnlyDevice>>
pub async fn get_readonly_devices_filtered(
&self,
user_id: &UserId
) -> Result<HashMap<OwnedDeviceId, ReadOnlyDevice>>
Get the read-only version of all the devices that the given user has.
Note: This doesn’t return our own device.
sourcepub async fn get_readonly_devices_unfiltered(
&self,
user_id: &UserId
) -> Result<HashMap<OwnedDeviceId, ReadOnlyDevice>>
pub async fn get_readonly_devices_unfiltered(
&self,
user_id: &UserId
) -> Result<HashMap<OwnedDeviceId, ReadOnlyDevice>>
Get the read-only version of all the devices that the given user has.
Note: This does also return our own device.
sourcepub async fn get_device_from_curve_key(
&self,
user_id: &UserId,
curve_key: &str
) -> Result<Option<Device>>
pub async fn get_device_from_curve_key(
&self,
user_id: &UserId,
curve_key: &str
) -> Result<Option<Device>>
Get a device for the given user with the given curve25519 key.
Note: This doesn’t return our own device.
sourcepub async fn get_user_devices_filtered(
&self,
user_id: &UserId
) -> Result<UserDevices>
pub async fn get_user_devices_filtered(
&self,
user_id: &UserId
) -> Result<UserDevices>
Get all devices associated with the given user_id
Note: This doesn’t return our own device.
sourcepub async fn get_user_devices(&self, user_id: &UserId) -> Result<UserDevices>
pub async fn get_user_devices(&self, user_id: &UserId) -> Result<UserDevices>
Get all devices associated with the given user_id
Note: This does also return our own device.
sourcepub async fn get_device(
&self,
user_id: &UserId,
device_id: &DeviceId
) -> Result<Option<Device>>
pub async fn get_device(
&self,
user_id: &UserId,
device_id: &DeviceId
) -> Result<Option<Device>>
Get a Device copy associated with device_id
for user_id
sourcepub async fn get_identity(
&self,
user_id: &UserId
) -> Result<Option<UserIdentities>>
pub async fn get_identity(
&self,
user_id: &UserId
) -> Result<Option<UserIdentities>>
Get the Identity of user_id
sourcepub async fn export_secret(&self, secret_name: &SecretName) -> Option<String>
pub async fn export_secret(&self, secret_name: &SecretName) -> Option<String>
Try to export the secret with the given secret name.
The exported secret will be encoded as unpadded base64. Returns Null
if the secret can’t be found.
Arguments
secret_name
- The name of the secret that should be exported.
sourcepub async fn import_cross_signing_keys(
&self,
export: CrossSigningKeyExport
) -> Result<CrossSigningStatus, SecretImportError>
pub async fn import_cross_signing_keys(
&self,
export: CrossSigningKeyExport
) -> Result<CrossSigningStatus, SecretImportError>
Import the Cross Signing Keys
sourcepub async fn import_secret(
&self,
secret_name: &SecretName,
secret: String
) -> Result<(), SecretImportError>
pub async fn import_secret(
&self,
secret_name: &SecretName,
secret: String
) -> Result<(), SecretImportError>
Import the given secret
named secret_name
into the keystore.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl !UnwindSafe for Store
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more