Expand description
§warrant-verify (Rust)
An independent, from-scratch implementation of the Warrant decision-record format: a decision is a small JSON body naming the policy it was made under, its reasons and evidence, its actor and its prior decisions; its identity (WarrantID) is the SHA-256 of the body’s RFC 8785 canonical bytes, and it is signed with Ed25519 over a domain-separated message.
This crate is held to the reference implementation (impl/warrant.py,
published on PyPI as warrant-verify) by differential tests that compare
output byte for byte: the same store gives the same report, the same counts,
the same exit status, and the same written records.
It has no dependencies: SHA-256, SHA-512, Ed25519 and the JSON parser are written here, so that agreeing with the reference is evidence about the specification rather than about a shared library.
use warrant_verify::{json, schema, store};
let body = json::parse_ijson(br#"{"warrant":"0.2","decision":"propose",
"subject":{"hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
"under":["bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"],
"because":[],"evidence":[],"actor":{"id":"a@example"},"prior":[],"ts":1}"#).unwrap();
assert!(schema::validate_body(&body).is_empty());
let wid = store::warrant_id(&body).unwrap();
assert_eq!(wid.len(), 64);Modules, in the order the format builds on them: hash, json
(I-JSON parsing and canonicalization, SPEC §4), schema (§2/§3),
sig and ed25519 (§5), ski (the ski@v1 evaluator, §3.1),
store, settlement (§5.1/§7/§9), verify (§6 and the §11 report),
ops (filing, why, resign, settle), conformance (§8 and the
warrant-conformance/1 probe) and cli.
Modules§
- cli
- The command line: the reference’s
warrantCLI, verb for verb and flag for flag, plus a few implementation-specific verbs (edtest,verify-sig). - conformance
conformance(SPEC §8: this implementation against the pinned vectors in a checkout),selftest(a live round-trip), andprobe(thewarrant-conformance/1candidate contract an external runner drives).- ed25519
- Ed25519 (RFC 8032), from scratch, no external crates: verification, and a
signing path for filing and re-signing records (see the note at
sign). Field is the 5×51-bit representation mod p = 2^255-19; points are extended Edwards coordinates.verifyreduces the SHA-512 challenge mod L (mod_l) and checks [S]B = R + [k]A cofactorless — RFC-exact for EVERY key, including mixed-torsion ones (an earlier draft used the unreduced 512-bit hash, which the Gemini 3.1 Pro audit showed diverges from the RFC on mixed-torsion keys). Non-canonical point encodings (y ≥ p, x=0 with sign 1) and non-canonical S (S ≥ L) are rejected; small-order keys are additionally rejected upstream by the blocklist. - hash
- SHA-256 (FIPS 180-4, from scratch) and the hex forms the format uses.
- json
- JSON, three ways, because the reference implementation reads JSON three ways and the differences are observable in its reports.
- ops
- The store-writing and store-reading verbs: filing,
why,resign,settle. - p256
- WRT-019: ECDSA P-256 / SHA-256 verification, written from scratch like the
rest of this crate (no external crates), so that agreement with the Python
(
cryptography) and Go (crypto/ecdsa) verifiers is evidence about the specification rather than about a shared library. - schema
- SPEC §2/§3: the record schema, with the reference’s exact error strings.
- settlement
- Settlement (SPEC §5.1, §7, §9): tunnels, outcome fingerprints, re-litigation admissibility, trust configs, threshold policies, and the settlement context (settlement-active roots and records, DAG-ordered key state, conflicts).
- sig
- SPEC §5: keys, the signed message, and signature checks.
- ski
ski@v1(SPEC §3.1): Σ-GLYPH Book I v0.5 hash-thunk evaluation, re-executed against the Warrant blob store, which IS a Σ-GLYPH content-addressed store.- store
- The plain-file store:
<root>/blobs/<sha256>and<root>/records/<WarrantID>.json. - verify
- SPEC §6 store verification (base grade) and SPEC §5.1/§7/§9 settlement grade,
plus the
warrant.verify-report@v0machine report (SPEC §11).