Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6526dd3
spike: the encrypt sink holds no context; one function derives a leaf…
coderdan Dec 2, 2026
ca1215d
spike: one value is walked, then sealed in one pass, with no adapter …
coderdan Dec 2, 2026
999a821
spike: a record is walked once by a sink built from the plan, and sea…
coderdan Dec 2, 2026
9bee1f2
spike: the encrypt sink's type parameters are the slot, then the erro…
coderdan Dec 2, 2026
d09c43a
spike: a value staged for encryption is a Pending, sealed through a t…
coderdan Dec 2, 2026
c4d944b
spike: the tree's name is Node; CipherText is an alias of it (not for…
coderdan Dec 2, 2026
72b5abc
spike: a copy of the published vitaminc-normalize 0.10.0, unchanged (…
coderdan Dec 2, 2026
f28c20a
spike: vitaminc-normalize's tests follow two vitaminc-aead changes (n…
coderdan Dec 2, 2026
f812fe1
spike: vitaminc-normalize no longer uses AsyncCipher (not for merging)
coderdan Dec 2, 2026
b3858b9
spike: AsyncCipher is deleted from vitaminc-aead (not for merging)
coderdan Dec 2, 2026
b99c0ea
spike: a value staged for encryption is a Node<Plaintext> (not for me…
coderdan Dec 2, 2026
284d5d7
spike: SealLeaf is removed; a staged value is sealed by a Cipher (not…
coderdan Dec 2, 2026
15609da
spike: a staged value is sealed by a closure, as it is opened (not fo…
coderdan Dec 2, 2026
0d2a194
spike: decrypt_to_frame is removed from vitaminc-aead (not for merging)
coderdan Dec 2, 2026
a8dbe60
spike: leaves_with_aad is a test helper, not public API (not for merg…
coderdan Dec 2, 2026
7e5a79d
spike: open_all is removed from vitaminc-aead (not for merging)
coderdan Dec 2, 2026
2c28f3d
spike: vitaminc-aead's doc examples follow plan(value) (not for merging)
coderdan Dec 2, 2026
60f8f74
spike: Opened is removed; an opened leaf is a Plaintext (not for merg…
coderdan Dec 2, 2026
966181f
spike: the hlist module is removed from vitaminc-aead (not for merging)
coderdan Dec 2, 2026
83b2735
spike: encrypt_native and open_native are removed from Stack Encrypt …
coderdan Dec 2, 2026
5828a7f
spike: ContextTag is removed (not for merging)
coderdan Dec 2, 2026
d6ac1ff
spike: LeafTypeAad is removed (not for merging)
coderdan Dec 2, 2026
bf7c69f
spike: a doc comment in vitaminc-aead no longer links to EncryptError…
coderdan Dec 2, 2026
78ccb5b
spike: vitaminc-aead gains the AES-256-GCM cipher from vitaminc-encry…
coderdan Dec 2, 2026
7b44e0a
spike: nothing in the repository depends on vitaminc-encrypt 0.10 (no…
coderdan Dec 2, 2026
f22f2d2
spike: the leaf writer, reader and nonce types are private to vitamin…
coderdan Dec 2, 2026
9caddd2
spike: the deprecated Aad and AadPiece names are removed (not for mer…
coderdan Dec 2, 2026
dce10fb
spike: the aws-lc seal no longer frees plaintext unwiped, and the hea…
coderdan Dec 2, 2026
51e7f9a
spike: vitaminc-aead's README describes the aes cipher, not the nonce…
coderdan Dec 2, 2026
c0e5ae0
spike: the spike passes cargo fmt and clippy (not for merging)
coderdan Dec 2, 2026
bfaa79e
spike: the Go guests, the EQL workspace, recipher-js and the fuzz cra…
coderdan Dec 3, 2026
c5febff
spike: a target declared as a sink and a finishing step, with no comb…
coderdan Dec 4, 2026
bdeb92a
spike: a record is a sink target, with each field under its own conte…
coderdan Dec 4, 2026
4ca1386
spike: the combinators as adapters over one trait, as iterator adapte…
coderdan Dec 4, 2026
5805205
spike: a record whose context is one of its fields, as a declaration …
coderdan Dec 4, 2026
78cdef3
spike: a plaintext of the wrong type does not compile, as with collec…
coderdan Dec 4, 2026
490ad69
spike: a plan builds its declaration at run time (not for merging)
coderdan Dec 4, 2026
ad99e1c
spike: the JSON index is one operation in a declaration (not for merg…
coderdan Dec 4, 2026
fca211e
spike: the JSON test counts the document's entries (not for merging)
coderdan Dec 4, 2026
a4ee05a
spike: a value walked as a map or a sequence is a JSON document (not …
coderdan Dec 4, 2026
ccf1d01
spike: one declaration seals a target and opens it again (not for mer…
coderdan Dec 4, 2026
08d109f
spike: a declaration gives the query term for an operator it answers …
coderdan Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 21 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ members = [
"packages/vitaminc-aead",
"packages/recipher-frame",
"packages/vitaminc-aead-derive",
# SPIKE: see the patch table at the end.
"packages/vitaminc-normalize",
"languages/typescript/packages/auth",
"languages/typescript/packages/profile",
"languages/typescript/packages/stack-auth-wasm",
Expand Down Expand Up @@ -155,14 +157,13 @@ web-time = "1.1"
zeroize = { version = "1.8.1", features = ["derive"] }
# This is needed because lock_api 0.4.6 was breaking things and the branch forces the use of 0.4.12
temp-env = { git = "https://github.com/cipherstash/temp-env", branch = "main" }
vitaminc = { version = "0.10.0", features = ["random", "protected", "encrypt"] }
vitaminc = { version = "0.10.0", features = ["random", "protected"] }
# The AEAD crates live in this repository (packages/vitaminc-aead*,
# packages/recipher-frame).
vitaminc-aead = { path = "./packages/vitaminc-aead", version = "0.10.0" }
# The transport frame and ciphertext codec every language binding carries
# across its FFI boundary. Optional in stack-encrypt (the `dynamic` feature).
recipher-frame = { path = "./packages/recipher-frame", version = "0.10.0" }
vitaminc-encrypt = "0.10.0"
vitaminc-hmac = "0.10.0"
# Normalized equality terms (Unicode 16 NFC text, one integer encoding for
# every width), which `vitaminc-prf`'s `normalize` feature derives over.
Expand All @@ -186,3 +187,7 @@ vitaminc-protected = "0.10.0"
[patch.crates-io]
vitaminc-aead = { path = "./packages/vitaminc-aead" }
vitaminc-aead-derive = { path = "./packages/vitaminc-aead-derive" }
# SPIKE, not for merging. A copy of the published vitaminc-normalize 0.10.0,
# so that the spike can show what that crate has to change. The crate lives
# in cipherstash/vitaminc, and the real change is a release from there.
vitaminc-normalize = { path = "./packages/vitaminc-normalize" }
20 changes: 7 additions & 13 deletions conformance/vitaminc-aead/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ After editing it, run `pnpm run code:fix` before committing.
| `normalized` | yes | yes | yes | A valid value that reads back as a different canonical value |
| `malformed` | yes | yes | yes | Bytes every decoder must refuse |
| `ciphertext_malformed` | yes | no | yes | Ciphertext transport bytes the codec must refuse |
| `leaf_type_aad` | yes | no | no | The `LeafTypeAad` context bytes for a (base, kind, logical) triple |

Node has no ciphertext transport codec, and neither binding exposes
`LeafTypeAad`, so those two sections are asserted where the code is. A new
Node has no ciphertext transport codec, so that section is asserted where
the code is. A new
section is consumed by every language that has the code it describes; the
table above is the record of who asserts what, so keep it current.

Expand All @@ -51,10 +50,6 @@ language writes back) and `reencode_value` (the host value it reads as).

`ciphertext_malformed`: `transport` bytes of a ciphertext tree.

`leaf_type_aad`: `base`, `kind` (the physical kind), an optional `logical`
`{id, param}`, and the `context` bytes; its `rule` spells out the encoding so
another language can build the bytes from the corpus alone.

## Host projections

Rust re-encodes every valid vector byte for byte. A host language whose
Expand All @@ -65,15 +60,14 @@ than skipping the row:
re-encodes as Float64. A timestamp that is a whole number of milliseconds
is read as a `Date`, and re-encodes as the `Timestamp(Millis)` envelope. A
finer timestamp is read as an `RcTimestamp`, and re-encodes in the
nanosecond shorthand. As for Go, the timestamp projection is safe for two
reasons. `LeafTypeAad` binds the kind and the logical id, but not the
unit. The equality terms put every unit in one timestamp domain.
nanosecond shorthand. As for Go, the timestamp projection is safe: no
context binds a timestamp's unit, and the equality terms put every unit
in one timestamp domain.
- `go_reencode`: Go has two projections. `undefined` becomes nil and
re-encodes as null. A timestamp in the envelope (seconds, milliseconds or
microseconds) is read as a `time.Time` and re-encodes in the nanosecond
shorthand, which is safe because `LeafTypeAad` binds the kind and the
logical id but not the unit, and the equality terms put every unit in one
timestamp domain.
shorthand, which is safe because no context binds a timestamp's unit, and
the equality terms put every unit in one timestamp domain.
- `js: "refused"`: Node has no value for this row and refuses it. Today that
is the `unknown-logical` envelope, a Node limitation tracked in #446, not a
rule of the format; Rust and Go read and re-encode it unchanged.
Expand Down
95 changes: 1 addition & 94 deletions conformance/vitaminc-aead/value-conformance.json
Original file line number Diff line number Diff line change
Expand Up @@ -713,98 +713,5 @@
"transport": "03010000000204000000deadbeef",
"rule": "ADR 0001 section 3: CT_NONE is refused wherever it appears"
}
],
"leaf_type_aad": {
"rule": "LeafTypeAad (ADR 0001 section 3): the context is PAE(domain, base, kind, id) under the vitaminc-context encoding, where PAE is a u64-le count then each element as a u64-le length and its bytes, and each element is itself a typed piece: a PAE of two parts, the u64-le-prefixed label vitaminc/context/value/v1 and the u64-le-prefixed type label then the payload. The domain is bytes/v1 over vitaminc/aead/leaf-type/v2; the base is utf8/v1 over the base string; the kind is u8-le/v1 over the physical kind byte (null 0, bool 1, int 2, float 3, text 4, bytes 5; a cross-language commitment, never renumbered); the id is u8-le/v1 over the logical id byte, 0 for no logical type. The parameter is not bound: two vectors with the same base, kind and id and different parameters have the same context.",
"vectors": [
{
"name": "int-date",
"base": "ctx",
"kind": "int",
"logical": {
"id": 2,
"param": 0
},
"context": "04000000000000006c0000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f62797465732f76311a00000000000000766974616d696e632f616561642f6c6561662d747970652f7632540000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311800000000000000766974616d696e632f636f6e746578742f757466382f76310300000000000000637478530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000002530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000002"
},
{
"name": "text-no-logical",
"base": "ctx",
"kind": "text",
"context": "04000000000000006c0000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f62797465732f76311a00000000000000766974616d696e632f616561642f6c6561662d747970652f7632540000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311800000000000000766974616d696e632f636f6e746578742f757466382f76310300000000000000637478530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000004530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000000"
},
{
"name": "bytes-uuid",
"base": "schema",
"kind": "bytes",
"logical": {
"id": 5,
"param": 0
},
"context": "04000000000000006c0000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f62797465732f76311a00000000000000766974616d696e632f616561642f6c6561662d747970652f7632570000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311800000000000000766974616d696e632f636f6e746578742f757466382f76310600000000000000736368656d61530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000005530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000005"
},
{
"name": "int-timestamp-millis",
"base": "events",
"kind": "int",
"logical": {
"id": 3,
"param": 1
},
"context": "04000000000000006c0000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f62797465732f76311a00000000000000766974616d696e632f616561642f6c6561662d747970652f7632570000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311800000000000000766974616d696e632f636f6e746578742f757466382f763106000000000000006576656e7473530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000002530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000003"
},
{
"name": "int-decimal-scale-2",
"base": "price",
"kind": "int",
"logical": {
"id": 4,
"param": 2
},
"context": "04000000000000006c0000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f62797465732f76311a00000000000000766974616d696e632f616561642f6c6561662d747970652f7632560000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311800000000000000766974616d696e632f636f6e746578742f757466382f763105000000000000007072696365530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000002530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000004"
},
{
"name": "null-undefined",
"base": "ctx",
"kind": "null",
"logical": {
"id": 1,
"param": 0
},
"context": "04000000000000006c0000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f62797465732f76311a00000000000000766974616d696e632f616561642f6c6561662d747970652f7632540000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311800000000000000766974616d696e632f636f6e746578742f757466382f76310300000000000000637478530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000000530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000001"
},
{
"name": "bool-no-logical",
"base": "ctx",
"kind": "bool",
"context": "04000000000000006c0000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f62797465732f76311a00000000000000766974616d696e632f616561642f6c6561662d747970652f7632540000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311800000000000000766974616d696e632f636f6e746578742f757466382f76310300000000000000637478530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000001530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000000"
},
{
"name": "float-no-logical",
"base": "ctx",
"kind": "float",
"context": "04000000000000006c0000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f62797465732f76311a00000000000000766974616d696e632f616561642f6c6561662d747970652f7632540000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311800000000000000766974616d696e632f636f6e746578742f757466382f76310300000000000000637478530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000003530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000000"
},
{
"name": "int-decimal-scale-0",
"base": "price",
"kind": "int",
"logical": {
"id": 4,
"param": 0
},
"context": "04000000000000006c0000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f62797465732f76311a00000000000000766974616d696e632f616561642f6c6561662d747970652f7632560000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311800000000000000766974616d696e632f636f6e746578742f757466382f763105000000000000007072696365530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000002530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000004"
},
{
"name": "int-timestamp-nanos",
"base": "events",
"kind": "int",
"logical": {
"id": 3,
"param": 3
},
"context": "04000000000000006c0000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f62797465732f76311a00000000000000766974616d696e632f616561642f6c6561662d747970652f7632570000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311800000000000000766974616d696e632f636f6e746578742f757466382f763106000000000000006576656e7473530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000002530000000000000003000000000000001900000000000000766974616d696e632f636f6e746578742f76616c75652f76311900000000000000766974616d696e632f636f6e746578742f75382d6c652f7631010000000000000003"
}
]
}
]
}
Loading
Loading