Skip to main content

Cryptographic proof for AI actions. Generate tamper-evident receipts, maintain hash-chained ledgers, and verify AI action audit trails. Zero dependencies.

Project description

rio-receipt-protocol

Cryptographic proof for AI actions. Open standard. Zero required dependencies.

Generate tamper-evident receipts, maintain hash-chained ledgers, and verify AI action audit trails — all with nothing more than the Python standard library.

Installation

pip install rio-receipt-protocol

For Ed25519 signature support (optional):

pip install rio-receipt-protocol[signing]

Quick Start

from rio_receipt_protocol import (
    hash_intent, hash_execution, generate_receipt, verify_receipt, create_ledger
)

# 1. Hash the intent
intent_hash = hash_intent(
    intent_id="i-001",
    action="send_email",
    agent_id="agent-1",
    parameters={"to": "user@example.com", "subject": "Hello"},
    timestamp="2026-04-01T00:00:00.000Z",
)

# 2. Hash the execution
execution_hash = hash_execution(
    intent_id="i-001",
    action="send_email",
    result="sent",
    connector="smtp",
    timestamp="2026-04-01T00:00:01.000Z",
)

# 3. Generate a receipt
receipt = generate_receipt(
    intent_hash=intent_hash,
    execution_hash=execution_hash,
    intent_id="i-001",
    action="send_email",
    agent_id="agent-1",
)

# 4. Verify it
result = verify_receipt(receipt)
assert result["valid"] is True

# 5. Append to a tamper-evident ledger
ledger = create_ledger()
entry = ledger.append(
    intent_id="i-001",
    action="send_email",
    agent_id="agent-1",
    status="executed",
    detail="Email sent",
    receipt_hash=receipt["hash_chain"]["receipt_hash"],
)

# 6. Verify the chain
chain = ledger.verify_chain()
assert chain["valid"] is True

API Reference

The Python package mirrors the Node.js API exactly:

Function Description
sha256(data) SHA-256 hash of a string
hash_intent(...) Hash an intent object
hash_execution(...) Hash an execution record
hash_governance(...) Hash a governance decision (optional)
hash_authorization(...) Hash an authorization record (optional)
generate_receipt(...) Generate a v2.2 receipt
verify_receipt(receipt) Verify a receipt's hash chain
create_ledger(file_path=None) Create a tamper-evident ledger
verify_receipt_standalone(receipt) Independent receipt verification
verify_chain(entries) Verify a ledger hash chain
verify_receipt_batch(receipts) Batch-verify multiple receipts

License

Dual-licensed under MIT and 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

rio_receipt_protocol-2.2.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

rio_receipt_protocol-2.2.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file rio_receipt_protocol-2.2.0.tar.gz.

File metadata

  • Download URL: rio_receipt_protocol-2.2.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for rio_receipt_protocol-2.2.0.tar.gz
Algorithm Hash digest
SHA256 959a463af5dc1d14781d6d1e43a9b6ed4f3cff734130138085f31a22200c75f4
MD5 0f7fdca9bd2693e8d7645a4ca7f89c77
BLAKE2b-256 5f235c69ca8de6ef867d776b2af073768af4b048cc41af87344031556ee82075

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rio_receipt_protocol-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8be3a26325483caa6ca4273afd06ddc922e1039d66c8503a3f79ee7ef83f472e
MD5 7c347e1602909c93aacc874b790dc785
BLAKE2b-256 f11aa9e5e81cf038b30de50087fbbe30503a0768466838eeac6822634945987d

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