Repository navigation
Description
Background
Stack Encrypt (the Rust crate stack-encrypt) encrypts values. The language SDKs reach it through stack_encrypt::dynamic, the part of the crate for values whose type is known only at run time. The Go SDK uses it through its WASI guest, and the TypeScript SDK @cipherstash/recipher uses it through its Node addon.
A value enters dynamic as a frame: vitaminc's transport encoding of one value, which a binding writes from its own language's value. dynamic::ValueFrame holds one frame and admits only the types in the engine's value model. The model is a subset of what a frame can carry.
vitaminc, the library below the engine, has a UUID type: the logical type Logical::Uuid over 16 bytes, with a sealed leaf of its own and the value type vitaminc_aead::Uuid.
Problem
The value model has no UUID, so no SDK can encrypt one, although vitaminc and the engine's static Rust path both can.
Verified on next with a small program against the engine (stack-encrypt with dynamic and vitaminc-aead's uuid feature):
keyset.encrypt(vitaminc_aead::Uuid::new(id))works, and decrypting it asvitaminc_aead::Uuidgives the UUID back. Decrypting it as aStringor as bytes is refused: "the ciphertext opened, but it does not hold a value of the type string". So the sealed leaf records that the value is a UUID.vitaminc_aead::to_frameof the same UUID gives a valid frame: the logical-type envelope0xF3, the UUID's id and parameter, then 16 bytes.ValueFrame::ofof that frame is refused: "expected a null, bool, integer, float, string, bytes, date, timestamp or decimal in range".
Where the model is defined:
modelandmodel_nullinpackages/stack-encrypt/src/dynamic/value_frame.rsadmit a date, a decimal and a timestamp, and nothing else with a logical type.scalar_kindin the same file, andValueKindindynamic/kind.rs, have no UUID kind, so a plan field cannot declare one.- The test
what_the_model_does_not_hold_is_refusedasserts that a UUID is refused.
The model took its current shape when #1144 added dates, timestamps, decimals and every integer width. UUID was not part of #1144, and no reason for leaving it out is recorded, so this looks like an omission rather than a decision. dynamic/term.rs already mentions UUIDs when it says how equality terms treat each type.
Impact: a UUID is a common column type, such as a user ID or an external reference. Today an SDK user has to encrypt it as text, which stores a different leaf, decrypts as a string, and does not match a UUID encrypted from Rust. The TypeScript SDK refuses a VcUuid with recipher::uuid and tells the user to encrypt its text. The Go SDK has no UUID kind at all.
Proposal
- Add a UUID to the value model:
ValueKind::Uuid("uuid"in a plan), admitted bymodelandmodel_nullasLogical::Uuidover 16 bytes. A typed null for a UUID field is padded to the UUID's length, as other fixed-width nulls are. - Say which indexes a UUID field takes. Equality is the obvious one. Match and order terms over a UUID should be refused when the plan is built, with an error that names the field.
- Add UUID cases to the conformance corpus (
conformance/stack-encrypt/v1), including the equality term, so that Rust, Go and TypeScript agree on the bytes. - Then each SDK adds it: the TypeScript SDK stops refusing a
VcUuid(and dropsrecipher::uuid), and the Go SDK gains a UUID kind inrecord.Kind,gensupportandstashgen.
Relationship to other work
- Go SDK:
int16is widened toInt32, and there's no way to encrypt a date, timestamp, decimal or 128-bit integer #1144 added the other value kinds the same way. @cipherstash/recipherencrypts a string only — add every value type, arrays and JSON documents #1812 is the TypeScript value-type work that found this.
Activity
docs(plans): opaque needs a storage-blob converter, not an engine change
docs(plans): opaque needs a storage-blob converter, not an engine change
docs(plans): opaque needs a storage-blob converter, not an engine change
feat(stack-encrypt): encrypt a UUID as a UUID with value::Uuid
feat(stack-encrypt): encrypt a UUID as a UUID with value::Uuid
feat(stack-encrypt): encrypt a UUID as a UUID with value::Uuid
coderdan commentedon Nov 27, 2026
Where a UUID stands in each SDK:
dynamic::record): stores, queries by equality and reads a UUID.stashgenmaps no Go type to a UUID. Tracked in Go SDK: stashgen cannot declare a UUID field, so generated code cannot store a UUID #1994.nextencrypts strings only. The values and records pull requests (feat(recipher-js): every value type, arrays and JSON documents #1775, feat(recipher-js): records through the engine's Planned #1776) still refuse a UUID withrecipher_js::uuid. They need to drop that code and add a test that stores, queries and reads one.This issue stays open until #1994 and the TypeScript part are done.
fix(conformance): let an update refresh a frozen ciphertext
fix(conformance): check the UUID record path in every build