@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.
- package/dist/browser/esm/index.js +42 -42
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +42 -42
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/credentials/status/reverse-sparse-merkle-tree.js +4 -3
- package/dist/node/esm/credentials/status/reverse-sparse-merkle-tree.js +4 -3
- package/package.json +1 -1
|
@@ -58387,6 +58387,45 @@ var PolygonIdSdk = (function (exports) {
|
|
|
58387
58387
|
}
|
|
58388
58388
|
}
|
|
58389
58389
|
|
|
58390
|
+
/**
|
|
58391
|
+
* IssuerResolver is a class that allows to interact with the issuer's http endpoint to get revocation status.
|
|
58392
|
+
*
|
|
58393
|
+
* @public
|
|
58394
|
+
* @class IssuerResolver
|
|
58395
|
+
*/
|
|
58396
|
+
class IssuerResolver {
|
|
58397
|
+
/**
|
|
58398
|
+
* resolve is a method to resolve a credential status directly from the issuer.
|
|
58399
|
+
*
|
|
58400
|
+
* @public
|
|
58401
|
+
* @param {CredentialStatus} credentialStatus - credential status to resolve
|
|
58402
|
+
* @param {CredentialStatusResolveOptions} credentialStatusResolveOptions - options for resolver
|
|
58403
|
+
* @returns `{Promise<RevocationStatus>}`
|
|
58404
|
+
*/
|
|
58405
|
+
async resolve(credentialStatus) {
|
|
58406
|
+
const revStatusResp = await fetch(credentialStatus.id);
|
|
58407
|
+
const revStatus = await revStatusResp.json();
|
|
58408
|
+
return toRevocationStatus(revStatus);
|
|
58409
|
+
}
|
|
58410
|
+
}
|
|
58411
|
+
/**
|
|
58412
|
+
* toRevocationStatus is a result of fetching credential status with type SparseMerkleTreeProof converts to RevocationStatus
|
|
58413
|
+
*
|
|
58414
|
+
* @param {RevocationStatusResponse} { issuer, mtp }
|
|
58415
|
+
* @returns {RevocationStatus} RevocationStatus
|
|
58416
|
+
*/
|
|
58417
|
+
const toRevocationStatus = ({ issuer, mtp }) => {
|
|
58418
|
+
const p = Kt$1.fromJSON({
|
|
58419
|
+
nodeAux: mtp.node_aux,
|
|
58420
|
+
existence: mtp.existence,
|
|
58421
|
+
siblings: mtp.siblings
|
|
58422
|
+
});
|
|
58423
|
+
return {
|
|
58424
|
+
mtp: p,
|
|
58425
|
+
issuer
|
|
58426
|
+
};
|
|
58427
|
+
};
|
|
58428
|
+
|
|
58390
58429
|
/**
|
|
58391
58430
|
* ProofNode is a partial Reverse Hash Service result
|
|
58392
58431
|
* it contains the current node hash and its children
|
|
@@ -58480,13 +58519,13 @@ var PolygonIdSdk = (function (exports) {
|
|
|
58480
58519
|
catch (e) {
|
|
58481
58520
|
if (credentialStatus?.statusIssuer?.type === exports.CredentialStatusType.SparseMerkleTreeProof) {
|
|
58482
58521
|
try {
|
|
58483
|
-
return await
|
|
58522
|
+
return await new IssuerResolver().resolve(credentialStatus.statusIssuer);
|
|
58484
58523
|
}
|
|
58485
58524
|
catch (e) {
|
|
58486
|
-
throw new Error(`can't fetch revocation status from backup endpoint`);
|
|
58525
|
+
throw new Error(`can't fetch revocation status from backup endpoint: ${e?.message}`);
|
|
58487
58526
|
}
|
|
58488
58527
|
}
|
|
58489
|
-
throw new Error(`can't fetch revocation status`);
|
|
58528
|
+
throw new Error(`can't fetch revocation status: ${e?.message}`);
|
|
58490
58529
|
}
|
|
58491
58530
|
}
|
|
58492
58531
|
/**
|
|
@@ -58669,45 +58708,6 @@ var PolygonIdSdk = (function (exports) {
|
|
|
58669
58708
|
return id.toString() === idFromState.bigInt().toString();
|
|
58670
58709
|
}
|
|
58671
58710
|
|
|
58672
|
-
/**
|
|
58673
|
-
* IssuerResolver is a class that allows to interact with the issuer's http endpoint to get revocation status.
|
|
58674
|
-
*
|
|
58675
|
-
* @public
|
|
58676
|
-
* @class IssuerResolver
|
|
58677
|
-
*/
|
|
58678
|
-
class IssuerResolver {
|
|
58679
|
-
/**
|
|
58680
|
-
* resolve is a method to resolve a credential status directly from the issuer.
|
|
58681
|
-
*
|
|
58682
|
-
* @public
|
|
58683
|
-
* @param {CredentialStatus} credentialStatus - credential status to resolve
|
|
58684
|
-
* @param {CredentialStatusResolveOptions} credentialStatusResolveOptions - options for resolver
|
|
58685
|
-
* @returns `{Promise<RevocationStatus>}`
|
|
58686
|
-
*/
|
|
58687
|
-
async resolve(credentialStatus) {
|
|
58688
|
-
const revStatusResp = await fetch(credentialStatus.id);
|
|
58689
|
-
const revStatus = await revStatusResp.json();
|
|
58690
|
-
return toRevocationStatus(revStatus);
|
|
58691
|
-
}
|
|
58692
|
-
}
|
|
58693
|
-
/**
|
|
58694
|
-
* toRevocationStatus is a result of fetching credential status with type SparseMerkleTreeProof converts to RevocationStatus
|
|
58695
|
-
*
|
|
58696
|
-
* @param {RevocationStatusResponse} { issuer, mtp }
|
|
58697
|
-
* @returns {RevocationStatus} RevocationStatus
|
|
58698
|
-
*/
|
|
58699
|
-
const toRevocationStatus = ({ issuer, mtp }) => {
|
|
58700
|
-
const p = Kt$1.fromJSON({
|
|
58701
|
-
nodeAux: mtp.node_aux,
|
|
58702
|
-
existence: mtp.existence,
|
|
58703
|
-
siblings: mtp.siblings
|
|
58704
|
-
});
|
|
58705
|
-
return {
|
|
58706
|
-
mtp: p,
|
|
58707
|
-
issuer
|
|
58708
|
-
};
|
|
58709
|
-
};
|
|
58710
|
-
|
|
58711
58711
|
/**
|
|
58712
58712
|
* CredentialStatusResolverRegistry is a registry of CredentialStatusResolver
|
|
58713
58713
|
*
|