@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
|
@@ -74657,9 +74657,6 @@ var PolygonIdSdk = (function (exports) {
|
|
|
74657
74657
|
if (!opts.senderAddress) {
|
|
74658
74658
|
throw new Error('Sender address is not provided');
|
|
74659
74659
|
}
|
|
74660
|
-
if (!opts.zkpResponses || opts.zkpResponses.length === 0) {
|
|
74661
|
-
throw new Error('ZKP responses are not provided');
|
|
74662
|
-
}
|
|
74663
74660
|
const challengeAuth = calcChallengeAuthV2(opts.senderAddress, opts.zkpResponses);
|
|
74664
74661
|
const zkpRes = await proofService.generateAuthProof(circuitId, to, { challenge: challengeAuth });
|
|
74665
74662
|
return {
|
|
@@ -74701,21 +74698,7 @@ var PolygonIdSdk = (function (exports) {
|
|
|
74701
74698
|
}
|
|
74702
74699
|
const preparedZkpProof = prepareZkpProof(zkProof.proof);
|
|
74703
74700
|
const zkProofEncoded = packZkpProof(inputs, preparedZkpProof.a, preparedZkpProof.b, preparedZkpProof.c);
|
|
74704
|
-
const
|
|
74705
|
-
if (zkProof.vp) {
|
|
74706
|
-
for (const key in zkProof.vp.verifiableCredential.credentialSubject) {
|
|
74707
|
-
if (key === '@type') {
|
|
74708
|
-
continue;
|
|
74709
|
-
}
|
|
74710
|
-
const metadataValue = $$2.hashBytes(byteEncoder.encode(JSON.stringify(zkProof.vp.verifiableCredential.credentialSubject[key])));
|
|
74711
|
-
const bytesValue = byteEncoder.encode(metadataValue.toString());
|
|
74712
|
-
metadataArr.push({
|
|
74713
|
-
key,
|
|
74714
|
-
value: bytesValue
|
|
74715
|
-
});
|
|
74716
|
-
}
|
|
74717
|
-
}
|
|
74718
|
-
const metadata = metadataArr.length ? packMetadatas(metadataArr) : emptyBytes;
|
|
74701
|
+
const metadata = emptyBytes;
|
|
74719
74702
|
return { requestId, zkProofEncoded, metadata };
|
|
74720
74703
|
};
|
|
74721
74704
|
/**
|
|
@@ -76750,6 +76733,8 @@ var PolygonIdSdk = (function (exports) {
|
|
|
76750
76733
|
for (const [txHash, zkpResponses] of txHashZkpResponsesMap) {
|
|
76751
76734
|
response.set(txHash, { responses: zkpResponses });
|
|
76752
76735
|
}
|
|
76736
|
+
// set txHash of the first response
|
|
76737
|
+
message.body.transaction_data.txHash = txHashZkpResponsesMap.keys().next().value;
|
|
76753
76738
|
return response;
|
|
76754
76739
|
}
|
|
76755
76740
|
case exports.FunctionSignatures.SubmitZKPResponseV1: {
|
|
@@ -76758,6 +76743,8 @@ var PolygonIdSdk = (function (exports) {
|
|
|
76758
76743
|
for (const [txHash, zkpResponse] of txHashZkpResponseMap) {
|
|
76759
76744
|
response.set(txHash, { responses: [zkpResponse] });
|
|
76760
76745
|
}
|
|
76746
|
+
// set txHash of the first response
|
|
76747
|
+
message.body.transaction_data.txHash = txHashZkpResponseMap.keys().next().value;
|
|
76761
76748
|
return response;
|
|
76762
76749
|
}
|
|
76763
76750
|
case exports.FunctionSignatures.SubmitResponse: {
|
|
@@ -76777,7 +76764,10 @@ var PolygonIdSdk = (function (exports) {
|
|
|
76777
76764
|
senderAddress: await ethSigner.getAddress(),
|
|
76778
76765
|
zkpResponses: zkpResponses
|
|
76779
76766
|
});
|
|
76780
|
-
return
|
|
76767
|
+
// we return txHash because responsesMap could be empty if there are no queries in scope
|
|
76768
|
+
const txHashZkpResponsesMap = await this._zkpVerifier.submitResponse(ethSigner, message.body.transaction_data, zkpResponses, authProof);
|
|
76769
|
+
message.body.transaction_data.txHash = txHashZkpResponsesMap.keys().next().value;
|
|
76770
|
+
return txHashZkpResponsesMap;
|
|
76781
76771
|
}
|
|
76782
76772
|
default:
|
|
76783
76773
|
throw new Error(`Not supported method id. Only '${exports.FunctionSignatures.SubmitZKPResponseV1}, ${exports.FunctionSignatures.SubmitZKPResponseV2} and ${exports.FunctionSignatures.SubmitResponse} are supported.'`);
|