Metadata-Version: 2.5
Name: runback-verify
Version: 2.2.0
Summary: Verify tamper-evidence and integrity of Runback audit cassettes (runback.cassette/v1). No account required, no dependencies.
Project-URL: Homepage, https://runback.dev
Project-URL: Specification, https://runback.dev/spec
Project-URL: Source, https://github.com/letsRunback/runback
Author-email: Runback <contact@runback.dev>
License-Expression: MIT
Keywords: ai-agents,audit,cassette,ed25519,eu-ai-act,governance,runback,tamper-evident,verification
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Legal Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# runback-verify

Verify the integrity of a Runback audit record offline, with nothing but Python's standard library.

```bash
pip install runback-verify
runback-verify record.json
```

```python
from runback_verify import verify_json

result = verify_json(open("record.json").read())
print(result["verdict"])   # "valid" | "unverified" | "invalid"
```

Evidence packs (the signed PDF from `GET /api/compliance/pack`, 2.2.0) are
detected by their `%PDF-` header:

```bash
python -m runback_verify runback-evidence-pack-2026-10-01-2026-10-31.pdf
```

```python
from runback_verify import verify_pack
verify_pack(open("pack.pdf", "rb").read())["verdict"]
```

Same checks and exit codes as `@runback/verify` 3.1: every byte outside the
embedded manifest must match its SHA-256, the manifest must carry Runback's
Ed25519 signature, and a SAMPLE pack is never `valid`.

## Zero dependencies, on purpose

This package is separate from `runback-sdk` because the SDK needs `requests` and
`python-ulid` to do its job, and an auditor needs neither. Ed25519 verification
is implemented here from RFC 8032 in plain Python, so the package installs and
runs on a stock interpreter in a locked-down environment.

## What the verdicts mean

| verdict | meaning |
|---|---|
| `valid` | integrity holds **and** the signer is a key you pinned |
| `unverified` | self-consistent, but the origin is unproven |
| `invalid` | something failed — it is not the record it claims to be |

The chain algorithm is public, so anyone can author a self-consistent record
from nothing, or edit a real one and re-chain it. Integrity alone proves only
internal coherence; provenance is a separate question, answered only by a
signature that verifies against a key you pinned **out of band**.

Exit codes: `0` valid, `1` invalid, `2` unverified. The CLI also exits `2` when
the file cannot be read or is not a Runback record, so a CI step should read
the printed verdict (or `--json`) before treating `2` as "unverified".

The CLI takes `--json` and nothing else. By default it pins Runback's published
Ed25519 keys, so a record signed by a self-hosted deployment's own key reports
`unverified`. Pin your key from Python instead:

```python
result = verify_json(raw, expected_public_key=open("audit_public.pem").read())
```

Legacy HMAC-signed records verify only with the shared secret:
`verify_json(raw, signing_key=...)`.

## The format

`runback.cassette/v1` is specified at <https://runback.dev/spec>. The reference
implementation is [`@runback/verify`](https://www.npmjs.com/package/@runback/verify)
on npm; this package is a port held to the same generated conformance fixture,
and where the two disagree the reference is authoritative.
