Python SDK for licensefoundry — issuance, verification, and CoMP-shaped translation of W3C Verifiable Credentials.
Reason this release was yanked:
v0.1.x lacks the licensefoundry.compliance module added in 0.2.0 (rubric scoring per https://licensefoundry.com/rubric/v1.0). Use >=0.2.0.
Project description
licensefoundry
Python SDK for licensefoundry — issuance, verification, and CoMP-shaped translation of W3C Verifiable Credentials (JWT-VC encoded, Ed25519-signed).
Built in: Phase 5 of /docs/path-c-rebuild-plan.md.
Install
pip install licensefoundry
Requires Python ≥ 3.10.
Quick start
import os
from licensefoundry import (
LicenseFoundryClient,
IssueCredentialRequest,
Rights,
TrainGrant,
TrainScope,
CommercialGrant,
CredentialScope,
Attribution,
CapabilityNotEnabledError,
)
with LicenseFoundryClient(
base_url="https://api.licensefoundry.com",
api_key=os.environ["LICENSEFOUNDRY_API_KEY"],
# Production verifiers MUST list only their production issuer DID
accepted_issuers=["did:web:licensefoundry.com"],
) as lf:
try:
cred = lf.issuer.issue_credential(IssueCredentialRequest(
asset_id="...",
rights=Rights(
train=TrainGrant(granted=True, scope=TrainScope(model_family="open-source")),
commercial=CommercialGrant(granted=True),
),
scope=CredentialScope(
audience="single_product",
product_id="my-rag",
jurisdiction=["US"],
attribution=Attribution(required=True),
),
))
print(cred.credential_jwt)
except CapabilityNotEnabledError as e:
show_upgrade_modal(plan=e.required_plan, url=e.upgrade_url)
# Verify offline (uses cached JWKS + Status List 2021)
result = lf.verifier.verify(some_jwt)
if not result.valid:
print("invalid:", result.errors)
Public surface
| Module | Use for |
|---|---|
lf.issuer |
register_asset, issue_credential, revoke_credential, status |
lf.verifier |
Offline verification with cached JWKS and Status List 2021 |
licensefoundry.comp |
from_credential(vc), satisfies(vc, function=, ause=, ...) |
The customer-facing API uses canonical Path C field names (train, rag, embed, display, eval, derive, commercial). CoMP terminology (function, subfn, ause, licensedur, etc.) is opt-in via licensefoundry.comp.
Typed errors
Per /docs/auth-access-flows.md §4.5, HTTP failures surface as typed exceptions:
| Exception | When |
|---|---|
AuthError |
401 — bad/missing API key |
CapabilityNotEnabledError |
402 with error: capability_not_enabled — upgrade needed |
ScopeDeniedError |
403 — API key scope rejects this action |
NotFoundError |
404 |
ConflictError |
409 — e.g. asset not yet anchored |
ValidationError |
422 |
RateLimitedError |
429 — carries retry_after |
ServerError |
5xx |
NetworkError |
request failure / timeout |
VerificationError |
raised by verifier.verify_or_raise() |
Verification
Verifier performs offline verification per /docs/credential-format.md §7:
- Parse JWT
- Resolve issuer (cached
did:web→ JWKS) - EdDSA signature verification (via
cryptography) - Temporal validity
@contextand issuer accepted-list checks- Revocation via Status List 2021 bitstring (cached)
Per /docs/billing-model.md §2, offline verification is free — no metering event. Online verification (calling the issuer's /v1/credentials/verify endpoint) is metered.
Specs that govern this SDK
/docs/credential-format.md— wire format and verification/docs/comp-mapping.md— CoMP translation/docs/auth-access-flows.md§4.5 — typed error contracts/docs/billing-model.md§2 — what is metered
Develop
pip install -e ".[dev]"
pytest
ruff check .
mypy src
Project details
Release history Release notifications | RSS feed
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 licensefoundry-0.1.1.tar.gz.
File metadata
- Download URL: licensefoundry-0.1.1.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a1b7f93cb73af51a5443f261a0d48513eea2952a6865b515201958375f1c65e
|
|
| MD5 |
16feb1f8752c85f036428e27a03d6622
|
|
| BLAKE2b-256 |
8e97db9e99089f8b4ede9ec1f9bc39fc438ac52aa94c80c0f1644af1a5c12826
|
File details
Details for the file licensefoundry-0.1.1-py3-none-any.whl.
File metadata
- Download URL: licensefoundry-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a958008c8099efac632b348398f3d97b7eacc05fc2d21103d10c94ac1c0845a5
|
|
| MD5 |
e7ae319d4638a487754976cba63f378d
|
|
| BLAKE2b-256 |
b309e4c54293612d8c6182c51b3134d3c4b77b7c74c91fb3998ca299c95dbae8
|