Skip to content

CLI usage

The witness CLI uses http://localhost:8080 unless you set --gateway (-g) or WITNESS_GATEWAY. Run witness <command> --help for options.

Command Purpose
attest --file FILE or attest --hash HASH Create or retrieve a job; --save PATH saves the returned job snapshot, which may not yet be confirmed.
status HASH Fetch the latest job snapshot.
verify FILE Verify a receipt or confirmed job snapshot. Use --data FILE or --hash HASH to check what the receipt covers.
verify-proof --bundle FILE or verify-proof --hash HASH Verify a saved or fetched bundle. --require-log-inclusion requires authenticated inclusion and can fetch missing evidence.
config Show informational gateway settings.
keys verify --network-config FILE Authenticate key history against an independent pin; optionally read --key-history FILE.
keys digest --network-config FILE Print the key-set digest used in a key transition.
keys vkeys --network-config FILE Print the public C2SP verifier keys for the log and its signers.
log checkpoint Fetch the latest signed checkpoint.
evidence export --hash HASH --out DIR Download an evidence package and write its records and receipt files. Does not verify them.
log consistency --first SIZE --second SIZE Fetch a consistency proof between two published checkpoints.

verify and verify-proof require exactly one of --network-config FILE and --trust-gateway. The latter trusts keys and policy fetched from the gateway and is weaker than an independent pin. log checkpoint --verify and log consistency --verify use the same choice. Supply --key-history FILE to use saved history. Otherwise these commands try GET /v1/key-history even if the receipt or checkpoint matches the pin's epoch. A fetched history that fails verification is always an error. If the history is unavailable, the command can fall back to the pin only when all evidence matches its epoch. In text mode, look for a warning on stderr. In JSON, key_history is "unchecked" after a fallback, or "verified" when the history was authenticated.

Pass --witness-policy FILE to verify-proof, log checkpoint --verify, or log consistency --verify to require signatures from witnesses you choose. The file is a JSON object with a witnesses list of C2SP verifier keys and a threshold specifying how many must sign. verify-proof and log checkpoint --verify also support --max-checkpoint-age in seconds.

attest, status, verify, verify-proof, and the log commands accept --output json. Failed verification exits nonzero, even with JSON output. See Offline verification for how to avoid network requests.