Struct MlsGroup
pub struct MlsGroup { /* private fields */ }Expand description
A MlsGroup represents an MLS group with a high-level API. The API exposes
high level functions to manage a group by adding/removing members, get the
current member list, etc.
The API is modeled such that it can serve as a direct interface to the
Delivery Service. Functions that modify the public state of the group will
return a Vec<MLSMessageOut> that can be sent to the Delivery Service
directly. Conversely, incoming messages from the Delivery Service can be fed
into process_message().
An MlsGroup has an internal queue of pending proposals that builds up as
new messages are processed. When creating proposals, those messages are not
automatically appended to this queue, instead they have to be processed
again through process_message(). This
allows the Delivery Service to reject them (e.g. if they reference the wrong
epoch).
If incoming messages or applied operations are semantically or syntactically incorrect, an error event will be returned with a corresponding error message and the state of the group will remain unchanged.
An MlsGroup has an internal state variable determining if it is active or
inactive, as well as if it has a pending commit. See MlsGroupState for
more information.
Implementations§
§impl MlsGroup
impl MlsGroup
pub fn create_message<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
message: &[u8],
) -> Result<MlsMessageOut, CreateMessageError>where
Provider: OpenMlsProvider,
pub fn create_message<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
message: &[u8],
) -> Result<MlsMessageOut, CreateMessageError>where
Provider: OpenMlsProvider,
Creates an application message.
Returns CreateMessageError::MlsGroupStateError::UseAfterEviction
if the member is no longer part of the group.
Returns CreateMessageError::MlsGroupStateError::PendingProposal if pending proposals
exist. In that case .process_pending_proposals() must be called first
and incoming messages from the DS must be processed afterwards.
§impl MlsGroup
impl MlsGroup
pub fn export_secret<CryptoProvider>(
&self,
crypto: &CryptoProvider,
label: &str,
context: &[u8],
key_length: usize,
) -> Result<Vec<u8>, ExportSecretError>where
CryptoProvider: OpenMlsCrypto,
pub fn export_secret<CryptoProvider>(
&self,
crypto: &CryptoProvider,
label: &str,
context: &[u8],
key_length: usize,
) -> Result<Vec<u8>, ExportSecretError>where
CryptoProvider: OpenMlsCrypto,
Exports a secret from the current epoch.
Returns ExportSecretError::KeyLengthTooLong if the requested
key length is too long.
Returns ExportSecretError::GroupStateError(MlsGroupStateError::UseAfterEviction)
if the group is not active.
pub fn epoch_authenticator(&self) -> &EpochAuthenticator
pub fn epoch_authenticator(&self) -> &EpochAuthenticator
Returns the epoch authenticator of the current epoch.
pub fn resumption_psk_secret(&self) -> &ResumptionPskSecret
pub fn resumption_psk_secret(&self) -> &ResumptionPskSecret
Returns the resumption PSK secret of the current epoch.
pub fn get_past_resumption_psk(
&self,
epoch: GroupEpoch,
) -> Option<&ResumptionPskSecret>
pub fn get_past_resumption_psk( &self, epoch: GroupEpoch, ) -> Option<&ResumptionPskSecret>
Returns a resumption psk for a given epoch. If no resumption psk
is available for that epoch, None is returned.
pub fn export_group_info<CryptoProvider>(
&self,
crypto: &CryptoProvider,
signer: &impl Signer,
with_ratchet_tree: bool,
) -> Result<MlsMessageOut, ExportGroupInfoError>where
CryptoProvider: OpenMlsCrypto,
pub fn export_group_info<CryptoProvider>(
&self,
crypto: &CryptoProvider,
signer: &impl Signer,
with_ratchet_tree: bool,
) -> Result<MlsMessageOut, ExportGroupInfoError>where
CryptoProvider: OpenMlsCrypto,
Export a group info object for this group.
§impl MlsGroup
impl MlsGroup
pub fn self_update<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
leaf_node_parameters: LeafNodeParameters,
) -> Result<CommitMessageBundle, SelfUpdateError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn self_update<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
leaf_node_parameters: LeafNodeParameters,
) -> Result<CommitMessageBundle, SelfUpdateError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Updates the own leaf node. The application can choose to update the
credential, the capabilities, and the extensions by buliding the
LeafNodeParameters.
If successful, it returns a tuple of MlsMessageOut (containing the
commit), an optional MlsMessageOut (containing the Welcome) and
the GroupInfo. The Welcome is Some when the queue of pending
proposals contained add proposals The GroupInfo is Some if the group
has the use_ratchet_tree_extension flag set.
Returns an error if there is a pending commit.
pub fn self_update_with_new_signer<Provider, S>(
&mut self,
provider: &Provider,
old_signer: &impl Signer,
new_signer: NewSignerBundle<'_, S>,
leaf_node_parameters: LeafNodeParameters,
) -> Result<CommitMessageBundle, SelfUpdateError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
S: Signer,
pub fn self_update_with_new_signer<Provider, S>(
&mut self,
provider: &Provider,
old_signer: &impl Signer,
new_signer: NewSignerBundle<'_, S>,
leaf_node_parameters: LeafNodeParameters,
) -> Result<CommitMessageBundle, SelfUpdateError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
S: Signer,
Updates the own leaf node. The application can choose to update the
credential, the capabilities, and the extensions by buliding the
LeafNodeParameters.
In contrast to self_update, this function allows updating the
signature public key in the senders leaf node. Note that new_signer
MUST be the private key corresponding to the public key set in the
leaf_node_parameters.
If successful, it returns a tuple of MlsMessageOut (containing the
commit), an optional MlsMessageOut (containing the Welcome) and
the GroupInfo. The Welcome is Some when the queue of pending
proposals contained add proposals The GroupInfo is Some if the group
has the use_ratchet_tree_extension flag set.
Returns an error if there is a pending commit.
pub fn propose_self_update<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
leaf_node_parameters: LeafNodeParameters,
) -> Result<(MlsMessageOut, HashReference), ProposeSelfUpdateError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_self_update<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
leaf_node_parameters: LeafNodeParameters,
) -> Result<(MlsMessageOut, HashReference), ProposeSelfUpdateError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates a proposal to update the own leaf node. The application can
choose to update the credential, the capabilities, and the extensions by
building the LeafNodeParameters.
§impl MlsGroup
impl MlsGroup
pub fn external_commit_builder() -> ExternalCommitBuilder
pub fn external_commit_builder() -> ExternalCommitBuilder
Creates a new ExternalCommitBuilder to build an external commit.
§impl MlsGroup
impl MlsGroup
pub fn commit_builder(&mut self) -> CommitBuilder<'_, Initial>
pub fn commit_builder(&mut self) -> CommitBuilder<'_, Initial>
Returns a builder for commits.
§impl MlsGroup
impl MlsGroup
pub fn builder() -> MlsGroupBuilder
pub fn builder() -> MlsGroupBuilder
Creates a builder which can be used to configure and build
a new MlsGroup.
pub fn new<Provider>(
provider: &Provider,
signer: &impl Signer,
mls_group_create_config: &MlsGroupCreateConfig,
credential_with_key: CredentialWithKey,
) -> Result<MlsGroup, NewGroupError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn new<Provider>(
provider: &Provider,
signer: &impl Signer,
mls_group_create_config: &MlsGroupCreateConfig,
credential_with_key: CredentialWithKey,
) -> Result<MlsGroup, NewGroupError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates a new group with the creator as the only member (and a random group ID).
This function removes the private key corresponding to the
key_package from the key store.
pub fn new_with_group_id<Provider>(
provider: &Provider,
signer: &impl Signer,
mls_group_create_config: &MlsGroupCreateConfig,
group_id: GroupId,
credential_with_key: CredentialWithKey,
) -> Result<MlsGroup, NewGroupError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn new_with_group_id<Provider>(
provider: &Provider,
signer: &impl Signer,
mls_group_create_config: &MlsGroupCreateConfig,
group_id: GroupId,
credential_with_key: CredentialWithKey,
) -> Result<MlsGroup, NewGroupError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates a new group with a given group ID with the creator as the only member.
pub fn join_by_external_commit<Provider>(
provider: &Provider,
signer: &impl Signer,
ratchet_tree: Option<RatchetTreeIn>,
verifiable_group_info: VerifiableGroupInfo,
mls_group_config: &MlsGroupJoinConfig,
capabilities: Option<Capabilities>,
extensions: Option<Extensions>,
aad: &[u8],
credential_with_key: CredentialWithKey,
) -> Result<(MlsGroup, MlsMessageOut, Option<GroupInfo>), ExternalCommitError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
👎Deprecated since 0.7.1: Use the MlsGroup::external_commit_builder instead.
pub fn join_by_external_commit<Provider>(
provider: &Provider,
signer: &impl Signer,
ratchet_tree: Option<RatchetTreeIn>,
verifiable_group_info: VerifiableGroupInfo,
mls_group_config: &MlsGroupJoinConfig,
capabilities: Option<Capabilities>,
extensions: Option<Extensions>,
aad: &[u8],
credential_with_key: CredentialWithKey,
) -> Result<(MlsGroup, MlsMessageOut, Option<GroupInfo>), ExternalCommitError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
MlsGroup::external_commit_builder instead.Join an existing group through an External Commit.
The resulting MlsGroup instance starts off with a pending
commit (the external commit, which adds this client to the group).
Merging this commit is necessary for this MlsGroup instance to
function properly, as, for example, this client is not yet part of the
tree. As a result, it is not possible to clear the pending commit. If
the external commit was rejected due to an epoch change, the
MlsGroup instance has to be discarded and a new one has to be
created using this function based on the latest ratchet_tree and
group info. For more information on the external init process,
please see Section 11.2.1 in the MLS specification.
Note: If there is a group member in the group with the same identity as us, this will create a remove proposal.
§impl MlsGroup
impl MlsGroup
pub fn update_group_membership<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
key_packages_to_add: &[KeyPackage],
leaf_nodes_to_remove: &[LeafNodeIndex],
new_extensions: Extensions,
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), UpdateGroupMembershipError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn update_group_membership<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
key_packages_to_add: &[KeyPackage],
leaf_nodes_to_remove: &[LeafNodeIndex],
new_extensions: Extensions,
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), UpdateGroupMembershipError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Updates the group membership using only inline proposals. Adds and removes members and updates the group context.
pub fn add_members<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
key_packages: &[KeyPackage],
) -> Result<(MlsMessageOut, MlsMessageOut, Option<GroupInfo>), AddMembersError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn add_members<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
key_packages: &[KeyPackage],
) -> Result<(MlsMessageOut, MlsMessageOut, Option<GroupInfo>), AddMembersError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Adds members to the group.
New members are added by providing a KeyPackage for each member.
This operation results in a Commit with a path, i.e. it includes an
update of the committer’s leaf KeyPackage. To add members without
forcing an update of the committer’s leaf KeyPackage, use
Self::add_members_without_update().
If successful, it returns a triple of MlsMessageOuts, where the first
contains the commit, the second one the Welcome and the third an optional GroupInfo that
will be Some if the group has the use_ratchet_tree_extension flag set.
Returns an error if there is a pending commit.
pub fn swap_members<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
members: &[LeafNodeIndex],
key_packages: &[KeyPackage],
) -> Result<WelcomeCommitMessages, SwapMembersError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn swap_members<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
members: &[LeafNodeIndex],
key_packages: &[KeyPackage],
) -> Result<WelcomeCommitMessages, SwapMembersError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Swap members.
This function replaces a set of members of the group with new members.
The members-to-be-replaced are identified by their index, and the new
members are identified by the provided key_packages.
This function can be used in scenarios where members are no
longer in sync with the rest of the group and need to be re-added.
Note however that this function does not enforce that the
removed members and new members in the key_packages correspond.
pub fn add_members_without_update<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
key_packages: &[KeyPackage],
) -> Result<(MlsMessageOut, MlsMessageOut, Option<GroupInfo>), AddMembersError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn add_members_without_update<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
key_packages: &[KeyPackage],
) -> Result<(MlsMessageOut, MlsMessageOut, Option<GroupInfo>), AddMembersError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Adds members to the group.
New members are added by providing a KeyPackage for each member.
This operation results in a Commit that does not necessarily include a
path, i.e. an update of the committer’s leaf KeyPackage. In
particular, it will only include a path if the group’s proposal store
includes one or more proposals that require a path (see Section 17.4 of
RFC 9420 for
a list of proposals and whether they require a path).
If successful, it returns a triple of MlsMessageOuts, where the
first contains the commit, the second one the Welcome and the third
an optional GroupInfo that will be Some if the group has the
use_ratchet_tree_extension flag set.
Returns an error if there is a pending commit.
pub fn remove_members<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
members: &[LeafNodeIndex],
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), RemoveMembersError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn remove_members<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
members: &[LeafNodeIndex],
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), RemoveMembersError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Removes members from the group.
Members are removed by providing the member’s leaf index.
If successful, it returns a tuple of MlsMessageOut (containing the
commit), an optional MlsMessageOut (containing the Welcome) and the current
GroupInfo.
The Welcome is Some when the queue of pending proposals contained
add proposals
The GroupInfo is Some if the group has the use_ratchet_tree_extension flag set.
Returns an error if there is a pending commit.
pub fn leave_group<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
) -> Result<MlsMessageOut, LeaveGroupError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn leave_group<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
) -> Result<MlsMessageOut, LeaveGroupError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Leave the group.
Creates a Remove Proposal that needs to be covered by a Commit from a different member.
The Remove Proposal is returned as a MlsMessageOut.
Returns an error if there is a pending commit.
pub fn leave_group_via_self_remove<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
) -> Result<MlsMessageOut, LeaveGroupError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn leave_group_via_self_remove<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
) -> Result<MlsMessageOut, LeaveGroupError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Leave the group via a SelfRemove proposal.
Creates a SelfRemove Proposal that needs to be covered by a Commit from
a different member. The SelfRemove Proposal is returned as a
MlsMessageOut.
Since SelfRemove proposals are always sent as PublicMessages, this
function can only be used if the group’s WireFormatPolicy allows for
it.
Returns an error if there is a pending commit.
pub fn member_leaf_index(
&self,
credential: &Credential,
) -> Option<LeafNodeIndex>
pub fn member_leaf_index( &self, credential: &Credential, ) -> Option<LeafNodeIndex>
Returns the LeafNodeIndex of a member corresponding to the given
credential. Returns None if the member can not be found in this group.
pub fn member(&self, leaf_index: LeafNodeIndex) -> Option<&Credential>
pub fn member(&self, leaf_index: LeafNodeIndex) -> Option<&Credential>
Returns the Credential of a member corresponding to the given
leaf index. Returns None if the member can not be found in this group.
pub fn member_at(&self, leaf_index: LeafNodeIndex) -> Option<Member>
pub fn member_at(&self, leaf_index: LeafNodeIndex) -> Option<Member>
Returns the Member corresponding to the given
leaf index. Returns None if the member can not be found in this group.
§impl MlsGroup
impl MlsGroup
pub fn process_message<Provider>(
&mut self,
provider: &Provider,
message: impl Into<ProtocolMessage>,
) -> Result<ProcessedMessage, ProcessMessageError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn process_message<Provider>(
&mut self,
provider: &Provider,
message: impl Into<ProtocolMessage>,
) -> Result<ProcessedMessage, ProcessMessageError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Parses incoming messages from the DS. Checks for syntactic errors and makes some semantic checks as well. If the input is an encrypted message, it will be decrypted. This processing function does syntactic and semantic validation of the message. It returns a ProcessedMessage enum.
§Errors:
Returns an ProcessMessageError when the validation checks fail
with the exact reason of the failure.
pub fn store_pending_proposal<Storage>(
&mut self,
storage: &Storage,
proposal: QueuedProposal,
) -> Result<(), <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
pub fn store_pending_proposal<Storage>(
&mut self,
storage: &Storage,
proposal: QueuedProposal,
) -> Result<(), <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
Stores a standalone proposal in the internal ProposalStore
pub fn has_pending_proposals(&self) -> bool
pub fn has_pending_proposals(&self) -> bool
Returns true if there are pending proposals queued in the proposal store.
pub fn commit_to_pending_proposals<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), CommitToPendingProposalsError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn commit_to_pending_proposals<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), CommitToPendingProposalsError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates a Commit message that covers the pending proposals that are currently stored in the group’s ProposalStore. The Commit message is created even if there are no valid pending proposals.
Returns an error if there is a pending commit. Otherwise it returns a
tuple of Commit, Option<Welcome>, Option<GroupInfo>, where Commit
and Welcome are MlsMessages of the type MlsMessageOut.
pub fn merge_staged_commit<Provider>(
&mut self,
provider: &Provider,
staged_commit: StagedCommit,
) -> Result<(), MergeCommitError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn merge_staged_commit<Provider>(
&mut self,
provider: &Provider,
staged_commit: StagedCommit,
) -> Result<(), MergeCommitError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Merge a StagedCommit into the group after inspection. As this advances the epoch of the group, it also clears any pending commits.
pub fn merge_pending_commit<Provider>(
&mut self,
provider: &Provider,
) -> Result<(), MergePendingCommitError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn merge_pending_commit<Provider>(
&mut self,
provider: &Provider,
) -> Result<(), MergePendingCommitError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Merges the pending StagedCommit if there is one, and
clears the field by setting it to None.
§impl MlsGroup
impl MlsGroup
pub fn propose_add_member_by_value<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: KeyPackage,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_add_member_by_value<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: KeyPackage,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates proposals to add an external PSK to the key schedule.
Returns an error if there is a pending commit.
pub fn propose_remove_member_by_value<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: LeafNodeIndex,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_remove_member_by_value<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: LeafNodeIndex,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates proposals to add an external PSK to the key schedule.
Returns an error if there is a pending commit.
pub fn propose_external_psk<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: PreSharedKeyId,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_external_psk<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: PreSharedKeyId,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates proposals to add an external PSK to the key schedule.
Returns an error if there is a pending commit.
pub fn propose_external_psk_by_value<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: PreSharedKeyId,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_external_psk_by_value<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: PreSharedKeyId,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates proposals to add an external PSK to the key schedule.
Returns an error if there is a pending commit.
pub fn propose_custom_proposal_by_value<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: CustomProposal,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_custom_proposal_by_value<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: CustomProposal,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates proposals to add an external PSK to the key schedule.
Returns an error if there is a pending commit.
pub fn propose_custom_proposal_by_reference<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: CustomProposal,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_custom_proposal_by_reference<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
value: CustomProposal,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates proposals to add an external PSK to the key schedule.
Returns an error if there is a pending commit.
pub fn propose<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
propose: Propose,
ref_or_value: ProposalOrRefType,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
propose: Propose,
ref_or_value: ProposalOrRefType,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Generate a proposal
pub fn propose_add_member<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
key_package: &KeyPackage,
) -> Result<(MlsMessageOut, HashReference), ProposeAddMemberError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_add_member<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
key_package: &KeyPackage,
) -> Result<(MlsMessageOut, HashReference), ProposeAddMemberError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates proposals to add members to the group.
Returns an error if there is a pending commit.
pub fn propose_remove_member<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
member: LeafNodeIndex,
) -> Result<(MlsMessageOut, HashReference), ProposeRemoveMemberError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_remove_member<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
member: LeafNodeIndex,
) -> Result<(MlsMessageOut, HashReference), ProposeRemoveMemberError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates proposals to remove members from the group.
The member has to be the member’s leaf index.
Returns an error if there is a pending commit.
pub fn propose_remove_member_by_credential<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
member: &Credential,
) -> Result<(MlsMessageOut, HashReference), ProposeRemoveMemberError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_remove_member_by_credential<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
member: &Credential,
) -> Result<(MlsMessageOut, HashReference), ProposeRemoveMemberError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates proposals to remove members from the group.
The member has to be the member’s credential.
Returns an error if there is a pending commit.
pub fn propose_remove_member_by_credential_by_value<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
member: &Credential,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_remove_member_by_credential_by_value<Provider>(
&mut self,
provider: &Provider,
signer: &impl Signer,
member: &Credential,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates proposals to remove members from the group.
The member has to be the member’s credential.
Returns an error if there is a pending commit.
pub fn propose_group_context_extensions<Provider>(
&mut self,
provider: &Provider,
extensions: Extensions,
signer: &impl Signer,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn propose_group_context_extensions<Provider>(
&mut self,
provider: &Provider,
extensions: Extensions,
signer: &impl Signer,
) -> Result<(MlsMessageOut, HashReference), ProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Creates a proposals with a new set of extensions for the group context.
Returns an error when the group does not support all the required capabilities
in the new extensions.
pub fn update_group_context_extensions<Provider>(
&mut self,
provider: &Provider,
extensions: Extensions,
signer: &impl Signer,
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), CreateGroupContextExtProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
pub fn update_group_context_extensions<Provider>(
&mut self,
provider: &Provider,
extensions: Extensions,
signer: &impl Signer,
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), CreateGroupContextExtProposalError<<Provider as OpenMlsProvider>::StorageError>>where
Provider: OpenMlsProvider,
Updates Group Context Extensions
Commits to the Group Context Extension inline proposal using the Extensions
Returns an error when the group does not support all the required capabilities
in the new extensions or if there is a pending commit.
pub fn remove_pending_proposal<Storage>(
&mut self,
storage: &Storage,
proposal_ref: &HashReference,
) -> Result<(), RemoveProposalError<<Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>>where
Storage: StorageProvider,
pub fn remove_pending_proposal<Storage>(
&mut self,
storage: &Storage,
proposal_ref: &HashReference,
) -> Result<(), RemoveProposalError<<Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>>where
Storage: StorageProvider,
Removes a specific proposal from the store.
§impl MlsGroup
impl MlsGroup
pub fn configuration(&self) -> &MlsGroupJoinConfig
pub fn configuration(&self) -> &MlsGroupJoinConfig
Returns the configuration.
pub fn set_configuration<Storage>(
&mut self,
storage: &Storage,
mls_group_config: &MlsGroupJoinConfig,
) -> Result<(), <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
pub fn set_configuration<Storage>(
&mut self,
storage: &Storage,
mls_group_config: &MlsGroupJoinConfig,
) -> Result<(), <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
Sets the configuration.
pub fn set_aad(&mut self, aad: Vec<u8>)
pub fn set_aad(&mut self, aad: Vec<u8>)
Sets the additional authenticated data (AAD) for the next outgoing
message. This is ephemeral and will be reset by every API call that
successfully returns an MlsMessageOut.
pub fn aad(&self) -> &[u8] ⓘ
pub fn aad(&self) -> &[u8] ⓘ
Returns the additional authenticated data (AAD) for the next outgoing message.
pub fn ciphersuite(&self) -> Ciphersuite
pub fn ciphersuite(&self) -> Ciphersuite
Returns the group’s ciphersuite.
pub fn confirmation_tag(&self) -> &ConfirmationTag
pub fn confirmation_tag(&self) -> &ConfirmationTag
Get confirmation tag.
pub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Returns whether the own client is still a member of the group or if it was already evicted
pub fn credential(&self) -> Result<&Credential, MlsGroupStateError>
pub fn credential(&self) -> Result<&Credential, MlsGroupStateError>
Returns own credential. If the group is inactive, it returns a
UseAfterEviction error.
pub fn own_leaf_index(&self) -> LeafNodeIndex
pub fn own_leaf_index(&self) -> LeafNodeIndex
Returns the leaf index of the client in the tree owning this group.
pub fn own_leaf_node(&self) -> Option<&LeafNode>
pub fn own_leaf_node(&self) -> Option<&LeafNode>
Returns the leaf node of the client in the tree owning this group.
pub fn epoch(&self) -> GroupEpoch
pub fn epoch(&self) -> GroupEpoch
Returns the epoch.
pub fn pending_proposals(&self) -> impl Iterator<Item = &QueuedProposal>
pub fn pending_proposals(&self) -> impl Iterator<Item = &QueuedProposal>
Returns an Iterator over pending proposals.
pub fn pending_commit(&self) -> Option<&StagedCommit>
pub fn pending_commit(&self) -> Option<&StagedCommit>
Returns a reference to the StagedCommit of the most recently created
commit. If there was no commit created in this epoch, either because
this commit or another commit was merged, it returns None.
pub fn clear_pending_commit<Storage>(
&mut self,
storage: &Storage,
) -> Result<(), <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
pub fn clear_pending_commit<Storage>(
&mut self,
storage: &Storage,
) -> Result<(), <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
Sets the group_state to MlsGroupState::Operational, thus clearing
any potentially pending commits.
Note that this has no effect if the group was created through an external commit and
the resulting external commit has not been merged yet. For more
information, see MlsGroup::external_commit_builder().
Use with caution! This function should only be used if it is clear that the pending commit will not be used in the group. In particular, if a pending commit is later accepted by the group, this client will lack the key material to encrypt or decrypt group messages.
pub fn clear_pending_proposals<Storage>(
&mut self,
storage: &Storage,
) -> Result<(), <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
pub fn clear_pending_proposals<Storage>(
&mut self,
storage: &Storage,
) -> Result<(), <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
Clear the pending proposals, if the proposal store is not empty.
Warning: Once the pending proposals are cleared it will be impossible to process
a Commit message that references those proposals. Only use this
function as a last resort, e.g. when a call to
MlsGroup::commit_to_pending_proposals fails.
pub fn extensions(&self) -> &Extensions
pub fn extensions(&self) -> &Extensions
Get a reference to the group context Extensions of this MlsGroup.
pub fn ext_commit_sender_index(
&self,
commit: &StagedCommit,
) -> Result<LeafNodeIndex, LibraryError>
pub fn ext_commit_sender_index( &self, commit: &StagedCommit, ) -> Result<LeafNodeIndex, LibraryError>
Returns the index of the sender of a staged, external commit.
pub fn load<Storage>(
storage: &Storage,
group_id: &GroupId,
) -> Result<Option<MlsGroup>, <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
pub fn load<Storage>(
storage: &Storage,
group_id: &GroupId,
) -> Result<Option<MlsGroup>, <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
Loads the state of the group with given id from persisted state.
pub fn delete<Storage>(
&mut self,
storage: &Storage,
) -> Result<(), <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
pub fn delete<Storage>(
&mut self,
storage: &Storage,
) -> Result<(), <Storage as StorageProvider<openmls::::storage::StorageProvider::{constant#0}>>::Error>where
Storage: StorageProvider,
Remove the persisted state of this group from storage. Note that signature key material is not managed by OpenMLS and has to be removed from the storage provider separately (if desired).
pub fn export_ratchet_tree(&self) -> RatchetTree
pub fn export_ratchet_tree(&self) -> RatchetTree
Exports the Ratchet Tree.
§impl MlsGroup
impl MlsGroup
pub fn export_group_context(&self) -> &GroupContext
pub fn tree_hash(&self) -> &[u8] ⓘ
pub fn print_ratchet_tree(&self, message: &str)
pub fn ensure_persistence( &self, storage: &impl StorageProvider, ) -> Result<(), LibraryError>
Trait Implementations§
impl StructuralPartialEq for MlsGroup
Auto Trait Implementations§
impl Freeze for MlsGroup
impl RefUnwindSafe for MlsGroup
impl Send for MlsGroup
impl Sync for MlsGroup
impl Unpin for MlsGroup
impl UnwindSafe for MlsGroup
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
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.