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