Skip to main content

StagedWelcome

Struct StagedWelcome 

Source
pub struct StagedWelcome { /* private fields */ }
Available on 32-bit or 64-bit only.
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn welcome_sender_index(&self) -> LeafNodeIndex

Returns the LeafNodeIndex of the group member that authored the Welcome message.

Source

pub fn welcome_sender(&self) -> Result<&LeafNode, LibraryError>

Returns the LeafNode of the group member that authored the Welcome message.

Source

pub fn own_leaf_index(&self) -> LeafNodeIndex

Returns the leaf index of the client in this welcome’s PublicGroup.

Source

pub fn own_leaf_node(&self) -> Option<&LeafNode>

Returns the leaf node of the client in this welcome’s PublicGroup.

Source

pub fn group_context(&self) -> &GroupContext

Get the GroupContext of this welcome’s PublicGroup.

Source

pub fn members(&self) -> impl Iterator<Item = Member> + '_

Get an iterator over all Members of this welcome’s PublicGroup.

Source

pub fn application_export_secret(&self) -> &ApplicationExportSecret

Available on crate feature extensions-draft only.

Get the ApplicationExportSecret of this welcome.

Source

pub fn emulation_group(self, emulation_group: bool) -> Self

Available on crate feature 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.

Source

pub fn into_group<Provider: OpenMlsProvider>( self, provider: &Provider, ) -> Result<MlsGroup, WelcomeError<Provider::StorageError>>

Consumes the StagedWelcome and returns the respective MlsGroup.

Source

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§

Source§

impl Debug for StagedWelcome

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V