pub struct StagedWelcome { /* private fields */ }Expand description
A StagedWelcome can be inspected and then turned into a MlsGroup.
This allows checking who authored the Welcome message.
Implementations§
Source§impl StagedWelcome
impl StagedWelcome
Sourcepub fn new_from_welcome<Provider: OpenMlsProvider>(
provider: &Provider,
mls_group_config: &MlsGroupJoinConfig,
welcome: Welcome,
ratchet_tree: Option<RatchetTreeIn>,
) -> Result<Self, WelcomeError<Provider::StorageError>>
pub fn new_from_welcome<Provider: OpenMlsProvider>( provider: &Provider, mls_group_config: &MlsGroupJoinConfig, welcome: Welcome, ratchet_tree: Option<RatchetTreeIn>, ) -> Result<Self, WelcomeError<Provider::StorageError>>
Creates a new staged welcome from a Welcome message. Returns an error
(WelcomeError::NoMatchingKeyPackage) if no KeyPackage
can be found.
Note: calling this function will consume the key material for decrypting the Welcome
message, even if the caller does not turn the StagedWelcome into an MlsGroup.
Sourcepub fn build_from_welcome<'a, Provider: OpenMlsProvider>(
provider: &'a Provider,
mls_group_config: &MlsGroupJoinConfig,
welcome: Welcome,
) -> Result<JoinBuilder<'a, Provider>, WelcomeError<Provider::StorageError>>
pub fn build_from_welcome<'a, Provider: OpenMlsProvider>( provider: &'a Provider, mls_group_config: &MlsGroupJoinConfig, welcome: Welcome, ) -> Result<JoinBuilder<'a, Provider>, WelcomeError<Provider::StorageError>>
Similar to StagedWelcome::new_from_welcome but as a builder.
The builder allows to set the ratchet tree, skip leaf node lifetime
validation, and get the ProcessedWelcome for inspection before staging.
Sourcepub fn build_from_branch<'a, Provider: OpenMlsProvider>(
provider: &'a Provider,
mls_group_config: &MlsGroupJoinConfig,
welcome: Welcome,
branch_info: BranchInfo,
) -> Result<JoinBuilder<'a, Provider>, WelcomeError<Provider::StorageError>>
pub fn build_from_branch<'a, Provider: OpenMlsProvider>( provider: &'a Provider, mls_group_config: &MlsGroupJoinConfig, welcome: Welcome, branch_info: BranchInfo, ) -> Result<JoinBuilder<'a, Provider>, WelcomeError<Provider::StorageError>>
Builder to create a StagedWelcome for a subgroup branched from a
parent group, as described in RFC 9420 §11.3.
The parent group’s parameters are provided via branch_info, which the
parent exports with
MlsGroup::branch_info.
In addition to the regular StagedWelcome::build_from_welcome
processing, this injects the parent’s resumption PSK secret (which is
required to derive the subgroup’s key schedule from the branch PSK) and
enforces the receiver-side checks the RFC mandates when joining a branched
subgroup.
The branch PSK carried in the Welcome must reference the same parent
group and epoch as the supplied branch_info; otherwise the injected
resumption PSK secret would be for the wrong epoch. This is checked here,
before the secret is mixed into the key schedule, and fails with
WelcomeError::SubgroupParentMismatch.
The remaining checks run when JoinBuilder::build is called:
- the protocol version and ciphersuite match the parent group,
- the subgroup is at epoch 1, and
- every member of the subgroup matches a member of the parent group
(unless disabled via
JoinBuilder::check_members).
Matching members is left to the application by the RFC; here we use credential equality for equivalent identifiers.
If the receiver does not yet know which parent epoch the branch was taken
from (its own view of the parent group may have advanced), use
StagedWelcome::process_branch_welcome to read the parent reference
from the Welcome first and then pick the matching branch_info. That
path decrypts the Welcome only once. This one-shot method is a
convenience for callers that already know the parent epoch; it also
decrypts only once, via the same carrier.
Sourcepub fn process_branch_welcome<Provider: OpenMlsProvider>(
provider: &Provider,
mls_group_config: &MlsGroupJoinConfig,
welcome: Welcome,
) -> Result<PendingBranchWelcome, WelcomeError<Provider::StorageError>>
pub fn process_branch_welcome<Provider: OpenMlsProvider>( provider: &Provider, mls_group_config: &MlsGroupJoinConfig, welcome: Welcome, ) -> Result<PendingBranchWelcome, WelcomeError<Provider::StorageError>>
Decrypt a subgroup-branch Welcome once so its parent reference can be
inspected before selecting the matching BranchInfo.
The branch PSK’s parent group and epoch live inside the Welcome’s
encrypted GroupSecrets, so reading them requires decryption. This
returns a PendingBranchWelcome holding the decrypted state: call
PendingBranchWelcome::parent to read the parent (group_id, epoch)
the branch derives from (RFC 9420 §8.4), select the BranchInfo for that
parent epoch (e.g. from a sliding window of recent epochs), then finish
with PendingBranchWelcome::build_from_branch — without decrypting the
Welcome a second time.
Note: like StagedWelcome::build_from_branch, this path assumes a
subgroup-branch Welcome. It consumes the matching key package from
storage. If PendingBranchWelcome::parent returns None the Welcome
is not a branch welcome and the carrier cannot complete a regular join
(the key package is already consumed); use the normal
ProcessedWelcome flow when the message may not be a branch welcome.
Sourcepub fn welcome_sender_index(&self) -> LeafNodeIndex
pub fn welcome_sender_index(&self) -> LeafNodeIndex
Returns the LeafNodeIndex of the group member that authored the Welcome message.
Sourcepub fn welcome_sender(&self) -> Result<&LeafNode, LibraryError>
pub fn welcome_sender(&self) -> Result<&LeafNode, LibraryError>
Sourcepub fn own_leaf_index(&self) -> LeafNodeIndex
pub fn own_leaf_index(&self) -> LeafNodeIndex
Returns the leaf index of the client in this welcome’s PublicGroup.
Sourcepub fn own_leaf_node(&self) -> Option<&LeafNode>
pub fn own_leaf_node(&self) -> Option<&LeafNode>
Returns the leaf node of the client in this welcome’s PublicGroup.
Sourcepub fn group_context(&self) -> &GroupContext
pub fn group_context(&self) -> &GroupContext
Get the GroupContext of this welcome’s PublicGroup.
Sourcepub fn members(&self) -> impl Iterator<Item = Member> + '_
pub fn members(&self) -> impl Iterator<Item = Member> + '_
Get an iterator over all Members of this welcome’s PublicGroup.
Sourcepub fn application_export_secret(&self) -> &ApplicationExportSecret
Available on crate feature extensions-draft only.
pub fn application_export_secret(&self) -> &ApplicationExportSecret
extensions-draft only.Get the ApplicationExportSecret of this welcome.
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 a joiner has to set this itself. Joining an emulation group without it leaves the virtual client’s secrets underived.
Sourcepub fn into_group<Provider: OpenMlsProvider>(
self,
provider: &Provider,
) -> Result<MlsGroup, WelcomeError<Provider::StorageError>>
pub fn into_group<Provider: OpenMlsProvider>( self, provider: &Provider, ) -> Result<MlsGroup, WelcomeError<Provider::StorageError>>
Consumes the StagedWelcome and returns the respective MlsGroup.
Sourcepub fn export_secret<CryptoProvider: OpenMlsCrypto>(
&self,
crypto: &CryptoProvider,
label: &str,
context: &[u8],
key_length: usize,
) -> Result<Vec<u8>, ExportSecretError>
pub fn export_secret<CryptoProvider: OpenMlsCrypto>( &self, crypto: &CryptoProvider, label: &str, context: &[u8], key_length: usize, ) -> Result<Vec<u8>, ExportSecretError>
Exports a secret from the epoch of the group that is joined
using this StagedWelcome.
Returns ExportSecretError::KeyLengthTooLong if the requested
key length is too long.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StagedWelcome
impl RefUnwindSafe for StagedWelcome
impl Send for StagedWelcome
impl Sync for StagedWelcome
impl Unpin for StagedWelcome
impl UnsafeUnpin for StagedWelcome
impl UnwindSafe for StagedWelcome
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