Skip to content

refactor(guest): hold no key vendor backend as None, not a fake one - #1560

Draft
freshtonic wants to merge 1 commit into
james/auth-keyset-vendor-namesfrom
james/guest-vendor-option
Draft

freshtonic wants to merge 1 commit into
james/auth-keyset-vendor-namesfrom
james/guest-vendor-option

Conversation

@freshtonic

Copy link
Copy Markdown
Contributor

Summary

The Go guest (the WebAssembly module that does the encryption for the Go SDK) used a fake vendor, GuestVendor::None, when no key vendor backend was set. It said its vendor was Static and failed every call. It was an Option in disguise. This PR uses a real Option.

No routing behaviour changes: with no vendor, every request goes to ZeroKMS, as before.

Changes

  • stack-kms-vendor: KeyRouter holds Option<VendorKeySource<B>>. New KeyRouter::zerokms_only. KeyRouter::vendor() returns an Option (an API change, unpublished). New router test for the no-vendor case.
  • Go guest: GuestVendor::None and no_vendor() are gone. The guest builds a vendor key source only when the config names a backend. A config with no ZeroKMS key and no backend (which already cannot parse) is refused explicitly.
  • Changeset: @cipherstash/auth patch.

Verification

Run on the top branch of this stack (james/kms-vendor-dispatch), on macOS:

  • cargo fmt --all --check and cargo clippy --workspace --all-features --all-targets -- -D warnings: pass.
  • mise x --env test -- cargo nextest run --workspace --all-features: 1401 of 1402 pass. The one failure is stack-encrypt::ui derive_diagnostics (trybuild). It fails on every snapshot because of a local rustc wrapper that changes the paths in the compiler output. This stack does not touch stack-encrypt. CI is the check for it.
  • mise run wasm:guest:test: 80 of 80 pass.
  • All four Go guests rebuilt, then go vet ./... and go test -count=1 ./... in languages/golang: pass.
  • pnpm --filter @cipherstash/auth test: 92 pass. pnpm --filter stash test: 1667 pass.
  • Biome on the changed TypeScript and script files: no errors.
  • cargo check of the workspace and the guest (native and wasm32-wasip1) on each branch of the stack: pass.

Related

Refs #1541. Code-smell follow-up to the key vendor backend stack.

GuestVendor::None was a vendor that was not there. It said its vendor
was Static, it offered no key mode, and every call failed. It existed
only because KeyRouter needed a vendor, even for a client with none.

KeyRouter now holds an Option of the vendor key source.
KeyRouter::zerokms_only makes a router with no vendor, and it sends
every request to ZeroKMS. KeyRouter::vendor returns an Option.

The guest builds a vendor key source only when the config names a
backend, and picks new or zerokms_only from that. GuestVendor has no
None variant, and the dispatch has no arm for it. A config with no
ZeroKMS key and no backend does not parse, and cipher_init refuses it
again rather than build a client with no key source.

The routing does not change: with no vendor, every request went to
ZeroKMS before, and it does now. A new router test shows it.
@coderabbitai

coderabbitai Bot commented Nov 6, 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

@changeset-bot

changeset-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d10c9dc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
@cipherstash/auth Patch
stash Patch
@cipherstash/stack Patch
@cipherstash/wizard Patch
@cipherstash/ffi-integration-tests Patch
@cipherstash/basic-example Patch
@cipherstash/e2e Patch
@cipherstash/bench Patch
@cipherstash/stack-drizzle Patch
@cipherstash/stack-prisma Patch
@cipherstash/stack-supabase Patch
@cipherstash/test-kit Patch
@cipherstash/prisma-example Patch
@cipherstash/auth-darwin-arm64 Patch
@cipherstash/auth-darwin-x64 Patch
@cipherstash/auth-linux-arm64-gnu Patch
@cipherstash/auth-linux-x64-gnu Patch
@cipherstash/auth-linux-x64-musl Patch
@cipherstash/auth-win32-x64-msvc Patch

Not sure what this means? Click here to learn what changesets are.

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

@freshtonic
freshtonic added this pull request to stack #1523 November 6, 2026 11:25

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