Skip to main content

agent-notary SDK

Asyncio-native Python SDK for the A&O Trust Layer Notary API.

Install

pip install agent-notary

Quickstart

import asyncio
from agent_notary import NotaryClient, NotarizeRequest

async def main():
    client = NotaryClient(
        api_key="your-api-key",
        base_url="https://api.aotrust.link/v1"
    )

    # Submit notarization
    req = NotarizeRequest(
        tx_hash="EzrfDW5b...",
        work_hash="599d6999...",
        agent_sig="base64_sig_A...",
        agent_pubkey="aff91a18...",
    )
    result = await client.notarize(req)
    print(f"Job: {result.job_id}")

    # Poll for PDR
    status = await client.wait_for_pdr(result.job_id, timeout=60)
    if status.is_anchored:
        pdr = await client.get_pdr(result.job_id)
        assert pdr.verify(client.notary_pubkey)
        print("PDR Valid: YES")

asyncio.run(main())

Configuration

Env Var Constructor Arg Description
NOTARY_API_KEY api_key API key for auth
NOTARY_API_URL base_url API base URL
NOTARY_PUBKEY notary_pubkey Notary Ed25519 public key (hex)

Endpoints

Method Path Description
POST /v1/notarize Submit notarization
GET /v1/status/{job_id} Poll job status
GET /v1/pdr/{job_id} Get PDR
POST /v1/notarize/quote Get price quote
GET /.well-known/agent.json MCP Server Card
GET /openapi.json OpenAPI 3.0 spec

PDR Verification

pdr = await client.get_pdr(job_id)
is_valid = pdr.verify(notary_pubkey_hex="9c7d64bb...")

Uses NEP-413 raw-buffer verification. No SHA256 pre-hash.

Error Handling

from agent_notary.exceptions import NotaryAuthError, NotaryPaymentError, NotaryNotFoundError

try:
    result = await client.notarize(req)
except NotaryAuthError:
    print("Invalid API key")
except NotaryPaymentError as e:
    print(f"Payment/sig failed: {e}")

Development

pip install -e ".[dev]"
pytest tests/ -v

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

aotrust_protocol-2.2.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file aotrust_protocol-2.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aotrust_protocol-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d11b811fcefb76908adae62e9d1bdc210bce5a813d8dfdd448f869c8c62bef0d
MD5 d066b4cfa59e334c971cae1287042d8f
BLAKE2b-256 2305487baa87bbd71085fac55c4b0f8425ce1a5de7f8e11fcf049c08048399ae

See more details on using hashes here.

Release history Release notifications | RSS feed

2.3.2

2 files

2.3.1

2 files

2.3.0

2 files

This release

2.2.0 This release

1 file

Supported by

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