noah-clarity 0.3.6 → 0.3.7

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.
@@ -26,8 +26,7 @@ export declare class KYCContract {
26
26
  */
27
27
  getRevocationRoot(): Promise<string | null>;
28
28
  /**
29
- * Check if a commitment is revoked by checking the revocation root
30
- * Note: This is a simplified check. For full verification, non-membership proofs are needed.
29
+ * Check if a commitment is revoked by querying the attester service
31
30
  * @param commitment Commitment to check (hex string)
32
31
  * @returns true if revoked, false if not revoked or if revocation checking is unavailable
33
32
  */
package/dist/contract.js CHANGED
@@ -325,24 +325,32 @@ export class KYCContract {
325
325
  }
326
326
  }
327
327
  /**
328
- * Check if a commitment is revoked by checking the revocation root
329
- * Note: This is a simplified check. For full verification, non-membership proofs are needed.
328
+ * Check if a commitment is revoked by querying the attester service
330
329
  * @param commitment Commitment to check (hex string)
331
330
  * @returns true if revoked, false if not revoked or if revocation checking is unavailable
332
331
  */
333
332
  async isCommitmentRevoked(commitment) {
334
- const root = await this.getRevocationRoot();
335
- // If no revocation registry configured or root is zero (empty tree), nothing is revoked
336
- if (!root || root === '0x0000000000000000000000000000000000000000000000000000000000000000') {
333
+ // If no attester service URL configured, skip revocation check
334
+ if (!this.config.attesterServiceUrl) {
335
+ return false;
336
+ }
337
+ try {
338
+ // Query attester service for revocation status
339
+ const url = `${this.config.attesterServiceUrl}/revocation/check?commitment=${encodeURIComponent(commitment)}`;
340
+ const response = await fetch(url);
341
+ if (!response.ok) {
342
+ // If service unavailable, assume not revoked (fail open)
343
+ console.warn('Revocation check service unavailable, assuming not revoked');
344
+ return false;
345
+ }
346
+ const data = await response.json();
347
+ return data.revoked === true;
348
+ }
349
+ catch (error) {
350
+ // On error, assume not revoked (fail open)
351
+ console.error('Error checking revocation status:', error);
337
352
  return false;
338
353
  }
339
- // TODO: Full revocation checking requires non-membership proof verification
340
- // For now, we return false (not revoked) when root exists but we can't verify without proof
341
- // In production, you should:
342
- // 1. Request a non-membership proof from the attester service
343
- // 2. Verify the proof using Merkle tree verification
344
- // 3. Return true if proof verification fails or if commitment is in revocation tree
345
- return false;
346
354
  }
347
355
  /**
348
356
  * Check if KYC is valid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noah-clarity",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "TypeScript SDK for Noah-v2 KYC system on Stacks",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",