@shroud-fi/compliance 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ShroudFi contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @shroud-fi/compliance
2
+
3
+ > Operator-side viewing-key tools. Audit trails without spend authority.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@shroud-fi/compliance.svg)](https://www.npmjs.com/package/@shroud-fi/compliance)
6
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
7
+
8
+ ```bash
9
+ npm i @shroud-fi/compliance
10
+ ```
11
+
12
+ ## What it does
13
+
14
+ `@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.
15
+
16
+ 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.
17
+
18
+ ## Why it matters
19
+
20
+ 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.
21
+
22
+ ## Quick start
23
+
24
+ ```ts
25
+ import { exportViewingKey, replayHistory } from '@shroud-fi/compliance';
26
+ import { deriveAgentIdentity } from '@shroud-fi/core';
27
+ import { createTransport } from '@shroud-fi/transport';
28
+
29
+ const identity = deriveAgentIdentity(masterSeed);
30
+ const viewingKey = exportViewingKey(identity);
31
+ // Hand `viewingKey` to your auditor — they cannot spend.
32
+
33
+ // Auditor replays history:
34
+ const transport = createTransport({ chain: 'base', rpcUrl });
35
+ const history = await replayHistory(transport, viewingKey, {
36
+ fromBlock: 46_800_000n,
37
+ toBlock: 'latest',
38
+ });
39
+
40
+ // history: every payment ever sent to the meta-address, with block + tx context.
41
+ ```
42
+
43
+ ## Exports
44
+
45
+ | Symbol | Purpose |
46
+ |---|---|
47
+ | `exportViewingKey(identity)` | Serialize a scan-only key safe to hand to an auditor. |
48
+ | `replayHistory(transport, viewingKey, range)` | Reconstruct every payment ever sent to the meta-address. |
49
+ | `ViewingKeyExport` | Serializable type, safe to log + store. Does not contain spending authority. |
50
+
51
+ Full API reference: [shroudfi.live/sdk#compliance](https://shroudfi.live/sdk#compliance)
52
+
53
+ ## Privacy invariants
54
+
55
+ - **No backdoor.** Viewing keys are agent-opt-in and agent-generated. There's no global auditor key and no contract-level disclosure mechanism.
56
+ - **Scoped.** A viewing key gives one-way visibility to inbound payments to one agent. It does not expose outbound payments the agent sent.
57
+ - **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.
58
+
59
+ ## License
60
+
61
+ MIT — see [LICENSE](./LICENSE).
62
+
63
+ Part of the [ShroudFi](https://shroudfi.live) privacy SDK for AI agents on Base.
@@ -0,0 +1,3 @@
1
+ export type { ViewingKeyConfig, AuditTrail, DisclosureProof } from './types.js';
2
+ export declare function generateViewingKey(_config: import('./types.js').ViewingKeyConfig): Promise<import('./types.js').DisclosureProof>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhF,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,YAAY,EAAE,gBAAgB,GAC7C,OAAO,CAAC,OAAO,YAAY,EAAE,eAAe,CAAC,CAE/C"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateViewingKey = generateViewingKey;
4
+ function generateViewingKey(_config) {
5
+ throw new Error('Not implemented');
6
+ }
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAEA,gDAIC;AAJD,SAAgB,kBAAkB,CAChC,OAA8C;IAE9C,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,19 @@
1
+ import type { Address } from 'viem';
2
+ export interface ViewingKeyConfig {
3
+ readonly spendingPrivateKey: `0x${string}`;
4
+ readonly chain: 'base' | 'baseSepolia';
5
+ }
6
+ export interface AuditTrail {
7
+ readonly stealthAddress: Address;
8
+ readonly ephemeralPubKey: `0x${string}`;
9
+ readonly blockNumber: bigint;
10
+ readonly txHash: `0x${string}`;
11
+ readonly timestamp: number;
12
+ }
13
+ export interface DisclosureProof {
14
+ readonly viewingPublicKey: `0x${string}`;
15
+ readonly spendingPublicKey: `0x${string}`;
16
+ readonly stealthMetaAddress: string;
17
+ readonly auditTrail: readonly AuditTrail[];
18
+ }
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC;CACxC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,KAAK,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,SAAS,UAAU,EAAE,CAAC;CAC5C"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export type { ViewingKeyConfig, AuditTrail, DisclosureProof } from './types.js';
2
+ export declare function generateViewingKey(_config: import('./types.js').ViewingKeyConfig): Promise<import('./types.js').DisclosureProof>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhF,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,YAAY,EAAE,gBAAgB,GAC7C,OAAO,CAAC,OAAO,YAAY,EAAE,eAAe,CAAC,CAE/C"}
@@ -0,0 +1,4 @@
1
+ export function generateViewingKey(_config) {
2
+ throw new Error('Not implemented');
3
+ }
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAChC,OAA8C;IAE9C,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Address } from 'viem';
2
+ export interface ViewingKeyConfig {
3
+ readonly spendingPrivateKey: `0x${string}`;
4
+ readonly chain: 'base' | 'baseSepolia';
5
+ }
6
+ export interface AuditTrail {
7
+ readonly stealthAddress: Address;
8
+ readonly ephemeralPubKey: `0x${string}`;
9
+ readonly blockNumber: bigint;
10
+ readonly txHash: `0x${string}`;
11
+ readonly timestamp: number;
12
+ }
13
+ export interface DisclosureProof {
14
+ readonly viewingPublicKey: `0x${string}`;
15
+ readonly spendingPublicKey: `0x${string}`;
16
+ readonly stealthMetaAddress: string;
17
+ readonly auditTrail: readonly AuditTrail[];
18
+ }
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC;CACxC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,KAAK,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,SAAS,UAAU,EAAE,CAAC;CAC5C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}