the ledger: a caller's own bedikot, read back and signed

The examination is the product; the record of it is what a caller can
carry away. Every bedikah was already engraved in L3 — output hash and
length, source digests, coupling trace, claims, violations, verdict,
never the text — and no caller could get theirs back.

- bedikot.key_id (migration): a SHA-256 digest of the courtyard key that
  brought the offering, never the key; threaded as :key_id through
  Bedikah.examine from every site that goes through the gate (courtyard
  bedikah, pair, the gate's pass and stream). Unique index on
  bedikah_ref.
- VavPipeline.Ledger: entry (the examination's fields, none of the
  database's, not the owner's), canonical JSON (keys sorted at every
  level, no whitespace, UTF-8), Ed25519 sign/verify, public key, render.
  Seed from BIKORET_LEDGER_SIGNING_KEY (base64 of 32 bytes) in
  shorashim-secrets; absent → unsigned and says so.
- GET /courtyard/ledger?limit&before — this key's bedikot, newest first,
  each rendered and signed; GET /courtyard/bedikah/<ref> — one, 404 for
  another key's or none alike; GET /peah/ledger_key — the public key.
- Tamid §1.1 "The ledger" (Doorpost pin moved → 02ddf313…), KOHEN
  "Issuing a key" (the seed, once), secrets.yaml template.

Tests: ledger_test (digest, entry, canonical, sign/verify, unsigned
rendering, signed rendering); ledger_l3_test (own records listed newest
first and only own; 404 alike for another's and none; an examination
engraved under the key reads back signed and verifies against
/peah/ledger_key). Elixir 642/0; L3 13/0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Scott KarpandClaude Fable 5.1 committed 2026-10-21 18:45:47 +00:00
1 parent e6c3702a22
commit d6cf9355fd
13 files changed
+542 -13

No files matched your search

+35
View File
@@ -526,6 +526,41 @@ model. The examination is pattern-based (`korban_processor/bedikah.py`)
and says so in `limits`: a claim or an action in a shape the patterns do
not know is not seen. The same output always yields the same verdict.
**The ledger — a caller's own bedikot, read back and signed.** Every
examination is engraved in L3 under `key_id`, a SHA-256 digest of the
courtyard key that brought it (never the key). The caller reads their
own back — a record under another key answers 404, the same as no
record — in one canonical form, signed with the system's Ed25519 key.
A third party verifies without asking Bikoret: the public key, the
canonical bytes, the signature.
```
GET /courtyard/ledger?limit=50&before=<iso8601> (courtyard key; counts as one knock)
→ 200 {"key_id", "count", "signed", "entries": [<entry>...], "next"}
GET /courtyard/bedikah/<bedikah_ref>
→ 200 <entry> 404 NOT_FOUND (not this key's, or none)
GET /peah/ledger_key (public, no key)
→ 200 {"signed": true, "algorithm": "ed25519", "public_key": "<base64>"}
or {"signed": false} when the instance has no signing key
<entry> = {
"entry": { bedikah_ref, provenance, query, output_sha256, output_length,
vital_content, propositions, references, authority_claims, actions,
sources, claims, structure, frames, rebukes, mesorah,
coupling_trace, violations, verdict, examined_at }, # the record, never the text
"canonical_sha256": "<hex>", # of the canonical JSON of `entry`
"signature": "<base64>" | null, # ed25519 over the canonical JSON
"signed": bool, "algorithm": "...", "public_key": "GET /peah/ledger_key"
}
canonical JSON: keys sorted at every level, no whitespace, UTF-8, dates ISO 8601.
```
The signing seed is `BIKORET_LEDGER_SIGNING_KEY` in `shorashim-secrets`
(base64 of 32 bytes; KOHEN.md "Issuing a key"). Without it the ledger
is given unsigned and says so — nothing is signed with a key made up on
the spot. Records from before 2026-10-21 carry no `key_id` and belong to
no caller.
#### Chatzer — Full Access
```