Audit compliance
Goal
Pull a complete audit trail for a tenant, validate the SHA-256 hash chain end to end, confirm the chain head matches the on-chain Merkle anchor.
Prerequisites
- Operator API key (read scope on the audit endpoints).
- The developer id you want to audit.
Step 1: Verify chain integrity
status = client.audit.verify(developer_id="dev_...")assert status.valid is Trueassert status.anchor_matches is Trueprint(status.chain_length, status.last_anchor_block)const status = await client.audit.verify({ developerId: 'dev_...' });if (!status.valid || !status.anchorMatches) { throw new Error('chain integrity broken');}console.log(status.chainLength, status.lastAnchorBlock);The endpoint walks the chain, recomputes every hash_chain_curr = sha256(prev || row_bytes), and confirms the head against OrisAuditLogRegistry.
Step 2: Query the trail
rows = client.audit.list( agent_id="ag_...", action="payment.completed", start_date="2026-05-01", end_date="2026-05-31", limit=200,)
for r in rows: print(r.id, r.created_at, r.bundle_id_keccak, r.verdict, r.sar_flagged)const rows = await client.audit.list({ agentId: 'ag_...', action: 'payment.completed', startDate: '2026-05-01', endDate: '2026-05-31', limit: 200,});
for (const r of rows) { console.log(r.id, r.createdAt, r.bundleIdKeccak, r.verdict, r.sarFlagged);}Step 3: Validate a specific row’s inclusion proof
proof = client.audit.get_inclusion_proof(audit_id=rows[0].id)
# Validate locally using the on-chain anchor + Merkle pathok = client.audit.validate_proof_offline(proof)assert okconst proof = await client.audit.getInclusionProof({ auditId: rows[0].id });const ok = client.audit.validateProofOffline(proof);if (!ok) throw new Error('inclusion proof invalid');Verification
audit.verify()returnsvalid=trueandanchor_matches=true.- Sample 10 rows; their inclusion proofs all validate.
Troubleshooting
anchor_matches=false— the on-chain anchor was not committed in the last hour. Wait for the next anchor cycle and retry.- Inclusion proof validation fails — verify the on-chain block referenced in the proof is finalized.
Where to go next
- L7 Audit for the cryptographic ground truth.
- Audit API for the endpoint reference.
- Regulator portal for the disclosure path.