Skip to content

Commit 0df55a0

Browse files
committed
docs(stack-encrypt): a guide to building a language integration
Nothing explained how to build a binding on Stack Encrypt. The knowledge was spread over the dynamic module's docs, the Go guest's module docs, stack-guest-abi, ADR-0007 and ADR-0008, and an author had to reconstruct it from the Go SDK. A Python integration has started without it. The guide ships in the crate docs as `dynamic::guide`, included from `docs/language-integration.md`, so it renders on docs.rs beside the API it describes. It is ordered contract before API: the binding versus the language SDK; native versus WebAssembly; the three operations and the Go guest's exports; the plan grammar; control messages versus plaintext, both frames, neither a tree; the plaintext hygiene rules and the heap tests that prove them; the step loop, the token import and the cancellation contract; the status table and se_last_error; versioning and the frozen stored-rows fixtures; one int32 stored as EQL v4 IntegerEq, traced through encrypt, query and decrypt with the bytes from the committed fixtures; and a checklist for a new binding. The frame format stays in vitaminc-aead-frame's documentation and is linked, not restated. The frame bytes in the worked example are asserted by doctests, so the guide fails the build if the engine's bytes move. The stored row and the query term are quoted from fixtures the Go SDK and Rust both read, named by file and key. Linked from the crate docs, the SDK design principles and the Go SDK's README. Closes #1254.
1 parent a840933 commit 0df55a0

6 files changed

Lines changed: 641 additions & 0 deletions

File tree

‎docs/sdk-design-principles.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ The second part applies to the Go SDK.
1313
- **Declaration:** the statement of how each field is encrypted: its context, and its indexes.
1414
The engine calls a saved declaration a plan.
1515

16+
How to build the binding itself, what crosses it and how to prove it, is the guide in `packages/stack-encrypt/docs/language-integration.md` (`stack_encrypt::dynamic::guide` in the crate documentation).
17+
1618
## When two principles disagree
1719

1820
Apply them in this order:

‎languages/golang/encrypt/README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,10 @@ credential guest) before `go test`, and
588588
round-trip and fixture tests use. Without the builds `NewClient` returns
589589
`ErrGuestNotBuilt` and the tests skip.
590590

591+
This package is the reference integration for the engine. How the binding
592+
works, what crosses it and how to build one for another language is the
593+
guide in `packages/stack-encrypt/docs/language-integration.md`.
594+
591595
## Licence
592596

593597
The Go code in this module is MIT-licensed ([`LICENSE`](../LICENSE)). The

‎packages/stack-encrypt/CHANGELOG.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- **A guide to building a language integration**, `dynamic::guide`
13+
(`docs/language-integration.md`, shipped in the crate docs under the
14+
`dynamic` feature): the binding versus the language SDK, native versus
15+
WebAssembly, the three operations and the Go guest's exports, the plan
16+
grammar, control messages versus plaintext, the plaintext hygiene rules
17+
and the tests that prove them, the step loop and the token import,
18+
the status table and `se_last_error`, versioning, one `int32` stored as
19+
EQL v4 `IntegerEq` traced through encrypt, query and decrypt with the
20+
bytes from the committed fixtures, and a checklist for a new binding.
21+
The frame format stays in `vitaminc-aead-frame`'s documentation and is
22+
linked, not restated.
1223
- **Every integer width, 128-bit integers, dates, timestamps and decimals
1324
as dynamic values** (`dynamic` feature; #1144, ADR-0002). They are
1425
vitaminc leaves in a `ValueFrame`, with no new `FfiValue` variant:

0 commit comments

Comments
 (0)