VCB Verify
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vcb_verify-2.0.0.tar.gz.
File metadata
- Download URL: vcb_verify-2.0.0.tar.gz
- Upload date:
- Size: 31.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f008b8b76792dd8d5777d60580dc881cebd653ce34bc5fedc6c4c673777760bb
|
|
| MD5 |
64c8b136c2b289a07c87450ac6653012
|
|
| BLAKE2b-256 |
b70ce2f9a15bb306c3f1721fe17614023d4650b66b997d2773131ccfe7437a3f
|
Provenance
The following attestation bundles were made for vcb_verify-2.0.0.tar.gz:
Publisher:
publish.yml on subfile-llc/vcb-verify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcb_verify-2.0.0.tar.gz -
Subject digest:
f008b8b76792dd8d5777d60580dc881cebd653ce34bc5fedc6c4c673777760bb - Sigstore transparency entry: 2386499795
- Sigstore integration time:
-
Permalink:
subfile-llc/vcb-verify@4aab9a731dd30a9666f15848a1536deff7af8293 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/subfile-llc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4aab9a731dd30a9666f15848a1536deff7af8293 -
Trigger Event:
release
-
Statement type:
File details
Details for the file vcb_verify-2.0.0-py3-none-any.whl.
File metadata
- Download URL: vcb_verify-2.0.0-py3-none-any.whl
- Upload date:
- Size: 36.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28765ee8baedcdbf38dc9f345f74f9da7123b2404bad2531257449ad7d7e7ff6
|
|
| MD5 |
f7c67c5e43502d53b91a5124e7a5234e
|
|
| BLAKE2b-256 |
33dac5b0aed5c0f30c5bfcd5e6997547f864df0a47b39a105c5d25eca2e84d12
|
Provenance
The following attestation bundles were made for vcb_verify-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on subfile-llc/vcb-verify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcb_verify-2.0.0-py3-none-any.whl -
Subject digest:
28765ee8baedcdbf38dc9f345f74f9da7123b2404bad2531257449ad7d7e7ff6 - Sigstore transparency entry: 2386499801
- Sigstore integration time:
-
Permalink:
subfile-llc/vcb-verify@4aab9a731dd30a9666f15848a1536deff7af8293 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/subfile-llc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4aab9a731dd30a9666f15848a1536deff7af8293 -
Trigger Event:
release
-
Statement type: