Verification Library

August 23, 2026 ยท View on GitHub

ca2a-verify verifies a delegation chain, and eventually the delegation DAG, offline. It does not require trusting any operator: a chain is checked against the issuers' public keys and the attenuation invariants alone.

API

from ca2a_verify import verify_delegation_chain, verify_chain_file, ChainResult

result: ChainResult = verify_chain_file(
    "chain.json", trusted_root_issuers={"<trusted-root-issuer-hex>"}
)
# result.hops, result.root_issuer, result.leaf_subject, result.leaf_scope
  • verify_delegation_chain(chain, trusted_root_issuers=..., max_depth=8, at_time=None) verifies a list of DelegationCredential against an explicit local root trust set and returns a ChainResult summary, or raises a CA2AError subtype.
  • verify_chain_file(path, trusted_root_issuers=..., max_depth=8, at_time=None) loads a chain from JSON (a bare list, or {"chain": [...]}) and verifies it against that trust set.

Root trust is mandatory. A self-consistent chain from an unknown root is cryptographically well formed but is not authorized and therefore does not produce a successful verification result.

at_time is the Unix time validity windows are evaluated at; None means the current time. An auditor replaying recorded evidence passes the time the action was decided, not its own. See delegation chain.

Errors

All verification failures are subtypes of CA2AError, re-exported as VerificationError. Each carries a stable code and an HTTP status. The specific codes and the invariants they map to are in delegation chain.

Offline by design

The verifier reads only the chain document. It contacts no server, trusts no operator signature over the transport, and produces the same verdict anywhere. This is what makes a delegation chain usable as evidence in an audit or a procurement review, not just at runtime.

Not yet implemented

The delegation DAG verifier, which links each hop's TRACE record to its parent and checks the whole tree, lands with the Tier 2 provenance work. See ROADMAP.md.