Receipt Verification

Cryptographic proof that your request was processed inside a confidential enclave.

What are receipts?

Receipts are JWS (JSON Web Signature) tokens signed with ES256. Each receipt cryptographically proves that your request was processed by a verified confidential enclave with a specific code measurement. You can verify receipts independently using the router's public JWKS endpoint.

Requesting a receipt

Add the X-Tresor-Receipt: true header to any chat completion request. Optionally include a nonce for replay protection.

curl https://api.trytresor.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Tresor-Receipt: true" \
  -H "X-Tresor-Nonce: $(uuidgen)" \
  -d '{
    "model": "gpt-oss-120b",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

The receipt is returned in the X-Tresor-Receipt response header as a compact JWS string.

Verifying a receipt

Install the required packages, then fetch the JWKS from /v1/verify/jwks.json and verify the JWS signature:

pip install pyjwt[crypto] requests
import json, jwt, requests

# Fetch the JWKS from the router
jwks_url = "https://api.trytresor.com/v1/verify/jwks.json"
jwks = requests.get(jwks_url).json()

# The receipt JWS is in the response header or body
receipt_jws = "eyJhbGciOiJFUzI1NiJ9.eyJzY2hlbWEuLi4"

# Decode and verify
from jwt.algorithms import ECAlgorithm
for key_data in jwks["keys"]:
    try:
        public_key = ECAlgorithm.from_jwk(key_data)
        payload = jwt.decode(receipt_jws, public_key, algorithms=["ES256"])
        print("Receipt verified:", json.dumps(payload, indent=2))
        break
    except jwt.InvalidSignatureError:
        continue

Receipt payload

FieldDescription
schema_versionReceipt schema version (e.g. "1.0.0")
receipt_type"model" or "message"
enclave_measurementLaunch digest (hash) of the enclave code
policy_hashAttestation policy hash
selected_modelModel info: provider, model_id, model_hash
nonceClient-supplied nonce for replay protection
issued_atRFC 3339 timestamp