@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/cjs/index.cjs
CHANGED
|
@@ -9818,45 +9818,47 @@ var CredentialProposalHandler = class extends AbstractMessageHandler {
|
|
|
9818
9818
|
for (let i = 0; i < proposalRequest.body.credentials.length; i++) {
|
|
9819
9819
|
const cred = proposalRequest.body.credentials[i];
|
|
9820
9820
|
let credsFromWallet = [];
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
type: cred.type,
|
|
9829
|
-
context: cred.context,
|
|
9830
|
-
allowedIssuers: [proposalRequest.to]
|
|
9831
|
-
});
|
|
9832
|
-
} catch (e) {
|
|
9833
|
-
if (e.message !== "no credential satisfied query") {
|
|
9834
|
-
throw e;
|
|
9835
|
-
}
|
|
9836
|
-
}
|
|
9837
|
-
if (credsFromWallet.length) {
|
|
9838
|
-
const guid = uuid8.v4();
|
|
9839
|
-
if (!credOfferMessage) {
|
|
9840
|
-
credOfferMessage = {
|
|
9841
|
-
id: guid,
|
|
9842
|
-
typ: this._params.packerParams.mediaType,
|
|
9843
|
-
type: PROTOCOL_MESSAGE_TYPE.CREDENTIAL_OFFER_MESSAGE_TYPE,
|
|
9844
|
-
thid: proposalRequest.thid ?? guid,
|
|
9845
|
-
body: {
|
|
9846
|
-
url: this._params.agentUrl,
|
|
9847
|
-
credentials: []
|
|
9821
|
+
if (!ctx?.forceCredentialReissue) {
|
|
9822
|
+
try {
|
|
9823
|
+
credsFromWallet = await this._identityWallet.credentialWallet.findByQuery({
|
|
9824
|
+
credentialSubject: {
|
|
9825
|
+
id: {
|
|
9826
|
+
$eq: proposalRequest.from
|
|
9827
|
+
}
|
|
9848
9828
|
},
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9829
|
+
type: cred.type,
|
|
9830
|
+
context: cred.context,
|
|
9831
|
+
allowedIssuers: [proposalRequest.to]
|
|
9832
|
+
});
|
|
9833
|
+
} catch (e) {
|
|
9834
|
+
if (e.message !== "no credential satisfied query") {
|
|
9835
|
+
throw e;
|
|
9836
|
+
}
|
|
9837
|
+
}
|
|
9838
|
+
if (credsFromWallet.length) {
|
|
9839
|
+
const guid = uuid8.v4();
|
|
9840
|
+
if (!credOfferMessage) {
|
|
9841
|
+
credOfferMessage = {
|
|
9842
|
+
id: guid,
|
|
9843
|
+
typ: this._params.packerParams.mediaType,
|
|
9844
|
+
type: PROTOCOL_MESSAGE_TYPE.CREDENTIAL_OFFER_MESSAGE_TYPE,
|
|
9845
|
+
thid: proposalRequest.thid ?? guid,
|
|
9846
|
+
body: {
|
|
9847
|
+
url: this._params.agentUrl,
|
|
9848
|
+
credentials: []
|
|
9849
|
+
},
|
|
9850
|
+
from: proposalRequest.to,
|
|
9851
|
+
to: proposalRequest.from
|
|
9852
|
+
};
|
|
9853
|
+
}
|
|
9854
|
+
credOfferMessage.body.credentials.push(
|
|
9855
|
+
...credsFromWallet.map((c) => ({
|
|
9856
|
+
id: c.id,
|
|
9857
|
+
description: ""
|
|
9858
|
+
}))
|
|
9859
|
+
);
|
|
9860
|
+
continue;
|
|
9852
9861
|
}
|
|
9853
|
-
credOfferMessage.body.credentials.push(
|
|
9854
|
-
...credsFromWallet.map((c) => ({
|
|
9855
|
-
id: c.id,
|
|
9856
|
-
description: ""
|
|
9857
|
-
}))
|
|
9858
|
-
);
|
|
9859
|
-
continue;
|
|
9860
9862
|
}
|
|
9861
9863
|
const proposal = await this._params.proposalResolverFn(cred.context, cred.type, {
|
|
9862
9864
|
msg: proposalRequest
|