# provenanceauth-verify (Python)

provenanceauth-verify (Python) in the Verifiers: 37 methods. Offline token checks for Python, with no API key.

## Methods

### [verify_intent_token](https://provenanceauth.com/docs/sdks/verify/python/verify-intent-token.md)

```ts
provenanceauth_verify.verify_intent_token(token: str, jwks: dict, now: Optional[int] = …) -> VerifyResult
```

Verify an ES256 intent token against a JWKS (authenticity + expiry only).

### [verify_trace_manifest](https://provenanceauth.com/docs/sdks/verify/python/verify-trace-manifest.md)

```ts
provenanceauth_verify.verify_trace_manifest(token: str, jwks: dict, graph: Any = …) -> TraceManifestResult
```

Verify a Trace manifest (ES256 JWS, typ provenance-trace+jwt) against a JWKS; optionally check a graph against its `graph_hash` / `public_graph_hash`.

### [verify_trace_diff_manifest](https://provenanceauth.com/docs/sdks/verify/python/verify-trace-diff-manifest.md)

```ts
provenanceauth_verify.verify_trace_diff_manifest(token: str, jwks: dict, report: Any = …) -> TraceDiffManifestResult
```

Verify a Neuron-CI diff manifest (ES256 JWS, typ provenance-trace-diff+jwt) against a JWKS; optionally check a snake_case report against its `report_hash`.

### [fetch_jwks](https://provenanceauth.com/docs/sdks/verify/python/fetch-jwks.md)

```ts
provenanceauth_verify.fetch_jwks(base_url: str, timeout: float = …) -> dict
```

### [ap2_hash](https://provenanceauth.com/docs/sdks/verify/python/ap2-hash.md)

```ts
provenanceauth_verify.ap2_hash(value: str) -> str
```

Base64url(SHA-256(ascii value)): how AP2 and SD-JWT hash disclosures, presentations and Checkout JWTs.

### [verify_ap2_user_mandate](https://provenanceauth.com/docs/sdks/verify/python/verify-ap2-user-mandate.md)

```ts
provenanceauth_verify.verify_ap2_user_mandate(serialized: str, issuers: list, expected: dict, now: Optional[int] = …, kb_max_age_seconds: int = …, accept_chains: bool = …) -> Ap2Result
```

Verify an AP2 v0.2 mandate SD-JWT (or delegate chain) against `issuers` (`[{"name", "jwks"}]`, your own list) and `expected` (`origin`, `checkout_jwt`, `payee_id`, `amount` in minor units, `currency`).

### [verify_authority_proof](https://provenanceauth.com/docs/sdks/verify/python/verify-authority-proof.md)

```ts
provenanceauth_verify.verify_authority_proof(token: str, jwks: dict, expect: Optional[dict] = …, holder: Optional[dict] = …, online: bool = …, api_base: Optional[str] = …, status: Optional[dict] = …, now_ms: Optional[int] = …, timeout: float = …) -> AuthorityProofResult
```

Check an authority proof; see the module docstring.

### [canonical](https://provenanceauth.com/docs/sdks/verify/python/canonical.md)

```ts
provenanceauth_verify.canonical(value: Any) -> str
```

Canonical JSON (sorted keys, no whitespace, JS number formatting): the offer-hash pre-image.

### [offer_hash](https://provenanceauth.com/docs/sdks/verify/python/offer-hash.md)

```ts
provenanceauth_verify.offer_hash(payload: dict) -> str
```

Sha256 (hex) of the offer's canonical JSON payload: what the acceptance token binds.

### [content_hash](https://provenanceauth.com/docs/sdks/verify/python/content-hash.md)

```ts
provenanceauth_verify.content_hash(content: Union[bytes, str]) -> str
```

Sha256 (hex) of delivered bytes or text.

### [items_total](https://provenanceauth.com/docs/sdks/verify/python/items-total.md)

```ts
provenanceauth_verify.items_total(items: list, currency: str) -> float
```

### [decode_jws](https://provenanceauth.com/docs/sdks/verify/python/decode-jws.md)

```ts
provenanceauth_verify.decode_jws(jws: str) -> Optional[tuple]
```

Header, payload, signing_input, signature) of a compact JWS, or None (no signature check).

### [offer_shape_error](https://provenanceauth.com/docs/sdks/verify/python/offer-shape-error.md)

```ts
provenanceauth_verify.offer_shape_error(p: dict, now: Optional[int] = …) -> Optional[str]
```

Why an offer payload is malformed (one line), or None.

### [sign_offer](https://provenanceauth.com/docs/sdks/verify/python/sign-offer.md)

```ts
provenanceauth_verify.sign_offer(payload: dict, private_jwk: dict, now: Optional[int] = …, ttl_seconds: int = …) -> dict
```

Sign an offer with the seller agent's Ed25519 key (a JWK with `d`).

### [verify_offer](https://provenanceauth.com/docs/sdks/verify/python/verify-offer.md)

```ts
provenanceauth_verify.verify_offer(offer: str, keys: list, now: Optional[int] = …, buyer_agent_id: Optional[str] = …, seller: Optional[str] = …) -> OfferResult
```

Verify a signed offer against the seller's registered keys (`[{kty, crv, x, kid, status?}]`).

### [sign_delivery](https://provenanceauth.com/docs/sdks/verify/python/sign-delivery.md)

```ts
provenanceauth_verify.sign_delivery(payload: dict, private_jwk: dict) -> dict
```

Sign a delivery receipt (`deal_id`, `offer_hash`, `content_hash`, …) with the seller's key.

### [verify_delivery](https://provenanceauth.com/docs/sdks/verify/python/verify-delivery.md)

```ts
provenanceauth_verify.verify_delivery(receipt: str, keys: list, seller: Optional[str] = …) -> bool
```

### [verify_deal_acceptance](https://provenanceauth.com/docs/sdks/verify/python/verify-deal-acceptance.md)

```ts
provenanceauth_verify.verify_deal_acceptance(token: str, offer: Union[str, dict], jwks: dict, seller: Optional[str] = …, revocations: Optional[dict] = …, now: Optional[int] = …) -> AcceptanceResult
```

The seller's offline check of a buyer's acceptance token (parity with `verifyDealAcceptance`).

### [verify_counterparty](https://provenanceauth.com/docs/sdks/verify/python/verify-counterparty.md)

```ts
provenanceauth_verify.verify_counterparty(api_base: str, kid: Optional[str] = …, agent_id: Optional[str] = …, origin: Optional[str] = …, cache_seconds: int = …, timeout: float = …) -> dict
```

`GET /v1/public/counterparties/check` (keyless), cached for 5 minutes per query.

### [holder_thumbprint](https://provenanceauth.com/docs/sdks/verify/python/holder-thumbprint.md)

```ts
provenanceauth_verify.holder_thumbprint(jwk: dict) -> str
```

RFC 7638: the SHA-256 thumbprint of a P-256 key, over `{"crv","kty","x","y"}` in that order, base64url.

### [access_token_hash](https://provenanceauth.com/docs/sdks/verify/python/access-token-hash.md)

```ts
provenanceauth_verify.access_token_hash(token: str) -> str
```

`ath`: the base64url SHA-256 of the token a proof rides with.

### [htu_of](https://provenanceauth.com/docs/sdks/verify/python/htu-of.md)

```ts
provenanceauth_verify.htu_of(url: str) -> str
```

RFC 9449: `htu` is compared without the query and the fragment.

### [holder_jwk_problem](https://provenanceauth.com/docs/sdks/verify/python/holder-jwk-problem.md)

```ts
provenanceauth_verify.holder_jwk_problem(jwk: Any) -> Optional[str]
```

The problem with a holder key, or None when it's a P-256 public JWK.

### [check_holder_proof](https://provenanceauth.com/docs/sdks/verify/python/check-holder-proof.md)

```ts
provenanceauth_verify.check_holder_proof(proof: str, method: str, url: str, token: Optional[str], now: int, nonce: Optional[str] = …, max_age_seconds: int = …) -> HolderProofResult
```

Check a DPoP proof.

### [grant_holder_jkt](https://provenanceauth.com/docs/sdks/verify/python/grant-holder-jkt.md)

```ts
provenanceauth_verify.grant_holder_jkt(payload: dict) -> Optional[str]
```

The grant's `cnf.jkt`: None for a bearer grant, `"malformed"` for a `cnf` we can't use (fails closed).

### [holder_reason](https://provenanceauth.com/docs/sdks/verify/python/holder-reason.md)

```ts
provenanceauth_verify.holder_reason(token: str, jkt: str, holder: Optional[dict], now_ms: int) -> Optional[str]
```

The holder check on a bound grant: None when it holds, else the reason.

### [need_fits](https://provenanceauth.com/docs/sdks/verify/python/need-fits.md)

```ts
provenanceauth_verify.need_fits(authority: dict, need: Optional[dict]) -> Optional[str]
```

The first limit `need` breaks, or None.

### [verify_mandate](https://provenanceauth.com/docs/sdks/verify/python/verify-mandate.md)

```ts
provenanceauth_verify.verify_mandate(token: str, jwks: dict, need: Optional[dict] = …, online: bool = …, api_base: Optional[str] = …, now_ms: Optional[int] = …, timeout: float = …, holder: Optional[dict] = …) -> MandateResult
```

Check another agent's mandate token; see the module docstring.

### [verify_tab](https://provenanceauth.com/docs/sdks/verify/python/verify-tab.md)

```ts
provenanceauth_verify.verify_tab(token: str, jwks: dict, seller: str, revocations: Optional[CachedRevocations], amount: Optional[float] = …, now_ms: Optional[int] = …) -> TabResult
```

The seller's offline check of one call's tab token.

### [verify_revocation_list](https://provenanceauth.com/docs/sdks/verify/python/verify-revocation-list.md)

```ts
provenanceauth_verify.verify_revocation_list(jws: str, jwks: dict, aud: str) -> Optional[dict]
```

The list's payload when its signature, typ and audience check out, else None.

### [fetch_revocations](https://provenanceauth.com/docs/sdks/verify/python/fetch-revocations.md)

```ts
provenanceauth_verify.fetch_revocations(api_base: str, aud: str, jwks: dict, current: Optional[CachedRevocations] = …, timeout: float = …) -> Optional[CachedRevocations]
```

`GET /v1/public/revocations?aud=` with `If-None-Match`.

### [sign_usage_statement](https://provenanceauth.com/docs/sdks/verify/python/sign-usage-statement.md)

```ts
provenanceauth_verify.sign_usage_statement(payload: dict, private_jwk: dict) -> dict
```

Sign a usage statement (`tab_id`, `period_start`, `period_end`, `calls`, `amount`) with the seller's key.

### [verify_usage_statement](https://provenanceauth.com/docs/sdks/verify/python/verify-usage-statement.md)

```ts
provenanceauth_verify.verify_usage_statement(statement: str, keys: list, seller: Optional[str] = …) -> bool
```

### [ucp_hashed_checkout](https://provenanceauth.com/docs/sdks/verify/python/ucp-hashed-checkout.md)

```ts
provenanceauth_verify.ucp_hashed_checkout(checkout: dict) -> dict
```

The checkout minus `UCP_HASH_EXCLUDED` (the members `checkout_hash` covers).

### [ucp_checkout_hash](https://provenanceauth.com/docs/sdks/verify/python/ucp-checkout-hash.md)

```ts
provenanceauth_verify.ucp_checkout_hash(checkout: dict) -> str
```

`checkout_hash`: SHA-256 hex of the JCS form of the checkout minus `UCP_HASH_EXCLUDED`.

### [ucp_binding_payload](https://provenanceauth.com/docs/sdks/verify/python/ucp-binding-payload.md)

```ts
provenanceauth_verify.ucp_binding_payload(checkout: dict, payee: str) -> dict
```

The object an intent token's `payload_hash` binds for this checkout.

### [ucp_binding_hash](https://provenanceauth.com/docs/sdks/verify/python/ucp-binding-hash.md)

```ts
provenanceauth_verify.ucp_binding_hash(checkout: dict, payee: str) -> str
```

The `payload_hash` an intent token carries for this checkout.
