Metadata-Version: 2.4
Name: chain-receipt-core
Version: 0.1.2
Summary: Reference implementation of the Chain-Receipt v1.0.0 spec — canonical JSON, SHA-256 receipt hash, Ed25519 signing, chain integrity, replay-attestation primitives.
Author-email: Mars Ausili <mars@cruxia.ai>
License-Expression: MIT
Project-URL: Homepage, https://github.com/Cruxia-AI/sagrada-engine
Project-URL: Specification, https://github.com/Cruxia-AI/sagrada-engine/blob/main/chain_receipt_core/SCHEMA.md
Keywords: audit,replay-attestation,receipt,ed25519,canonical-json,rfc8785,llm-agent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2.0
Requires-Dist: cryptography>=41
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"

# chain-receipt-core (Python)

Reference implementation of the **Chain-Receipt v1.0.0** spec
(`../SCHEMA.md`). Provides:

- Pydantic v2 models (`Receipt`, `Interaction`, `Chain`, `Stability`, `Signature`)
- RFC 8785–compatible canonical JSON
- SHA-256 hash helpers (`receipt_hash`, `compute_tool_calls_hash`, `compute_text_hash`)
- Ed25519 sign / verify
- `ReceiptBuilder` for emitter-side use
- `verify_receipt`, `verify_chain`

```python
from chain_receipt_core import (
    ClientInfo, Interaction, ReceiptBuilder, generate_keypair, verify_chain,
    compute_text_hash, compute_tool_calls_hash,
)

sk, pub_b64 = generate_keypair()
client = ClientInfo(
    name="chain-receipt-langchain-sdk",
    version="0.1.0",
    platform="python-3.12",
    emitter_pubkey=f"ed25519:{pub_b64}",
)
b = ReceiptBuilder(client=client, private_key=sk,
                   verifier_url="https://chain-determinism.org",
                   chain_seed=pub_b64.encode())

inter = Interaction(
    vendor="anthropic", model="claude-sonnet-4-5", temperature=0.0,
    system_prompt_hash=compute_text_hash("you are helpful"),
    prompt_hash=compute_text_hash("hello"),
    response_hash=compute_text_hash("hi"),
    tool_calls_hash=compute_tool_calls_hash([]),
    n_tool_calls=0, latency_ms=120,
)
r = b.build(interaction=inter)
assert verify_chain([r]).ok
```

Cross-language conformance vectors live in `../conformance/vectors/`.
