Skip to content

Bindings: remove the TypeScript, Go and EQL workarounds for the engine, so every SDK can store a UUID #1992

Done

Description

@coderdan

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 in vitaminc-aead.
  • Each index says which types it takes.
  • OwnedFrame and Frame are 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_uuid and the recipher_js::uuid code (crate/src/value.rs, crate/src/cipher.rs, crate/src/engine_tests.rs). is_uuid classifies a value to explain an engine refusal that no longer happens. OneValue wraps the engine's value to satisfy a trait.
  • Go: the guest parses each plaintext input with Frame::parse itself (guest/src/ops.rs, checked_plaintext and the function after it), before it calls the engine.
  • EQL: the Plaintext trait 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 with ValueKind.

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

  1. TypeScript: delete OneValue, is_uuid and the recipher_js::uuid code. 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.
  2. 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.
  3. EQL: the Plaintext trait and the generated code use vitaminc_aead::plaintext::ValueKind (re-exported by stack-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.
  4. 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.
  5. No stored bytes change. The pinned fixtures and conformance cases pass unchanged.

Relationship to other work

Activity

  1. added
    Rust
    on Nov 27, 2026
  2. coderdan commented on Nov 27, 2026

    @coderdan
    ContributorAuthor

    Scope correction for the TypeScript and Go parts.

    This issue now covers the EQL part and the UUID check for Rust and Go.

  3. self-assigned this
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

RustSDK

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions