@0xpolygonid/js-sdk 1.40.2 → 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 +39 -37
- 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 +39 -37
- package/dist/node/cjs/index.cjs.map +1 -1
- package/dist/node/esm/index.js +39 -37
- package/dist/node/esm/index.js.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/credential-proposal.ts +45 -40
package/dist/node/esm/index.js
CHANGED
|
@@ -9265,45 +9265,47 @@ var CredentialProposalHandler = class extends AbstractMessageHandler {
|
|
|
9265
9265
|
for (let i = 0; i < proposalRequest.body.credentials.length; i++) {
|
|
9266
9266
|
const cred = proposalRequest.body.credentials[i];
|
|
9267
9267
|
let credsFromWallet = [];
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
type: cred.type,
|
|
9276
|
-
context: cred.context,
|
|
9277
|
-
allowedIssuers: [proposalRequest.to]
|
|
9278
|
-
});
|
|
9279
|
-
} catch (e) {
|
|
9280
|
-
if (e.message !== "no credential satisfied query") {
|
|
9281
|
-
throw e;
|
|
9282
|
-
}
|
|
9283
|
-
}
|
|
9284
|
-
if (credsFromWallet.length) {
|
|
9285
|
-
const guid = uuid8.v4();
|
|
9286
|
-
if (!credOfferMessage) {
|
|
9287
|
-
credOfferMessage = {
|
|
9288
|
-
id: guid,
|
|
9289
|
-
typ: this._params.packerParams.mediaType,
|
|
9290
|
-
type: PROTOCOL_MESSAGE_TYPE.CREDENTIAL_OFFER_MESSAGE_TYPE,
|
|
9291
|
-
thid: proposalRequest.thid ?? guid,
|
|
9292
|
-
body: {
|
|
9293
|
-
url: this._params.agentUrl,
|
|
9294
|
-
credentials: []
|
|
9268
|
+
if (!ctx?.forceCredentialReissue) {
|
|
9269
|
+
try {
|
|
9270
|
+
credsFromWallet = await this._identityWallet.credentialWallet.findByQuery({
|
|
9271
|
+
credentialSubject: {
|
|
9272
|
+
id: {
|
|
9273
|
+
$eq: proposalRequest.from
|
|
9274
|
+
}
|
|
9295
9275
|
},
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
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;
|
|
9299
9308
|
}
|
|
9300
|
-
credOfferMessage.body.credentials.push(
|
|
9301
|
-
...credsFromWallet.map((c) => ({
|
|
9302
|
-
id: c.id,
|
|
9303
|
-
description: ""
|
|
9304
|
-
}))
|
|
9305
|
-
);
|
|
9306
|
-
continue;
|
|
9307
9309
|
}
|
|
9308
9310
|
const proposal = await this._params.proposalResolverFn(cred.context, cred.type, {
|
|
9309
9311
|
msg: proposalRequest
|