Signet Protocol - Python Verification SDK
Verify Signet Protocol receipts and chains in 5 lines of code.
Quick Start
Installation
pip install signet-verify
Verify a Receipt (One-liner)
from signet_verify import verify_receipt
# Verify any receipt in one line
valid, reason = verify_receipt(receipt_data)
print(f"Valid: {valid}, Reason: {reason}")
Verify a Receipt Chain
from signet_verify import verify_chain
# Verify complete audit trail
receipts = [receipt1, receipt2, receipt3] # Chronological order
valid, reason = verify_chain(receipts)
print(f"Chain valid: {valid}, Reason: {reason}")
Verify Export Bundle with Signatures
from signet_verify import verify_export_bundle
# Verify cryptographically signed bundle
valid, reason = verify_export_bundle(
bundle,
jwks_url="https://your-server/.well-known/jwks.json"
)
print(f"Bundle valid: {valid}, Reason: {reason}")
Advanced Usage
Using the Verifier Class
from signet_verify import SignetVerifier
# Create verifier with custom settings
verifier = SignetVerifier(jwks_cache_ttl=7200) # 2 hour cache
# Verify individual receipt
valid, reason = verifier.verify_receipt(receipt)
# Verify with previous receipt for chain validation
valid, reason = verifier.verify_receipt(receipt, previous_receipt)
# Verify complete chain
valid, reason = verifier.verify_chain(receipts)
# Verify signed export bundle
valid, reason = verifier.verify_export_bundle(bundle, jwks_url)
API Reference
Functions
verify_receipt(receipt, previous_receipt=None)
Verify a single Signet receipt.
Parameters:
receipt(dict): The receipt to verifyprevious_receipt(dict, optional): Previous receipt in chain for linkage verification
Returns:
(bool, str): (is_valid, reason)
verify_chain(receipts)
Verify a complete receipt chain.
Parameters:
receipts(list): List of receipts in chronological order
Returns:
(bool, str): (is_valid, reason)
verify_export_bundle(bundle, jwks_url=None)
Verify a signed export bundle.
Parameters:
bundle(dict): The export bundle to verifyjwks_url(str, optional): URL to fetch JWKS for signature verification
Returns:
(bool, str): (is_valid, reason)
SignetVerifier Class
__init__(jwks_cache_ttl=3600)
Create a new verifier instance.
Parameters:
jwks_cache_ttl(int): JWKS cache TTL in seconds (default: 1 hour)
Methods
verify_receipt(receipt, previous_receipt=None)- Verify single receiptverify_chain(receipts)- Verify receipt chainverify_export_bundle(bundle, jwks_url=None)- Verify signed bundle
Receipt Format
Signet receipts follow the SR-1 specification:
{
"trace_id": "unique-trace-identifier",
"hop": 1,
"ts": "2025-01-27T12:00:00Z",
"cid": "sha256:content-hash",
"canon": "{\"normalized\":\"data\"}",
"algo": "sha256",
"prev_receipt_hash": null,
"policy": {
"engine": "HEL",
"allowed": true,
"reason": "ok"
},
"tenant": "your-tenant",
"receipt_hash": "sha256:receipt-hash"
}
Validation Rules
The SDK validates:
- Receipt Hash Integrity - Verifies receipt_hash matches computed hash
- Chain Linkage - Ensures prev_receipt_hash links correctly
- Hop Sequence - Validates hop numbers increment correctly
- Content Integrity - Verifies CID matches canonicalized content
- Timestamp Format - Ensures ISO 8601 timestamp format
- Signature Verification - Validates Ed25519 signatures (if JWKS provided)
Error Handling
from signet_verify import verify_receipt
try:
valid, reason = verify_receipt(receipt)
if not valid:
print(f"Verification failed: {reason}")
except Exception as e:
print(f"Verification error: {e}")
Test Vectors
The SDK is verified against comprehensive test vectors:
import json
from signet_verify import verify_receipt
# Load test vector
with open('test-vectors/receipts/basic-receipt.json') as f:
test_receipt = json.load(f)
# Should pass
valid, reason = verify_receipt(test_receipt)
assert valid, f"Test vector failed: {reason}"
Requirements
- Python 3.7+
cryptography>=3.0.0(for signature verification)requests>=2.25.0(for JWKS fetching)
License
Apache License 2.0 - see LICENSE for details.
Links
Verify receipts in 5 lines. Build trust in 1 line. 🔗
Metadata
Release files for signet-verify 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| signet_verify-1.0.0.tar.gz | 6.4 kB | Without provenance | Details for signet_verify-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| signet_verify-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for signet_verify-1.0.0-py3-none-any.whl |
Total release size: 12.9 kB
Release files / signet_verify-1.0.0.tar.gz
| Download URL | signet_verify-1.0.0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f8bd09c2d754f2ae98d4ae904fd22ac308ecdf5d6728bf744576eb627e81371
|
|
BLAKE2b-256 checksum How to use checksums |
8807d661201d3ab97ccfd37b59742fd1917ef6c3cd0e9f4c8c03ff7fa99ca749
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / signet_verify-1.0.0-py3-none-any.whl
| Download URL | signet_verify-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8015400699aef6cf68ee215f9d9977ff12248e4735753d4951a9f4945c1bebf5
|
|
BLAKE2b-256 checksum How to use checksums |
ee5cefd659ce505d2016a815739f7830daece1bee35302179690c03a5b3d93b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for signet-verify 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.