Skip to main content

Auths Python SDK - decentralized identity for developers and AI agents

Project description

Auths Python SDK

Decentralized identity for developers and AI agents. Sign, verify, and manage cryptographic identities with Git-native storage.

Install

pip install auths-python

Quick start

from auths import Auths

auths = Auths()

# Verify an attestation
result = auths.verify(attestation_json=data, issuer_key=public_key_hex)
print(result.valid)  # True

# Sign bytes
signature = auths.sign(b"hello world", private_key=secret_key_hex)

Identity management

from auths import Auths

auths = Auths(repo_path="~/.auths")

# Create a cryptographic identity
identity = auths.identities.create(label="laptop")
print(identity.did)  # did:keri:EBfd...

# Provision an agent (for CI, MCP servers, etc.)
agent = auths.identities.provision_agent(
    identity.did,
    name="deploy-bot",
    capabilities=["sign"],
)

# Sign using the keychain-stored identity key
sig = auths.sign_as(b"hello world", identity=identity.did)

# Link and manage devices
device = auths.devices.link(identity_did=identity.did, capabilities=["sign"])
auths.devices.revoke(device.did, identity_did=identity.did, note="replaced")

Git commit verification

from auths.git import verify_commit_range

result = verify_commit_range("HEAD~5..HEAD")
for commit in result.commits:
    print(f"{commit.commit_sha}: {'valid' if commit.is_valid else commit.error}")

Capability-aware verification

# Verify an attestation grants a specific capability
result = auths.verify(attestation_json=data, issuer_key=key, required_capability="sign_commit")

# Verify an entire chain grants a capability
report = auths.verify_chain(chain, root_key, required_capability="deploy")

Agent auth for MCP / AI frameworks

from auths.agent import AgentAuth

auth = AgentAuth(
    bridge_url="https://bridge.example.com",
    attestation_chain_path=".auths/agent-chain.json",
)
token = auth.get_token(capabilities=["read", "write"])

Error handling

from auths import Auths, VerificationError, NetworkError

auths = Auths()
try:
    result = auths.verify(attestation_json=data, issuer_key=key)
except VerificationError as e:
    print(e.code)     # "expired_attestation"
    print(e.message)  # "Attestation expired at 2024-01-15T..."
except NetworkError as e:
    if e.should_retry:
        pass  # safe to retry

All errors inherit from AuthsError and carry .code, .message, and .context.

Configuration

# Auto-discover (uses ~/.auths)
auths = Auths()

# Explicit repo path
auths = Auths(repo_path="/path/to/identity-repo")

# With passphrase (or set AUTHS_PASSPHRASE env var)
auths = Auths(passphrase="my-secret")

# Headless / CI mode
# Set AUTHS_KEYCHAIN_BACKEND=file for environments without a system keychain

API reference

Type stubs are bundled (py.typed + __init__.pyi). Your editor will show full signatures, docstrings, and return types for all methods.

License

Apache-2.0

Project details


Download files

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

Source Distribution

auths_python-0.1.0.tar.gz (872.8 kB view details)

Uploaded Source

Built Distributions

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

auths_python-0.1.0-cp38-abi3-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.8+Windows x86-64

auths_python-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.39+ x86-64

auths_python-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.9 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

auths_python-0.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (9.8 MB view details)

Uploaded CPython 3.8+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: auths_python-0.1.0.tar.gz
  • Upload date:
  • Size: 872.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for auths_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 84882fed3deb5c860c0a36ae00ea12269ba320be6a85b77c854efb7f11ab2ae5
MD5 a30816044b6665e8f8e85787db1f55de
BLAKE2b-256 c1d6c0e86773004275f3d32fde0affd295d3f1110c47cf1b61b05560916ca5e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for auths_python-0.1.0.tar.gz:

Publisher: publish-python.yml on auths-dev/auths

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file auths_python-0.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: auths_python-0.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for auths_python-0.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b8d5b9988ed56b683d965a6a7df32f674a8a9241178348d2171b3bd4e6b39175
MD5 b36559587d75d43003feecd4e879b341
BLAKE2b-256 bccf203608f059798e3325637a61f38e53929db7308261cdcee49ce9139df069

See more details on using hashes here.

Provenance

The following attestation bundles were made for auths_python-0.1.0-cp38-abi3-win_amd64.whl:

Publisher: publish-python.yml on auths-dev/auths

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file auths_python-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for auths_python-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 31c4db9a9d80ae6bb90f3c0ea5745a435275c9372c870e5c5a32b8fcd9fba5d3
MD5 c5507fde01f236bab0e886208fc13697
BLAKE2b-256 404c13a7dfd1a13b9abe49430419bdf5ec343977c7c3cc9e078c0eb50682eb37

See more details on using hashes here.

Provenance

The following attestation bundles were made for auths_python-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl:

Publisher: publish-python.yml on auths-dev/auths

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file auths_python-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for auths_python-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f217f0f9850ec2eaa940b8c268ba04c19df3281761a62935f48c60959d117560
MD5 4f8fac81011e31d8ffacb47be94068e3
BLAKE2b-256 989a2b1009b2f123cfc4d4935e9d673633f65a7e03d029fc3e3e0c80c454175c

See more details on using hashes here.

Provenance

The following attestation bundles were made for auths_python-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish-python.yml on auths-dev/auths

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file auths_python-0.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for auths_python-0.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 d711ee80158799d9d50b31e01ebe512144e1439397dadbaf9c4f7b0ed91d464a
MD5 abfde9c55cdda4ea4aee77ad8074d80e
BLAKE2b-256 bf46bbd33fcf4582b347b7b1f6f51d29ef1b68b5c78eeb0d9badbae61ee40184

See more details on using hashes here.

Provenance

The following attestation bundles were made for auths_python-0.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: publish-python.yml on auths-dev/auths

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page