@zanii/redact
v0.1.1
Published
Selective disclosure for Zanii receipts - prove an agent acted on specific data without revealing the rest, via salted field commitments and Merkle inclusion proofs.
Readme
@zanii/redact
Selective disclosure for Zanii receipts — prove an agent acted on specific data without revealing the rest. Each payload field is salted and committed; the commitments form a Merkle tree whose root becomes the receipt payload. Later you disclose individual fields with an inclusion proof that anyone verifies against the immutable, anchored ledger entry — while the undisclosed fields stay hidden.
For privacy-preserving audits and cross-org sharing. No server change — the log only ever sees the root.
npm install @zanii/redact @zanii/sdkUsage
import { commit, disclose, verifyDisclosure } from '@zanii/redact';
import { ZaniiAgent } from '@zanii/sdk';
const agent = new ZaniiAgent({ /* … */ });
// 1. Commit the sensitive payload; record the envelope (root only):
const c = commit({ customer: 'acme-corp', amount: 4999, ssn: '123-45-6789' });
await agent.record({ target: 'billing.charge', payload: c.envelope });
// keep c.secrets private
// 2. Later, disclose just one field to an auditor:
const d = disclose(c, 'amount');
// 3. Anyone verifies it against the on-ledger envelope — the other fields stay hidden:
verifyDisclosure(d, c.envelope); // → trueThe recorded envelope contains only the Merkle root and the field names — never
the values. A disclosure reveals exactly one field; a tampered value, index, or
root fails verification. Reuses @zanii/core's audited Merkle + JCS, so TS and
Python produce identical roots and proofs (format: "Zanii Selective Disclosure v1",
SPEC.md §12).
Changelog
- 0.1.0 — initial release:
commit,disclose,verifyDisclosure.
License
Apache-2.0.
