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, &alice_signature_keys, true)
        .expect("Cannot export group info")
        .into_verifiable_group_info()
        .expect("Could not get group info");

Calling join_by_external_commit requires an MlsGroupJoinConfig (see Group configuration for more details). The function creates an MlsGroup and leave it with a commit pending to be merged.

    let (mut dave_group, _out, _group_info) = MlsGroup::join_by_external_commit(
        provider,
        &dave_signature_keys,
        None, // No ratchtet tree extension
        verifiable_group_info,
        &mls_group_config,
        None, // No special capabilities
        None, // No special extensions
        &[],
        dave_credential,
    )
    .expect("Error joining from external commit");
    dave_group
        .merge_pending_commit(provider)
        .expect("Cannot merge 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.