Skip to main content

larzid

Decentralized identity & verifiable credentials in pure Python.

Self-certifying identities and signed, checkable claims — with no blockchain, no central registry, and no certificate authority. An identity is an Ed25519 keypair whose DID (did:larz:<pubkey>) literally contains its public key, so anyone can verify its signatures from the DID alone. Issuers sign credentials about subjects that anyone can verify offline.

from larzid import Identity, Credential

issuer  = Identity.generate()
subject = Identity.generate()

# issue a signed, expiring claim about the subject
cred = Credential.issue(issuer, {"role": "admin"},
                        subject=subject.did, expires_in=3600)

cred.verify(issuer.did)      # True — signature + expiry checked, offline

Why

  • Self-certifying. The DID carries the public key, so verification needs nothing external — no ledger lookup, no CA, no callback to the issuer.
  • Real signatures. Ed25519 via larzcrypt (itself pure Python). Tamper with a credential and verification fails.
  • Offline-verifiable credentials. Issue a claim once; anyone can check who signed it, that it's unmodified, and that it hasn't expired — without talking to the issuer.
  • Safe by construction. Public-only identities (from a DID) can verify but can't sign; to_dict() never leaks the secret; bad input returns False instead of throwing.

Install

pip install larzid

Identities

from larzid import Identity

alice = Identity.generate()
alice.did                     # "did:larz:3b6a08...f1"  (self-certifying)
sig = alice.sign(b"hello")    # hex signature
Identity.verify(alice.did, b"hello", sig)     # True

# persist / restore an identity by its secret seed (back this up securely!)
seed = alice.export_secret()  # 64 hex chars
alice = Identity.from_secret(seed)

# a verify-only identity from just a DID
watcher = Identity.from_did(alice.did)
watcher.can_sign              # False

Verifiable credentials

An issuer attests to some claims about a subject and signs them. The credential is a self-contained object anyone can verify.

from larzid import Identity, Credential

issuer, subject = Identity.generate(), Identity.generate()

cred = Credential.issue(
    issuer,
    {"role": "admin", "org": "acme"},
    subject=subject.did,
    expires_in=86400,
)

cred.verify(issuer.did)       # True
cred.claims                   # {"role": "admin", "org": "acme"}
cred.is_expired()             # False

# hand it over the wire and verify on the other side
wire = cred.to_json()
Credential.from_json(wire).verify(issuer.did)

Verification checks the issuer's signature, optionally that it came from the issuer you expect, and that it hasn't expired — all offline.

Use it for

Service-to-service auth, API tokens you can verify without a database, capability grants ("this DID may do X until T"), attestations, and anything blockchain-adjacent — it's the natural identity layer for larzchain.

Scope

larzid gives you identities and signed credentials. It deliberately doesn't include revocation lists, selective disclosure, or a DID resolver network — those are layers you can build on top. What's here is the cryptographic core, done simply and correctly.

Tests

python -m unittest discover -s tests -v      # 19 tests, incl. tamper/expiry/forgery

The Larz stack

Pure-Python, zero-third-party-dependency building blocks:

  • larz — money-native web framework
  • larzchain — from-scratch PoW blockchain
  • larzmoney — exact, penny-perfect money
  • larzcrypt — pure-Python cryptography toolkit
  • larzdb — crash-safe embedded database
  • larzagent — zero-dep AI agent framework
  • larzchart — data to inline SVG charts
  • larzmark — Markdown + SEO static sites
  • larztask — durable background job queue
  • larzvault — encrypted secrets manager
  • larzvm — deterministic gas-metered VM
  • larzcache — LRU/TTL/tiered caching
  • larzvalidate — schema validation
  • larzid — this library

License

MIT © larz-scripter

Metadata

Release files for larzid 0.1.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 larzid 0.1.0
File Size Uploaded Provenance
larzid-0.1.0.tar.gz 8.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 17.2 kB

Release files / larzid-0.1.0.tar.gz

Download URL larzid-0.1.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8700999063e536b4b9671b4565b62591b299a65deda124c78569526fadcc2bed
BLAKE2b-256 checksum
How to use checksums
9c35e1b76aca61555d967dba9babbd63c8e67e079f49283792e931aad16a434b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / larzid-0.1.0-py3-none-any.whl

Download URL larzid-0.1.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ed50c2cdde918b108bf6a7f18f59299d979fe2ab9cd3096b8a319766e4efec0
BLAKE2b-256 checksum
How to use checksums
f0c6f6a8f73eb06b5292f00c5c5ce5a58803d078ae003d489386d0b8d5c09391
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for larzid 0.1.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.1.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