pub struct ExternalCommitBuilder { /* private fields */ }Expand description
This is the builder for external commits. It allows you to build an external commit that can be used to join a group externally. Parameters such as optional SelfRemove proposals from other members, the ratchet tree, and the group join configuration can be set in the first builder stage.
Self::build_group verifies the group info and ratchet tree and returns
a CommitBuilder. To inspect the verified group info and group context
before building the external commit, use Self::verify_group instead,
which returns a VerifiedExternalCommitBuilder.
The CommitBuilder stage can be used to add one or more proposals by
value to the external commit and specify LeafNodeParameters. Note that
only proposal types that RFC 9420 and the MLS extensions draft allow in an
external commit pass validation when the commit is built.
Implementations§
Source§impl ExternalCommitBuilder
impl ExternalCommitBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ExternalCommitBuilder with default values.
Sourcepub fn with_proposals(self, proposals: Vec<PublicMessageIn>) -> Self
pub fn with_proposals(self, proposals: Vec<PublicMessageIn>) -> Self
Adds SelfRemove proposals to the external commit. Other proposals or other types of messages are ignored.
Sourcepub fn with_ratchet_tree(self, ratchet_tree: RatchetTreeIn) -> Self
pub fn with_ratchet_tree(self, ratchet_tree: RatchetTreeIn) -> Self
Specifies the ratchet tree to use for the external commit. This is only
used if the ratchet tree is not provided in the VerifiableGroupInfo
extensions. A ratchet tree must be provided, either in the
VerifiableGroupInfo extensions or via this method.
Sourcepub fn with_config(self, config: MlsGroupJoinConfig) -> Self
pub fn with_config(self, config: MlsGroupJoinConfig) -> Self
Specifies the configuration to use for the group built as part of the
external commit. Note that the external commit will always be a
PublicMessage regardless of the wire format policy set in the group
config.
Sourcepub fn with_aad(self, aad: Vec<u8>) -> Self
pub fn with_aad(self, aad: Vec<u8>) -> Self
Specifies additional authenticated data (AAD) to be included in the external commit. It applies to the external commit only and is not retained as the AAD of the group that is being joined.
Sourcepub fn emulation_group(self, emulation_group: bool) -> Self
Available on crate feature virtual-clients-draft only.
pub fn emulation_group(self, emulation_group: bool) -> Self
virtual-clients-draft only.Join the group as an emulation group of a virtual client. See
MlsGroupCreateConfigBuilder::emulation_group for what an emulation
group is.
Nothing on the wire marks a group as an emulation group, so an emulator client resyncing into one has to set this itself. The external commit changes membership, so merging it registers the epoch it creates as a derivation epoch, converging with the members already in the group.
Sourcepub fn skip_lifetime_validation(self) -> Self
pub fn skip_lifetime_validation(self) -> Self
Skip the validation of lifetimes in leaf nodes in the ratchet tree. Note that only the leaf nodes are checked that were never updated.
By default they are validated.
Sourcepub fn leaf_node_lifetime_policy(
self,
lifetime_policy: LeafNodeLifetimePolicy,
) -> Self
pub fn leaf_node_lifetime_policy( self, lifetime_policy: LeafNodeLifetimePolicy, ) -> Self
Sets how the lifetimes of leaf nodes in the ratchet tree are checked.
Self::skip_lifetime_validation is the same as passing
LeafNodeLifetimePolicy::Skip.
Sourcepub fn build_group<Provider: OpenMlsProvider>(
self,
provider: &Provider,
verifiable_group_info: VerifiableGroupInfo,
credential_with_key: CredentialWithKey,
) -> Result<CommitBuilder<'_, Initial, MlsGroup>, ExternalCommitBuilderError<Provider::StorageError>>
pub fn build_group<Provider: OpenMlsProvider>( self, provider: &Provider, verifiable_group_info: VerifiableGroupInfo, credential_with_key: CredentialWithKey, ) -> Result<CommitBuilder<'_, Initial, MlsGroup>, ExternalCommitBuilderError<Provider::StorageError>>
Build the MlsGroup from the provided VerifiableGroupInfo and
CredentialWithKey.
This is equivalent to calling Self::verify_group followed by
VerifiedExternalCommitBuilder::build_group.
Returns a CommitBuilder that can be used to further configure the
external commit.
Sourcepub fn verify_group<Provider: OpenMlsProvider>(
self,
provider: &Provider,
verifiable_group_info: VerifiableGroupInfo,
) -> Result<VerifiedExternalCommitBuilder, ExternalCommitBuilderError<Provider::StorageError>>
pub fn verify_group<Provider: OpenMlsProvider>( self, provider: &Provider, verifiable_group_info: VerifiableGroupInfo, ) -> Result<VerifiedExternalCommitBuilder, ExternalCommitBuilderError<Provider::StorageError>>
Verify the provided VerifiableGroupInfo and the ratchet tree of the
group to be joined, without building an external commit. The ratchet
tree is taken from the VerifiableGroupInfo extensions if present,
and from Self::with_ratchet_tree otherwise.
Returns a VerifiedExternalCommitBuilder that exposes the verified
GroupInfo and GroupContext and can build the external commit.
Trait Implementations§
Auto Trait Implementations§
impl Forget for ExternalCommitBuilder
impl Freeze for ExternalCommitBuilder
impl Move for ExternalCommitBuilder
impl RefUnwindSafe for ExternalCommitBuilder
impl Send for ExternalCommitBuilder
impl Sync for ExternalCommitBuilder
impl Unpin for ExternalCommitBuilder
impl UnsafeUnpin for ExternalCommitBuilder
impl UnwindSafe for ExternalCommitBuilder
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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