Repository navigation
Description
Background
Stack Encrypt is the Rust engine in packages/stack-encrypt. Three bindings call it: the TypeScript addon (languages/typescript/packages/recipher-js), the Go guest (languages/golang/encrypt/guest, a WebAssembly module the Go SDK runs), and EQL's Rust bindings (packages/eql/crates/eql-bindings, with code generated by eql-codegen).
Each binding grew code to work around the engine: a type the engine refused, a wrapper it needed, or its own list of type names. Steps 2.2 to 2.5 of docs/plans/2026-11-14-move-vitaminc-aead-into-the-stack.md removed the causes:
ValueKind, with its names, is defined once invitaminc-aead.- Each index says which types it takes.
OwnedFrameandFrameare the engine's value types.- A write converts a value to its declared type.
This is step 2.6 (tracking issue #1831).
Problem
The workarounds are still in the bindings:
- TypeScript:
OneValue,is_uuidand therecipher_js::uuidcode (crate/src/value.rs,crate/src/cipher.rs,crate/src/engine_tests.rs).is_uuidclassifies a value to explain an engine refusal that no longer happens.OneValuewraps the engine's value to satisfy a trait. - Go: the guest parses each plaintext input with
Frame::parseitself (guest/src/ops.rs,checked_plaintextand the function after it), before it calls the engine. - EQL: the
Plaintexttrait and the generated code (eql-bindings/src/encryption/targets.rs,eql-codegen/src/targets.rs,eql-codegen/src/bindings.rs) name value types their own way, not withValueKind.
Each copy can drift from the engine. #1821 records the cost: an SDK could not encrypt a UUID because one copy left it out.
Proposal
- TypeScript: delete
OneValue,is_uuidand therecipher_js::uuidcode. Pass the bridge's frame to the engine as it is, and let the engine's refusal reach the caller with its own reason. Keep a test that a UUID is written and read through the addon. - Go: stop parsing frames in the guest where the engine already parses or checks the same bytes, so a malformed frame is refused in one place. If the guest needs the parse (for example, to refuse a malformed frame before any key is requested, or to give the Go SDK its "not a frame" error), keep it, and write down why in a comment.
- EQL: the
Plaintexttrait and the generated code usevitaminc_aead::plaintext::ValueKind(re-exported bystack-encrypt) for a type and its name. Generated code is regenerated, and the drift checks (mise run types:check,cargo test -p eql-codegen) pass. - UUID: check that a UUID field can be written, queried by equality and read through each SDK, and close stack-encrypt: the dynamic value model refuses a UUID, so no SDK can encrypt one — add it #1821 with this pull request. If anything still refuses a UUID, fix it here.
- No stored bytes change. The pinned fixtures and conformance cases pass unchanged.
Relationship to other work
- Closes stack-encrypt: the dynamic value model refuses a UUID, so no SDK can encrypt one — add it #1821 if every SDK can store a UUID.
- Step 3 of the plan, moving the Go packages, follows this.
Activity
coderdan commentedon Nov 27, 2026
Scope correction for the TypeScript and Go parts.
next, the addon has onlyOneValue.is_uuidand therecipher_js::uuidcode are on the open pull requests feat(recipher-js): every value type, arrays and JSON documents #1775 and feat(recipher-js): records through the engine's Planned #1776, so they are removed there when those are rebased.OneValuestays onnextfor now. The addon's string-onlyencryptgoes through the engine's opaque scalar path, which needs aScalar, and anOwnedFrameis not one.Frame::parse. It is the only way to build aFramefrom the host's bytes, and it gives the Go SDK its "not a frame" error before any key is requested.This issue now covers the EQL part and the UUID check for Rust and Go.