@0xpolygonid/js-sdk 1.29.2 → 1.29.4
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 +9 -19
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +9 -19
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/iden3comm/handlers/common.js +1 -18
- package/dist/node/cjs/iden3comm/handlers/contract-request.js +8 -1
- package/dist/node/esm/iden3comm/handlers/common.js +3 -20
- 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
|
@@ -53775,9 +53775,6 @@ const processProofAuth = async (to, proofService, opts) => {
|
|
|
53775
53775
|
if (!opts.senderAddress) {
|
|
53776
53776
|
throw new Error('Sender address is not provided');
|
|
53777
53777
|
}
|
|
53778
|
-
if (!opts.zkpResponses || opts.zkpResponses.length === 0) {
|
|
53779
|
-
throw new Error('ZKP responses are not provided');
|
|
53780
|
-
}
|
|
53781
53778
|
const challengeAuth = calcChallengeAuthV2(opts.senderAddress, opts.zkpResponses);
|
|
53782
53779
|
const zkpRes = await proofService.generateAuthProof(circuitId, to, { challenge: challengeAuth });
|
|
53783
53780
|
return {
|
|
@@ -53819,21 +53816,7 @@ const processProofResponse = (zkProof) => {
|
|
|
53819
53816
|
}
|
|
53820
53817
|
const preparedZkpProof = prepareZkpProof(zkProof.proof);
|
|
53821
53818
|
const zkProofEncoded = packZkpProof(inputs, preparedZkpProof.a, preparedZkpProof.b, preparedZkpProof.c);
|
|
53822
|
-
const
|
|
53823
|
-
if (zkProof.vp) {
|
|
53824
|
-
for (const key in zkProof.vp.verifiableCredential.credentialSubject) {
|
|
53825
|
-
if (key === '@type') {
|
|
53826
|
-
continue;
|
|
53827
|
-
}
|
|
53828
|
-
const metadataValue = poseidon.hashBytes(byteEncoder.encode(JSON.stringify(zkProof.vp.verifiableCredential.credentialSubject[key])));
|
|
53829
|
-
const bytesValue = byteEncoder.encode(metadataValue.toString());
|
|
53830
|
-
metadataArr.push({
|
|
53831
|
-
key,
|
|
53832
|
-
value: bytesValue
|
|
53833
|
-
});
|
|
53834
|
-
}
|
|
53835
|
-
}
|
|
53836
|
-
const metadata = metadataArr.length ? packMetadatas(metadataArr) : emptyBytes;
|
|
53819
|
+
const metadata = emptyBytes;
|
|
53837
53820
|
return { requestId, zkProofEncoded, metadata };
|
|
53838
53821
|
};
|
|
53839
53822
|
/**
|
|
@@ -55868,6 +55851,8 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
55868
55851
|
for (const [txHash, zkpResponses] of txHashZkpResponsesMap) {
|
|
55869
55852
|
response.set(txHash, { responses: zkpResponses });
|
|
55870
55853
|
}
|
|
55854
|
+
// set txHash of the first response
|
|
55855
|
+
message.body.transaction_data.txHash = txHashZkpResponsesMap.keys().next().value;
|
|
55871
55856
|
return response;
|
|
55872
55857
|
}
|
|
55873
55858
|
case FunctionSignatures.SubmitZKPResponseV1: {
|
|
@@ -55876,6 +55861,8 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
55876
55861
|
for (const [txHash, zkpResponse] of txHashZkpResponseMap) {
|
|
55877
55862
|
response.set(txHash, { responses: [zkpResponse] });
|
|
55878
55863
|
}
|
|
55864
|
+
// set txHash of the first response
|
|
55865
|
+
message.body.transaction_data.txHash = txHashZkpResponseMap.keys().next().value;
|
|
55879
55866
|
return response;
|
|
55880
55867
|
}
|
|
55881
55868
|
case FunctionSignatures.SubmitResponse: {
|
|
@@ -55895,7 +55882,10 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
55895
55882
|
senderAddress: await ethSigner.getAddress(),
|
|
55896
55883
|
zkpResponses: zkpResponses
|
|
55897
55884
|
});
|
|
55898
|
-
return
|
|
55885
|
+
// we return txHash because responsesMap could be empty if there are no queries in scope
|
|
55886
|
+
const txHashZkpResponsesMap = await this._zkpVerifier.submitResponse(ethSigner, message.body.transaction_data, zkpResponses, authProof);
|
|
55887
|
+
message.body.transaction_data.txHash = txHashZkpResponsesMap.keys().next().value;
|
|
55888
|
+
return txHashZkpResponsesMap;
|
|
55899
55889
|
}
|
|
55900
55890
|
default:
|
|
55901
55891
|
throw new Error(`Not supported method id. Only '${FunctionSignatures.SubmitZKPResponseV1}, ${FunctionSignatures.SubmitZKPResponseV2} and ${FunctionSignatures.SubmitResponse} are supported.'`);
|