pylongfellow provides a Python interface to implementations of
Longfellow zero-knowledge proofs over ISO 18013-5 mdoc
credentials.
Two backends are supported:
The package is experimental and unstable.
pip install pylongfellow
Wheels containing both backends are published for CPython 3.11–3.14 on Linux x86_64
(manylinux and musllinux). On any other platform pip falls back to the source distribution,
which builds both backends locally — see the
development page.
import cbor2
from pylongfellow import Pylongfellow, mdoc
from pylongfellow.backends.google_cpp import generate_circuit
longfellow = Pylongfellow(backend="google-cpp")
circuit = generate_circuit(7, 1) # or Path(...).read_bytes()
longfellow.load_circuit(circuit, 7, 1)
claims = [mdoc.RequestedAttribute("org.iso.18013.5.1", "age_over_18", cbor2.dumps(True))]
issuer_public_key = mdoc.PublicKey(x, y)
proof = longfellow.prove(credential, issuer_public_key, transcript, claims, now)
longfellow.verify(issuer_public_key, transcript, claims, now, proof, doctype) # raises on failureExamples are in examples/.
https://pylongfellow.readthedocs.io/en/stable/. The API reference is generated from the docstrings and carries the exact types of every function.
Both backends are vendored as git submodules and built from source into each wheel:
google/longfellow-zk— pinned to v0.9 (fe83ec6).abetterinternet/zk-cred-longfellow— pinned tob22d84e. Upstream publishes no tags.
The pins do not float: upstream ABIs and circuits can change between releases. A nightly canary runs the test suite against both upstream HEADs.
git submodule update --init --recursive
uv sync
uv run pytest
uv run ruff check . && uv run ruff format --check .
uv run mypy
Build prerequisites and single-backend builds are on the development page.
You should not rely on this code.
- Wheels cover CPython 3.11–3.14 on Linux x86_64 only; other platforms build from source.
- The API changes between minor versions.
pylongfellow is licensed Apache-2.0.
The vendored backends are licensed as follows:
google/longfellow-zk— Apache-2.0abetterinternet/zk-cred-longfellow— MPL-2.0
pylongfellow is not affiliated with Google, ISRG, or the European Commission.