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. Done in refactor(stack-encrypt)!: each index says which kinds it takes; add the uuid kind #1929.
- Stack Encrypt wraps a frame in its own ValueFrame type — let the AEAD crates provide the owned frame, and rename the frame crate recipher-frame #1955 Stage 2.4: the AEAD crates provide the owned value. Replaces
ValueFrame. Rename "frame" here. Done in refactor(stack-encrypt)!: the AEAD crates provide the owned frame; rename the frame crate recipher-frame #1959. - stack-encrypt: convert a value to its declared type on a write, as on a query, and refuse
undefinedon a typed field #1990 Stage 2.5: one place converts a value to its declared type, on a write as on a query. Done in feat(stack-encrypt): convert a typed field's value to its declared type on a write, and refuse undefined #1991. - Bindings: remove the TypeScript, Go and EQL workarounds for the engine, so every SDK can store a UUID #1992 Stage 2.6: the bridges and the SDKs drop their workarounds. Done in refactor(eql-bindings)!: name a target's plaintext with ValueKind; keep the Go guest's frame parse in one helper #1995. stack-encrypt: the dynamic value model refuses a UUID, so no SDK can encrypt one — add it #1821 stays open until the UUID work in feat(recipher-js): encrypt a VcUuid as the engine's UUID #1996 (TypeScript) and feat(golang): stashgen stores a UUID field #1997 (Go) merges.
- refactor(go)!: move vitaminc's vcffi and vcvalue into the module as encrypt/frame and encrypt/value #2003 Stage 3: move vitaminc's Go packages
vcffiandvcvalueinto the Go module, as the public packagesencrypt/frameandencrypt/value. Before the Go SDK's final release. - chore(go): remove the Go bindings, now that the Go SDK has its own copies vitaminc#646 Stage 3, in vitaminc: delete
bindings/go:vcffi,vcvalue, andvcencryptwith its guest. The differential fuzzers move to the Go guest in Go SDK: fuzz the Go frame codec against the guest's Rust codec, as vitaminc's differential fuzzers did #2004. - stack-encrypt: turn on vitaminc's uuid feature so Rust can encrypt a UUID #1833
stack-encryptturns on vitaminc'suuidfeature (Rust only). - For each crate on crates.io that depends on
vitaminc-aead(vitaminc-normalize,-prf,-ore,-encrypt, thevitamincumbrella crate,clww-oreandore-rs), decide whether it moves here or is released againstrecipher-aead. The rename waits on this. - Rename
vitaminc-aeadtorecipher-aead, andstack-encrypttorecipher. - Decide what becomes of
vitaminc-aead-derive: the intent is to remove it and move its derives, changed as needed, intorecipher-derive. Open question 2 in the plan (docs(plans): publish the AEAD crates as recipher-aead, with recipher, not under vitaminc's names #2041). - Publish
recipherwithrecipher-aead,recipher-frameand the derive crate or crates the open question leaves. Nothing is published before then (docs(plans): publish the AEAD crates as recipher-aead, with recipher, not under vitaminc's names #2041 updates the plan). - 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
- The AEAD crates are published with
recipher, under new names (2 December).vitaminc-aeadis not published again under that name. It is renamedrecipher-aead, and is published only whenstack-encryptis, asrecipher. So there is no furtherstack-encryptrelease, and an EQL release with itsstack-encryptfeature waits forrecipher. This replaces "publish the three crates under the same names, before the nextstack-encryptrelease". - 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 records (feat(recipher-js): records through the engine's Planned #1776), 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). Done: feat(recipher-js): every value type, arrays and JSON documents #1775, feat(stack-encrypt): add dynamic::ScalarFrame to seal one runtime-typed value with keyset.encrypt #1827 and spike(recipher-js): the value bridge declares its own TypeScript types #1829.
- 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.
docs(plans): ask what becomes of vitaminc-aead-derive, rather than re…