Skip to content

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

Closed
freshtonic wants to merge 1 commit into
james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutralfrom
james/cip-5306-keyset-records-the-two-key-modes-and-the-static-key-backend
Closed

freshtonic wants to merge 1 commit into
james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutralfrom
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 3 of the CIP-5203 stack. Implements CIP-5306 (ADR-0013).

  • New crate stack-kms-vendor, with the KeyVendorBackend trait (wrap, unwrap, sleep). Each vendor crate implements only this trait.
  • KeysetRecord is a versioned record, written as stack-keyset: + base64url, with create and rewrap.
  • Derived data keys: HKDF-SHA256 from the root key. The info binds the keyset id, the vendor and the key mode. The root key is cached for a TTL (default 5 minutes).
  • KeyRouter holds ZeroKMS and at most one vendor, and routes by keyset.
  • The static key backend.
  • Also: retry (backoff on throttling), the VendorTransport trait, and a shared contract suite.
  • The crate docs hold the capability matrix of every key backend.

stack-encrypt does not change. 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: 7d4722c

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
Pre-merge checks: Passed 1 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Passed Passed checks: 1 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

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

No mutants were generated for the changed lines.

@freshtonic
freshtonic force-pushed the james/cip-5305-v2-sealed-leaf-with-key-backend-and-key-mode branch from bb8fc9d to 15163ba Compare November 6, 2026 05:10
@freshtonic
freshtonic force-pushed the james/cip-5306-keyset-records-the-two-key-modes-and-the-static-key-backend branch 2 times, most recently from 11819bf to 6268036 Compare November 9, 2026 04:16
@freshtonic
freshtonic force-pushed the james/cip-5305-v2-sealed-leaf-with-key-backend-and-key-mode branch from 15163ba to 22594ee Compare November 9, 2026 04:16
@freshtonic
freshtonic removed this pull request from stack #1523 November 9, 2026 04:17
@freshtonic
freshtonic added this pull request to stack #1579 November 9, 2026 04:17
@freshtonic
freshtonic force-pushed the james/cip-5305-v2-sealed-leaf-with-key-backend-and-key-mode branch from 22594ee to dbdc34e Compare November 10, 2026 02:37
@freshtonic
freshtonic force-pushed the james/cip-5306-keyset-records-the-two-key-modes-and-the-static-key-backend branch 2 times, most recently from 376712b to 11ca7f3 Compare November 12, 2026 03:44
@freshtonic
freshtonic removed this pull request from stack #1579 November 12, 2026 03:45
@freshtonic freshtonic changed the title feat(stack-kms-vendor): keyset records, both key modes and the static key backend (CIP-5306) feat(stack-kms-vendor): keyset records, derived data keys and the static key backend (CIP-5306) Nov 12, 2026
@freshtonic
freshtonic changed the base branch from james/cip-5305-v2-sealed-leaf-with-key-backend-and-key-mode to james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutral November 12, 2026 03:45
@freshtonic
freshtonic added this pull request to stack #1623 November 12, 2026 03:47
@freshtonic

Copy link
Copy Markdown
Contributor Author

Scope reduced (2026-11-12). This branch was rebuilt from one final tree by path, and the follow-up PRs #1555 to #1563 were folded in. The plan is docs/plans/2026-11-12-key-vendor-backends-scope-reduction.md; the decision log's "Scope reduction" section records each change. Decisions: no stack-encrypt change, no v2 leaf, and the wrapped data key mode deferred.

In this PR: the derived data key mode only, with the root key TTL in VendorKeySource. The index key stays in the cipher's cache until eviction, as for ZeroKMS; the capability matrix states that gap. The vendor and mode bytes are in the HKDF info of every derived key. KeyVendorBackend is vendor, wrap, unwrap and sleep; run_batch became retry. Folded in: the shared fixture harness (#1556), the shared credential cache (#1557) and the one-vendor router (#1562). The base is now #1522 (#1524 is closed).

…tic key backend (CIP-5306)

The vendor seam (wrap, unwrap), keyset records, the derived data key mode
with the root key TTL in the key source, the key router (ZeroKMS and at
most one vendor, by keyset id), the static key backend, the transport seam,
the shared credential cache, the contract suite and the fixture harness.
The vendor and mode bytes are bound into every derived key.
@freshtonic
freshtonic force-pushed the james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutral branch from fb05412 to cd90970 Compare November 12, 2026 05:24
@freshtonic
freshtonic force-pushed the james/cip-5306-keyset-records-the-two-key-modes-and-the-static-key-backend branch from 11ca7f3 to 7d4722c Compare November 12, 2026 05:24
@freshtonic
freshtonic removed this pull request from stack #1623 November 12, 2026 05:28
@freshtonic

Copy link
Copy Markdown
Contributor Author

Replaced by #1625, in the new stack #1633. The code is the same, rebased onto the latest next. The ADRs are now ADR-0013 and ADR-0014, and the text about the wrapped data key mode is removed.

@freshtonic freshtonic closed this Nov 12, 2026
@freshtonic
freshtonic deleted the james/cip-5306-keyset-records-the-two-key-modes-and-the-static-key-backend branch November 12, 2026 05:52
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