Metadata-Version: 2.4
Name: inherence-verifier
Version: 0.1.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Security :: Cryptography
Summary: Verify Inherence receipts (verification protocol v1). PyO3 bindings to the audited Rust verifier.
Keywords: inherence,zk,verifier,receipts,groth16
License: Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# inherence-verifier (Python)

PyO3 bindings over the [Rust verifier](https://github.com/inherencelabs/inherence-verifier-rs). Published on PyPI as `inherence-verifier`.

## Why bindings and not pure Python?

The verification protocol requires Groth16 over BN254 — the same elliptic-curve pairing arithmetic that the issuer's proving side runs. We use the audited arkworks crates via Rust and expose them through PyO3, rather than relying on a pure-Python pairing implementation. The bindings are abi3-py39 compatible (one wheel per OS×arch covers every Python 3.9+).

## Install

```sh
pip install inherence-verifier
```

(After publishing — see `Build from source` below for development.)

## Build from source

```sh
cargo install maturin
maturin develop --release         # local dev, installs into the active venv
maturin build --release --strip   # build a wheel for distribution
```

The local Rust verifier crate is a path dep (`../inherence-verifier-rs`). For published builds, point it at a tagged version of `inherence-verifier` on crates.io.

## API

```python
from inherence_verifier import VerifyConfig, verify_receipt
import json

cfg = VerifyConfig()
cfg.pin_authority_jwk(json.dumps(authority_jwk))   # dict or JSON string
cfg.pin_vk_b64(vk_hash_hex, vk_b64)                # OR pin_vk(hash, bytes)

out = verify_receipt(receipt_jwt, cfg)
if out["verdict"] == "VALID":
    pass
else:
    code = out["failure_code"]   # SPEC §8 controlled vocabulary
    detail = out["detail"]
```

`verify_receipt` never raises for verification failures — outcomes
are values. It raises `ValueError` only for malformed input
(e.g. an authority JWK that isn't valid JSON).

## Conformance

The same 22 vectors from `inherence-python/spec/receipts/v1/FIXTURES.json`. Replay them with:

```sh
pytest tests/test_vectors.py
```

