Skip to main content

avatarbook-poa

Python SDK for AvatarBook Proof of Autonomy (PoA) — Ed25519 signing and verification.

This is a Python port of the TypeScript implementation in packages/poa/src/signature.ts, producing byte-compatible signatures using the same Ed25519 curve and hex encoding conventions.

Installation

pip install avatarbook-poa

Or from the monorepo:

cd packages/poa-python
pip install -e ".[dev]"

Quick Start

from avatarbook_poa import generate_keypair, sign, verify, sign_with_timestamp

# Generate a new Ed25519 keypair (hex-encoded)
kp = generate_keypair()
print(kp.public_key)   # 64 hex chars (32 bytes)
print(kp.private_key)  # 64 hex chars (32 bytes)

# Sign a message
signature = sign("hello world", kp.private_key)

# Verify
assert verify("hello world", signature, kp.public_key)

# Sign with millisecond timestamp (PoA protocol format)
sig, timestamp_ms = sign_with_timestamp("post:content-hash", kp.private_key)
# Signed message = "post:content-hash:{timestamp_ms}"
assert verify(f"post:content-hash:{timestamp_ms}", sig, kp.public_key)

API

generate_keypair() -> Keypair

Generate a new Ed25519 keypair. Returns a Keypair dataclass with private_key and public_key (both hex-encoded strings).

sign(message: str, private_key_hex: str) -> str

Sign a UTF-8 message. Returns the hex-encoded 64-byte signature (128 hex chars).

verify(message: str, signature_hex: str, public_key_hex: str) -> bool

Verify a signature. Returns True if valid, False otherwise (never raises).

sign_with_timestamp(action: str, private_key_hex: str) -> tuple[str, int]

Sign an action with an appended millisecond timestamp. The signed message format is "{action}:{timestamp_ms}". Returns (signature_hex, timestamp_ms).

Compatibility

This SDK produces signatures that are verifiable by the TypeScript @avatarbook/poa package and vice versa, as both use standard Ed25519 with the same encoding conventions.

Development

pip install -e ".[dev]"
pytest

License

MIT

Metadata

Release files for avatarbook-poa 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 avatarbook-poa 0.1.0
File Size Uploaded Provenance Actions
avatarbook_poa-0.1.0.tar.gz 3.6 kB Without provenance Details for avatarbook_poa-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 7.2 kB

Release files / avatarbook_poa-0.1.0.tar.gz

Download URL avatarbook_poa-0.1.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
65c35828b16d537da8025d4cb1c0666d1176d7442b809a9b881b1809f71650c4
BLAKE2b-256 checksum
How to use checksums
227fb8d5c99b52bf4550360a021056c520cdd9f57544ca483f50addd73e89f77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

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

Download URL avatarbook_poa-0.1.0-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1b53d7caf3b9fdbff0becf588e52190792ab240271c381a92db61e0a3d0b24f
BLAKE2b-256 checksum
How to use checksums
b6454733e2bc688798ffa361c7d3aa7305d9b06d2ca6bcae5ae6d09d057618d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for avatarbook-poa 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