Skip to main content

Verify Inherence receipts (verification protocol v1). PyO3 bindings to the audited Rust verifier.

Project description

inherence-verifier (Python)

PyO3 bindings over the Rust verifier. 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

pip install inherence-verifier

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

Build from source

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

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:

pytest tests/test_vectors.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inherence_verifier-0.1.0.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inherence_verifier-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (447.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file inherence_verifier-0.1.0.tar.gz.

File metadata

  • Download URL: inherence_verifier-0.1.0.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.3

File hashes

Hashes for inherence_verifier-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3deb2a95cf75a57107fc36759df37abc571811621de3f4fd3a01255c59f862bd
MD5 e095c6e43a45f9651b53e9413c5976ea
BLAKE2b-256 433645a28a4c9417916737bc8b043e1ef91cde72a1b77415c6c333865ada3c73

See more details on using hashes here.

File details

Details for the file inherence_verifier-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for inherence_verifier-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a2aa14a950e5104c9f46c69e0ebfba4943b36c509543de05223fdf74e504d95
MD5 33594d2f224792ba38d00268f7b24a82
BLAKE2b-256 43d8a6b623b1657ceae87192e46cb8c7ba6e71553a654df565c4f80541f9cfbe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page