Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Join a group with an external commit

To join a group with an external commit message, a new MlsGroup can be instantiated directly from the GroupInfo. The GroupInfo/Ratchet Tree should be shared over a secure channel. If the RatchetTree extension is not included in the GroupInfo as a GroupInfoExtension, then the ratchet tree needs to be provided.

The GroupInfo can be obtained either from a call to export_group_infofrom the MlsGroup:

    let (mls_message_out, welcome, group_info) = alice_group
        .add_members(
            provider,
            &alice_signature_keys,
            &[bob_key_package.key_package().clone()],
        )
        .expect("Could not add members.");

Or from a call to a function that results in a staged commit:

    let verifiable_group_info = alice_group
        .export_group_info(provider.crypto(), &alice_signature_keys, true)
        .expect("Cannot export group info")
        .into_verifiable_group_info()
        .expect("Could not get group info");

External commits can be created using a builder pattern via MlsGroup::external_commit_builder(). The ExternalCommitBuilder provides more options than join_by_external in that it allows the inclusion of SelfRemove or PSK proposals. After its first stage, the ExternalCommitBuilder turns into a regular CommitBuilder. As external commits come with a few restrictions relative to regular commits, not all CommitBuilder capabilities are exposed for external commits. Also, instead of stage_commit this CommitBuilder requires a call to finalize before it returns the new MlsGroup, as well as a CommitMessageBundle containing the external commit, as well as a potential GroupInfo.

    let (mut bob_group, commit_message_bundle) = MlsGroup::external_commit_builder()
        .with_ratchet_tree(tree_option.into())
        .with_config(join_group_config.clone())
        .with_aad(AAD.to_vec())
        .build_group(
            provider,
            verifiable_group_info,
            bob_credential_with_key.clone(),
        )
        .expect("error building group")
        .leaf_node_parameters(leaf_node_parameters)
        .load_psks(provider.storage())
        .expect("error loading psks")
        .build(provider.rand(), provider.crypto(), &bob_signer, |_| true)
        .expect("error building external commit")
        .finalize(provider)
        .expect("error finalizing external commit");

The resulting external commit message needs to be fanned out to the Delivery Service and accepted by the other members before merging this external commit.