Skip to main content

VCB Verify

CI PyPI Python

Verify Verifiable Credential Barcodes on DL/ID PDF417 barcodes.

Background

Verifiable Credential Barcodes embed digitally signed credentials inside PDF417 barcodes on government-issued drivers licenses and identification cards. This library verifies those credentials: it parses the barcode, checks the cryptographic proof, and optionally checks revocation status.

The library is jurisdiction-agnostic. Any issuer that follows the W3C VCB specification can be supported by adding an IssuerProfile. Built-in profiles are included for California DMV and the W3C Utopia test vectors. Each profile bundles DID documents for offline use, but online resolution is recommended for production to pick up key rotations. Host allowlists on each profile restrict which remote resources can be fetched during verification.

The API is synchronous. Python 3.12+.

Install

pip install vcb-verify

Development:

git clone https://github.com/subfile-llc/vcb-verify.git
cd vcb-verify
pip install -e ".[dev]"

Usage

Basic verification

from vcb_verify import verify
from vcb_verify.issuers import ca_dmv_prod_profile

scanned_data = ...  # PDF417 bytes or string from barcode scanner
result = verify(data=scanned_data, profile=ca_dmv_prod_profile())

if result.valid:
    print("Valid credential")
else:
    print(f"Invalid: {result.error}")

By default, barcodes without VCB data are returned as not-valid rather than raising an error. Pass require_vcb=True to treat missing VCB data as a verification failure, or use profile.vcb_required_after to require it based on the credential's issued date.

Check revocation status

result = verify(
    data=scanned_data,
    profile=ca_dmv_prod_profile(),
    verify_status=True,
)

This uses profile.get_fetching_loader() by default. To supply a custom fetch implementation, pass http_fetch=... to verify() or use profile.get_fetching_loader(http_fetch=...) as document_loader.

Document loaders

Verification resolves JSON-LD contexts and DID documents through a DocumentLoader callback. IssuerProfile.get_loader() provides offline (bundled) and online (HTTP) defaults. For custom fetch behaviour, use build_loader(..., http_fetch=...) or profile.get_fetching_loader(http_fetch=...).

Online mode

online=True (and verify_status=True) enables HTTP for allowlisted remote resources such as revocation status lists. Live did:web fetch happens only when no bundled document is available.

Debug output

result = verify(
    data=scanned_data,
    profile=ca_dmv_prod_profile(),
    debug=True,
)
if result.debug:
    print(result.debug["credential"])
    print(result.debug["aamva_hash"].hex())

Issuer Profiles

An IssuerProfile configures verification for a specific jurisdiction.

Built-in profiles

Profile Function Description
CA DMV Production ca_dmv_prod_profile() California production credentials
CA DMV UAT ca_dmv_uat_profile() California test/UAT credentials
W3C Utopia utopia_test_profile() W3C spec test vectors (offline only)
from vcb_verify.issuers import ca_dmv_prod_profile, ca_dmv_uat_profile, utopia_test_profile

Custom profiles

from vcb_verify import IssuerProfile

profile = IssuerProfile(
    name="my-state",
    issuer_identification_number="123456",
    vcb_subfile="ZC",
    vcb_field="ZCE",
    type_table={ ... },           # CBOR-LD compression table for this issuer
    allowed_hosts={"did.example.com"},
    static_documents={ ... },     # Bundled DID documents for offline mode
)

See the CA DMV profile for a complete example.

API

verify(data, *, profile, ...)

Parameter Type Default Description
data bytes | str (required) PDF417 barcode data
profile IssuerProfile (required) Issuer configuration
require_vcb bool False Require VCB data to be present
verify_status bool False Check revocation status online
document_loader DocumentLoader None Override document loader (default from profile)
http_fetch Callable None Custom HTTP fetch when verify_status=True
debug bool False Include debug details in result

Returns: VerifyResult

Field Type Description
valid bool True if the credential is valid
error Exception | None Error details if invalid
debug dict | None Debug details if requested

IssuerProfile.get_loader(*, online=False)

Returns a document loader for this profile.

Mode Behaviour
online=False (default) Bundled static DID documents (no HTTP)
online=True Bundled DIDs for keys; HTTP for allowlisted status / remote URLs
get_fetching_loader(http_fetch=...) Online loader; optional http_fetch (defaults to default_http_fetch)
Field Type Default Description
loader_timeout float 5.0 HTTP timeout (seconds) for online / fetching loaders

Contribute

pip install -e ".[dev]"
pytest
ruff check src tests

See CHANGELOG.md for release notes.

License

BSD-3-Clause © Subfile, LLC

Metadata

Release files for vcb-verify 2.0.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 vcb-verify 2.0.0
File Size Uploaded Provenance Actions
vcb_verify-2.0.0.tar.gz 31.4 kB With provenance Details for vcb_verify-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vcb-verify 2.0.0
File Interpreter ABI Platform Actions
vcb_verify-2.0.0-py3-none-any.whl Python 3 none any Details for vcb_verify-2.0.0-py3-none-any.whl

Total release size: 67.9 kB

Release files / vcb_verify-2.0.0.tar.gz

Download URL vcb_verify-2.0.0.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f008b8b76792dd8d5777d60580dc881cebd653ce34bc5fedc6c4c673777760bb
BLAKE2b-256 checksum
How to use checksums
b70ce2f9a15bb306c3f1721fe17614023d4650b66b997d2773131ccfe7437a3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 8, 2026.

Transparency log

Release files / vcb_verify-2.0.0-py3-none-any.whl

Download URL vcb_verify-2.0.0-py3-none-any.whl
Size 36.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28765ee8baedcdbf38dc9f345f74f9da7123b2404bad2531257449ad7d7e7ff6
BLAKE2b-256 checksum
How to use checksums
33dac5b0aed5c0f30c5bfcd5e6997547f864df0a47b39a105c5d25eca2e84d12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 8, 2026.

Transparency log

Security for vcb-verify 2.0.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 vcb_verify-2.0.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 Aug 8, 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.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files Full provenance

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