Repository navigation
Description
Background
Stack Encrypt (the Rust crate stack-encrypt) seals values with vitaminc, CipherStash's cryptography library, which lives in cipherstash/vitaminc. vitaminc's AEAD crates (AEAD: authenticated encryption with associated data) define the value types, how each is encoded, and how a value is sealed. The language SDKs (Go, TypeScript) reach the engine through stack_encrypt::dynamic.
Problem
The list of value types is written down in vitaminc, written again in the engine (ValueKind, the allow-list in ValueFrame), and reconciled a third time in each language SDK. The copies disagree. A UUID is read by the JavaScript bridge and refused by the engine (#1821). A JavaScript Date is written in milliseconds and rewritten to nanoseconds by the engine. An integer is converted to its declared type by Go, refused by the engine on a write, and sent at its narrowest width by the JavaScript bridge.
Work on the TypeScript SDK stops until this is fixed.
Proposal
Follow the plan in docs/plans/2026-11-14-move-vitaminc-aead-into-the-stack.md (#1717). This issue tracks its steps. Each step gets its own issue when work starts, sized to one pull request.
- Pin the bytes of every stored and wire format of a value before vitaminc's AEAD crates move #1832 Stage 0: pin the bytes of every stored and wire format of a value, before any code moves.
- Import vitaminc-aead, -aead-frame and -aead-derive into the stack with their history #1836, Run vitaminc's checks on the imported AEAD crates in this repository's CI #1837 Stage 1: move
vitaminc-aead,vitaminc-aead-frameandvitaminc-aead-deriveinto this repository, with their history and no change in behaviour. - Seal every timestamp in nanoseconds in vitaminc-aead, not by the engine's rewrite #1846 Stage 2.1: one canonical form for a timestamp, in the AEAD crates.
- One type description with its name in vitaminc-aead, replacing the engine's ValueKind #1907 Stage 2.2: one description of a type, with its name, in the AEAD crates. Replaces
ValueKind. - Each index says which value kinds it takes; delete the engine's allow-list #1918 Stage 2.3: each index says which types it takes. Replaces the engine's allow-list.
- Stage 2.4: the AEAD crates provide the owned value. Replaces
ValueFrame. Rename "frame" here. - Stage 2.5: one place converts a value to its declared type, on a write as on a query.
- Stage 2.6: the bridges and the SDKs drop their workarounds. Closes stack-encrypt: the dynamic value model refuses a UUID, so no SDK can encrypt one — add it #1821.
- Stage 3: move vitaminc's Go packages
vcffiandvcvalueinto the Go module, and deletevcencrypt. Before the Go SDK's final release. - stack-encrypt: turn on vitaminc's uuid feature so Rust can encrypt a UUID #1833
stack-encryptturns on vitaminc'suuidfeature (Rust only). - Publish the three crates from this repository, before the next
stack-encryptrelease. - Delete the three crates from vitaminc, once everything here is settled.
No stored format changes. A change to stored bytes is a defect.
Decisions recorded since the plan merged
- An order index takes no UUID.
stack-encryptdoes not turn onvitaminc-ore'suuidfeature, and nothing in the workspace does today. Ifvitaminc-oremoves into this repository, itsuuidfeature, and the UUID order target behind it, are removed. Until then, stage 2.3 refuses a UUID in the engine's order index. - An order index takes no bytes.
vitaminc-orehas a bytes order target that is not behind a feature, andstack-encryptnames no bytes target today. Ifvitaminc-oremoves into this repository, the bytes order target is removed. Until then, stage 2.3 refuses bytes in the engine's order index.
Relationship to other work
- Waiting on this: the TypeScript SDK (feat(recipher-js): every value type, arrays and JSON documents #1775, feat(recipher-js): records through the engine's Planned #1776, spike(recipher-js): the value bridge declares its own TypeScript types #1829),
ScalarFrame(feat(stack-encrypt): add dynamic::ScalarFrame to seal one runtime-typed value with keyset.encrypt #1827), the language integration guide (docs(stack-encrypt): the value model, nulls, opaque values and error codes in the language integration guide #1828) and the UUID fix (stack-encrypt: the dynamic value model refuses a UUID, so no SDK can encrypt one — add it #1821). - vitaminc issues to move with the code: aead-frame: only a Rust
Serializecan write a storage blob, and version 1 has no dates or UUIDs — add a frame-to-storage converter vitaminc#643, aead-frame: ship the conformance corpus in the crate and fill its gaps; remove the Go bindings once Stack has its own vitaminc#473 andvitaminc-aead-napihas no WebAssembly counterpart, so awasm-bindgenbuild must copy the JavaScript value mapping — addvitaminc-aead-wasmvitaminc#632.
Activity
coderdan commentedon Nov 27, 2026
Step 2.5 is #1990.
coderdan commentedon Nov 27, 2026
Step 2.6 is #1992.