Skip to main content

Python SDK for Bolyra — unified ZKP identity for humans and AI agents

Project description

bolyra

Python SDK for Bolyra — zero-knowledge identity verification for AI agents.

Install

pip install bolyra

Quick Start

from bolyra import Permission, permissions_to_bitmask, validate_cumulative_bit_encoding

# Define agent permissions
bitmask = permissions_to_bitmask([
    Permission.READ_DATA,
    Permission.WRITE_DATA,
    Permission.FINANCIAL_SMALL,
])
print(f"Bitmask: {bitmask}")  # 7

# Validate cumulative encoding
validate_cumulative_bit_encoding(bitmask)  # OK — no exception

# Types for identity and credentials
from bolyra import HumanIdentity, AgentCredential, HandshakeResult

Architecture

The Python SDK provides:

  • Pure Python types, validation, and error handling (zero dependencies)
  • Subprocess bridge to the Node.js @bolyra/sdk for ZK proof generation (snarkjs is JavaScript-only)

For proof generation and verification, install the Node.js SDK:

npm install @bolyra/sdk

API

Types

  • HumanIdentity — EdDSA identity with secret, public key, and commitment
  • AgentCredential — AI agent credential with model hash, permissions, expiry
  • HandshakeResult — Mutual handshake verification result
  • Permission — 8-bit permission enum with cumulative encoding

Functions

  • permissions_to_bitmask(permissions) — Convert permission list to bitmask
  • validate_cumulative_bit_encoding(bitmask) — Validate cumulative bit rules
  • validate_human_secret(secret) — Validate secret is within BN254 field
  • validate_agent_expiry(expiry) — Validate expiry is in the future

Errors

All errors extend BolyraError with a .code property matching the TypeScript SDK.

License

Apache-2.0 — see LICENSE.

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

bolyra-0.3.0.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

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

bolyra-0.3.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file bolyra-0.3.0.tar.gz.

File metadata

  • Download URL: bolyra-0.3.0.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for bolyra-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d465b65b6f42627921f30dbd22ae7d141c969337f8b2ebde15dc11e991c31729
MD5 78b0925ccd06433ee208b742e84e1e79
BLAKE2b-256 9d0ed25ea2b54de81808b1245c75fbc2537dd82b65677840e21e6c027fef1293

See more details on using hashes here.

File details

Details for the file bolyra-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: bolyra-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for bolyra-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f76dbfa6c7f6222f10da3e10420d339ff13b143d2396bbdfaef04576ea685661
MD5 743074b751cb9729ef2c21e0a9e7ab1e
BLAKE2b-256 f65cd4e3f4e7db52f424236379f23d36a49f789c47be98bdf9c1dc973384ca66

See more details on using hashes here.

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