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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

larzid-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

larzid-0.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file larzid-0.1.0.tar.gz.

File metadata

  • Download URL: larzid-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for larzid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8700999063e536b4b9671b4565b62591b299a65deda124c78569526fadcc2bed
MD5 442266f07ae01d41caf6f73962458808
BLAKE2b-256 9c35e1b76aca61555d967dba9babbd63c8e67e079f49283792e931aad16a434b

See more details on using hashes here.

File details

Details for the file larzid-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: larzid-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for larzid-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ed50c2cdde918b108bf6a7f18f59299d979fe2ab9cd3096b8a319766e4efec0
MD5 17f27b302a4b2bf565674b77dcd22118
BLAKE2b-256 f0c6f6a8f73eb06b5292f00c5c5ce5a58803d078ae003d489386d0b8d5c09391

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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