Skip to content

VC KeyPackage handling - #2067

Merged
kkohbrok merged 10 commits into
mainfrom
konrad/vc_keypackage_handling
Jun 19, 2026
Merged

kkohbrok merged 10 commits into
mainfrom
konrad/vc_keypackage_handling

Conversation

@kkohbrok

@kkohbrok kkohbrok commented Jun 18, 2026 •

Copy link
Copy Markdown
Member

Adds KeyPackage building and Welcome processing for virtual clients (behind virtual-clients-draft), so a virtual client can publish KeyPackages that a sibling recovers and uses to join higher-level groups.

  • Building: KeyPackageBuilder::build_vc_batch allocates one key_package operation generation per batch, derives a per-KeyPackage seed (and from it the init and leaf encryption keys) for each index, and embeds an encrypted DerivationInfo in each leaf under VC_COMPONENT_ID. Returns a VcKeyPackageBatch with the generation and the built bundles.
  • Carrying between siblings: assemble_vc_key_package_upload builds and retains the key material for a received KeyPackage upload message.
  • Welcome: find_and_validate_vc_own_leaf locates the joined leaf by its derived encryption key, decrypts the leaf's DerivationInfo, and checks the embedded (leaf_index, generation, key_package_index) against the retained material.

kkohbrok added 6 commits June 18, 2026 06:37
Add the key_package operation secret and per-index seed derivation
(KeyPackageSeedContext), the KeyPackageInfo, KeyPackageUpload, and
RetainedKeyPackageMaterial types, the leaf_node_source select on
DerivationInfoTBE, upload validation, and the assemble and process
helpers.
Add the RetainedKeyPackageMaterial storage entity with its batch write,
single read and delete, epoch-liveness query, and guarded epoch-state
deletion, across the storage trait and the memory and sqlite providers,
with the sqlite migration.
Embed and read the DerivationInfo on commit and update leaves, inject the
derived leaf encryption keypair, and carry the (GroupId, GroupEpoch)
emulation binding.
Add KeyPackageBuilder::build_vc_batch and KeyPackage::new_from_vc_keys to
build a batch of virtual-client KeyPackages whose init and leaf keys
derive from per-index seeds.
Let a sibling emulator join a higher-level group via a virtual client's
KeyPackage: look up the retained material by KeyPackageRef, derive the
keys from the stored seed, and validate against the leaf's DerivationInfo.
Unit and integration tests for KeyPackage building, upload processing,
Welcome joins, and the storage epoch-liveness behavior.
@kkohbrok
kkohbrok marked this pull request as ready for review June 18, 2026 06:49
@kkohbrok
kkohbrok requested a review from a team as a code owner June 18, 2026 06:49

@raphaelrobert raphaelrobert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good in general. I found a few nits. It would also be good to have a PR description for posterity.

Comment thread openmls/src/group/mls_group/creation.rs Resolved
Comment thread openmls/src/key_packages/mod.rs Resolved
Comment thread openmls/src/key_packages/mod.rs Resolved
Comment thread openmls/src/key_packages/mod.rs Resolved
Comment thread openmls/src/key_packages/mod.rs Resolved
@kkohbrok
kkohbrok requested a review from raphaelrobert June 19, 2026 06:47

@raphaelrobert raphaelrobert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes!

@kkohbrok
kkohbrok merged commit 9f41ddc into main Jun 19, 2026
40 checks passed
@kkohbrok
kkohbrok deleted the konrad/vc_keypackage_handling branch June 19, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants