Skip to main content

zk-age-verifier

zk-age-verifier is a verifier service for EU age verification, accepting Longfellow zero-knowledge proofs over mdoc through the W3C Digital Credentials API. It runs as a sidecar HTTP service beside a consumer backend. A verified verdict contains one boolean per requested check. The service has no authentication and is intended to be reachable only from the consumer backend, not the browser or internet. It is experimental and unstable.

CI Docs PyPI License: Apache 2.0

Installation

pip install zk-age-verifier
uv add zk-age-verifier
docker pull ghcr.io/pipe23-org/zk-age-verifier:latest

Usage

The verifier needs a configured origin and at least one trust source.

[service]
expected_origin = "https://av.example"

[[trust.sources]]
pem = "/etc/zk-age-verifier/anchors"
python -m zk_age_verifier --config config.toml

POST /sessions opens a session and returns the navigator.credentials.get() argument under transports.dc.

$ curl -X POST http://127.0.0.1:8000/sessions \
    -H 'content-type: application/json' -d '{"checks": ["age_over_18"]}'
{"session_id": "tmcdOPmo7oCgd4AmmMFyYg",
 "transports": {"dc": {"digital": {"requests": [{"protocol": "org-iso-mdoc",
   "data": {"deviceRequest": "omd2ZXJzaW9u…", "encryptionInfo": "gmVkY2FwaaJ…"}}]},
   "mediation": "required"}},
 "expires_at": "2026-07-20T09:34:22.089682Z"}

The consumer backend relays the wallet response to POST /sessions/{session_id}/presentation. A verified and a failed verification both return 200.

POST /sessions/{session_id}/presentation
{"response": "<wallet response, base64url>"}

{"state": "verified", "result": {"age_over_18": true}, "verified_at": "<iso8601>"}
{"state": "failed", "reason": "decrypt-failed"}

GET /health returns {"status": "ok", "zk_age_verifier": "0.5.0", "pylongfellow": "0.8.0", "engine": "google-cpp", "ref": null} while the process is up.

GET /debug/transcript/{session_id} returns the transcript inputs stored for a session — the origin and the encryptionInfo string — with the handover hash and session-transcript bytes reconstructed from them, hex-encoded. It is a development route, unauthenticated like the rest of the service.

Configuration

The verifier reads a TOML file with two tables, [service] and [trust], passed with --config. Scalar values can be overridden with environment variables.

[service]

  • expected_origin (required) — the origin the service accepts presentations for, a bare scheme://host[:port]. The origin is hashed into the presentation transcript, so it must correspond to the origin that the presentation asserts.
  • pylongfellow.backend (default google-cpp) — the proof engine, see Proof engine.
  • session_ttl_seconds (default 300) — seconds a session stays usable after creation.
  • session_cap (default 1000) — maximum live sessions; session creation is rejected at the cap. Expired sessions are swept before the cap is enforced.
  • timestamp_skew_seconds (default 300) — allowed difference in either direction between the proof timestamp and the verifier clock.
  • cors_allowed_origins (default empty) — origins granted cross-origin access to the API. An empty list sends no CORS headers.
  • log_level (default info) — the threshold below which log events are dropped, one of debug, info, warning, error. Debug output includes the subject, issuer, validity dates, and SHA-256 fingerprint of the certificate a refused presentation supplied.

[trust]

[[trust.sources]] entries form a non-empty list. Each entry sets exactly one of:

  • pem — a PEM file, or a directory whose *.pem files are all loaded.
  • etsi_xml — an ETSI trusted list, path or URL; its certificates become anchors.

Every listed anchor is authorized to vouch for age credentials. Sources that resolve to zero anchors fail startup.

Environment variables

ZK_AGE_VERIFIER_SECTION__KEY overrides a scalar value: ZK_AGE_VERIFIER_ is the prefix and __ separates nesting levels, so ZK_AGE_VERIFIER_SERVICE__PYLONGFELLOW__BACKEND overrides pylongfellow.backend under [service].

Lists and tables cannot be set from the environment and must be written in the TOML file.

LOG_FORMAT=console switches log output from JSON lines to console rendering. It is read from the environment only and takes no prefix.

Proof engine

The pylongfellow.backend key selects the proof engine the service verifies with. Registry names: google-cpp (the C++ implementation in longfellow-zk/longfellow-zk), isrg-rust (abetterinternet/zk-cred-longfellow), lf-rust (the Rust implementation in longfellow-zk/longfellow-zk). All three ship in the default pylongfellow install. An unknown or unbuilt name fails startup.

Open issues on pylongfellow detail any known problems with these backends.

Documentation

Full documentation: https://zk-age-verifier.readthedocs.io/

Development

uv sync
uv run pytest
uv run ruff check
uv run ruff format --check
uv run mypy

make test-live runs the suite against a running server over HTTP. make test-container runs it against the built container image.

Status

You should not rely on this code.

  • No rate limiting.
  • The session store is in-process.
  • The proof is verified against an empty device-namespace map; the ZK response format carries no field holding the map the wallet signed.
  • An etsi_xml trust source takes every certificate in the list file as an anchor, including the list's own signer.
  • Log output at info level can contain text supplied by the presenter.

License

Apache-2.0.

Metadata

Release files for zk-age-verifier 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zk-age-verifier 0.5.0
File Size Uploaded Provenance Actions
zk_age_verifier-0.5.0.tar.gz 1.2 MB With provenance Details for zk_age_verifier-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zk-age-verifier 0.5.0
File Interpreter ABI Platform Actions
zk_age_verifier-0.5.0-py3-none-any.whl Python 3 none any Details for zk_age_verifier-0.5.0-py3-none-any.whl

Total release size: 1.5 MB

Release files / zk_age_verifier-0.5.0.tar.gz

Download URL zk_age_verifier-0.5.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
a252e016644d86cfaa6b8e9f84d8d537c0e00fc9d4732471a7eb2bef4f820fb4
BLAKE2b-256 checksum
How to use checksums
89ea9843d7264665e8547636db110b8be407976d7f5e31b1965afeb0549eebd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / zk_age_verifier-0.5.0-py3-none-any.whl

Download URL zk_age_verifier-0.5.0-py3-none-any.whl
Size 339.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a66be565202612b9a640756e6fcb1cd2ec6b14aa0c49c62fd0bc0efcd46799fa
BLAKE2b-256 checksum
How to use checksums
91e10cc7f8703f90f9bd3cbfb8953ee77cb93b7cf1998a075ad217aab46962ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for zk-age-verifier 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for zk_age_verifier-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page