Skip to main content

process_vc_key_package_upload

Function process_vc_key_package_upload 

Source
pub fn process_vc_key_package_upload<Provider: OpenMlsProvider>(
    provider: &Provider,
    upload: &KeyPackageUpload,
) -> Result<(), VirtualClientsError>
Available on crate feature extensions-draft and crate feature virtual-clients-draft and (32-bit or 64-bit) only.
Expand description

Process a KeyPackageUpload received from a sibling virtual client.

Derives the batch’s single key_package operation secret once from the uploader’s leaf ratchet at (epoch_id, leaf_index, generation), then stores the advanced operation tree and one RetainedKeyPackageMaterial per KeyPackageInfo (keyed by the info’s KeyPackageRef) in a single atomic batch write.

The batch operation secret is derived under the emulation ciphersuite (the operation tree’s ciphersuite). Each per-KeyPackage seed is imported from it into the ciphersuite the upload names for this KeyPackage. The init and leaf-encryption keys are later derived from each seed under the same ciphersuite at Welcome time. The operation secret is dropped once all seeds are derived. The batch generation is consumed in the tree exactly once.