veritaszk-sdk 0.2.1 → 0.3.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/dist/index.d.ts CHANGED
@@ -31,3 +31,16 @@ export declare function getAuditTrail(orgCommitment: string): Promise<AuditEvent
31
31
  export declare function isRegistered(orgCommitment: string): Promise<boolean>;
32
32
  export declare function getVerificationCount(orgCommitment: string): Promise<number>;
33
33
  export declare function isProofExpired(orgCommitment: string): Promise<boolean>;
34
+ export interface ProofStatus {
35
+ commitment: string;
36
+ isSolvent: boolean;
37
+ proofStatus: number;
38
+ timestamp: number;
39
+ expiry: number;
40
+ isExpired: boolean;
41
+ verificationCount: number;
42
+ tier: number;
43
+ }
44
+ export declare function batchVerifyFromIndexer(commitments: string[], indexerUrl: string): Promise<(ProofStatus | null)[]>;
45
+ export declare function watchProof(commitment: string, callback: (status: ProofStatus) => void, indexerUrl: string, intervalMs?: number): () => void;
46
+ export declare function isProofExpiredFromIndexer(commitment: string, indexerUrl: string): Promise<boolean>;
package/dist/index.js CHANGED
@@ -7,6 +7,9 @@ exports.getAuditTrail = getAuditTrail;
7
7
  exports.isRegistered = isRegistered;
8
8
  exports.getVerificationCount = getVerificationCount;
9
9
  exports.isProofExpired = isProofExpired;
10
+ exports.batchVerifyFromIndexer = batchVerifyFromIndexer;
11
+ exports.watchProof = watchProof;
12
+ exports.isProofExpiredFromIndexer = isProofExpiredFromIndexer;
10
13
  const EXPLORER = 'https://api.explorer.provable.com/v1/testnet';
11
14
  exports.PROGRAMS = {
12
15
  REGISTRY: 'veritaszk_registry.aleo',
@@ -103,3 +106,45 @@ async function isProofExpired(orgCommitment) {
103
106
  return false;
104
107
  return expiryBlock > 0 && ts > expiryBlock;
105
108
  }
109
+ async function batchVerifyFromIndexer(commitments, indexerUrl) {
110
+ const res = await fetch(`${indexerUrl}/api/proofs`);
111
+ if (!res.ok)
112
+ throw new Error(`Indexer returned ${res.status}`);
113
+ const all = await res.json();
114
+ return commitments.map(c => {
115
+ const found = all.find(p => p.commitment === c);
116
+ return found ?? null;
117
+ });
118
+ }
119
+ function watchProof(commitment, callback, indexerUrl, intervalMs = 30000) {
120
+ let prev = null;
121
+ let stopped = false;
122
+ const poll = async () => {
123
+ if (stopped)
124
+ return;
125
+ try {
126
+ const res = await fetch(`${indexerUrl}/api/proofs/${commitment}`);
127
+ if (!res.ok)
128
+ return;
129
+ const status = await res.json();
130
+ const key = JSON.stringify(status);
131
+ if (prev !== null && key !== prev)
132
+ callback(status);
133
+ prev = key;
134
+ }
135
+ catch {
136
+ // silently ignore network errors
137
+ }
138
+ };
139
+ // Do an immediate poll to seed prev, then start interval
140
+ poll();
141
+ const id = setInterval(poll, intervalMs);
142
+ return () => { stopped = true; clearInterval(id); };
143
+ }
144
+ async function isProofExpiredFromIndexer(commitment, indexerUrl) {
145
+ const res = await fetch(`${indexerUrl}/api/proofs/${commitment}`);
146
+ if (!res.ok)
147
+ return false;
148
+ const status = await res.json();
149
+ return status.isExpired || status.proofStatus === 2;
150
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "veritaszk-sdk",
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.",
3
+ "version": "0.3.1",
4
+ "description": "TypeScript SDK for VeritasZK zero-knowledge solvency proofs on Aleo. Batch verification, live proof watching, and expiry checking.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
@@ -16,13 +16,12 @@
16
16
  "keywords": [
17
17
  "aleo",
18
18
  "zero-knowledge",
19
- "zk",
20
19
  "solvency",
21
- "proof-of-reserves",
20
+ "zk-proof",
22
21
  "privacy",
23
22
  "blockchain",
24
- "leo",
25
- "veritaszk"
23
+ "compliance",
24
+ "basel-iii"
26
25
  ],
27
26
  "author": "Vinay Sharma",
28
27
  "license": "MIT",