@0xpolygonid/js-sdk 1.4.1 → 1.4.2

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.
@@ -5,6 +5,7 @@ const js_iden3_core_1 = require("@iden3/js-iden3-core");
5
5
  const js_merkletree_1 = require("@iden3/js-merkletree");
6
6
  const constants_1 = require("../../verifiable/constants");
7
7
  const utils_1 = require("./utils");
8
+ const sparse_merkle_tree_1 = require("./sparse-merkle-tree");
8
9
  /**
9
10
  * ProofNode is a partial Reverse Hash Service result
10
11
  * it contains the current node hash and its children
@@ -99,13 +100,13 @@ class RHSResolver {
99
100
  catch (e) {
100
101
  if (credentialStatus?.statusIssuer?.type === constants_1.CredentialStatusType.SparseMerkleTreeProof) {
101
102
  try {
102
- return await (await fetch(credentialStatus.id)).json();
103
+ return await new sparse_merkle_tree_1.IssuerResolver().resolve(credentialStatus.statusIssuer);
103
104
  }
104
105
  catch (e) {
105
- throw new Error(`can't fetch revocation status from backup endpoint`);
106
+ throw new Error(`can't fetch revocation status from backup endpoint: ${e?.message}`);
106
107
  }
107
108
  }
108
- throw new Error(`can't fetch revocation status`);
109
+ throw new Error(`can't fetch revocation status: ${e?.message}`);
109
110
  }
110
111
  }
111
112
  /**
@@ -2,6 +2,7 @@ import { buildDIDType, BytesHelper, DID, Id } from '@iden3/js-iden3-core';
2
2
  import { Hash, Proof, ZERO_HASH, testBit } from '@iden3/js-merkletree';
3
3
  import { VerifiableConstants, CredentialStatusType } from '../../verifiable/constants';
4
4
  import { isGenesisState } from './utils';
5
+ import { IssuerResolver } from './sparse-merkle-tree';
5
6
  /**
6
7
  * ProofNode is a partial Reverse Hash Service result
7
8
  * it contains the current node hash and its children
@@ -95,13 +96,13 @@ export class RHSResolver {
95
96
  catch (e) {
96
97
  if (credentialStatus?.statusIssuer?.type === CredentialStatusType.SparseMerkleTreeProof) {
97
98
  try {
98
- return await (await fetch(credentialStatus.id)).json();
99
+ return await new IssuerResolver().resolve(credentialStatus.statusIssuer);
99
100
  }
100
101
  catch (e) {
101
- throw new Error(`can't fetch revocation status from backup endpoint`);
102
+ throw new Error(`can't fetch revocation status from backup endpoint: ${e?.message}`);
102
103
  }
103
104
  }
104
- throw new Error(`can't fetch revocation status`);
105
+ throw new Error(`can't fetch revocation status: ${e?.message}`);
105
106
  }
106
107
  }
107
108
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xpolygonid/js-sdk",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "SDK to work with Polygon ID",
5
5
  "main": "dist/node/cjs/index.js",
6
6
  "module": "dist/node/esm/index.js",