#!/usr/bin/env bash # JCR-1 quickstart — Rust mints a receipt, then Python and Go each # independently verify both the 10 canonical vectors and the # Rust-minted receipt. Three implementations, one standard. set -euo pipefail HERE="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$HERE/../.." && pwd)" # workspace root (jouleclaw-rs/) MINTED="${MINTED:-/tmp/jcr1-minted.json}" KEYS="$HERE/conformance/test-keys.json" VECTORS="$HERE/conformance/vectors.json" echo "==> [1/4] Rust mints a JCR-1 receipt from an energy reading" ( cd "$ROOT" && cargo run -p jouleclaw-jcr1 --example jcr1_mint --quiet -- "$MINTED" ) echo echo "==> [2/4] Python reference verifier on the 10 canonical vectors" python3 "$HERE/conformance/verify.py" "$VECTORS" "$KEYS" echo echo "==> [3/4] Independent Go verifier on the same 10 vectors" ( cd "$HERE/conformance" && go run verify.go vectors.json test-keys.json ) echo echo "==> [4/4] BOTH verifiers on the FRESH Rust-minted receipt" python3 "$HERE/conformance/verify.py" "$MINTED" "$KEYS" ( cd "$HERE/conformance" && go run verify.go "$MINTED" test-keys.json ) echo echo "OK — Rust minted; Python and Go both verified." echo "Byte-identical canonical CBOR across all three implementations."