pub struct CryptoKeystore { /* private fields */ }
Implementations§
Source§impl Database
impl Database
pub async fn open( location: ConnectionType<'_>, key: &DatabaseKey, ) -> Result<Database, CryptoKeystoreError>
pub async fn borrow_conn( &self, ) -> Result<MutexGuard<'_, SqlCipherConnection>, CryptoKeystoreError>
pub async fn migrate_db_key_type_to_bytes( name: &str, old_key: &str, new_key: &DatabaseKey, ) -> Result<(), CryptoKeystoreError>
pub async fn update_key( &mut self, new_key: &DatabaseKey, ) -> Result<(), CryptoKeystoreError>
pub async fn wipe(self) -> Result<(), CryptoKeystoreError>
Sourcepub async fn close(self) -> Result<(), CryptoKeystoreError>
pub async fn close(self) -> Result<(), CryptoKeystoreError>
Wait for any running transaction to finish, then close the database connection.
Sourcepub async fn new_transaction(&self) -> Result<(), CryptoKeystoreError>
pub async fn new_transaction(&self) -> Result<(), CryptoKeystoreError>
Waits for the current transaction to be committed or rolled back, then starts a new one.
pub async fn commit_transaction(&self) -> Result<(), CryptoKeystoreError>
pub async fn rollback_transaction(&self) -> Result<(), CryptoKeystoreError>
pub async fn child_groups<E>( &self, entity: E, ) -> Result<Vec<E>, CryptoKeystoreError>
pub async fn save<E>(&self, entity: E) -> Result<E, CryptoKeystoreError>
pub async fn remove<E, S>(&self, id: S) -> Result<(), CryptoKeystoreError>
pub async fn find_pending_messages_by_conversation_id( &self, conversation_id: &[u8], ) -> Result<Vec<MlsPendingMessage>, CryptoKeystoreError>
pub async fn remove_pending_messages_by_conversation_id( &self, conversation_id: &[u8], ) -> Result<(), CryptoKeystoreError>
pub async fn cred_delete_by_credential( &self, cred: Vec<u8>, ) -> Result<(), CryptoKeystoreError>
Trait Implementations§
Source§impl CryptoKeystoreMls for Database
impl CryptoKeystoreMls for Database
Source§fn mls_fetch_keypackages<'life0, 'async_trait, V>(
&'life0 self,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<V>, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
V: 'async_trait + MlsEntity,
Database: 'async_trait,
fn mls_fetch_keypackages<'life0, 'async_trait, V>(
&'life0 self,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<V>, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
V: 'async_trait + MlsEntity,
Database: 'async_trait,
Fetches Keypackages Read more
Source§fn mls_group_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Database: 'async_trait,
fn mls_group_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Database: 'async_trait,
Checks if the given MLS group id exists in the keystore
Note: in case of any error, this will return false Read more
Source§fn mls_group_persist<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
state: &'life2 [u8],
parent_group_id: Option<&'life3 [u8]>,
) -> Pin<Box<dyn Future<Output = Result<(), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Database: 'async_trait,
fn mls_group_persist<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
state: &'life2 [u8],
parent_group_id: Option<&'life3 [u8]>,
) -> Pin<Box<dyn Future<Output = Result<(), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Database: 'async_trait,
Persists a
MlsGroup
Read moreSource§fn mls_groups_restore<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Vec<u8>, (Option<Vec<u8>>, Vec<u8>)>, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Database: 'async_trait,
fn mls_groups_restore<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Vec<u8>, (Option<Vec<u8>>, Vec<u8>)>, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Database: 'async_trait,
Loads
MlsGroups
from the database. It will be returned as a HashMap
where the key is
the group/conversation id and the value the group state Read moreSource§fn mls_group_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Database: 'async_trait,
fn mls_group_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Database: 'async_trait,
Deletes
MlsGroups
from the database. Read moreSource§fn mls_pending_groups_save<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
mls_group: &'life2 [u8],
custom_configuration: &'life3 [u8],
parent_group_id: Option<&'life4 [u8]>,
) -> Pin<Box<dyn Future<Output = Result<(), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Database: 'async_trait,
fn mls_pending_groups_save<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
mls_group: &'life2 [u8],
custom_configuration: &'life3 [u8],
parent_group_id: Option<&'life4 [u8]>,
) -> Pin<Box<dyn Future<Output = Result<(), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Database: 'async_trait,
Saves a
MlsGroup
in a temporary table (typically used in scenarios where the group cannot
be committed until the backend acknowledges it, like external commits) Read moreSource§fn mls_pending_groups_load<'life0, 'life1, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Vec<u8>), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Database: 'async_trait,
fn mls_pending_groups_load<'life0, 'life1, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Vec<u8>), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Database: 'async_trait,
Loads a temporary
MlsGroup
and its configuration from the database Read moreSource§fn mls_pending_groups_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Database: 'async_trait,
fn mls_pending_groups_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
group_id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Database: 'async_trait,
Deletes a temporary
MlsGroup
from the database Read moreSource§fn save_e2ei_enrollment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 [u8],
content: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Database: 'async_trait,
fn save_e2ei_enrollment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 [u8],
content: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Database: 'async_trait,
Persists an enrollment instance Read more
Source§fn pop_e2ei_enrollment<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Database: 'async_trait,
fn pop_e2ei_enrollment<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Database: 'async_trait,
Fetches and delete the enrollment instance Read more
Source§impl CryptoKeystoreProteus for Database
impl CryptoKeystoreProteus for Database
Source§impl FetchFromDatabase for Database
impl FetchFromDatabase for Database
fn find<'life0, 'life1, 'async_trait, E>(
&'life0 self,
id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Option<E>, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
E: 'async_trait + Entity<ConnectionType = SqlCipherConnection>,
Database: 'async_trait,
fn find_unique<'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<U, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
U: 'async_trait + UniqueEntity,
Database: 'async_trait,
fn find_all<'life0, 'async_trait, E>(
&'life0 self,
params: EntityFindParams,
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
E: 'async_trait + Entity<ConnectionType = SqlCipherConnection>,
Database: 'async_trait,
fn find_many<'life0, 'life1, 'async_trait, E>(
&'life0 self,
ids: &'life1 [Vec<u8>],
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
E: 'async_trait + Entity<ConnectionType = SqlCipherConnection>,
Database: 'async_trait,
fn count<'life0, 'async_trait, E>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize, CryptoKeystoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
E: 'async_trait + Entity<ConnectionType = SqlCipherConnection>,
Database: 'async_trait,
Source§impl OpenMlsKeyStore for Database
impl OpenMlsKeyStore for Database
Source§type Error = CryptoKeystoreError
type Error = CryptoKeystoreError
The error type returned by the [
OpenMlsKeyStore
].Source§fn store<'life0, 'life1, 'life2, 'async_trait, V>(
&'life0 self,
k: &'life1 [u8],
v: &'life2 V,
) -> Pin<Box<dyn Future<Output = Result<(), <Database as OpenMlsKeyStore>::Error>> + Send + 'async_trait>>
fn store<'life0, 'life1, 'life2, 'async_trait, V>( &'life0 self, k: &'life1 [u8], v: &'life2 V, ) -> Pin<Box<dyn Future<Output = Result<(), <Database as OpenMlsKeyStore>::Error>> + Send + 'async_trait>>
Source§fn read<'life0, 'life1, 'async_trait, V>(
&'life0 self,
k: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Option<V>> + Send + 'async_trait>>
fn read<'life0, 'life1, 'async_trait, V>( &'life0 self, k: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Option<V>> + Send + 'async_trait>>
Read and return a value stored for ID
k
that implements the
[MlsEntity
] trait for deserialization. Read moreSource§fn delete<'life0, 'life1, 'async_trait, V>(
&'life0 self,
k: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), <Database as OpenMlsKeyStore>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
V: 'async_trait + MlsEntity,
Database: 'async_trait,
fn delete<'life0, 'life1, 'async_trait, V>(
&'life0 self,
k: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), <Database as OpenMlsKeyStore>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
V: 'async_trait + MlsEntity,
Database: 'async_trait,
Delete a value stored for ID
k
. Read moreSource§impl PreKeyStore for Database
impl PreKeyStore for Database
impl Send for Database
impl Sync for Database
Auto Trait Implementations§
impl Freeze for Database
impl !RefUnwindSafe for Database
impl Unpin for Database
impl !UnwindSafe for Database
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more