Updating own key package

Immediate operation

Members can update their own leaf key package atomically with the .self_update() function. The application can optionally provide a KeyPackage manually. If not, a key package will be created on the fly with the same extensions as the current one, but with a fresh HPKE init key.

    let (mls_message_out, welcome_option) = bob_group
        .self_update(
            backend,
            None, // We don't provide a key package, it will be created on the fly instead
        )
        .expect("Could not update own key package.");

The function returns the tuple (MlsMessageOut, Option<Welcome>). The MlsMessageOut contains a Commit message that needs to be fanned out to existing members of the group. Despite the fact that the member only updates its own key package in this operation, the Commit message could potentially also cover Add Proposals that were previously received in the epoch. Therefore the function can also optionally return a Welcome message. The Welcome message needs to be sent to the newly added members.

Proposal

Members can also update their key package as a proposal (without the corresponding Commit message) by using the .propose_self_update() function. Just like with the .self_update() function, an optional key package can be provided:

    let mls_message_out = alice_group
        .propose_self_update(
            backend,
            None, // We don't provide a key package, it will be created on the fly instead
        )
        .expect("Could not create update proposal.");

In this case the the function returns an MlsMessageOut that needs to be fanned out to existing group members.