@0xpolygonid/js-sdk 1.40.1 → 1.40.3
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 +41 -38
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.global.js +1 -1
- package/dist/browser/umd/index.global.js.map +1 -1
- package/dist/node/cjs/index.cjs +41 -38
- package/dist/node/cjs/index.cjs.map +1 -1
- package/dist/node/esm/index.js +41 -38
- package/dist/node/esm/index.js.map +1 -1
- package/dist/types/iden3comm/handlers/common.d.ts.map +1 -1
- package/dist/types/iden3comm/handlers/credential-proposal.d.ts +4 -1
- package/dist/types/iden3comm/handlers/credential-proposal.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/iden3comm/handlers/common.ts +3 -2
- package/src/iden3comm/handlers/credential-proposal.ts +45 -40
|
@@ -7024,7 +7024,8 @@ var processZeroKnowledgeProofRequests = async (to, requests, from, proofService,
|
|
|
7024
7024
|
const expectedErrors = [
|
|
7025
7025
|
VerifiableConstants.ERRORS.PROOF_SERVICE_NO_CREDENTIAL_FOR_IDENTITY_OR_PROFILE,
|
|
7026
7026
|
VerifiableConstants.ERRORS.ID_WALLET_NO_CREDENTIAL_SATISFIED_QUERY,
|
|
7027
|
-
VerifiableConstants.ERRORS.CREDENTIAL_WALLET_ALL_CREDENTIALS_ARE_REVOKED
|
|
7027
|
+
VerifiableConstants.ERRORS.CREDENTIAL_WALLET_ALL_CREDENTIALS_ARE_REVOKED,
|
|
7028
|
+
VerifiableConstants.ERRORS.PROOF_SERVICE_CREDENTIAL_IS_EXPIRED
|
|
7028
7029
|
];
|
|
7029
7030
|
if (error instanceof Error && (expectedErrors.includes(error.message) || error.message.includes(
|
|
7030
7031
|
VerifiableConstants.ERRORS.PROOF_SERVICE_NO_CREDENTIAL_FOR_QUERY
|
|
@@ -9264,45 +9265,47 @@ var CredentialProposalHandler = class extends AbstractMessageHandler {
|
|
|
9264
9265
|
for (let i = 0; i < proposalRequest.body.credentials.length; i++) {
|
|
9265
9266
|
const cred = proposalRequest.body.credentials[i];
|
|
9266
9267
|
let credsFromWallet = [];
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
type: cred.type,
|
|
9275
|
-
context: cred.context,
|
|
9276
|
-
allowedIssuers: [proposalRequest.to]
|
|
9277
|
-
});
|
|
9278
|
-
} catch (e) {
|
|
9279
|
-
if (e.message !== "no credential satisfied query") {
|
|
9280
|
-
throw e;
|
|
9281
|
-
}
|
|
9282
|
-
}
|
|
9283
|
-
if (credsFromWallet.length) {
|
|
9284
|
-
const guid = uuid8.v4();
|
|
9285
|
-
if (!credOfferMessage) {
|
|
9286
|
-
credOfferMessage = {
|
|
9287
|
-
id: guid,
|
|
9288
|
-
typ: this._params.packerParams.mediaType,
|
|
9289
|
-
type: PROTOCOL_MESSAGE_TYPE.CREDENTIAL_OFFER_MESSAGE_TYPE,
|
|
9290
|
-
thid: proposalRequest.thid ?? guid,
|
|
9291
|
-
body: {
|
|
9292
|
-
url: this._params.agentUrl,
|
|
9293
|
-
credentials: []
|
|
9268
|
+
if (!ctx?.forceCredentialReissue) {
|
|
9269
|
+
try {
|
|
9270
|
+
credsFromWallet = await this._identityWallet.credentialWallet.findByQuery({
|
|
9271
|
+
credentialSubject: {
|
|
9272
|
+
id: {
|
|
9273
|
+
$eq: proposalRequest.from
|
|
9274
|
+
}
|
|
9294
9275
|
},
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9276
|
+
type: cred.type,
|
|
9277
|
+
context: cred.context,
|
|
9278
|
+
allowedIssuers: [proposalRequest.to]
|
|
9279
|
+
});
|
|
9280
|
+
} catch (e) {
|
|
9281
|
+
if (e.message !== "no credential satisfied query") {
|
|
9282
|
+
throw e;
|
|
9283
|
+
}
|
|
9284
|
+
}
|
|
9285
|
+
if (credsFromWallet.length) {
|
|
9286
|
+
const guid = uuid8.v4();
|
|
9287
|
+
if (!credOfferMessage) {
|
|
9288
|
+
credOfferMessage = {
|
|
9289
|
+
id: guid,
|
|
9290
|
+
typ: this._params.packerParams.mediaType,
|
|
9291
|
+
type: PROTOCOL_MESSAGE_TYPE.CREDENTIAL_OFFER_MESSAGE_TYPE,
|
|
9292
|
+
thid: proposalRequest.thid ?? guid,
|
|
9293
|
+
body: {
|
|
9294
|
+
url: this._params.agentUrl,
|
|
9295
|
+
credentials: []
|
|
9296
|
+
},
|
|
9297
|
+
from: proposalRequest.to,
|
|
9298
|
+
to: proposalRequest.from
|
|
9299
|
+
};
|
|
9300
|
+
}
|
|
9301
|
+
credOfferMessage.body.credentials.push(
|
|
9302
|
+
...credsFromWallet.map((c) => ({
|
|
9303
|
+
id: c.id,
|
|
9304
|
+
description: ""
|
|
9305
|
+
}))
|
|
9306
|
+
);
|
|
9307
|
+
continue;
|
|
9298
9308
|
}
|
|
9299
|
-
credOfferMessage.body.credentials.push(
|
|
9300
|
-
...credsFromWallet.map((c) => ({
|
|
9301
|
-
id: c.id,
|
|
9302
|
-
description: ""
|
|
9303
|
-
}))
|
|
9304
|
-
);
|
|
9305
|
-
continue;
|
|
9306
9309
|
}
|
|
9307
9310
|
const proposal = await this._params.proposalResolverFn(cred.context, cred.type, {
|
|
9308
9311
|
msg: proposalRequest
|