@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
package/README.md
CHANGED
|
@@ -55612,8 +55612,8 @@ class CredentialWallet {
|
|
|
55612
55612
|
request.context.push(VerifiableConstants.JSONLD_SCHEMA.IDEN3_DISPLAY_METHOD);
|
|
55613
55613
|
}
|
|
55614
55614
|
const context = [
|
|
55615
|
-
...request.context,
|
|
55616
55615
|
VerifiableConstants.JSONLD_SCHEMA.W3C_CREDENTIAL_2018,
|
|
55616
|
+
...request.context,
|
|
55617
55617
|
VerifiableConstants.JSONLD_SCHEMA.IDEN3_CREDENTIAL,
|
|
55618
55618
|
schema.$metadata.uris['jsonLdContext']
|
|
55619
55619
|
];
|
|
@@ -59816,12 +59816,20 @@ class IdentityWallet {
|
|
|
59816
59816
|
},
|
|
59817
59817
|
allowedIssuers: [did.string()]
|
|
59818
59818
|
});
|
|
59819
|
-
if
|
|
59819
|
+
// if credential exists with the same credential status type we return this credential
|
|
59820
|
+
if (credentials.length === 1 &&
|
|
59821
|
+
credentials[0].credentialStatus.type === opts.revocationOpts.type) {
|
|
59820
59822
|
return {
|
|
59821
59823
|
did,
|
|
59822
59824
|
credential: credentials[0]
|
|
59823
59825
|
};
|
|
59824
59826
|
}
|
|
59827
|
+
// 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.
|
|
59828
|
+
// in this way credential status of auth credential can be upgraded
|
|
59829
|
+
for (let i = 0; i < credentials.length; i++) {
|
|
59830
|
+
await this._credentialWallet.remove(credentials[i].id);
|
|
59831
|
+
}
|
|
59832
|
+
// otherwise we create a new credential
|
|
59825
59833
|
const credential = await this.createAuthBJJCredential(did, pubKey, authClaim, currentState, opts.revocationOpts);
|
|
59826
59834
|
const index = authClaim.hIndex();
|
|
59827
59835
|
const { proof } = await claimsTree.generateProof(index, ctr);
|
|
@@ -59839,10 +59847,13 @@ class IdentityWallet {
|
|
|
59839
59847
|
coreClaim: authClaim
|
|
59840
59848
|
});
|
|
59841
59849
|
credential.proof = [mtpProof];
|
|
59842
|
-
|
|
59843
|
-
|
|
59844
|
-
|
|
59845
|
-
|
|
59850
|
+
// only if user specified that genesis state publishing is not needed we won't do this.
|
|
59851
|
+
if (!opts.revocationOpts.genesisPublishingDisabled) {
|
|
59852
|
+
await this.publishRevocationInfoByCredentialStatusType(did, opts.revocationOpts.type, {
|
|
59853
|
+
rhsUrl: opts.revocationOpts.id,
|
|
59854
|
+
onChain: opts.revocationOpts.onChain
|
|
59855
|
+
});
|
|
59856
|
+
}
|
|
59846
59857
|
await this._credentialWallet.save(credential);
|
|
59847
59858
|
return {
|
|
59848
59859
|
did,
|
|
@@ -60205,23 +60216,13 @@ class IdentityWallet {
|
|
|
60205
60216
|
throw new Error(`there is no registered publisher to save hash is not registered for ${credentialStatusType} is not registered`);
|
|
60206
60217
|
}
|
|
60207
60218
|
let nodes = [];
|
|
60208
|
-
|
|
60209
|
-
|
|
60210
|
-
|
|
60211
|
-
|
|
60212
|
-
|
|
60213
|
-
|
|
60214
|
-
|
|
60215
|
-
}
|
|
60216
|
-
else {
|
|
60217
|
-
const treeState = await this.getDIDTreeModel(issuerDID);
|
|
60218
|
-
nodes = await getNodesRepresentation(opts?.revokedNonces, {
|
|
60219
|
-
revocationTree: treeState.revocationTree,
|
|
60220
|
-
claimsTree: treeState.claimsTree,
|
|
60221
|
-
state: treeState.state,
|
|
60222
|
-
rootsTree: treeState.rootsTree
|
|
60223
|
-
}, treeState.state);
|
|
60224
|
-
}
|
|
60219
|
+
const tree = opts?.treeModel ?? (await this.getDIDTreeModel(issuerDID));
|
|
60220
|
+
nodes = await getNodesRepresentation(opts?.revokedNonces ?? [], {
|
|
60221
|
+
revocationTree: tree.revocationTree,
|
|
60222
|
+
claimsTree: tree.claimsTree,
|
|
60223
|
+
state: tree.state,
|
|
60224
|
+
rootsTree: tree.rootsTree
|
|
60225
|
+
}, tree.state);
|
|
60225
60226
|
if (!nodes.length) {
|
|
60226
60227
|
return;
|
|
60227
60228
|
}
|