Skip to main content

Crate proof_cli

Crate proof_cli 

Source
Expand description

proof-cli: command-line front end over the library crates (Phase 7). Adds no trust logic of its own: every artifact is re-verified on load, every time input is an explicit flag, keys are supplied per invocation.

Modules§

artifact
Artifact files: JSON wrappers around canonical CBOR bytes (hex). JSON is transport-only; the canonical CBOR is the artifact of record (FORMAT §7). Every load re-verifies bytes against schema and recomputes the id — a file whose bytes do not match its id is rejected, never used.
check
Verification-side output: proof loading, report emission, exit codes. Exit code contract: 0 = PASS, 1 = FAIL/INDETERMINATE, 2 = error.
demo
demo: the killer use-case (ARCHITECTURE §8), end to end and deterministically: build a payment-settles-invoice proof, verify it fresh (PASS), have the merchant revoke their own attestation, re-verify (REVOKED), and prove byte-identical determinism by rebuilding everything. Every timestamp is a constant; the same seed yields the same bytes.
make
Creation commands: build artifacts and assemble/verify proofs. Every command re-derives ids and signatures through the library crates; this module contains no trust logic of its own.

Structs§

Cli
Parsed command line: subcommand + positional args + --flag value flags. Deliberately hand-rolled (no new dependencies in V0.1).

Constants§

EXIT_ERR
EXIT_FAIL
EXIT_OK
Exit codes: 0 PASS, 1 FAIL/INDETERMINATE verdict, 2 usage or engine error.
MAX_INPUT_FILE_BYTES
Cap for any file the CLI reads (artifacts, proofs, policies). Well above the largest legitimate input (1 MiB proof → ~2 MiB hex JSON): oversized files are refused with a clean error instead of being buffered without bound (Phase 7 hostile review H1).
USAGE

Functions§

limits
load_key
Load an Ed25519 key from --seed: test selects the fixed test key (fixtures/demos ONLY); otherwise 64 hex chars = 32 seed bytes.
load_key_opt
Load a key for commands taking --seed/--seed-file. --seed-file reads the seed from a file (capped by MAX_INPUT_FILE_BYTES) so raw key material never lands in argv, shell history, or process listings; --seed keeps working for demos/tests. The two flags must not combine.
parse_fields
Parse k=v[,k=v…] into flat metadata / claim fields. Values are text, true/false, or unsigned integers (matching the closed MetaValue set).
progress
Print progress to stderr unless –quiet is set.
read_input_file
Read a CLI input file with the size cap enforced during buffering (no TOCTOU window: at most one byte over the cap is ever read).