claw401
Python SDK for the Claw401 X401 wallet authentication protocol.
Install
pip install claw401
Overview
Implements the X401 challenge-response authentication flow for Solana Ed25519 wallet keys.
Usage
Generate and verify a challenge
from claw401 import generate_challenge, verify_signature, InMemoryNonceCache
from claw401.types import SignedChallenge
nonce_cache = InMemoryNonceCache()
# Server: generate challenge
challenge = generate_challenge(domain="app.example.com")
# Client signs challenge_signing_bytes(challenge) with their Ed25519 key
# ...
# Server: verify
signed = SignedChallenge(
challenge=challenge,
signature="<base64-signature>",
public_key="<base58-public-key>",
)
result = verify_signature(signed, "app.example.com", nonce_cache)
if result.valid:
print(result.public_key) # authenticated wallet address
Create a session
from claw401 import create_session, verify_session
session = create_session(
public_key=result.public_key,
domain="app.example.com",
nonce=challenge.nonce,
scopes=["read", "write"],
)
# Later: verify session
result = verify_session(session, "app.example.com", required_scopes=["write"])
Agent attestation
from claw401 import create_agent_attestation, verify_agent_attestation
attestation = create_agent_attestation(
agent_key=agent_pubkey,
operator_key=operator_pubkey,
operator_secret_key=operator_signing_key,
agent_id="my-agent-001",
actions=["read:orders", "submit:tx"],
mcp_tools=["get_order", "submit_settlement"],
ttl_ms=24 * 60 * 60 * 1000,
)
result = verify_agent_attestation(attestation, expected_operator_key=operator_pubkey)
License
Apache-2.0
Metadata
Release files for claw401 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| claw401-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for claw401-0.1.0-py3-none-any.whl |
Release files / claw401-0.1.0-py3-none-any.whl
| Download URL | claw401-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73e8b00a479090be08e4afd1166817029c25dfdef16b2145269346fb0e6582f7
|
|
BLAKE2b-256 checksum How to use checksums |
db321b906cf35b551046955218eec4b7eff84a478b2b57365c04c5d5acbbf78a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.6 Windows/11
|
Security for claw401 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.