@0xpolygonid/js-sdk 1.18.2 → 1.18.4
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 +2 -2
- package/dist/browser/esm/index.js +24 -23
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +24 -23
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/credentials/credential-wallet.js +1 -1
- package/dist/node/cjs/identity/identity-wallet.js +23 -22
- package/dist/node/esm/credentials/credential-wallet.js +1 -1
- package/dist/node/esm/identity/identity-wallet.js +23 -22
- package/dist/types/identity/identity-wallet.d.ts +7 -1
- package/package.json +1 -1
|
@@ -55751,8 +55751,8 @@ var PolygonIdSdk = (function (exports) {
|
|
|
55751
55751
|
request.context.push(VerifiableConstants.JSONLD_SCHEMA.IDEN3_DISPLAY_METHOD);
|
|
55752
55752
|
}
|
|
55753
55753
|
const context = [
|
|
55754
|
-
...request.context,
|
|
55755
55754
|
VerifiableConstants.JSONLD_SCHEMA.W3C_CREDENTIAL_2018,
|
|
55755
|
+
...request.context,
|
|
55756
55756
|
VerifiableConstants.JSONLD_SCHEMA.IDEN3_CREDENTIAL,
|
|
55757
55757
|
schema.$metadata.uris['jsonLdContext']
|
|
55758
55758
|
];
|
|
@@ -80698,12 +80698,20 @@ var PolygonIdSdk = (function (exports) {
|
|
|
80698
80698
|
},
|
|
80699
80699
|
allowedIssuers: [did.string()]
|
|
80700
80700
|
});
|
|
80701
|
-
if
|
|
80701
|
+
// if credential exists with the same credential status type we return this credential
|
|
80702
|
+
if (credentials.length === 1 &&
|
|
80703
|
+
credentials[0].credentialStatus.type === opts.revocationOpts.type) {
|
|
80702
80704
|
return {
|
|
80703
80705
|
did,
|
|
80704
80706
|
credential: credentials[0]
|
|
80705
80707
|
};
|
|
80706
80708
|
}
|
|
80709
|
+
// otherwise something is already wrong with storage as it has more than 1 credential in it or credential status type of existing credential is different from what user provides - We should remove everything and create new credential.
|
|
80710
|
+
// in this way credential status of auth credential can be upgraded
|
|
80711
|
+
for (let i = 0; i < credentials.length; i++) {
|
|
80712
|
+
await this._credentialWallet.remove(credentials[i].id);
|
|
80713
|
+
}
|
|
80714
|
+
// otherwise we create a new credential
|
|
80707
80715
|
const credential = await this.createAuthBJJCredential(did, pubKey, authClaim, currentState, opts.revocationOpts);
|
|
80708
80716
|
const index = authClaim.hIndex();
|
|
80709
80717
|
const { proof } = await claimsTree.generateProof(index, ctr);
|
|
@@ -80721,10 +80729,13 @@ var PolygonIdSdk = (function (exports) {
|
|
|
80721
80729
|
coreClaim: authClaim
|
|
80722
80730
|
});
|
|
80723
80731
|
credential.proof = [mtpProof];
|
|
80724
|
-
|
|
80725
|
-
|
|
80726
|
-
|
|
80727
|
-
|
|
80732
|
+
// only if user specified that genesis state publishing is not needed we won't do this.
|
|
80733
|
+
if (!opts.revocationOpts.genesisPublishingDisabled) {
|
|
80734
|
+
await this.publishRevocationInfoByCredentialStatusType(did, opts.revocationOpts.type, {
|
|
80735
|
+
rhsUrl: opts.revocationOpts.id,
|
|
80736
|
+
onChain: opts.revocationOpts.onChain
|
|
80737
|
+
});
|
|
80738
|
+
}
|
|
80728
80739
|
await this._credentialWallet.save(credential);
|
|
80729
80740
|
return {
|
|
80730
80741
|
did,
|
|
@@ -81087,23 +81098,13 @@ var PolygonIdSdk = (function (exports) {
|
|
|
81087
81098
|
throw new Error(`there is no registered publisher to save hash is not registered for ${credentialStatusType} is not registered`);
|
|
81088
81099
|
}
|
|
81089
81100
|
let nodes = [];
|
|
81090
|
-
|
|
81091
|
-
|
|
81092
|
-
|
|
81093
|
-
|
|
81094
|
-
|
|
81095
|
-
|
|
81096
|
-
|
|
81097
|
-
}
|
|
81098
|
-
else {
|
|
81099
|
-
const treeState = await this.getDIDTreeModel(issuerDID);
|
|
81100
|
-
nodes = await getNodesRepresentation(opts?.revokedNonces, {
|
|
81101
|
-
revocationTree: treeState.revocationTree,
|
|
81102
|
-
claimsTree: treeState.claimsTree,
|
|
81103
|
-
state: treeState.state,
|
|
81104
|
-
rootsTree: treeState.rootsTree
|
|
81105
|
-
}, treeState.state);
|
|
81106
|
-
}
|
|
81101
|
+
const tree = opts?.treeModel ?? (await this.getDIDTreeModel(issuerDID));
|
|
81102
|
+
nodes = await getNodesRepresentation(opts?.revokedNonces ?? [], {
|
|
81103
|
+
revocationTree: tree.revocationTree,
|
|
81104
|
+
claimsTree: tree.claimsTree,
|
|
81105
|
+
state: tree.state,
|
|
81106
|
+
rootsTree: tree.rootsTree
|
|
81107
|
+
}, tree.state);
|
|
81107
81108
|
if (!nodes.length) {
|
|
81108
81109
|
return;
|
|
81109
81110
|
}
|