Struct mls_rs::client::Client

source ·
pub struct Client<C> { /* private fields */ }
Expand description

MLS client used to create key packages and manage groups.

Client::builder can be used to instantiate it.

Clients are able to support multiple protocol versions, ciphersuites and underlying identities used to join groups and generate key packages. Applications may decide to create one or many clients depending on their specific needs.

Implementations§

source§

impl Client<()>

source

pub fn builder() -> ClientBuilder<BaseConfig>

Returns a ClientBuilder used to configure client preferences and providers.

source§

impl<C> Client<C>
where C: ClientConfig + Clone,

source

pub fn to_builder(&self) -> ClientBuilder<MakeConfig<C>>

source

pub fn generate_key_package_message(&self) -> Result<MlsMessage, MlsError>

Creates a new key package message that can be used to to add this client to a Group. Each call to this function will produce a unique value that is signed by signing_identity.

The secret keys for the resulting key package message will be stored in the KeyPackageStorage that was used to configure the client and will automatically be erased when this key package is used to join a group.

§Warning

A key package message may only be used once.

source

pub fn create_group_with_id( &self, group_id: Vec<u8>, group_context_extensions: ExtensionList, ) -> Result<Group<C>, MlsError>

Create a group with a specific group_id.

This function behaves the same way as create_group except that it specifies a specific unique group identifier to be used.

§Warning

It is recommended to use create_group instead of this function because it guarantees that group_id values are globally unique.

source

pub fn create_group( &self, group_context_extensions: ExtensionList, ) -> Result<Group<C>, MlsError>

Create a MLS group.

The cipher_suite provided must be supported by the CipherSuiteProvider that was used to build the client.

source

pub fn join_group( &self, tree_data: Option<ExportedTree<'_>>, welcome_message: &MlsMessage, ) -> Result<(Group<C>, NewMemberInfo), MlsError>

Join a MLS group via a welcome message created by a Commit.

tree_data is required to be provided out of band if the client that created welcome_message did not use the ratchet_tree_extension according to MlsRules::commit_options. at the time the welcome message was created. tree_data can be exported from a group using the export tree function.

source

pub fn commit_external( &self, group_info_msg: MlsMessage, ) -> Result<(Group<C>, MlsMessage), MlsError>

0-RTT add to an existing group

External commits allow for immediate entry into a group, even if all of the group members are currently offline and unable to process messages. Sending an external commit is only allowed for groups that have provided a public group_info_message containing an ExternalPubExt, which can be generated by an existing group member using the group_info_message function.

tree_data may be provided following the same rules as Client::join_group

If PSKs are provided in external_psks, the PreSharedKeyStorage used to configure the client will be searched to resolve their values.

to_remove may be used to remove an existing member provided that the identity of the existing group member at that index is a valid successor of signing_identity as defined by the IdentityProvider that this client was configured with.

§Warning

Only one external commit can be performed against a given group info. There may also be security trade-offs to this approach.

source

pub fn external_commit_builder( &self, ) -> Result<ExternalCommitBuilder<C>, MlsError>

source

pub fn load_group(&self, group_id: &[u8]) -> Result<Group<C>, MlsError>

Load an existing group state into this client using the GroupStateStorage that this client was configured to use.

source

pub fn external_add_proposal( &self, group_info: &MlsMessage, tree_data: Option<ExportedTree<'_>>, authenticated_data: Vec<u8>, ) -> Result<MlsMessage, MlsError>

Request to join an existing group.

An existing group member will need to perform a commit to complete the add and the resulting welcome message can be used by join_group.

source

pub fn signing_identity( &self, ) -> Result<(&SigningIdentity, CipherSuite), MlsError>

source

pub fn key_package_extensions(&self) -> ExtensionList

Returns key package extensions used by this client

source

pub fn key_package_store(&self) -> <C as ClientConfig>::KeyPackageRepository

The KeyPackageStorage that this client was configured to use.

source

pub fn secret_store(&self) -> <C as ClientConfig>::PskStore

The PreSharedKeyStorage that this client was configured to use.

source

pub fn group_state_storage(&self) -> <C as ClientConfig>::GroupStateStorage

The GroupStateStorage that this client was configured to use.

Trait Implementations§

source§

impl<C: Clone> Clone for Client<C>

source§

fn clone(&self) -> Client<C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C: Debug> Debug for Client<C>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C> Freeze for Client<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for Client<C>
where C: RefUnwindSafe,

§

impl<C> Send for Client<C>
where C: Send,

§

impl<C> Sync for Client<C>
where C: Sync,

§

impl<C> Unpin for Client<C>
where C: Unpin,

§

impl<C> UnwindSafe for Client<C>
where C: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.