Skip to content

feat(stack-kms-vendor): keyset records, both key modes and the static key backend (CIP-5306) - #1526

Draft
freshtonic wants to merge 8 commits into
james/cip-5305-v2-sealed-leaf-with-key-backend-and-key-modefrom
james/cip-5306-keyset-records-the-two-key-modes-and-the-static-key-backend
Draft

freshtonic wants to merge 8 commits into
james/cip-5305-v2-sealed-leaf-with-key-backend-and-key-modefrom
james/cip-5306-keyset-records-the-two-key-modes-and-the-static-key-backend

Conversation

@freshtonic

@freshtonic freshtonic commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Layer 4 of the CIP-5203 stack. Implements CIP-5306 (ADR-0009).

  • New crate stack-kms-vendor, with the KeyVendorBackend trait. Each vendor crate implements only this trait.
  • KeysetRecord is a versioned record, written as stack-keyset: + base64url, with create and rewrap.
  • Wrapped data key mode: no key outlives one settle. Terms are now derived inside the settle, so a handle holds no index key. This closes the gap that CIP-5304 left.
  • Derived data key mode: HKDF-SHA256 from the root key, with a default TTL of 5 minutes.
  • KeyRouter holds ZeroKMS and at most one vendor.
  • The static key backend offers derived data keys only.
  • Also: run_batch (concurrency limit, backoff on throttling), the VendorTransport trait, and a shared contract suite.
  • Breaking change: KeysetCipher::prf() now returns an Option.

Decisions are in docs/plans/2026-11-05-key-vendor-backends-decisions.md (CIP-5306 section).

@freshtonic
freshtonic added this pull request to stack #1523 November 5, 2026 23:14
@changeset-bot

changeset-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 11819bf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@freshtonic freshtonic changed the title james/cip 5306 keyset records the two key modes and the static key backend feat(stack-kms-vendor): keyset records, both key modes and the static key backend (CIP-5306) Nov 5, 2026
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Mutation testing (cargo-mutants, --in-diff, stack-auth + stack-encrypt)

caught missed unviable timeout
60 0 94 0

Every mutant in the changed lines was caught by a test.

A key source can route by keyset. It can also load an index key for each
settle.
…306)

Add keyset records, the vendor seam, the two key modes and the static key
backend.
Derive the terms inside the settle.

KeysetCipher::prf now returns Option: a keyset whose key backend loads its
index key per settle holds no PRF between settles.
Run the suite on the static vendor and on the fake vendor.
@freshtonic
freshtonic force-pushed the james/cip-5306-keyset-records-the-two-key-modes-and-the-static-key-backend branch from a4009c2 to 11819bf Compare November 6, 2026 05:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant