@shroud-fi/compliance
v0.1.3
Published
Operator-side viewing-key tools for ShroudFi. Generate audit trails of payments received without granting spend authority.
Downloads
384
Maintainers
Readme
@shroud-fi/compliance
Operator-side viewing-key tools. Audit trails without spend authority.
npm i @shroud-fi/complianceWhat it does
@shroud-fi/compliance lets the operator behind an agent generate an audit trail of every payment ever directed at the agent's meta-address — without giving the auditor spend authority and without revealing live strategy.
The mechanism is the scan key. In ShroudFi, the spending key controls funds; the scanning key only sees payments. Exporting a scan-only viewing key gives an auditor full historical visibility into receipts while keeping the spend authority sealed.
Why it matters
Confidentiality infrastructure for AI agents has to coexist with compliance. ShroudFi is not an anonymizer — it's a directed-payment system (like a PO box) where the recipient can selectively prove receipt to a third party. This package is how you do that.
Quick start
import { exportViewingKey, replayHistory } from '@shroud-fi/compliance';
import { deriveAgentIdentity } from '@shroud-fi/core';
import { createTransport } from '@shroud-fi/transport';
const identity = deriveAgentIdentity(masterSeed);
const viewingKey = exportViewingKey(identity);
// Hand `viewingKey` to your auditor — they cannot spend.
// Auditor replays history:
const transport = createTransport({ chain: 'base', rpcUrl });
const history = await replayHistory(transport, viewingKey, {
fromBlock: 46_800_000n,
toBlock: 'latest',
});
// history: every payment ever sent to the meta-address, with block + tx context.Exports
| Symbol | Purpose |
|---|---|
| exportViewingKey(identity) | Serialize a scan-only key safe to hand to an auditor. |
| replayHistory(transport, viewingKey, range) | Reconstruct every payment ever sent to the meta-address. |
| ViewingKeyExport | Serializable type, safe to log + store. Does not contain spending authority. |
Full API reference: shroudfi.live/sdk#compliance
Privacy invariants
- No backdoor. Viewing keys are agent-opt-in and agent-generated. There's no global auditor key and no contract-level disclosure mechanism.
- Scoped. A viewing key gives one-way visibility to inbound payments to one agent. It does not expose outbound payments the agent sent.
- Revocable in practice. Since the viewing key only enables reading historical announcements, an agent rotating its meta-address effectively cuts off future visibility for old viewing-key holders.
License
MIT — see LICENSE.
Part of the ShroudFi privacy SDK for AI agents on Base.
