Skip to main content

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:

  1. Parse JWT
  2. Resolve issuer (cached did:web → JWKS)
  3. EdDSA signature verification (via cryptography)
  4. Temporal validity
  5. @context and issuer accepted-list checks
  6. 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

Develop

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

Metadata

Release files for licensefoundry 0.3.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 licensefoundry 0.3.0
File Size Uploaded Provenance Actions
licensefoundry-0.3.0.tar.gz 16.8 kB Without provenance Details for licensefoundry-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for licensefoundry 0.3.0
File Interpreter ABI Platform Actions
licensefoundry-0.3.0-py3-none-any.whl Python 3 none any Details for licensefoundry-0.3.0-py3-none-any.whl

Total release size: 38.0 kB

Release files / licensefoundry-0.3.0.tar.gz

Download URL licensefoundry-0.3.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b1cc40ca4fb727295aa09280e4449604dae8b7403d8499eb69c9c5066754815b
BLAKE2b-256 checksum
How to use checksums
598d94ff0aa6ec501dc440630befeb815d9527218740b318f15b105d94f78036
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / licensefoundry-0.3.0-py3-none-any.whl

Download URL licensefoundry-0.3.0-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d20c4ba6cf3528d2102e004268cd7a2925a6ad96b10b3f9a999b8bb72b84f15e
BLAKE2b-256 checksum
How to use checksums
b917326c1ec5a63cf904ac47df3582a35eb6fa81a8392b235469092336670a3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for licensefoundry 0.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

0.3.0 This release

2 release files No 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