@0xpolygonid/js-sdk 1.29.2 → 1.29.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 +8 -4
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +8 -4
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/iden3comm/handlers/common.js +0 -3
- package/dist/node/cjs/iden3comm/handlers/contract-request.js +8 -1
- package/dist/node/esm/iden3comm/handlers/common.js +0 -3
- package/dist/node/esm/iden3comm/handlers/contract-request.js +8 -1
- package/dist/types/iden3comm/types/protocol/contract-request.d.ts +1 -0
- package/package.json +1 -1
|
@@ -112,9 +112,6 @@ const processProofAuth = async (to, proofService, opts) => {
|
|
|
112
112
|
if (!opts.senderAddress) {
|
|
113
113
|
throw new Error('Sender address is not provided');
|
|
114
114
|
}
|
|
115
|
-
if (!opts.zkpResponses || opts.zkpResponses.length === 0) {
|
|
116
|
-
throw new Error('ZKP responses are not provided');
|
|
117
|
-
}
|
|
118
115
|
const challengeAuth = (0, exports.calcChallengeAuthV2)(opts.senderAddress, opts.zkpResponses);
|
|
119
116
|
const zkpRes = await proofService.generateAuthProof(circuitId, to, { challenge: challengeAuth });
|
|
120
117
|
return {
|
|
@@ -83,6 +83,8 @@ class ContractRequestHandler extends message_handler_1.AbstractMessageHandler {
|
|
|
83
83
|
for (const [txHash, zkpResponses] of txHashZkpResponsesMap) {
|
|
84
84
|
response.set(txHash, { responses: zkpResponses });
|
|
85
85
|
}
|
|
86
|
+
// set txHash of the first response
|
|
87
|
+
message.body.transaction_data.txHash = txHashZkpResponsesMap.keys().next().value;
|
|
86
88
|
return response;
|
|
87
89
|
}
|
|
88
90
|
case storage_1.FunctionSignatures.SubmitZKPResponseV1: {
|
|
@@ -91,6 +93,8 @@ class ContractRequestHandler extends message_handler_1.AbstractMessageHandler {
|
|
|
91
93
|
for (const [txHash, zkpResponse] of txHashZkpResponseMap) {
|
|
92
94
|
response.set(txHash, { responses: [zkpResponse] });
|
|
93
95
|
}
|
|
96
|
+
// set txHash of the first response
|
|
97
|
+
message.body.transaction_data.txHash = txHashZkpResponseMap.keys().next().value;
|
|
94
98
|
return response;
|
|
95
99
|
}
|
|
96
100
|
case storage_1.FunctionSignatures.SubmitResponse: {
|
|
@@ -110,7 +114,10 @@ class ContractRequestHandler extends message_handler_1.AbstractMessageHandler {
|
|
|
110
114
|
senderAddress: await ethSigner.getAddress(),
|
|
111
115
|
zkpResponses: zkpResponses
|
|
112
116
|
});
|
|
113
|
-
return
|
|
117
|
+
// we return txHash because responsesMap could be empty if there are no queries in scope
|
|
118
|
+
const txHashZkpResponsesMap = await this._zkpVerifier.submitResponse(ethSigner, message.body.transaction_data, zkpResponses, authProof);
|
|
119
|
+
message.body.transaction_data.txHash = txHashZkpResponsesMap.keys().next().value;
|
|
120
|
+
return txHashZkpResponsesMap;
|
|
114
121
|
}
|
|
115
122
|
default:
|
|
116
123
|
throw new Error(`Not supported method id. Only '${storage_1.FunctionSignatures.SubmitZKPResponseV1}, ${storage_1.FunctionSignatures.SubmitZKPResponseV2} and ${storage_1.FunctionSignatures.SubmitResponse} are supported.'`);
|
|
@@ -108,9 +108,6 @@ export const processProofAuth = async (to, proofService, opts) => {
|
|
|
108
108
|
if (!opts.senderAddress) {
|
|
109
109
|
throw new Error('Sender address is not provided');
|
|
110
110
|
}
|
|
111
|
-
if (!opts.zkpResponses || opts.zkpResponses.length === 0) {
|
|
112
|
-
throw new Error('ZKP responses are not provided');
|
|
113
|
-
}
|
|
114
111
|
const challengeAuth = calcChallengeAuthV2(opts.senderAddress, opts.zkpResponses);
|
|
115
112
|
const zkpRes = await proofService.generateAuthProof(circuitId, to, { challenge: challengeAuth });
|
|
116
113
|
return {
|
|
@@ -80,6 +80,8 @@ export class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
80
80
|
for (const [txHash, zkpResponses] of txHashZkpResponsesMap) {
|
|
81
81
|
response.set(txHash, { responses: zkpResponses });
|
|
82
82
|
}
|
|
83
|
+
// set txHash of the first response
|
|
84
|
+
message.body.transaction_data.txHash = txHashZkpResponsesMap.keys().next().value;
|
|
83
85
|
return response;
|
|
84
86
|
}
|
|
85
87
|
case FunctionSignatures.SubmitZKPResponseV1: {
|
|
@@ -88,6 +90,8 @@ export class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
88
90
|
for (const [txHash, zkpResponse] of txHashZkpResponseMap) {
|
|
89
91
|
response.set(txHash, { responses: [zkpResponse] });
|
|
90
92
|
}
|
|
93
|
+
// set txHash of the first response
|
|
94
|
+
message.body.transaction_data.txHash = txHashZkpResponseMap.keys().next().value;
|
|
91
95
|
return response;
|
|
92
96
|
}
|
|
93
97
|
case FunctionSignatures.SubmitResponse: {
|
|
@@ -107,7 +111,10 @@ export class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
107
111
|
senderAddress: await ethSigner.getAddress(),
|
|
108
112
|
zkpResponses: zkpResponses
|
|
109
113
|
});
|
|
110
|
-
return
|
|
114
|
+
// we return txHash because responsesMap could be empty if there are no queries in scope
|
|
115
|
+
const txHashZkpResponsesMap = await this._zkpVerifier.submitResponse(ethSigner, message.body.transaction_data, zkpResponses, authProof);
|
|
116
|
+
message.body.transaction_data.txHash = txHashZkpResponsesMap.keys().next().value;
|
|
117
|
+
return txHashZkpResponsesMap;
|
|
111
118
|
}
|
|
112
119
|
default:
|
|
113
120
|
throw new Error(`Not supported method id. Only '${FunctionSignatures.SubmitZKPResponseV1}, ${FunctionSignatures.SubmitZKPResponseV2} and ${FunctionSignatures.SubmitResponse} are supported.'`);
|