Skip to content

Commit 28f0c33

Browse files
committed
refactor(stack-encrypt)!: remove FfiValue
Nothing takes a value tree any more. A plaintext is a ValueFrame, one value as its transport frame in a wiped buffer, and every control message a binding sends or reads is a typed value read from, or written to, its frame by serde (#1252, steps 1 to 3). The tests that still spelled values as FfiValue trees were moved off it in the commits before this one, so `dynamic::FfiValue` had no caller left. Removed: `FfiValue`, `Utf8String`, the tree's sink types (`ValueSink`, `ValueSeq`, `ValueMap`, `Put`, `Root`, `Element`, `Entry`), `ValueKind::holds` and `FfiValue::kind`. `ValueKind` and `ParseValueKindError` move into `dynamic::kind` and `FromFrameError` into `dynamic::value_frame`; all three are still exported from `dynamic`, unchanged. The doc examples that built an FfiValue now use Rust values (`ValueFrame::of(34u32)`, a map) or a binding's frame bytes. The trybuild snapshot for `plaintext_needs_encrypt` lists `&PassthroughFrame` where it listed `&FfiValue`, the next implementor in rustc's list. Stored records, terms and the frozen fixtures are byte for byte what they were. Refs #1252. BREAKING CHANGE: `stack_encrypt::dynamic::FfiValue` and the types above are gone. Build a value as a Rust value (`ValueFrame::of`) or hand over the frame bytes a binding sends.
1 parent 37f2bd3 commit 28f0c33

15 files changed

Lines changed: 259 additions & 993 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ updates:
299299
- dependency-name: "recipher"
300300
- dependency-name: "cllw-ore"
301301
# vitaminc is pinned at 0.5.0 across the crates and the guests; the
302-
# guests' `FfiValue: Decrypt` bound fails if two versions resolve.
302+
# guests' `ValueFrame: Decrypt` bound fails if two versions resolve.
303303
- dependency-name: "vitaminc*"
304304
# Major bumps are reviewed and applied manually, not by Dependabot.
305305
- dependency-name: "*"

‎languages/golang/encrypt/guest/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ zerokms-protocol = "=0.12.31"
6464
# The transport frame and ciphertext codec, shared with vitaminc's own
6565
# guest — one codec, not a fork. Same vitaminc version stack-encrypt builds
6666
# against (see the comment in packages/stack-encrypt/Cargo.toml). A
67-
# different version here fails at the `FfiValue: Decrypt` bound, since the
67+
# different version here fails at the `ValueFrame: Decrypt` bound, since the
6868
# aead crate would be duplicated.
6969
vitaminc-aead-frame = { version = "0.6.1", features = ["serde"] }
7070
vitaminc-protected = "0.6.1"

‎packages/stack-encrypt/CHANGELOG.md‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
214214
is a decrypt target that writes what it opens straight into a frame
215215
(`Decrypt`). The plaintext paths walk frames:
216216
- `record::encrypt`, `encrypt_with` and `check_source` take the source as
217-
any `Encrypt` (a `ValueFrame`, a `vitaminc_aead::Frame`, or an `FfiValue`
217+
any `Encrypt` (a `ValueFrame`, a `vitaminc_aead::Frame`, or a Rust value
218218
a test spells), walk it once and write each field's value into a
219219
`ValueFrame` of its own, which is all the engine keeps of it. A value
220220
refused while the source is split names its field, with the reasons it
@@ -246,8 +246,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
246246
- `TargetResolver::encrypt` and `query` take a `ValueFrame`, and
247247
`decrypt` resolves to one.
248248

249-
`FfiValue` stays for now, in the control data not yet read with serde
250-
(see the next entry).
249+
`FfiValue` is gone (see the entry after next).
251250
Ciphertexts, terms and the cross-language fixtures are byte for byte what
252251
they were. The Go guest decodes plaintext as `ValueFrame`s and returns an
253252
opened record's frame as it is. Copies of an opened string that remain in
@@ -288,6 +287,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
288287
`to_value`, `OperatorEntry::new` replaces `operator_to_value`, and
289288
`Limit::rows` replaces `limit_to_value` (`None` writes null).
290289

290+
- **`dynamic::FfiValue` is removed** (`dynamic` feature, #1252). Nothing
291+
takes a value tree any more: a plaintext is a `ValueFrame`, and control
292+
data is read from its frame by serde (above). Gone with it are
293+
`Utf8String`, the tree's sink types (`ValueSink`, `ValueSeq`, `ValueMap`,
294+
`Put`, `Root`, `Element`, `Entry`), `ValueKind::holds` and
295+
`FfiValue::kind`. `ValueKind` and `ParseValueKindError` are unchanged and
296+
still exported from `dynamic`, as is `FromFrameError`, now the error of
297+
`ValueFrame::from_bytes` and `ValueFrame::check` alone. A value a test or
298+
a caller spelled as an `FfiValue` is a Rust value instead
299+
(`ValueFrame::of(34u32)`, `ValueFrame::of(&map)`), or the frame bytes a
300+
binding sends. Stored records, terms and the frozen fixtures are byte for
301+
byte what they were.
302+
291303
- **A match value with no tokens is stored as the empty filter, so
292304
`KeysetCipher::match_terms` is no longer a query.** In 0.2.0 the same call
293305
served write time and query time, and refused text that cuts no token

‎packages/stack-encrypt/Cargo.toml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ tokio = { workspace = true, features = ["rt", "macros"] }
8989
trybuild = "1"
9090

9191
# The derive diagnostics are recorded with every feature on, as `test:unit`
92-
# and CI run them. They cannot hold under both feature sets — rustc lists a
93-
# trait's other implementors in its help, and the `dynamic` feature's
94-
# `FfiValue` joins one such list and pushes another entry off it — so the
95-
# test is only built with that feature rather than skipped at runtime.
92+
# and CI run them. They cannot be relied on to hold under both feature sets
93+
# — rustc lists a trait's other implementors in its help, and the `dynamic`
94+
# feature adds implementors (`ValueFrame`) that can join such a list — so
95+
# the test is only built with that feature rather than skipped at runtime.
9696
[[test]]
9797
name = "ui"
9898
required-features = ["dynamic"]

0 commit comments

Comments
 (0)