v0.4.0: Python-friendly Receipt API
What's Changed
π Major Receipt API Improvements
Python-friendly properties and methods for better ergonomics and security.
New Features
- Journal Properties:
journal_bytes,journal_hex,journal_text,journal_lenfor easy journal access - Structured Exit Status:
ExitStatuswithkind,user_code, andokproperties - ExitKind Enum: Clear exit types (HALTED, PAUSED, SYSTEM_SPLIT, SESSION_LIMIT)
- Image ID Properties:
claimed_image_id_hex/claimed_image_id_bytes(clearly marked as untrusted) - New Verification Methods:
verify_hex(image_id)- accepts hex strings with optional 0x prefixverify_bytes(image_id)- accepts 32-byte valuesverify_integrity()- safe inspection of failed proofs
- Receipt Serialization:
to_bytes()/from_bytes()for storage/transport - Helper Function:
compute_image_id_hex(elf_bytes)to derive trusted image IDs - Better Debugging: Improved
__repr__()with journal preview and image ID
Security Improvements
- Clear separation between "claimed" (from receipt) and "trusted" (from verifier) image IDs
- Verification methods require explicit trusted image ID parameter
- Better error messages and validation
Removed
decode_journal()- Not implemented as RISC Zero 1.2 doesn't expose needed APIs (requires 2.x+)
Backward Compatibility
- Legacy properties (
journal,program_id,exit_code) still work verify()method continues to work with image_id parameter
Installation
# For development
uv tool run maturin build --release
uv pip install --force-reinstall target/wheels/PyR0-*.whlFull Changelog: v0.3.0...v0.4.0