Skip to content

docs(plans): the TypeScript SDK on Stack Encrypt, a core with EQL as an extension - #1747

Merged
coderdan merged 22 commits into
nextfrom
docs/typescript-sdk-plan
Nov 25, 2026
Merged

coderdan merged 22 commits into
nextfrom
docs/typescript-sdk-plan

Conversation

@coderdan

@coderdan coderdan commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1809.

Summary

A plan for the TypeScript SDK on Stack Encrypt, CipherStash's Rust encryption engine. Today only Go uses the engine.

The SDK is one new npm package and an addition to an existing one, split the way Rust splits stack-encrypt from eql-bindings:

  • @cipherstash/recipher, the core. It encrypts a value, a file, a whole object and a record, and derives search terms. It names no EQL type and needs no database.
  • @cipherstash/eql/recipher, an extension. @cipherstash/eql exists and holds EQL's wire types, schemas and SQL. Its new entry adds the EQL v4 types (the JSON a CipherStash-enabled PostgreSQL column stores) to the core, so a record's fields can be stored in PostgreSQL and queried there.

The plan also moves the Drizzle, Supabase and Prisma Next adapters, and the DynamoDB integration, onto them. They wait for recipher-compat, the planned crate that reads EQL v3 and v2, so no customer upgrades into rows they cannot read.

The work is in three phases, so it can start before the engine has the context design of ADR-0016 (#1772):

  1. Now: everything that needs no context from the caller. The core first, then the EQL extension, then a pre-release of both on npm.
  2. When the engine has ADR-0016's named parts: labels and partitions, a value with a context, and the policies the engine and ZeroKMS have.
  3. After the issues that change stored bytes: refinements and the first stable release. Then, when recipher-compat exists, the adapters.

Nothing is built. This pull request adds one document.

Changes

  • docs/plans/2026-11-22-recipher-typescript-sdk.md, which covers:
    • The core: in the order the engine's own documentation teaches it. Plain encryption of a value with no context, then a value with a context, a file and a whole object, a record, and search terms. The words are the engine's: encrypt, index, passthrough, opaque, Cipher, Keyset.
    • The EQL extension: an EQL v4 type is a field's target in a core record, through the core's calls. The types are generated from the EQL catalog. A record that names an EQL type does not compile against a cipher built without the extension.
    • Bindings: a napi-rs extension for Node.js, and the same Rust built for wasm32-unknown-unknown with wasm-bindgen for edge runtimes. The core's builds hold no EQL code. @cipherstash/eql ships builds that link eql-bindings' resolver, as Go's encrypt/eql guest does. Its root, ./schema and ./sql entries load no native build.
    • One Rust crate, recipher-js, the Node addon. Cipher, Keyset and Ciphertext are napi classes written in Rust, and napi-rs generates their TypeScript types. TypeScript keeps only Result, the declaration types and the typed signatures. A common crate is split off when the wasm build needs one. The engine crate itself is to be renamed recipher.
    • Phases: what each phase builds and what it waits for. Phase 1 waits for nothing. For each engine issue that is still open (stack-encrypt refactor: finalize crate ownership, naming and coordinated migration #1489, stack-encrypt: bindings send a serialised Planned, and the conformance corpus is written as one #1594, stack-encrypt: a dynamic plan holds its indexes as a free list — add the closed FieldIndexes shape #1672, stack-encrypt: match options are a fixed struct — add one analyzer pipeline for Rust, Go and EQL #1673, stack-encrypt conformance: declarations, requests and responses have no JSON Schema and no protocol version #1678), the plan says which part of phase 1 changes when it lands. The core crate names no Label, so stack-encrypt: the context path type Label is still public, and the Go guest takes a context as path text — remove Label and IntoLabel #1663 removes it without a change to the SDK.
    • Values: converted by vitaminc's vitaminc-aead-napi, with vitaminc's mapping: a number is a float, a bigint an integer, a Date a timestamp, and VcDate, VcTimestamp, VcDecimal and VcUuid are the types JavaScript lacks. The wasm build needs the same mapping, which vitaminc does not have yet.
    • The rest of the SDK: credentials (a forgotten per-call credential is a type error), errors, plaintext hygiene, cancellation, the conformance runners, and packaging modelled on @cipherstash/auth.
    • The adapters: each takes a new major version. This needs recipher-compat, and EQL v4 installable through stash eql install, which it is not yet.
    • EQL v3 and v2: out of scope. recipher-compat, the planned crate for them, would arrive as another extension.
    • Context: the TypeScript form of ADR-0016. The built-in parts are functions (tenantId, recordId, forSub, notAfter and the rest) with the engine's wire names. A record lists its parts or reads one from a field, keyset.with(..) carries them, and a query takes partitions only.
    • Results: no call throws. Every call resolves to a Result<T, RecipherError> with Rust's combinators.
    • Decisions: none is open. The ones taken on 2026-11-23 are listed in the plan.

Review feedback taken

  • The examples no longer start with a database table. The core has its own sections, and EQL has one section after them.
  • The core is decoupled from EQL: separate builds, and a test that the core links no eql-bindings. The extension lives in @cipherstash/eql.
  • The core has plain encryption with no context, as the engine's keyset.encrypt(value) has. Go SDK: a value cannot be encrypted without a context, or without a struct — add plain Encrypt and Decrypt on Cipher #1771 asks the same of the Go SDK.
  • A value's TypeScript type picks how it is encrypted: keyset.encrypt("a secret message"). No call names a kind; only a record field does.
  • The first example encrypts one string. An array in is an array out, through the same call, in one request.
  • Calls return a Result and never throw. Result is the core's own type with Rust's Result methods. unwrap() and expect() are the only way to get an exception.
  • Value conversion is vitaminc-aead-napi's, not the SDK's own.
  • The core and EQL are released apart. A build reports a binding interface number, so several EQL versions work with one core.
  • A JSON integer outside JavaScript's safe range is a bigint, so the eql-json-v1 case with 18446744073709551615 round-trips.
  • An EQL record has no context field, because the engine refuses one. It takes a tenant as a scope from the caller.
  • decryptField covers Prisma Next's reads of one column.
  • The wasm build promises to wipe the buffers a finished call owned, not all of linear memory.

Verification

Claims the plan depends on were run or read on next:

Read in cipherstash/vitaminc at 222f1ad39: vitaminc-aead-napi is a Rust library for a Node addon on napi-rs 3, with no wasm counterpart.

Not checked, and listed in the plan: that the engine's pending calls are Send for napi-rs, that a binding can reach OpaqueBlob's format, that the engine opens one field of a stored row alone, the largest value one call can seal, the size of each wasm build, how @cipherstash/eql declares its platform packages so the SQL entries install no native build, napi addons under Bun and Deno, and whether PostgREST can write the EQL v4 query casts.

No package changes, so no changeset.

Related

Refs #1479 (the TypeScript conformance runner, which the plan includes).

Review notes

  • Read "The core" and "The EQL extension" first. They hold the API shape.
  • Integers are a bigint in the core at every width, as in vitaminc. An adapter converts for an ORM whose integer columns are a number.
  • The wasm build needs vitaminc's mapping over wasm-bindgen. vitaminc-aead-napi has no WebAssembly counterpart, so a wasm-bindgen build must copy the JavaScript value mapping — add vitaminc-aead-wasm vitaminc#632 asks for it; the wasm crate holds it until then.
  • "Phases" is the section to check against milestone priorities.
  • "Context" gives parts to the keyset with keyset.with(..), as Go's Cipher.With does, not to each call. Rust passes them to each call. Check that this is the form you want.
  • Phase 1 has no .withContext. It writes only the two forms ADR-0016 says keep their stored bytes.

@changeset-bot

changeset-bot Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9cfbfdc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI; Enforced overrides: Organization
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bb08859c-49fa-45a8-82e8-07059fa1d3c0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The plan’s JSON representation risks corrupting large integers, and its EQL scoping and Prisma projected-read contracts remain incompatible with existing engine behavior.

4 open issues
What changed in this PR

Proposes @cipherstash/recipher, a TypeScript SDK on the Stack Encrypt engine, and a path for moving the existing database adapters to EQL v4. This PR adds a design document only; no implementation or package changes are included.

Changes:

  • Defines native Node.js and WebAssembly backends, typed declarations, operations and value handling.
  • Plans conformance coverage, packaging, release steps and engine prerequisites.
  • Outlines adapter migrations and open decisions about legacy data, timestamps and DynamoDB.
File Description
docs/​plans/​2026-11-22-recipher-typescript-sdk.md Adds the SDK architecture, API proposal, verification notes and staged delivery plan.

Review effort: Balanced

@coderdan coderdan changed the title docs(plans): @cipherstash/recipher, the TypeScript SDK on Stack Encrypt docs(plans): the TypeScript SDK on Stack Encrypt, a core with EQL as an extension Nov 23, 2026
@coderdan
coderdan added this pull request to stack #1789 November 24, 2026 05:17
@coderdan
coderdan removed this pull request from stack #1789 November 24, 2026 12:45
@coderdan
coderdan added this pull request to stack #1817 November 24, 2026 12:46
@coderdan coderdan closed this Nov 25, 2026
@coderdan coderdan reopened this Nov 25, 2026
@coderdan
coderdan force-pushed the docs/typescript-sdk-plan branch from dfdc959 to ceb6cb6 Compare November 25, 2026 08:21
A plan for @cipherstash/recipher: a napi-rs extension for Node.js and
the same Rust built for wasm32-unknown-unknown with wasm-bindgen for
edge runtimes, both running every operation through dynamic::Planned.
EQL v4 only.

It covers the milestone issues that must land first, the declaration
and its compile-time checks from the EQL catalog, columns named by
table and column name (as the Drizzle, Supabase and Prisma Next
adapters already name them), values, credentials, errors, plaintext
hygiene, cancellation, the conformance runners, packaging after
@cipherstash/auth, moving the three adapters onto it in a new major
each, and the order of work. Three decisions are open: data the
current adapters wrote, the date and time types, and DynamoDB.
The engine crate is to be renamed recipher, so the TypeScript SDK's
Rust crates are recipher-js, recipher-js-node and recipher-js-wasm, in
languages/typescript/packages/recipher-js. The npm package stays
@cipherstash/recipher.
recipher-compat is planned to read and write EQL v3 and v2. The plan
does not design it, but keeps the EQL version in a column's type, builds
the EQL resolver in one place, and has adapters take casts from a query
term's domain, so recipher-compat needs no new call shape. Decision 1
now asks whether the adapters' new majors wait for it.
The engine issues the plan waited for are mostly still open, and the
design of contexts and labels is taking time. Phase 1 starts now and
builds everything that needs no context from the caller. Phase 2 adds
scopes, bindings, context fields and the expected context once #1663 is
closed and the context design is settled. Phase 3 is the stable release
and the adapters, after the issues that change stored bytes.

Phase 1 values are encrypted under the table and column name only, and
the core crate names no Label, so #1663 removes it without a change
here. The plan now lists what each open issue changes when it lands,
and asks whether phase 1 publishes a pre-release.
The plan followed the old stack library: one package, declared as
database tables of EQL types. Stack Encrypt is a general-purpose engine,
and eql-bindings adds the EQL types to it. The TypeScript SDK now has
the same split.

@cipherstash/recipher is the core. It encrypts a value, a file, a whole
object and a record, and derives search terms, in the order the engine's
own documentation teaches them. It names no EQL type and needs no
database. @cipherstash/recipher-eql is an extension: an EQL v4 type is a
field's target in a core record, through the core's calls. Its builds
link eql-bindings' resolver, as Go's encrypt/eql guest does.

Also from review: a JSON integer outside the safe range is a bigint, an
EQL record takes no context field, decryptField covers a projected
column, and the wasm wipe promise covers one call's own buffers.
The EQL extension is an entry of @cipherstash/eql,
@cipherstash/eql/recipher, not a new package. The package's root,
schema and SQL entries load no native build.

The core has plain encryption with no context, as the engine's
keyset.encrypt(value) has: a kind used alone is the declaration. A value
with a context is value(kind, { context }).

The adapters' new majors, and DynamoDB after them, wait for
recipher-compat, so no customer upgrades into rows they cannot read.
Dates and timestamps are a Date for now, and a finer timestamp opens
truncated to the millisecond.

Two decisions stay open: a pre-release after phase 1, and where the EQL
builds are published.
From review of the TypeScript SDK plan.

A value's TypeScript type picks how it is encrypted, so the plain call
is keyset.encrypt("a secret message"). A kind is named only to choose
another encoding, as kinds.int32(36), and in a record field.

One value returns one result. An array is a batch in one request.

No call throws and no promise rejects. Every call resolves to a
Result<T, RecipherError> with Rust's combinators; unwrap() is the only
way to get an exception.

The core and EQL are released apart. A build reports a binding interface
number, and Cipher.create refuses another, so several EQL versions work
with one core. That closes the decision on where the EQL builds are
published.
From review of the TypeScript SDK plan.

The node crate converts JavaScript values with vitaminc's napi bridge
(JsRef, JsBuilder, Wrappers) and holds no conversion of its own. The
mapping is vitaminc's: a number is a float, a bigint an integer at the
narrowest width, a Date a millisecond timestamp, and VcDate, VcTimestamp,
VcDecimal and VcUuid are the types JavaScript lacks. A timestamp finer
than a millisecond opens as a VcTimestamp, so nothing is truncated. The
wasm crate needs the same mapping, which vitaminc does not have yet.

The first example encrypts one string. An array is its own section: an
array in is an array out, through the same call, so principle 5 holds
and is not amended.

Result is the core's own type with Rust's Result methods.
The core keeps vitaminc's one mapping, so an integer field is a bigint
at every width. An adapter converts for an ORM whose integer columns are
a number, because it knows the column's type.

The wasm build's mapping belongs in vitaminc, which has no wasm-bindgen
bridge: cipherstash/vitaminc#632 asks for one. vcffi is the Go transport
into a WASI guest and does not apply.
The release jobs, the platform packages and trusted publishing move into
phase 1, as step 10. Both packages are published under a pre-release
version and tag, with no promise that a later version opens their stored
values. The stable release stays in phase 3. No decision is open.
ADR-0016 (PR #1772) decides that a context is a field path and named
parts: policies, labels and partitions, with one wire name each. The
plan takes its words, its wire names and its rules, and gives the
TypeScript form: the built-in parts as functions, parts listed on a
record or read from a field, keyset.with(..) to carry them, and
.partition(..) on a query. A bare value in .withContext is a note.

Phase 2 now waits for the engine to have named parts, not for a design.
Phase 1 writes only values with no parts, which are the two forms the
ADR says keep their stored bytes, so .withContext moves to phase 2.
Refinements are in phase 3, with #1567.
From review of #1774.

The SDK has one Rust crate, the Node addon. The split into a core crate
and a thin node crate had one consumer, and the core mostly re-wrapped
engine types. A common crate is split off when the wasm build exists and
what the two builds share can be seen.

Cipher, Keyset and Ciphertext are napi classes written in Rust, and
napi-rs generates their types. TypeScript keeps only what Rust cannot
express: Result, the declaration types and the typed signatures. There
is no hand-written description of the native interface.

The crate uses the engine's and vitaminc's types directly, and derives
OpaqueDebug for a type that holds a secret. The plan no longer takes the
Python SDK as an example.
The bridge between JavaScript values and the engine was copied in from
vitaminc as an unpublished crate. Its refusals are typed diagnostics with
recipher:: codes, and the wasm mapping belongs beside it here.
The context design is settled, so the test that held the crate clear of
Label and IntoLabel was removed in review, and the rule goes with it.
opaque and UUID wait on the engine: nothing writes a frame in the storage
profile, and the dynamic value model has no UUID. The engine's futures
are Send, one field opens alone, and a scalar's bytes name its type. The
two crates get the checks #1797 lists.
An OpaqueBlob is its storage blob sealed as bytes, so the SDK writes the
blob from a JavaScript value as Go's MarshalStorage does (#1822). UUID
waits on the engine's value model (#1821).
@coderdan
coderdan force-pushed the docs/typescript-sdk-plan branch from ceb6cb6 to 9cfbfdc Compare November 25, 2026 08:38
@coderdan
coderdan marked this pull request as ready for review November 25, 2026 08:43
@coderdan
coderdan requested a review from a team as a code owner November 25, 2026 08:43
@coderdan
coderdan merged commit a7a71a8 into next Nov 25, 2026
24 checks passed
@coderdan
coderdan deleted the docs/typescript-sdk-plan branch November 25, 2026 08:44

@cipherstash-agent cipherstash-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review attestation

Reviewed 9cfbfdc · posted from Claude Code · claude-opus-5-5 · effort medium
Sources: rust-security · claude-opus-5-5; code-review (manual) · claude-opus-5-5; mattpocock code-review · claude-opus-5-5
Skills: code-review (loaded, but it reviewed the wrong target; the delegate reviewed by hand), company-skills:rust-security, mattpocock-skills:code-review, company-skills:review-cross-check

Every finding was checked against 9cfbfdc and cross-checked against the existing threads, and none repeats one. This PR merged while the review ran.

Findings (23): 10 major, 13 minor. 22 inline, 1 below.

  • general minor The PR description lists VcUuid among the bridge's types, but the plan refuses it with recipher::uuid until #1821 (586, 594-597). Its "Not checked" list also still names three items the plan records as found (1160-1175).

Source: mattpocock code-review · claude-opus-5-5


Generated by Claude Code

Comment on lines +723 to +725
- **Testing without ZeroKMS.** `@cipherstash/recipher/testing` builds a
cipher over the engine's deterministic test keys, with no credentials and
no network, as Go's `encrypttest.NewClient` does.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major @cipherstash/recipher/testing puts the engine's deterministic keys in the production package, so every shipped .node and wasm build must carry stack-kms/test-support (DeterministicSource: "A test double, not a cipher"), and an app that imports /testing by mistake seals real data under keys anyone can derive. Go's encrypttest is a separate module with its own deterministic guest, "Import it only from _test.go files". Publish it as a separate package with its own test build, and check in CI that no release artefact links the deterministic source.

Source: rust-security · claude-opus-5-5


Generated by Claude Code

Comment on lines +76 to +78
- **Node.js**, through a native extension built with napi-rs.
- **Edge runtimes and browsers**, through the same Rust code built for
`wasm32-unknown-unknown` with `wasm-bindgen`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major "Edge runtimes and browsers", with default loading the wasm build (line 270) and credentials from "the variables or the cipher's options" (704-708), ships the workspace clientKey in a browser bundle: the engine needs CS_CLIENT_KEY on every auth path (packages/stack-encrypt/src/lib.rs:130). skills/stash-edge says server-side only with no browser condition (#804), and @cipherstash/auth sets "browser": false. Drop browsers, say the wasm build is server-side only, and add "browser": false.

Source: rust-security · claude-opus-5-5


Generated by Claude Code

Comment on lines +778 to +781
- **No error holds a secret.** No message, property or `toString()` holds
a plaintext, a key, a token, a ciphertext or a context value. A
decrypted row's `inspect` output names its fields and hides their
values, as Go's `Redacted` does.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major A decrypted row is a plain object of own data properties (Plaintext<..> at 406-407, built by the value bridge's JsBuilder), so console.log(row), util.inspect and JSON.stringify print the plaintext: nothing in the plan gives the promised redacted inspect. Either drop the claim and say a decrypted row must not be logged, or make rows a redacted wrapper type and change Plaintext<..> to match.

Source: rust-security · claude-opus-5-5


Generated by Claude Code

Comment on lines +214 to +222
A cipher runs in one build. A program names its extensions when it builds
the cipher, and the cipher loads the build that holds them:

```ts
import { Cipher } from "@cipherstash/recipher";
import { eql } from "@cipherstash/eql/recipher";

const cipher = (await Cipher.create({ extensions: [eql] })).unwrap();
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major The core addon and the EQL build each define their own napi Cipher/Ciphertext classes, and with no TypeScript wrapper (245-246) an object made by one cannot be used by the other: napi 3 tags classes by crate@version::path, so a core Ciphertext.fromBytes(..) passed to an EQL-build cipher is refused once the two are released at different versions (928-932), and instanceof Cipher is false. Either keep every class in one addon or put a TypeScript layer in front of each build, and record the choice; it is missing from "Not checked".

Source: code-review (manual) · claude-opus-5-5


Generated by Claude Code

Comment on lines +774 to +777
- **Nothing escapes as an exception.** A failure in the binding, such as a
build that does not load, is an `Err` too. A test passes each call a
wrong argument and a failing key service, and asserts that none throws
or rejects.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major napi-rs converts arguments in the generated callback and throws InvalidArg synchronously before any promise exists, so cipher.decrypt(123) throws, which this test would fail on and which contradicts "No call throws" (310, 729). Take arguments as Unknown and validate in Rust, or add a guard layer; widen #1801 to cover it.

Source: code-review (manual) · claude-opus-5-5


Generated by Claude Code

- **Installing EQL v4.** `@cipherstash/eql` ships the v3 bundle, and
`stash eql install` installs it. Both need the v4 bundle before an
adapter can move. That is its own piece of work, in the CLI and in
`packages/eql`, and step 17 depends on it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor Step 17 is DynamoDB, which needs no EQL; the step that waits for the EQL v4 install is step 16 (1021-1023).

Suggested change
`packages/eql`, and step 17 depends on it.
`packages/eql`, and step 16 depends on it.

Source: mattpocock code-review · claude-opus-5-5; code-review (manual) · claude-opus-5-5


Generated by Claude Code

Comment on lines +1030 to +1031
- **A method called without its object (#1801).** When Rust returns each
`Result`, the hand-written TypeScript layer over the native classes can

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor "the hand-written TypeScript layer over the native classes can go" contradicts "no TypeScript class that wraps a native one" (245-246), and Result is a TypeScript type (249, 753) that Rust would then have to build. Say which side defines Result and whether a layer exists.

Source: mattpocock code-review · claude-opus-5-5


Generated by Claude Code

Comment on lines +3 to +5
Date: 2026-11-22. Revised 2026-11-23: the SDK is a general-purpose core
with EQL as an extension, and the work is in three phases. Status:
proposed. Nothing in this plan is built.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor The header says "Revised 2026-11-23" while the decisions are dated 2026-11-25 (1068), and "Nothing in this plan is built" sits beside findings from #1774-#1776 (1160-1165). Refresh the date and status.

Source: mattpocock code-review · claude-opus-5-5


Generated by Claude Code

Comment on lines +241 to +253
**Rust defines the API, and TypeScript does not copy it.** `Cipher`,
`Keyset` and `Ciphertext` are napi classes written in Rust. napi-rs
generates their TypeScript types, and the generated file is committed and
checked for drift in CI, as `@cipherstash/auth`'s `native.d.ts` is. There
is no hand-written description of the native interface, and no TypeScript
class that wraps a native one. TypeScript holds only what Rust cannot
express:

- `Result` and its methods, because `isOk()` narrows a type;
- the types of a declaration, such as `Plaintext<..>` and `Stored<..>`,
and the compile-time checks of a query;
- the typed signatures over the Rust methods, such as one value in and
one out, an array in and an array out.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor napi-rs cannot generate a generic class or per-record overloads, so Ciphertext<string> (329) and the typed signatures need a hand-written .d.ts that re-declares the native classes, which "no hand-written description of the native interface" rules out. Say a hand-written declaration re-types the generated classes, and how CI checks the two for drift.

Source: code-review (manual) · claude-opus-5-5


Generated by Claude Code

Comment on lines +470 to +471
- **Each call returns a builder.** Awaiting it runs it and gives a
`Result`. `.audit`, `.withCredential` and `.signal` come before the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor "Each call returns a builder … .audit, .withCredential and .signal" reads as every call, but a query has no .audit (721-722) and .withCredential exists only on the per-call-credential cipher (709-713). Qualify the sentence.

Source: code-review (manual) · claude-opus-5-5


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There is no design for a TypeScript SDK on the Stack Encrypt engine — write the plan

3 participants