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§
source§impl MlsGroup
impl MlsGroup
sourcepub fn create_message(
&mut self,
backend: &impl OpenMlsCryptoProvider,
signer: &impl Signer,
message: &[u8]
) -> Result<MlsMessageOut, CreateMessageError>
pub fn create_message( &mut self, backend: &impl OpenMlsCryptoProvider, signer: &impl Signer, message: &[u8] ) -> Result<MlsMessageOut, CreateMessageError>
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.
source§impl MlsGroup
impl MlsGroup
sourcepub fn new<KeyStore: OpenMlsKeyStore>(
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
mls_group_config: &MlsGroupConfig,
credential_with_key: CredentialWithKey
) -> Result<Self, NewGroupError<KeyStore::Error>>
pub fn new<KeyStore: OpenMlsKeyStore>( backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, mls_group_config: &MlsGroupConfig, credential_with_key: CredentialWithKey ) -> Result<Self, NewGroupError<KeyStore::Error>>
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.
sourcepub fn new_with_group_id<KeyStore: OpenMlsKeyStore>(
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
mls_group_config: &MlsGroupConfig,
group_id: GroupId,
credential_with_key: CredentialWithKey
) -> Result<Self, NewGroupError<KeyStore::Error>>
pub fn new_with_group_id<KeyStore: OpenMlsKeyStore>( backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, mls_group_config: &MlsGroupConfig, group_id: GroupId, credential_with_key: CredentialWithKey ) -> Result<Self, NewGroupError<KeyStore::Error>>
Creates a new group with a given group ID with the creator as the only member.
sourcepub fn new_from_welcome<KeyStore: OpenMlsKeyStore>(
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
mls_group_config: &MlsGroupConfig,
welcome: Welcome,
ratchet_tree: Option<RatchetTreeIn>
) -> Result<Self, WelcomeError<KeyStore::Error>>
pub fn new_from_welcome<KeyStore: OpenMlsKeyStore>( backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, mls_group_config: &MlsGroupConfig, welcome: Welcome, ratchet_tree: Option<RatchetTreeIn> ) -> Result<Self, WelcomeError<KeyStore::Error>>
Creates a new group from a Welcome
message. Returns an error
(WelcomeError::NoMatchingKeyPackage
) if no KeyPackage
can be found.
sourcepub fn join_by_external_commit(
backend: &impl OpenMlsCryptoProvider,
signer: &impl Signer,
ratchet_tree: Option<RatchetTreeIn>,
verifiable_group_info: VerifiableGroupInfo,
mls_group_config: &MlsGroupConfig,
aad: &[u8],
credential_with_key: CredentialWithKey
) -> Result<(Self, MlsMessageOut, Option<GroupInfo>), ExternalCommitError>
pub fn join_by_external_commit( backend: &impl OpenMlsCryptoProvider, signer: &impl Signer, ratchet_tree: Option<RatchetTreeIn>, verifiable_group_info: VerifiableGroupInfo, mls_group_config: &MlsGroupConfig, aad: &[u8], credential_with_key: CredentialWithKey ) -> Result<(Self, MlsMessageOut, Option<GroupInfo>), ExternalCommitError>
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.
source§impl MlsGroup
impl MlsGroup
sourcepub fn export_secret(
&self,
backend: &impl OpenMlsCryptoProvider,
label: &str,
context: &[u8],
key_length: usize
) -> Result<Vec<u8>, ExportSecretError>
pub fn export_secret( &self, backend: &impl OpenMlsCryptoProvider, label: &str, context: &[u8], key_length: usize ) -> Result<Vec<u8>, ExportSecretError>
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.
sourcepub fn epoch_authenticator(&self) -> &EpochAuthenticator
pub fn epoch_authenticator(&self) -> &EpochAuthenticator
Returns the epoch authenticator of the current epoch.
sourcepub fn resumption_psk_secret(&self) -> &ResumptionPskSecret
pub fn resumption_psk_secret(&self) -> &ResumptionPskSecret
Returns the resumption PSK secret of the current epoch.
sourcepub 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.
sourcepub fn export_group_info(
&self,
backend: &impl OpenMlsCryptoProvider,
signer: &impl Signer,
with_ratchet_tree: bool
) -> Result<MlsMessageOut, ExportGroupInfoError>
pub fn export_group_info( &self, backend: &impl OpenMlsCryptoProvider, signer: &impl Signer, with_ratchet_tree: bool ) -> Result<MlsMessageOut, ExportGroupInfoError>
Export a group info object for this group.
source§impl MlsGroup
impl MlsGroup
sourcepub fn self_update<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), SelfUpdateError<KeyStore::Error>>
pub fn self_update<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer ) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), SelfUpdateError<KeyStore::Error>>
Updates the own leaf node.
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.
TODO #1208 : The caller should be able to optionally provide a
LeafNode
here, so that things like extensions can be changed via
commit.
sourcepub fn propose_self_update<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
leaf_node: Option<LeafNode>
) -> Result<(MlsMessageOut, ProposalRef), ProposeSelfUpdateError<KeyStore::Error>>
pub fn propose_self_update<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, leaf_node: Option<LeafNode> ) -> Result<(MlsMessageOut, ProposalRef), ProposeSelfUpdateError<KeyStore::Error>>
Creates a proposal to update the own leaf node.
sourcepub fn propose_self_update_by_value<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
leaf_node: Option<LeafNode>
) -> Result<(MlsMessageOut, ProposalRef), ProposeSelfUpdateError<KeyStore::Error>>
pub fn propose_self_update_by_value<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, leaf_node: Option<LeafNode> ) -> Result<(MlsMessageOut, ProposalRef), ProposeSelfUpdateError<KeyStore::Error>>
Creates a proposal to update the own leaf node.
source§impl MlsGroup
impl MlsGroup
sourcepub fn add_members<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
key_packages: &[KeyPackage]
) -> Result<(MlsMessageOut, MlsMessageOut, Option<GroupInfo>), AddMembersError<KeyStore::Error>>
pub fn add_members<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, key_packages: &[KeyPackage] ) -> Result<(MlsMessageOut, MlsMessageOut, Option<GroupInfo>), AddMembersError<KeyStore::Error>>
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.
If successful, it returns a triple of MlsMessageOut
s, 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.
sourcepub fn remove_members<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
members: &[LeafNodeIndex]
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), RemoveMembersError<KeyStore::Error>>
pub fn remove_members<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, members: &[LeafNodeIndex] ) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), RemoveMembersError<KeyStore::Error>>
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.
sourcepub fn leave_group(
&mut self,
backend: &impl OpenMlsCryptoProvider,
signer: &impl Signer
) -> Result<MlsMessageOut, LeaveGroupError>
pub fn leave_group( &mut self, backend: &impl OpenMlsCryptoProvider, signer: &impl Signer ) -> Result<MlsMessageOut, LeaveGroupError>
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.
sourcepub fn members(&self) -> impl Iterator<Item = Member> + '_
pub fn members(&self) -> impl Iterator<Item = Member> + '_
Returns a list of Member
s in the group.
sourcepub 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.
source§impl MlsGroup
impl MlsGroup
sourcepub fn process_message(
&mut self,
backend: &impl OpenMlsCryptoProvider,
message: impl Into<ProtocolMessage>
) -> Result<ProcessedMessage, ProcessMessageError>
pub fn process_message( &mut self, backend: &impl OpenMlsCryptoProvider, message: impl Into<ProtocolMessage> ) -> Result<ProcessedMessage, ProcessMessageError>
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.
sourcepub fn store_pending_proposal(&mut self, proposal: QueuedProposal)
pub fn store_pending_proposal(&mut self, proposal: QueuedProposal)
Stores a standalone proposal in the internal ProposalStore
sourcepub fn commit_to_pending_proposals<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), CommitToPendingProposalsError<KeyStore::Error>>
pub fn commit_to_pending_proposals<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer ) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), CommitToPendingProposalsError<KeyStore::Error>>
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
.
sourcepub fn merge_staged_commit<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
staged_commit: StagedCommit
) -> Result<(), MergeCommitError<KeyStore::Error>>
pub fn merge_staged_commit<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, staged_commit: StagedCommit ) -> Result<(), MergeCommitError<KeyStore::Error>>
Merge a StagedCommit into the group after inspection. As this advances the epoch of the group, it also clears any pending commits.
sourcepub fn merge_pending_commit<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>
) -> Result<(), MergePendingCommitError<KeyStore::Error>>
pub fn merge_pending_commit<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore> ) -> Result<(), MergePendingCommitError<KeyStore::Error>>
Merges the pending StagedCommit
if there is one, and
clears the field by setting it to None
.
source§impl MlsGroup
impl MlsGroup
sourcepub fn propose_add_member_by_value<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
value: KeyPackage
) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
pub fn propose_add_member_by_value<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, value: KeyPackage ) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
Creates proposals to add an external PSK to the key schedule.
Returns an error if there is a pending commit.
sourcepub fn propose_remove_member_by_value<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
value: LeafNodeIndex
) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
pub fn propose_remove_member_by_value<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, value: LeafNodeIndex ) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
Creates proposals to add an external PSK to the key schedule.
Returns an error if there is a pending commit.
sourcepub fn propose_external_psk<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
value: PreSharedKeyId
) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
pub fn propose_external_psk<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, value: PreSharedKeyId ) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
Creates proposals to add an external PSK to the key schedule.
Returns an error if there is a pending commit.
sourcepub fn propose_external_psk_by_value<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
value: PreSharedKeyId
) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
pub fn propose_external_psk_by_value<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, value: PreSharedKeyId ) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
Creates proposals to add an external PSK to the key schedule.
Returns an error if there is a pending commit.
sourcepub fn propose<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
propose: Propose,
ref_or_value: ProposalOrRefType
) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
pub fn propose<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, propose: Propose, ref_or_value: ProposalOrRefType ) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
Generate a proposal
sourcepub fn propose_add_member(
&mut self,
backend: &impl OpenMlsCryptoProvider,
signer: &impl Signer,
key_package: &KeyPackage
) -> Result<(MlsMessageOut, ProposalRef), ProposeAddMemberError>
pub fn propose_add_member( &mut self, backend: &impl OpenMlsCryptoProvider, signer: &impl Signer, key_package: &KeyPackage ) -> Result<(MlsMessageOut, ProposalRef), ProposeAddMemberError>
Creates proposals to add members to the group.
Returns an error if there is a pending commit.
sourcepub fn propose_remove_member(
&mut self,
backend: &impl OpenMlsCryptoProvider,
signer: &impl Signer,
member: LeafNodeIndex
) -> Result<(MlsMessageOut, ProposalRef), ProposeRemoveMemberError>
pub fn propose_remove_member( &mut self, backend: &impl OpenMlsCryptoProvider, signer: &impl Signer, member: LeafNodeIndex ) -> Result<(MlsMessageOut, ProposalRef), ProposeRemoveMemberError>
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.
sourcepub fn propose_remove_member_by_credential(
&mut self,
backend: &impl OpenMlsCryptoProvider,
signer: &impl Signer,
member: &Credential
) -> Result<(MlsMessageOut, ProposalRef), ProposeRemoveMemberError>
pub fn propose_remove_member_by_credential( &mut self, backend: &impl OpenMlsCryptoProvider, signer: &impl Signer, member: &Credential ) -> Result<(MlsMessageOut, ProposalRef), ProposeRemoveMemberError>
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.
sourcepub fn propose_remove_member_by_credential_by_value<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
member: &Credential
) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
pub fn propose_remove_member_by_credential_by_value<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, signer: &impl Signer, member: &Credential ) -> Result<(MlsMessageOut, ProposalRef), ProposalError<KeyStore::Error>>
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.
source§impl MlsGroup
impl MlsGroup
sourcepub fn configuration(&self) -> &MlsGroupConfig
pub fn configuration(&self) -> &MlsGroupConfig
Returns the configuration.
sourcepub fn set_configuration(&mut self, mls_group_config: &MlsGroupConfig)
pub fn set_configuration(&mut self, mls_group_config: &MlsGroupConfig)
Sets the configuration.
sourcepub fn ciphersuite(&self) -> Ciphersuite
pub fn ciphersuite(&self) -> Ciphersuite
Returns the group’s ciphersuite.
sourcepub 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
sourcepub 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.
sourcepub fn own_identity(&self) -> Option<&[u8]>
pub fn own_identity(&self) -> Option<&[u8]>
Get the identity of the client’s Credential
owning this group.
sourcepub 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.
sourcepub 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.
sourcepub fn epoch(&self) -> GroupEpoch
pub fn epoch(&self) -> GroupEpoch
Returns the epoch.
sourcepub fn pending_proposals(&self) -> impl Iterator<Item = &QueuedProposal>
pub fn pending_proposals(&self) -> impl Iterator<Item = &QueuedProposal>
Returns an Iterator
over pending proposals.
sourcepub 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
.
sourcepub fn clear_pending_commit(&mut self)
pub fn clear_pending_commit(&mut self)
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::join_by_external_commit()
.
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.
sourcepub fn load(
group_id: &GroupId,
backend: &impl OpenMlsCryptoProvider
) -> Option<MlsGroup>
pub fn load( group_id: &GroupId, backend: &impl OpenMlsCryptoProvider ) -> Option<MlsGroup>
Loads the state from persisted state.
sourcepub fn save<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>
) -> Result<(), KeyStore::Error>
pub fn save<KeyStore: OpenMlsKeyStore>( &mut self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore> ) -> Result<(), KeyStore::Error>
Persists the state.
sourcepub fn state_changed(&self) -> InnerState
pub fn state_changed(&self) -> InnerState
Returns true
if the internal state has changed and needs to be persisted and
false
otherwise. Calling Self::save()
resets the value to false
.
sourcepub fn export_ratchet_tree(&self) -> RatchetTree
pub fn export_ratchet_tree(&self) -> RatchetTree
Exports the Ratchet Tree.
source§impl MlsGroup
impl MlsGroup
sourcepub fn remove_pending_proposal(
&mut self,
proposal_ref: ProposalRef
) -> Result<(), MlsGroupStateError>
pub fn remove_pending_proposal( &mut self, proposal_ref: ProposalRef ) -> Result<(), MlsGroupStateError>
Removes a specific proposal from the store.