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<()>
impl Client<()>
sourcepub fn builder() -> ClientBuilder<BaseConfig>
pub fn builder() -> ClientBuilder<BaseConfig>
Returns a ClientBuilder
used to configure client preferences and providers.
source§impl<C> Client<C>where
C: ClientConfig + Clone,
impl<C> Client<C>where
C: ClientConfig + Clone,
pub fn to_builder(&self) -> ClientBuilder<MakeConfig<C>>
sourcepub fn generate_key_package_message(&self) -> Result<MlsMessage, MlsError>
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.
sourcepub fn create_group_with_id(
&self,
group_id: Vec<u8>,
group_context_extensions: ExtensionList,
) -> Result<Group<C>, MlsError>
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.
sourcepub fn create_group(
&self,
group_context_extensions: ExtensionList,
) -> Result<Group<C>, MlsError>
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.
sourcepub fn join_group(
&self,
tree_data: Option<ExportedTree<'_>>,
welcome_message: &MlsMessage,
) -> Result<(Group<C>, NewMemberInfo), MlsError>
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.
sourcepub fn examine_welcome_message(
&self,
welcome_message: &MlsMessage,
) -> Result<GroupInfo, MlsError>
pub fn examine_welcome_message( &self, welcome_message: &MlsMessage, ) -> Result<GroupInfo, MlsError>
Decrypt GroupInfo encrypted in the Welcome message without actually joining the group. The ratchet tree is not needed.
sourcepub fn validate_group_info(
&self,
group_info_message: &MlsMessage,
signer: &SigningIdentity,
) -> Result<(), MlsError>
pub fn validate_group_info( &self, group_info_message: &MlsMessage, signer: &SigningIdentity, ) -> Result<(), MlsError>
Validate GroupInfo message. This does NOT validate the ratchet tree in case it is provided in the extension. It validates the signature, identity of the signer, identities of external senders and cipher suite.
sourcepub fn commit_external(
&self,
group_info_msg: MlsMessage,
) -> Result<(Group<C>, MlsMessage), MlsError>
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.
pub fn external_commit_builder( &self, ) -> Result<ExternalCommitBuilder<C>, MlsError>
sourcepub fn load_group(&self, group_id: &[u8]) -> Result<Group<C>, MlsError>
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.
sourcepub fn external_add_proposal(
&self,
group_info: &MlsMessage,
tree_data: Option<ExportedTree<'_>>,
authenticated_data: Vec<u8>,
) -> Result<MlsMessage, MlsError>
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.
pub fn signing_identity( &self, ) -> Result<(&SigningIdentity, CipherSuite), MlsError>
sourcepub fn key_package_extensions(&self) -> ExtensionList
pub fn key_package_extensions(&self) -> ExtensionList
Returns key package extensions used by this client
sourcepub fn key_package_store(&self) -> <C as ClientConfig>::KeyPackageRepository
pub fn key_package_store(&self) -> <C as ClientConfig>::KeyPackageRepository
The KeyPackageStorage that this client was configured to use.
sourcepub fn secret_store(&self) -> <C as ClientConfig>::PskStore
pub fn secret_store(&self) -> <C as ClientConfig>::PskStore
The PreSharedKeyStorage that this client was configured to use.
sourcepub fn group_state_storage(&self) -> <C as ClientConfig>::GroupStateStorage
pub fn group_state_storage(&self) -> <C as ClientConfig>::GroupStateStorage
The GroupStateStorage that this client was configured to use.
sourcepub fn identity_provider(&self) -> <C as ClientConfig>::IdentityProvider
pub fn identity_provider(&self) -> <C as ClientConfig>::IdentityProvider
The IdentityProvider that this client was configured to use.
Trait Implementations§
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> 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
)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>
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