Struct core_crypto::prelude::Client
source · pub struct Client { /* private fields */ }
Expand description
Represents a MLS client which in our case is the equivalent of a device. It can be the Android, iOS, web or desktop application which the authenticated user is using. A user has many client, a client has only one user. A client can belong to many MLS groups
Implementations§
source§impl Client
impl Client
sourcepub async fn generate_one_keypackage_from_credential_bundle(
&self,
backend: &MlsCryptoProvider,
cs: MlsCiphersuite,
cb: &CredentialBundle,
) -> CryptoResult<KeyPackage>
pub async fn generate_one_keypackage_from_credential_bundle( &self, backend: &MlsCryptoProvider, cs: MlsCiphersuite, cb: &CredentialBundle, ) -> CryptoResult<KeyPackage>
sourcepub async fn request_key_packages(
&self,
count: usize,
ciphersuite: MlsCiphersuite,
credential_type: MlsCredentialType,
backend: &MlsCryptoProvider,
) -> CryptoResult<Vec<KeyPackage>>
pub async fn request_key_packages( &self, count: usize, ciphersuite: MlsCiphersuite, credential_type: MlsCredentialType, backend: &MlsCryptoProvider, ) -> CryptoResult<Vec<KeyPackage>>
Requests count
keying material to be present and returns
a reference to it for the consumer to copy/clone.
§Arguments
count
- number of openmls::key_packages::KeyPackage to generateciphersuite
- of openmls::key_packages::KeyPackage to generatebackend
- the KeyStorage to load the keypackages from
§Errors
KeyStore and OpenMls errors
sourcepub async fn valid_keypackages_count(
&self,
backend: &MlsCryptoProvider,
ciphersuite: MlsCiphersuite,
credential_type: MlsCredentialType,
) -> CryptoResult<usize>
pub async fn valid_keypackages_count( &self, backend: &MlsCryptoProvider, ciphersuite: MlsCiphersuite, credential_type: MlsCredentialType, ) -> CryptoResult<usize>
Returns the count of valid, non-expired, unclaimed keypackages in store
sourcepub async fn prune_keypackages(
&self,
backend: &MlsCryptoProvider,
refs: &[KeyPackageRef],
) -> CryptoResult<()>
pub async fn prune_keypackages( &self, backend: &MlsCryptoProvider, refs: &[KeyPackageRef], ) -> CryptoResult<()>
Prune the provided KeyPackageRefs from the keystore
Warning: Despite this API being public, the caller should know what they’re doing. Provided KeypackageRefs will be purged regardless of their expiration state, so please be wary of what you are doing if you directly call this API. This could result in still valid, uploaded keypackages being pruned from the system and thus being impossible to find when referenced in a future Welcome message.
source§impl Client
impl Client
sourcepub async fn init(
identifier: ClientIdentifier,
ciphersuites: &[MlsCiphersuite],
backend: &MlsCryptoProvider,
nb_key_package: usize,
) -> CryptoResult<Self>
pub async fn init( identifier: ClientIdentifier, ciphersuites: &[MlsCiphersuite], backend: &MlsCryptoProvider, nb_key_package: usize, ) -> CryptoResult<Self>
Initializes the client. If the client’s cryptographic material is already stored in the keystore, it loads it Otherwise, it is being created.
§Arguments
identifier
- client identifier ; either a ClientId or a x509 certificate chainciphersuites
- all ciphersuites this client is supposed to supportbackend
- the KeyStore and crypto provider to read identities from
§Errors
KeyStore and OpenMls errors can happen
sourcepub async fn generate_raw_keypairs(
ciphersuites: &[MlsCiphersuite],
backend: &MlsCryptoProvider,
) -> CryptoResult<Vec<ClientId>>
pub async fn generate_raw_keypairs( ciphersuites: &[MlsCiphersuite], backend: &MlsCryptoProvider, ) -> CryptoResult<Vec<ClientId>>
Initializes a raw MLS keypair without an associated client ID Returns a random ClientId to bind later in Client::init_with_external_client_id
§Arguments
ciphersuites
- all ciphersuites this client is supposed to supportbackend
- the KeyStore and crypto provider to read identities from
§Errors
KeyStore and OpenMls errors can happen
sourcepub async fn init_with_external_client_id(
client_id: ClientId,
tmp_ids: Vec<ClientId>,
ciphersuites: &[MlsCiphersuite],
backend: &MlsCryptoProvider,
) -> CryptoResult<Self>
pub async fn init_with_external_client_id( client_id: ClientId, tmp_ids: Vec<ClientId>, ciphersuites: &[MlsCiphersuite], backend: &MlsCryptoProvider, ) -> CryptoResult<Self>
Finalizes initialization using a 2-step process of uploading first a public key and then associating a new Client ID to that keypair
§Arguments
client_id
- The client ID you have fetched from the MLS Authentication Servicetmp_ids
- The temporary random client ids generated in the previous step Client::generate_raw_keypairsciphersuites
- To initialize the Client withbackend
- the KeyStore and crypto provider to read identities from
WARNING: You have absolutely NO reason to call this if you didn’t call Client::generate_raw_keypairs first. You have been warned!
sourcepub fn id(&self) -> &ClientId
pub fn id(&self) -> &ClientId
Retrieves the client’s client id. This is free-form and not inspected.
sourcepub fn is_e2ei_capable(&self) -> bool
pub fn is_e2ei_capable(&self) -> bool
Returns whether this client is E2EI capable
Trait Implementations§
impl Eq for Client
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
Read moresource§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>
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>
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