veritaszk-sdk 0.1.0 → 0.2.1

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/README.md CHANGED
@@ -1,77 +1,189 @@
1
1
  # veritaszk-sdk
2
2
 
3
- Zero-knowledge solvency verification for Aleo.
4
- Verify any organization's proof of solvency in 3 lines of code —
5
- without seeing their financial data.
3
+ TypeScript SDK for [VeritasZK](https://veritaszk.vercel.app) — the first
4
+ zero-knowledge proof-of-solvency system on Aleo.
5
+
6
+ Organizations prove assets exceed liabilities via ZK proof without revealing
7
+ amounts, asset types, or wallet addresses. Anyone can verify the result.
8
+ Nobody sees the underlying data. Ever.
9
+
10
+ ## Quick Start
6
11
 
7
- ## Install
8
12
  ```bash
9
13
  npm install veritaszk-sdk
10
14
  ```
11
15
 
16
+ ```typescript
17
+ import { verifySolvency } from 'veritaszk-sdk'
18
+
19
+ const result = await verifySolvency('aleo1cdmu479q6duu327wgm3vnphqtq2n4q4vcvp66f5742gv5f8f9qxq0w9r00')
20
+ console.log(result.isSolvent) // true — no amounts revealed
21
+ console.log(result.verificationCount) // times verified on-chain
22
+ ```
23
+
24
+ ## Architecture
25
+
26
+ VeritasZK runs three Leo programs on Aleo Testnet in a CPI chain:
27
+
28
+ ```
29
+ veritaszk_registry.aleo (org identity, credentials, delegation)
30
+
31
+ veritaszk_core.aleo ──→ veritaszk_audit.aleo
32
+ (ZK proof generation) (immutable audit trail)
33
+ ```
34
+
35
+ This SDK queries public mappings across all three programs.
36
+ Private financial data is mathematically inaccessible — the amounts
37
+ exist only in encrypted Leo Records.
38
+
39
+ ## API Reference
40
+
41
+ ### Core Functions
42
+
43
+ | Function | Description | Returns |
44
+ |----------|-------------|---------|
45
+ | `verifySolvency(commitment)` | Full solvency status for one org | `Promise<SolvencyStatus>` |
46
+ | `batchVerify(commitments[])` | Check multiple orgs in parallel | `Promise<BatchVerifyResult[]>` |
47
+ | `isRegistered(commitment)` | Check if org is in registry | `Promise<boolean>` |
48
+ | `getAuditTrail(commitment)` | Proof event history from audit program | `Promise<AuditEvent>` |
49
+ | `getVerificationCount(commitment)` | Number of on-chain verifications | `Promise<number>` |
50
+ | `isProofExpired(commitment)` | Check if proof has expired | `Promise<boolean>` |
51
+
52
+ ### React Hooks
53
+
54
+ | Hook | Description |
55
+ |------|-------------|
56
+ | `useSolvencyStatus(commitment)` | Auto-refreshing solvency status (polls every 30s) |
57
+ | `useAuditTrail(commitment)` | Fetches audit event history on mount |
58
+
59
+ ### Webhook
60
+
61
+ | Class | Description |
62
+ |-------|-------------|
63
+ | `VeritasZKWebhook` | Polls solvency status and POSTs to your webhook URL on state changes |
64
+
12
65
  ## Usage
66
+
67
+ ### Verify a single organization
68
+
13
69
  ```typescript
14
- import { VeritasZK } from "veritaszk-sdk"
70
+ import { verifySolvency } from 'veritaszk-sdk'
71
+
72
+ const status = await verifySolvency('aleo1...')
73
+ // {
74
+ // orgCommitment: 'aleo1...',
75
+ // isSolvent: true,
76
+ // timestamp: 142857,
77
+ // expiryBlock: 147857,
78
+ // verificationCount: 12,
79
+ // thresholdLevel: 2,
80
+ // hasMultiWallet: false,
81
+ // isExpired: false,
82
+ // lastProofBlock: 142857
83
+ // }
84
+ ```
15
85
 
16
- const client = new VeritasZK({ network: "testnet" })
86
+ ### Batch verification
17
87
 
18
- // Verify an organization's solvency
19
- const result = await client.verifySolvency("aleo1abc...")
20
- console.log(result.isSolvent) // true
21
- console.log(result.timestamp) // proof timestamp
22
- console.log(result.verificationCount) // times verified
23
- // Note: no amounts, no asset types, no financial data returned
88
+ ```typescript
89
+ import { batchVerify } from 'veritaszk-sdk'
24
90
 
25
- // Get organization info
26
- const org = await client.getOrgInfo("aleo1abc...")
27
- console.log(org?.isActive) // true
91
+ const results = await batchVerify([
92
+ 'aleo1abc...',
93
+ 'aleo1def...',
94
+ ])
95
+ // [{ orgCommitment: 'aleo1abc...', isSolvent: true }, ...]
96
+ ```
97
+
98
+ ### Check registry
99
+
100
+ ```typescript
101
+ import { isRegistered } from 'veritaszk-sdk'
28
102
 
29
- // One-line convenience function
30
- import { verifySolvency } from "veritaszk-sdk"
31
- const { isSolvent } = await verifySolvency("aleo1abc...")
103
+ const registered = await isRegistered('aleo1...')
104
+ // true organization has registered via veritaszk_registry.aleo
32
105
  ```
33
106
 
34
- ## What the SDK does NOT return
107
+ ### Audit trail
35
108
 
36
- By design, `veritaszk-sdk` never returns:
37
- - Asset amounts or liability amounts
38
- - Asset types or compositions
39
- - Wallet addresses beyond the one queried
40
- - Any data that could reveal financial strategy
109
+ ```typescript
110
+ import { getAuditTrail } from 'veritaszk-sdk'
111
+
112
+ const trail = await getAuditTrail('aleo1...')
113
+ // {
114
+ // orgCommitment: 'aleo1...',
115
+ // eventCount: 5,
116
+ // lastProofBlock: 142857,
117
+ // isExpired: false
118
+ // }
119
+ ```
41
120
 
42
- This is guaranteed by the underlying Leo smart contract —
43
- the data does not exist in any queryable public state.
121
+ ### React hooks
44
122
 
45
- ## API Reference
123
+ ```tsx
124
+ import { useSolvencyStatus } from 'veritaszk-sdk/react'
46
125
 
47
- ### `new VeritasZK(config?)`
126
+ function SolvencyBadge({ commitment }: { commitment: string }) {
127
+ const { status, loading, error } = useSolvencyStatus(commitment)
128
+
129
+ if (loading) return <span>Checking...</span>
130
+ if (error) return <span>Error: {error}</span>
131
+ if (!status) return null
132
+
133
+ return (
134
+ <span style={{ color: status.isSolvent ? '#10b981' : '#ef4444' }}>
135
+ {status.isSolvent ? '✓ SOLVENT' : '✗ NOT SOLVENT'}
136
+ </span>
137
+ )
138
+ }
139
+ ```
140
+
141
+ ### Webhook monitoring
142
+
143
+ ```typescript
144
+ import { VeritasZKWebhook } from 'veritaszk-sdk/webhooks'
145
+
146
+ const webhook = new VeritasZKWebhook({
147
+ url: 'https://your-server.com/webhook',
148
+ events: ['proof.generated', 'proof.expired', 'proof.revoked'],
149
+ orgCommitment: 'aleo1...',
150
+ pollIntervalMs: 60000,
151
+ })
152
+
153
+ webhook.start()
154
+ // POSTs to your URL whenever solvency state changes
155
+ ```
156
+
157
+ ## What the SDK Does NOT Return
158
+
159
+ By design, no function in this SDK can return:
160
+
161
+ - Asset amounts or liability amounts
162
+ - Wallet addresses beyond the org commitment
163
+ - Asset types or portfolio composition
164
+ - Any data that could reveal financial strategy
48
165
 
49
- | Option | Type | Default | Description |
50
- |--------|------|---------|-------------|
51
- | network | `"testnet"` \| `"mainnet"` | `"testnet"` | Aleo network |
52
- | rpcUrl | `string` | Aleo testnet RPC | Custom RPC endpoint |
53
- | programId | `string` | `"veritaszk.aleo"` | Contract program ID |
166
+ This is guaranteed by the underlying Leo contracts — the data does not
167
+ exist in any queryable public state on Aleo.
54
168
 
55
- ### `client.verifySolvency(address)` → `Promise<SolvencyResult>`
169
+ ## Deployed Programs
56
170
 
57
- | Field | Type | Description |
58
- |-------|------|-------------|
59
- | isSolvent | boolean | Whether a valid proof exists |
60
- | timestamp | number | When the proof was generated |
61
- | proofNonce | string | BHP256 commitment — not reversible |
62
- | assetCount | number | Number of asset categories declared |
63
- | liabilityCount | number | Number of liability categories declared |
64
- | verificationCount | number | Times this proof has been verified |
65
- | lastChecked | Date | When this query was made |
171
+ | Program | Explorer |
172
+ |---------|----------|
173
+ | `veritaszk_registry.aleo` | [Explorer](https://explorer.aleo.org/program/veritaszk_registry.aleo) |
174
+ | `veritaszk_core.aleo` | [Explorer](https://explorer.aleo.org/program/veritaszk_core.aleo) |
175
+ | `veritaszk_audit.aleo` | [Explorer](https://explorer.aleo.org/program/veritaszk_audit.aleo) |
66
176
 
67
- ### `client.getOrgInfo(address)` → `Promise<OrgInfo | null>`
177
+ ## Related Packages
68
178
 
69
- ### `client.getVerificationCount(address)` `Promise<number>`
179
+ - [veritaszk-mcp](https://www.npmjs.com/package/veritaszk-mcp) MCP server for AI agent integration (Claude Desktop)
180
+ - [veritaszk-cli](https://www.npmjs.com/package/veritaszk-cli) — Terminal queries for solvency proofs
70
181
 
71
182
  ## Links
72
183
 
73
- - [Live Demo](https://veritaszk.vercel.app)
184
+ - [Live Dashboard](https://veritaszk.vercel.app)
74
185
  - [GitHub](https://github.com/Vinaystwt/veritaszk)
75
- - [Aleo Explorer](https://explorer.aleo.org)
186
+ - [Aleo Explorer](https://explorer.aleo.org/program/veritaszk_core.aleo)
187
+ - [Documentation](https://veritaszk.vercel.app/docs)
76
188
 
77
- Built on [Aleo](https://aleo.org) — privacy by default.
189
+ Built on Aleo — privacy by default.
package/dist/index.d.ts CHANGED
@@ -1,74 +1,33 @@
1
- export interface SolvencyResult {
2
- address: string;
1
+ export declare const PROGRAMS: {
2
+ readonly REGISTRY: "veritaszk_registry.aleo";
3
+ readonly CORE: "veritaszk_core.aleo";
4
+ readonly AUDIT: "veritaszk_audit.aleo";
5
+ };
6
+ export interface SolvencyStatus {
7
+ orgCommitment: string;
3
8
  isSolvent: boolean;
4
- timestamp: number;
5
- proofNonce: string;
6
- assetCount: number;
7
- liabilityCount: number;
9
+ timestamp: number | null;
10
+ expiryBlock: number | null;
8
11
  verificationCount: number;
9
- lastChecked: Date;
12
+ thresholdLevel: number;
13
+ hasMultiWallet: boolean;
14
+ isExpired: boolean;
15
+ lastProofBlock: number | null;
10
16
  }
11
- export interface OrgInfo {
12
- address: string;
13
- nameHash: string;
14
- registeredAt: number;
15
- isActive: boolean;
17
+ export interface AuditEvent {
18
+ orgCommitment: string;
19
+ eventCount: number;
20
+ lastProofBlock: number | null;
21
+ isExpired: boolean;
16
22
  }
17
- export interface VeritasZKConfig {
18
- network?: "testnet" | "mainnet";
19
- rpcUrl?: string;
20
- programId?: string;
21
- }
22
- export declare class VeritasZK {
23
- private rpcUrl;
24
- private programId;
25
- private network;
26
- constructor(config?: VeritasZKConfig);
27
- /**
28
- * Verify whether an organization holds a valid solvency proof.
29
- * Returns proof status without revealing any financial data.
30
- *
31
- * @param address - The Aleo address of the organization to verify
32
- * @returns SolvencyResult containing proof status and metadata
33
- *
34
- * @example
35
- * const client = new VeritasZK({ network: "testnet" })
36
- * const result = await client.verifySolvency("aleo1abc...")
37
- * console.log(result.isSolvent) // true or false — no amounts revealed
38
- */
39
- verifySolvency(address: string): Promise<SolvencyResult>;
40
- /**
41
- * Retrieve public metadata for a registered organization.
42
- * Name hash only — raw organization name is never stored on-chain.
43
- *
44
- * @param address - The Aleo address of the organization
45
- * @returns OrgInfo containing registration metadata, or null if not registered
46
- */
47
- getOrgInfo(address: string): Promise<OrgInfo | null>;
48
- /**
49
- * Get the total number of times an organization's proof
50
- * has been publicly verified.
51
- *
52
- * @param address - The Aleo address of the organization
53
- * @returns verification count as a number
54
- */
55
- getVerificationCount(address: string): Promise<number>;
56
- /**
57
- * Query any mapping from the veritaszk.aleo program.
58
- * Hits: GET {rpcUrl}/program/{programId}/mapping/{mappingName}/{key}
59
- *
60
- * @param mappingName - The mapping to query
61
- * @param key - The key to look up
62
- * @returns Parsed mapping value or null if not found
63
- */
64
- private queryMapping;
23
+ export interface BatchVerifyResult {
24
+ orgCommitment: string;
25
+ isSolvent: boolean;
26
+ error?: string;
65
27
  }
66
- /**
67
- * One-line convenience function for solvency verification.
68
- *
69
- * @example
70
- * import { verifySolvency } from "veritaszk-sdk"
71
- * const { isSolvent } = await verifySolvency("aleo1abc...")
72
- */
73
- export declare function verifySolvency(address: string, config?: VeritasZKConfig): Promise<SolvencyResult>;
74
- //# sourceMappingURL=index.d.ts.map
28
+ export declare function verifySolvency(orgCommitment: string): Promise<SolvencyStatus>;
29
+ export declare function batchVerify(orgCommitments: string[]): Promise<BatchVerifyResult[]>;
30
+ export declare function getAuditTrail(orgCommitment: string): Promise<AuditEvent>;
31
+ export declare function isRegistered(orgCommitment: string): Promise<boolean>;
32
+ export declare function getVerificationCount(orgCommitment: string): Promise<number>;
33
+ export declare function isProofExpired(orgCommitment: string): Promise<boolean>;
package/dist/index.js CHANGED
@@ -1,153 +1,105 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.VeritasZK = void 0;
3
+ exports.PROGRAMS = void 0;
7
4
  exports.verifySolvency = verifySolvency;
8
- const node_fetch_1 = __importDefault(require("node-fetch"));
9
- function stripSuffix(val) {
10
- return String(val ?? "").replace(/u(8|16|32|64|128)$/, "");
5
+ exports.batchVerify = batchVerify;
6
+ exports.getAuditTrail = getAuditTrail;
7
+ exports.isRegistered = isRegistered;
8
+ exports.getVerificationCount = getVerificationCount;
9
+ exports.isProofExpired = isProofExpired;
10
+ const EXPLORER = 'https://api.explorer.provable.com/v1/testnet';
11
+ exports.PROGRAMS = {
12
+ REGISTRY: 'veritaszk_registry.aleo',
13
+ CORE: 'veritaszk_core.aleo',
14
+ AUDIT: 'veritaszk_audit.aleo',
15
+ };
16
+ async function queryMapping(program, mapping, key) {
17
+ const url = `${EXPLORER}/program/${program}/mapping/${mapping}/${key}`;
18
+ const res = await fetch(url);
19
+ if (!res.ok)
20
+ return null;
21
+ const text = await res.text();
22
+ try {
23
+ return JSON.parse(text);
24
+ }
25
+ catch {
26
+ return text;
27
+ }
11
28
  }
12
- function isSolvencyProofRaw(v) {
13
- return typeof v === "object" && v !== null && "is_solvent" in v;
29
+ function parseU32(val) {
30
+ if (val === null || val === undefined)
31
+ return null;
32
+ return Number(String(val).replace('u32', '').trim());
14
33
  }
15
- function isOrgInfoRaw(v) {
16
- return typeof v === "object" && v !== null && "name_hash" in v;
34
+ function parseU8(val) {
35
+ if (val === null || val === undefined)
36
+ return 0;
37
+ return Number(String(val).replace('u8', '').trim());
17
38
  }
18
- // ─────────────────────────────────────────────────────────────────────────────
19
- // VeritasZK main SDK class
20
- // ─────────────────────────────────────────────────────────────────────────────
21
- class VeritasZK {
22
- constructor(config = {}) {
23
- this.network = config.network ?? "testnet";
24
- this.rpcUrl =
25
- config.rpcUrl ?? "https://api.explorer.provable.com/v1/testnet";
26
- this.programId = config.programId ?? "veritaszk.aleo";
27
- }
28
- /**
29
- * Verify whether an organization holds a valid solvency proof.
30
- * Returns proof status without revealing any financial data.
31
- *
32
- * @param address - The Aleo address of the organization to verify
33
- * @returns SolvencyResult containing proof status and metadata
34
- *
35
- * @example
36
- * const client = new VeritasZK({ network: "testnet" })
37
- * const result = await client.verifySolvency("aleo1abc...")
38
- * console.log(result.isSolvent) // true or false — no amounts revealed
39
- */
40
- async verifySolvency(address) {
41
- const [raw, count] = await Promise.all([
42
- this.queryMapping("solvency_proofs", address),
43
- this.getVerificationCount(address),
44
- ]);
45
- if (!isSolvencyProofRaw(raw)) {
46
- return {
47
- address,
48
- isSolvent: false,
49
- timestamp: 0,
50
- proofNonce: "",
51
- assetCount: 0,
52
- liabilityCount: 0,
53
- verificationCount: count,
54
- lastChecked: new Date(),
55
- };
56
- }
57
- return {
58
- address,
59
- isSolvent: raw.is_solvent === true,
60
- timestamp: Number(stripSuffix(raw.timestamp)),
61
- proofNonce: String(raw.proof_nonce ?? ""),
62
- assetCount: Number(stripSuffix(raw.asset_count)),
63
- liabilityCount: Number(stripSuffix(raw.liability_count)),
64
- verificationCount: count,
65
- lastChecked: new Date(),
66
- };
67
- }
68
- /**
69
- * Retrieve public metadata for a registered organization.
70
- * Name hash only — raw organization name is never stored on-chain.
71
- *
72
- * @param address - The Aleo address of the organization
73
- * @returns OrgInfo containing registration metadata, or null if not registered
74
- */
75
- async getOrgInfo(address) {
76
- const raw = await this.queryMapping("org_metadata", address);
77
- if (!isOrgInfoRaw(raw))
78
- return null;
79
- return {
80
- address,
81
- nameHash: String(raw.name_hash ?? ""),
82
- registeredAt: Number(stripSuffix(raw.registered_at)),
83
- isActive: raw.is_active === true,
84
- };
85
- }
86
- /**
87
- * Get the total number of times an organization's proof
88
- * has been publicly verified.
89
- *
90
- * @param address - The Aleo address of the organization
91
- * @returns verification count as a number
92
- */
93
- async getVerificationCount(address) {
94
- try {
95
- const raw = await this.queryMapping("verification_count", address);
96
- if (raw === null || raw === undefined)
97
- return 0;
98
- return Number(stripSuffix(raw));
99
- }
100
- catch {
101
- return 0;
102
- }
103
- }
104
- /**
105
- * Query any mapping from the veritaszk.aleo program.
106
- * Hits: GET {rpcUrl}/program/{programId}/mapping/{mappingName}/{key}
107
- *
108
- * @param mappingName - The mapping to query
109
- * @param key - The key to look up
110
- * @returns Parsed mapping value or null if not found
111
- */
112
- async queryMapping(mappingName, key) {
113
- const url = `${this.rpcUrl}/program/${this.programId}/mapping/${mappingName}/${key}`;
114
- let res;
115
- try {
116
- res = await (0, node_fetch_1.default)(url);
117
- }
118
- catch (err) {
119
- throw new Error(`VeritasZK network error: Unable to reach ${this.rpcUrl}. ` +
120
- `Check your network connection or rpcUrl config. (${String(err)})`);
121
- }
122
- if (res.status === 404)
123
- return null;
124
- if (!res.ok) {
125
- throw new Error(`VeritasZK RPC error: ${res.status} ${res.statusText} for ${url}`);
126
- }
127
- const text = await res.text();
128
- if (!text || text === "null")
129
- return null;
130
- try {
131
- return JSON.parse(text);
132
- }
133
- catch {
134
- return text.replace(/^"|"$/g, "");
39
+ async function verifySolvency(orgCommitment) {
40
+ const [solvent, timestamp, expiry, count, threshold, multiWallet] = await Promise.all([
41
+ queryMapping(exports.PROGRAMS.CORE, 'solvency_proofs', orgCommitment),
42
+ queryMapping(exports.PROGRAMS.CORE, 'proof_timestamps', orgCommitment),
43
+ queryMapping(exports.PROGRAMS.CORE, 'proof_expiry', orgCommitment),
44
+ queryMapping(exports.PROGRAMS.CORE, 'verification_counts', orgCommitment),
45
+ queryMapping(exports.PROGRAMS.CORE, 'threshold_proofs', orgCommitment),
46
+ queryMapping(exports.PROGRAMS.CORE, 'multi_wallet_commitments', orgCommitment),
47
+ ]);
48
+ const expiryBlock = parseU32(expiry);
49
+ const ts = parseU32(timestamp);
50
+ return {
51
+ orgCommitment,
52
+ isSolvent: solvent === true || solvent === 'true',
53
+ timestamp: ts,
54
+ expiryBlock,
55
+ verificationCount: parseU32(count) ?? 0,
56
+ thresholdLevel: parseU8(threshold),
57
+ hasMultiWallet: multiWallet !== null,
58
+ isExpired: expiryBlock !== null && expiryBlock > 0 &&
59
+ (parseU32(timestamp) ?? 0) > expiryBlock,
60
+ lastProofBlock: ts,
61
+ };
62
+ }
63
+ async function batchVerify(orgCommitments) {
64
+ const results = await Promise.allSettled(orgCommitments.map(c => verifySolvency(c)));
65
+ return results.map((r, i) => {
66
+ if (r.status === 'fulfilled') {
67
+ return { orgCommitment: orgCommitments[i],
68
+ isSolvent: r.value.isSolvent };
135
69
  }
136
- }
70
+ return { orgCommitment: orgCommitments[i], isSolvent: false,
71
+ error: r.reason?.message ?? 'Query failed' };
72
+ });
73
+ }
74
+ async function getAuditTrail(orgCommitment) {
75
+ const [count, lastBlock, expired] = await Promise.all([
76
+ queryMapping(exports.PROGRAMS.AUDIT, 'event_count', orgCommitment),
77
+ queryMapping(exports.PROGRAMS.AUDIT, 'last_proof_block', orgCommitment),
78
+ queryMapping(exports.PROGRAMS.AUDIT, 'expired_proofs', orgCommitment),
79
+ ]);
80
+ return {
81
+ orgCommitment,
82
+ eventCount: parseU32(count) ?? 0,
83
+ lastProofBlock: parseU32(lastBlock),
84
+ isExpired: expired === true || expired === 'true',
85
+ };
86
+ }
87
+ async function isRegistered(orgCommitment) {
88
+ const result = await queryMapping(exports.PROGRAMS.REGISTRY, 'org_registry', orgCommitment);
89
+ return result === true || result === 'true';
90
+ }
91
+ async function getVerificationCount(orgCommitment) {
92
+ const result = await queryMapping(exports.PROGRAMS.CORE, 'verification_counts', orgCommitment);
93
+ return parseU32(result) ?? 0;
137
94
  }
138
- exports.VeritasZK = VeritasZK;
139
- // ─────────────────────────────────────────────────────────────────────────────
140
- // Convenience export — verify in one line
141
- // ─────────────────────────────────────────────────────────────────────────────
142
- /**
143
- * One-line convenience function for solvency verification.
144
- *
145
- * @example
146
- * import { verifySolvency } from "veritaszk-sdk"
147
- * const { isSolvent } = await verifySolvency("aleo1abc...")
148
- */
149
- async function verifySolvency(address, config) {
150
- const client = new VeritasZK(config);
151
- return client.verifySolvency(address);
95
+ async function isProofExpired(orgCommitment) {
96
+ const [expiry, timestamp] = await Promise.all([
97
+ queryMapping(exports.PROGRAMS.CORE, 'proof_expiry', orgCommitment),
98
+ queryMapping(exports.PROGRAMS.CORE, 'proof_timestamps', orgCommitment),
99
+ ]);
100
+ const expiryBlock = parseU32(expiry);
101
+ const ts = parseU32(timestamp);
102
+ if (!expiryBlock || !ts)
103
+ return false;
104
+ return expiryBlock > 0 && ts > expiryBlock;
152
105
  }
153
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,12 @@
1
+ import type { SolvencyStatus, AuditEvent } from './index';
2
+ export declare function useSolvencyStatus(orgCommitment: string): {
3
+ status: SolvencyStatus | null;
4
+ loading: boolean;
5
+ error: string | null;
6
+ refetch: () => Promise<void>;
7
+ };
8
+ export declare function useAuditTrail(orgCommitment: string): {
9
+ events: AuditEvent | null;
10
+ loading: boolean;
11
+ error: string | null;
12
+ };
package/dist/react.js ADDED
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSolvencyStatus = useSolvencyStatus;
4
+ exports.useAuditTrail = useAuditTrail;
5
+ const react_1 = require("react");
6
+ const index_1 = require("./index");
7
+ function useSolvencyStatus(orgCommitment) {
8
+ const [status, setStatus] = (0, react_1.useState)(null);
9
+ const [loading, setLoading] = (0, react_1.useState)(true);
10
+ const [error, setError] = (0, react_1.useState)(null);
11
+ const refetch = (0, react_1.useCallback)(async () => {
12
+ if (!orgCommitment)
13
+ return;
14
+ setLoading(true);
15
+ try {
16
+ const result = await (0, index_1.verifySolvency)(orgCommitment);
17
+ setStatus(result);
18
+ setError(null);
19
+ }
20
+ catch (e) {
21
+ setError(e.message);
22
+ }
23
+ finally {
24
+ setLoading(false);
25
+ }
26
+ }, [orgCommitment]);
27
+ (0, react_1.useEffect)(() => {
28
+ refetch();
29
+ const interval = setInterval(refetch, 30000);
30
+ return () => clearInterval(interval);
31
+ }, [refetch]);
32
+ return { status, loading, error, refetch };
33
+ }
34
+ function useAuditTrail(orgCommitment) {
35
+ const [events, setEvents] = (0, react_1.useState)(null);
36
+ const [loading, setLoading] = (0, react_1.useState)(true);
37
+ const [error, setError] = (0, react_1.useState)(null);
38
+ (0, react_1.useEffect)(() => {
39
+ if (!orgCommitment)
40
+ return;
41
+ (0, index_1.getAuditTrail)(orgCommitment)
42
+ .then(setEvents)
43
+ .catch((e) => setError(e.message))
44
+ .finally(() => setLoading(false));
45
+ }, [orgCommitment]);
46
+ return { events, loading, error };
47
+ }
@@ -0,0 +1,16 @@
1
+ export interface WebhookConfig {
2
+ url: string;
3
+ secret?: string;
4
+ events: Array<'proof.generated' | 'proof.expired' | 'proof.revoked'>;
5
+ orgCommitment: string;
6
+ pollIntervalMs?: number;
7
+ }
8
+ export declare class VeritasZKWebhook {
9
+ private config;
10
+ private interval;
11
+ private lastSolvent;
12
+ constructor(config: WebhookConfig);
13
+ start(): void;
14
+ stop(): void;
15
+ private post;
16
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VeritasZKWebhook = void 0;
4
+ const index_1 = require("./index");
5
+ class VeritasZKWebhook {
6
+ constructor(config) {
7
+ this.interval = null;
8
+ this.lastSolvent = null;
9
+ this.config = config;
10
+ }
11
+ start() {
12
+ const ms = this.config.pollIntervalMs ?? 60000;
13
+ this.interval = setInterval(async () => {
14
+ try {
15
+ const status = await (0, index_1.verifySolvency)(this.config.orgCommitment);
16
+ const changed = this.lastSolvent !== null &&
17
+ this.lastSolvent !== status.isSolvent;
18
+ if (changed || this.lastSolvent === null) {
19
+ const eventType = status.isSolvent
20
+ ? 'proof.generated' : 'proof.revoked';
21
+ if (this.config.events.includes(eventType)) {
22
+ await this.post({ event: eventType,
23
+ orgCommitment: this.config.orgCommitment,
24
+ isSolvent: status.isSolvent,
25
+ timestamp: new Date().toISOString() });
26
+ }
27
+ }
28
+ if (status.isExpired &&
29
+ this.config.events.includes('proof.expired')) {
30
+ await this.post({ event: 'proof.expired',
31
+ orgCommitment: this.config.orgCommitment,
32
+ isSolvent: false,
33
+ timestamp: new Date().toISOString() });
34
+ }
35
+ this.lastSolvent = status.isSolvent;
36
+ }
37
+ catch (e) {
38
+ console.error('VeritasZKWebhook error:', e);
39
+ }
40
+ }, ms);
41
+ }
42
+ stop() {
43
+ if (this.interval) {
44
+ clearInterval(this.interval);
45
+ this.interval = null;
46
+ }
47
+ }
48
+ async post(payload) {
49
+ await fetch(this.config.url, {
50
+ method: 'POST',
51
+ headers: { 'Content-Type': 'application/json' },
52
+ body: JSON.stringify(payload),
53
+ });
54
+ }
55
+ }
56
+ exports.VeritasZKWebhook = VeritasZKWebhook;
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "veritaszk-sdk",
3
- "version": "0.1.0",
4
- "description": "Zero-knowledge solvency verification SDK for Aleo. Verify any organization's proof of solvency without seeing their financial data.",
3
+ "version": "0.2.1",
4
+ "description": "TypeScript SDK for VeritasZK — query zero-knowledge solvency proofs on Aleo. Verify that organizations prove assets exceed liabilities without any private financial data being revealed. Includes React hooks, batch verification, and webhook support.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist/",
9
+ "README.md"
10
+ ],
7
11
  "scripts": {
8
12
  "build": "tsc",
13
+ "test": "jest",
9
14
  "prepublishOnly": "npm run build"
10
15
  },
11
16
  "keywords": [
@@ -15,19 +20,29 @@
15
20
  "solvency",
16
21
  "proof-of-reserves",
17
22
  "privacy",
18
- "leo"
23
+ "blockchain",
24
+ "leo",
25
+ "veritaszk"
19
26
  ],
20
- "author": "VeritasZK",
27
+ "author": "Vinay Sharma",
21
28
  "license": "MIT",
29
+ "homepage": "https://veritaszk.vercel.app",
22
30
  "repository": {
23
31
  "type": "git",
24
32
  "url": "https://github.com/Vinaystwt/veritaszk"
25
33
  },
26
- "homepage": "https://veritaszk.vercel.app",
34
+ "bugs": {
35
+ "url": "https://github.com/Vinaystwt/veritaszk/issues"
36
+ },
27
37
  "devDependencies": {
28
- "typescript": "^5.0.0"
38
+ "@types/jest": "^29.0.0",
39
+ "@types/node": "^20.0.0",
40
+ "@types/react": "^19.2.14",
41
+ "jest": "^29.0.0",
42
+ "ts-jest": "^29.0.0",
43
+ "typescript": "^5.4.0"
29
44
  },
30
- "dependencies": {
31
- "node-fetch": "^3.3.0"
45
+ "peerDependencies": {
46
+ "react": ">=18.0.0"
32
47
  }
33
- }
48
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgCD,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,GAAE,eAAoB;IAOxC;;;;;;;;;;;OAWG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA+B9D;;;;;;OAMG;IACG,UAAU,CAAC,OAAO,EAAE,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;QAC9B,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC;QAE1C,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;CACF;AApID,8BAoIC;AAED,gFAAgF;AAChF,0CAA0C;AAC1C,gFAAgF;AAEhF;;;;;;GAMG;AACI,KAAK,UAAU,cAAc,CAClC,OAAe,EACf,MAAwB;IAExB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
package/src/index.ts DELETED
@@ -1,212 +0,0 @@
1
- import fetch from "node-fetch";
2
-
3
- // ─────────────────────────────────────────────────────────────────────────────
4
- // Types
5
- // ─────────────────────────────────────────────────────────────────────────────
6
-
7
- export interface SolvencyResult {
8
- address: string;
9
- isSolvent: boolean;
10
- timestamp: number;
11
- proofNonce: string;
12
- assetCount: number;
13
- liabilityCount: number;
14
- verificationCount: number;
15
- lastChecked: Date;
16
- }
17
-
18
- export interface OrgInfo {
19
- address: string;
20
- nameHash: string;
21
- registeredAt: number;
22
- isActive: boolean;
23
- }
24
-
25
- export interface VeritasZKConfig {
26
- network?: "testnet" | "mainnet";
27
- rpcUrl?: string;
28
- programId?: string;
29
- }
30
-
31
- interface SolvencyProofRaw {
32
- is_solvent: boolean;
33
- timestamp: string | number;
34
- proof_nonce: string;
35
- asset_count: string | number;
36
- liability_count: string | number;
37
- }
38
-
39
- interface OrgInfoRaw {
40
- name_hash: string;
41
- registered_at: string | number;
42
- is_active: boolean;
43
- }
44
-
45
- function stripSuffix(val: unknown): string {
46
- return String(val ?? "").replace(/u(8|16|32|64|128)$/, "");
47
- }
48
-
49
- function isSolvencyProofRaw(v: unknown): v is SolvencyProofRaw {
50
- return typeof v === "object" && v !== null && "is_solvent" in v;
51
- }
52
-
53
- function isOrgInfoRaw(v: unknown): v is OrgInfoRaw {
54
- return typeof v === "object" && v !== null && "name_hash" in v;
55
- }
56
-
57
- // ─────────────────────────────────────────────────────────────────────────────
58
- // VeritasZK — main SDK class
59
- // ─────────────────────────────────────────────────────────────────────────────
60
-
61
- export class VeritasZK {
62
- private rpcUrl: string;
63
- private programId: string;
64
- private network: string;
65
-
66
- constructor(config: VeritasZKConfig = {}) {
67
- this.network = config.network ?? "testnet";
68
- this.rpcUrl =
69
- config.rpcUrl ?? "https://api.explorer.provable.com/v1/testnet";
70
- this.programId = config.programId ?? "veritaszk.aleo";
71
- }
72
-
73
- /**
74
- * Verify whether an organization holds a valid solvency proof.
75
- * Returns proof status without revealing any financial data.
76
- *
77
- * @param address - The Aleo address of the organization to verify
78
- * @returns SolvencyResult containing proof status and metadata
79
- *
80
- * @example
81
- * const client = new VeritasZK({ network: "testnet" })
82
- * const result = await client.verifySolvency("aleo1abc...")
83
- * console.log(result.isSolvent) // true or false — no amounts revealed
84
- */
85
- async verifySolvency(address: string): Promise<SolvencyResult> {
86
- const [raw, count] = await Promise.all([
87
- this.queryMapping("solvency_proofs", address),
88
- this.getVerificationCount(address),
89
- ]);
90
-
91
- if (!isSolvencyProofRaw(raw)) {
92
- return {
93
- address,
94
- isSolvent: false,
95
- timestamp: 0,
96
- proofNonce: "",
97
- assetCount: 0,
98
- liabilityCount: 0,
99
- verificationCount: count,
100
- lastChecked: new Date(),
101
- };
102
- }
103
-
104
- return {
105
- address,
106
- isSolvent: raw.is_solvent === true,
107
- timestamp: Number(stripSuffix(raw.timestamp)),
108
- proofNonce: String(raw.proof_nonce ?? ""),
109
- assetCount: Number(stripSuffix(raw.asset_count)),
110
- liabilityCount: Number(stripSuffix(raw.liability_count)),
111
- verificationCount: count,
112
- lastChecked: new Date(),
113
- };
114
- }
115
-
116
- /**
117
- * Retrieve public metadata for a registered organization.
118
- * Name hash only — raw organization name is never stored on-chain.
119
- *
120
- * @param address - The Aleo address of the organization
121
- * @returns OrgInfo containing registration metadata, or null if not registered
122
- */
123
- async getOrgInfo(address: string): Promise<OrgInfo | null> {
124
- const raw = await this.queryMapping("org_metadata", address);
125
- if (!isOrgInfoRaw(raw)) return null;
126
-
127
- return {
128
- address,
129
- nameHash: String(raw.name_hash ?? ""),
130
- registeredAt: Number(stripSuffix(raw.registered_at)),
131
- isActive: raw.is_active === true,
132
- };
133
- }
134
-
135
- /**
136
- * Get the total number of times an organization's proof
137
- * has been publicly verified.
138
- *
139
- * @param address - The Aleo address of the organization
140
- * @returns verification count as a number
141
- */
142
- async getVerificationCount(address: string): Promise<number> {
143
- try {
144
- const raw = await this.queryMapping("verification_count", address);
145
- if (raw === null || raw === undefined) return 0;
146
- return Number(stripSuffix(raw));
147
- } catch {
148
- return 0;
149
- }
150
- }
151
-
152
- /**
153
- * Query any mapping from the veritaszk.aleo program.
154
- * Hits: GET {rpcUrl}/program/{programId}/mapping/{mappingName}/{key}
155
- *
156
- * @param mappingName - The mapping to query
157
- * @param key - The key to look up
158
- * @returns Parsed mapping value or null if not found
159
- */
160
- private async queryMapping(
161
- mappingName: string,
162
- key: string
163
- ): Promise<unknown> {
164
- const url = `${this.rpcUrl}/program/${this.programId}/mapping/${mappingName}/${key}`;
165
-
166
- let res;
167
- try {
168
- res = await fetch(url);
169
- } catch (err) {
170
- throw new Error(
171
- `VeritasZK network error: Unable to reach ${this.rpcUrl}. ` +
172
- `Check your network connection or rpcUrl config. (${String(err)})`
173
- );
174
- }
175
-
176
- if (res.status === 404) return null;
177
-
178
- if (!res.ok) {
179
- throw new Error(
180
- `VeritasZK RPC error: ${res.status} ${res.statusText} for ${url}`
181
- );
182
- }
183
-
184
- const text = await res.text();
185
- if (!text || text === "null") return null;
186
-
187
- try {
188
- return JSON.parse(text);
189
- } catch {
190
- return text.replace(/^"|"$/g, "");
191
- }
192
- }
193
- }
194
-
195
- // ─────────────────────────────────────────────────────────────────────────────
196
- // Convenience export — verify in one line
197
- // ─────────────────────────────────────────────────────────────────────────────
198
-
199
- /**
200
- * One-line convenience function for solvency verification.
201
- *
202
- * @example
203
- * import { verifySolvency } from "veritaszk-sdk"
204
- * const { isSolvent } = await verifySolvency("aleo1abc...")
205
- */
206
- export async function verifySolvency(
207
- address: string,
208
- config?: VeritasZKConfig
209
- ): Promise<SolvencyResult> {
210
- const client = new VeritasZK(config);
211
- return client.verifySolvency(address);
212
- }
package/tsconfig.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "commonjs",
5
- "lib": [
6
- "ES2020"
7
- ],
8
- "declaration": true,
9
- "declarationMap": true,
10
- "sourceMap": true,
11
- "outDir": "./dist",
12
- "rootDir": "./src",
13
- "strict": true,
14
- "esModuleInterop": true,
15
- "skipLibCheck": true,
16
- "forceConsistentCasingInFileNames": true,
17
- "resolveJsonModule": true
18
- },
19
- "include": [
20
- "src/**/*"
21
- ],
22
- "exclude": [
23
- "node_modules",
24
- "dist"
25
- ]
26
- }