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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rio_receipt_protocol-2.3.0.tar.gz.
File metadata
- Download URL: rio_receipt_protocol-2.3.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d4c27cb6a2648d64788d20abfd32e3d40e05ae515516520b94080eb754b4044
|
|
| MD5 |
eb84ff6b270f79a79de46c53471733ef
|
|
| BLAKE2b-256 |
e43b279de3a7eb569a759d77b23c6b66f2e54766c5a6a77ac5077c04dfe2ee2d
|
File details
Details for the file rio_receipt_protocol-2.3.0-py3-none-any.whl.
File metadata
- Download URL: rio_receipt_protocol-2.3.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf6acc16644c29fb52baea026cba0eee06f40a800066f8010d1f7bb13587f746
|
|
| MD5 |
a019f2e2452f23b0c7c688b97fc7a563
|
|
| BLAKE2b-256 |
d68cb5cf56f601143829f4fac81c719f5f11df021d73e37c80f466f966fdac40
|