@0xpolygonid/js-sdk 1.28.1 → 1.29.0

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.
Files changed (27) hide show
  1. package/dist/browser/esm/index.js +1645 -809
  2. package/dist/browser/esm/index.js.map +1 -1
  3. package/dist/browser/umd/index.js +24286 -23448
  4. package/dist/browser/umd/index.js.map +1 -1
  5. package/dist/node/cjs/iden3comm/handlers/common.js +63 -1
  6. package/dist/node/cjs/iden3comm/handlers/contract-request.js +64 -7
  7. package/dist/node/cjs/iden3comm/types/protocol/contract-request.js +6 -0
  8. package/dist/node/cjs/iden3comm/utils/contract-request.utils.js +16 -1
  9. package/dist/node/cjs/proof/proof-service.js +26 -0
  10. package/dist/node/cjs/storage/blockchain/onchain-zkp-verifier.js +107 -16
  11. package/dist/node/cjs/storage/blockchain/state.js +5 -6
  12. package/dist/node/esm/iden3comm/handlers/common.js +62 -2
  13. package/dist/node/esm/iden3comm/handlers/contract-request.js +66 -9
  14. package/dist/node/esm/iden3comm/types/protocol/contract-request.js +5 -1
  15. package/dist/node/esm/iden3comm/utils/contract-request.utils.js +14 -1
  16. package/dist/node/esm/proof/proof-service.js +26 -0
  17. package/dist/node/esm/storage/blockchain/onchain-zkp-verifier.js +107 -16
  18. package/dist/node/esm/storage/blockchain/state.js +5 -6
  19. package/dist/types/iden3comm/handlers/common.d.ts +16 -1
  20. package/dist/types/iden3comm/handlers/contract-request.d.ts +3 -1
  21. package/dist/types/iden3comm/types/protocol/auth.d.ts +8 -0
  22. package/dist/types/iden3comm/types/protocol/contract-request.d.ts +12 -0
  23. package/dist/types/iden3comm/utils/contract-request.utils.d.ts +7 -0
  24. package/dist/types/proof/proof-service.d.ts +14 -2
  25. package/dist/types/storage/blockchain/onchain-zkp-verifier.d.ts +10 -3
  26. package/dist/types/storage/interfaces/onchain-zkp-verifier.d.ts +18 -1
  27. package/package.json +2 -1
@@ -52547,6 +52547,395 @@ class TransactionService {
52547
52547
  }
52548
52548
  }
52549
52549
 
52550
+ /**
52551
+ * creates empty basic message
52552
+ *
52553
+ * @returns BasicMessage
52554
+ */
52555
+ const basicMessageFactory = () => {
52556
+ return {
52557
+ id: '',
52558
+ typ: '',
52559
+ thid: '',
52560
+ type: '',
52561
+ body: {},
52562
+ from: '',
52563
+ to: ''
52564
+ };
52565
+ };
52566
+ /**
52567
+ * create empty header stub
52568
+ *
52569
+ * @returns {HeaderStub}
52570
+ */
52571
+ const headerStubFactory = () => {
52572
+ return {
52573
+ typ: ''
52574
+ };
52575
+ };
52576
+
52577
+ // Envelope Errors
52578
+ // Token Errors
52579
+ const ErrUnknownCircuitID = "unknown circuit ID. can't verify msg sender";
52580
+ const ErrSenderNotUsedTokenCreation = 'sender of message is not used for jwz token creation';
52581
+ // ZKP-Packer Errors
52582
+ const ErrPackedWithUnsupportedCircuit = 'message was packed with unsupported circuit';
52583
+ const ErrProofIsInvalid = 'message proof is invalid';
52584
+ const ErrStateVerificationFailed = 'message state verification failed';
52585
+ const ErrNoProvingMethodAlg = 'unknown proving method algorithm';
52586
+
52587
+ const objectIs = (obj, //eslint-disable-line @typescript-eslint/no-explicit-any
52588
+ targetObj //eslint-disable-line @typescript-eslint/no-explicit-any
52589
+ ) => {
52590
+ Object.keys(targetObj).forEach((prop) => {
52591
+ if (!obj[prop]) {
52592
+ return false;
52593
+ }
52594
+ if (typeof targetObj[prop] !== typeof obj[prop]) {
52595
+ return false;
52596
+ }
52597
+ });
52598
+ return true;
52599
+ };
52600
+ //eslint-disable-next-line @typescript-eslint/no-explicit-any
52601
+ const isProtocolMessage = (message) => {
52602
+ const basicMessage = basicMessageFactory();
52603
+ Object.keys(basicMessage).forEach((prop) => {
52604
+ if (!message[prop]) {
52605
+ return false;
52606
+ }
52607
+ if (prop !== 'body') {
52608
+ const res = typeof basicMessage[prop] ===
52609
+ typeof message[prop]; //eslint-disable-line @typescript-eslint/no-explicit-any
52610
+ if (!res) {
52611
+ return false;
52612
+ }
52613
+ }
52614
+ });
52615
+ return true;
52616
+ };
52617
+ /**
52618
+ * helper function to convert serialized JSON bytes to protocol message
52619
+ *
52620
+ * @param {Uint8Array} bytes
52621
+ * @returns {BasicMessage}
52622
+ */
52623
+ const bytesToProtocolMessage = (bytes) => {
52624
+ const str = byteDecoder.decode(bytes);
52625
+ const message = JSON.parse(str);
52626
+ if (!isProtocolMessage(message)) ;
52627
+ return message;
52628
+ };
52629
+ /**
52630
+ * helper function to convert serialized JSON bytes to header stub
52631
+ * so we can work with know the media type of the message
52632
+ *
52633
+ * @param {Uint8Array} envelope
52634
+ * @returns {HeaderStub}
52635
+ */
52636
+ const bytesToHeaderStub = (envelope) => {
52637
+ const tmpObj = headerStubFactory();
52638
+ const str = byteDecoder.decode(envelope);
52639
+ const message = JSON.parse(str);
52640
+ if (!objectIs(message, tmpObj)) ;
52641
+ return message;
52642
+ };
52643
+
52644
+ const IDEN3_PROTOCOL = 'https://iden3-communication.io/';
52645
+ const DIDCOMM_PROTOCOL = 'https://didcomm.org/';
52646
+ /**
52647
+ * Constants for Iden3 protocol
52648
+ */
52649
+ const PROTOCOL_MESSAGE_TYPE = Object.freeze({
52650
+ // AuthorizationV2RequestMessageType defines auth request type of the communication protocol
52651
+ AUTHORIZATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}authorization/1.0/request`,
52652
+ // AuthorizationResponseMessageType defines auth response type of the communication protocol
52653
+ AUTHORIZATION_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}authorization/1.0/response`,
52654
+ // CredentialIssuanceRequestMessageType accepts request for credential creation
52655
+ CREDENTIAL_ISSUANCE_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/issuance-request`,
52656
+ // CredentialFetchRequestMessageType is type for request of credential generation
52657
+ CREDENTIAL_FETCH_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/fetch-request`,
52658
+ // CredentialOfferMessageType is type of message with credential offering
52659
+ CREDENTIAL_OFFER_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/offer`,
52660
+ // CredentialIssuanceResponseMessageType is type for message with a credential issuance
52661
+ CREDENTIAL_ISSUANCE_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/issuance-response`,
52662
+ // CredentialRefreshMessageType is type for message with a credential issuance
52663
+ CREDENTIAL_REFRESH_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/refresh`,
52664
+ // DeviceRegistrationRequestMessageType defines device registration request type of the communication protocol
52665
+ DEVICE_REGISTRATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}devices/1.0/registration`,
52666
+ // MessageFetMessageFetchRequestMessageType defines message fetch request type of the communication protocol.
52667
+ MESSAGE_FETCH_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}messages/1.0/fetch`,
52668
+ // ProofGenerationRequestMessageType is type for request of proof generation
52669
+ PROOF_GENERATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/request`,
52670
+ // ProofGenerationResponseMessageType is type for response of proof generation
52671
+ PROOF_GENERATION_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/response`,
52672
+ // RevocationStatusRequestMessageType is type for request of revocation status
52673
+ REVOCATION_STATUS_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}revocation/1.0/request-status`,
52674
+ // RevocationStatusResponseMessageType is type for response with a revocation status
52675
+ REVOCATION_STATUS_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}revocation/1.0/status`,
52676
+ // ContractInvokeRequestMessageType is type for request of contract invoke request
52677
+ CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/contract-invoke-request`,
52678
+ // ContractInvokeResponseMessageType is type for response of contract invoke request
52679
+ CONTRACT_INVOKE_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/contract-invoke-response`,
52680
+ // CredentialOnchainOfferMessageType is type of message with credential onchain offering
52681
+ CREDENTIAL_ONCHAIN_OFFER_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/onchain-offer`,
52682
+ // ProposalRequestMessageType is type for proposal-request message
52683
+ PROPOSAL_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/proposal-request`,
52684
+ // ProposalMessageType is type for proposal message
52685
+ PROPOSAL_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/proposal`,
52686
+ // PaymentRequestMessageType is type for payment-request message
52687
+ PAYMENT_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/payment-request`,
52688
+ // PaymentMessageType is type for payment message
52689
+ PAYMENT_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/payment`,
52690
+ // DiscoveryProtocolQueriesMessageType is type for didcomm discovery protocol queries
52691
+ DISCOVERY_PROTOCOL_QUERIES_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/queries`,
52692
+ // DiscoveryProtocolDiscloseMessageType is type for didcomm discovery protocol disclose
52693
+ DISCOVERY_PROTOCOL_DISCLOSE_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/disclose`,
52694
+ // ProblemReportMessageType is type for didcomm problem report
52695
+ PROBLEM_REPORT_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}report-problem/2.0/problem-report`
52696
+ });
52697
+ /**
52698
+ * Media types for iden3 comm communication protocol
52699
+ *
52700
+ * @enum {number}
52701
+ */
52702
+ var MediaType;
52703
+ (function (MediaType) {
52704
+ MediaType["ZKPMessage"] = "application/iden3-zkp-json";
52705
+ MediaType["PlainMessage"] = "application/iden3comm-plain-json";
52706
+ MediaType["SignedMessage"] = "application/iden3comm-signed-json";
52707
+ })(MediaType || (MediaType = {}));
52708
+ const SUPPORTED_PUBLIC_KEY_TYPES = {
52709
+ ES256K: [
52710
+ 'EcdsaSecp256k1VerificationKey2019',
52711
+ /**
52712
+ * Equivalent to EcdsaSecp256k1VerificationKey2019 when key is an ethereumAddress
52713
+ */
52714
+ 'EcdsaSecp256k1RecoveryMethod2020',
52715
+ 'JsonWebKey2020'
52716
+ ],
52717
+ 'ES256K-R': [
52718
+ 'EcdsaSecp256k1VerificationKey2019',
52719
+ /**
52720
+ * Equivalent to EcdsaSecp256k1VerificationKey2019 when key is an ethereumAddress
52721
+ */
52722
+ 'EcdsaSecp256k1RecoveryMethod2020',
52723
+ 'JsonWebKey2020'
52724
+ ]
52725
+ };
52726
+ var ProtocolVersion;
52727
+ (function (ProtocolVersion) {
52728
+ ProtocolVersion["V1"] = "iden3comm/v1";
52729
+ })(ProtocolVersion || (ProtocolVersion = {}));
52730
+ var AcceptAuthCircuits;
52731
+ (function (AcceptAuthCircuits) {
52732
+ AcceptAuthCircuits["AuthV2"] = "authV2";
52733
+ AcceptAuthCircuits["AuthV3"] = "authV3";
52734
+ })(AcceptAuthCircuits || (AcceptAuthCircuits = {}));
52735
+ var AcceptJwzAlgorithms;
52736
+ (function (AcceptJwzAlgorithms) {
52737
+ AcceptJwzAlgorithms["Groth16"] = "groth16";
52738
+ })(AcceptJwzAlgorithms || (AcceptJwzAlgorithms = {}));
52739
+ var AcceptJwsAlgorithms;
52740
+ (function (AcceptJwsAlgorithms) {
52741
+ AcceptJwsAlgorithms["ES256K"] = "ES256K";
52742
+ AcceptJwsAlgorithms["ES256KR"] = "ES256K-R";
52743
+ })(AcceptJwsAlgorithms || (AcceptJwsAlgorithms = {}));
52744
+ const defaultAcceptProfile = {
52745
+ protocolVersion: ProtocolVersion.V1,
52746
+ env: MediaType.ZKPMessage,
52747
+ circuits: [AcceptAuthCircuits.AuthV2],
52748
+ alg: [AcceptJwzAlgorithms.Groth16]
52749
+ };
52750
+ const DEFAULT_PROOF_VERIFY_DELAY = 1 * 60 * 60 * 1000; // 1 hour
52751
+ const DEFAULT_AUTH_VERIFY_DELAY = 5 * 60 * 1000; // 5 minutes
52752
+
52753
+ var constants = /*#__PURE__*/Object.freeze({
52754
+ __proto__: null,
52755
+ get AcceptAuthCircuits () { return AcceptAuthCircuits; },
52756
+ get AcceptJwsAlgorithms () { return AcceptJwsAlgorithms; },
52757
+ get AcceptJwzAlgorithms () { return AcceptJwzAlgorithms; },
52758
+ DEFAULT_AUTH_VERIFY_DELAY: DEFAULT_AUTH_VERIFY_DELAY,
52759
+ DEFAULT_PROOF_VERIFY_DELAY: DEFAULT_PROOF_VERIFY_DELAY,
52760
+ get MediaType () { return MediaType; },
52761
+ PROTOCOL_MESSAGE_TYPE: PROTOCOL_MESSAGE_TYPE,
52762
+ get ProtocolVersion () { return ProtocolVersion; },
52763
+ SUPPORTED_PUBLIC_KEY_TYPES: SUPPORTED_PUBLIC_KEY_TYPES,
52764
+ defaultAcceptProfile: defaultAcceptProfile
52765
+ });
52766
+
52767
+ const DIDAuthenticationSection = 'authentication';
52768
+ const resolveVerificationMethods = (didDocument) => {
52769
+ const vms = didDocument.verificationMethod || [];
52770
+ // prioritize: first verification methods to be chosen are from `authentication` section.
52771
+ const sortedVerificationMethods = (didDocument[DIDAuthenticationSection] || [])
52772
+ .map((verificationMethod) => {
52773
+ if (typeof verificationMethod === 'string') {
52774
+ return vms.find((i) => i.id === verificationMethod);
52775
+ }
52776
+ return verificationMethod;
52777
+ })
52778
+ .filter((key) => key);
52779
+ // add all other verification methods
52780
+ for (let index = 0; index < vms.length; index++) {
52781
+ const id = vms[index].id;
52782
+ if (sortedVerificationMethods.findIndex((vm) => vm.id === id) === -1) {
52783
+ sortedVerificationMethods.push(vms[index]);
52784
+ }
52785
+ }
52786
+ return sortedVerificationMethods;
52787
+ };
52788
+ const extractPublicKeyBytes = (vm) => {
52789
+ const isSupportedVmType = Object.keys(SUPPORTED_PUBLIC_KEY_TYPES).some((key) => SUPPORTED_PUBLIC_KEY_TYPES[key].includes(vm.type));
52790
+ if (vm.publicKeyBase58 && isSupportedVmType) {
52791
+ return { publicKeyBytes: base58ToBytes$1(vm.publicKeyBase58), kmsKeyType: KmsKeyType.Secp256k1 };
52792
+ }
52793
+ if (vm.publicKeyBase64 && isSupportedVmType) {
52794
+ return {
52795
+ publicKeyBytes: base64UrlToBytes(vm.publicKeyBase64),
52796
+ kmsKeyType: KmsKeyType.Secp256k1
52797
+ };
52798
+ }
52799
+ if (vm.publicKeyHex && isSupportedVmType) {
52800
+ return { publicKeyBytes: hexToBytes$3(vm.publicKeyHex), kmsKeyType: KmsKeyType.Secp256k1 };
52801
+ }
52802
+ if (vm.publicKeyJwk &&
52803
+ vm.publicKeyJwk.crv === 'secp256k1' &&
52804
+ vm.publicKeyJwk.x &&
52805
+ vm.publicKeyJwk.y) {
52806
+ const [xHex, yHex] = [
52807
+ base64UrlToBytes(vm.publicKeyJwk.x),
52808
+ base64UrlToBytes(vm.publicKeyJwk.y)
52809
+ ].map(bytesToHex$3);
52810
+ const x = xHex.includes('0x') ? BigInt(xHex) : BigInt(`0x${xHex}`);
52811
+ const y = yHex.includes('0x') ? BigInt(yHex) : BigInt(`0x${yHex}`);
52812
+ return {
52813
+ publicKeyBytes: secp256k1$1.ProjectivePoint.fromAffine({
52814
+ x,
52815
+ y
52816
+ }).toRawBytes(false),
52817
+ kmsKeyType: KmsKeyType.Secp256k1
52818
+ };
52819
+ }
52820
+ return { publicKeyBytes: null };
52821
+ };
52822
+
52823
+ const packZkpProof = (inputs, a, b, c) => {
52824
+ return new AbiCoder().encode(['uint256[] inputs', 'uint256[2]', 'uint256[2][2]', 'uint256[2]'], [inputs, a, b, c]);
52825
+ };
52826
+ const prepareZkpProof = (proof) => {
52827
+ return {
52828
+ a: proof.pi_a.slice(0, 2),
52829
+ b: [
52830
+ [proof.pi_b[0][1], proof.pi_b[0][0]],
52831
+ [proof.pi_b[1][1], proof.pi_b[1][0]]
52832
+ ],
52833
+ c: proof.pi_c.slice(0, 2)
52834
+ };
52835
+ };
52836
+
52837
+ function isProtocolVersion(value) {
52838
+ return Object.values(ProtocolVersion).includes(value);
52839
+ }
52840
+ function isMediaType(value) {
52841
+ return Object.values(MediaType).includes(value);
52842
+ }
52843
+ function isAcceptAuthCircuits(value) {
52844
+ return Object.values(AcceptAuthCircuits).includes(value);
52845
+ }
52846
+ function isAcceptJwsAlgorithms(value) {
52847
+ return Object.values(AcceptJwsAlgorithms).includes(value);
52848
+ }
52849
+ function isAcceptJwzAlgorithms(value) {
52850
+ return Object.values(AcceptJwzAlgorithms).includes(value);
52851
+ }
52852
+ const buildAccept = (profiles) => {
52853
+ const result = [];
52854
+ for (const profile of profiles) {
52855
+ let accept = `${profile.protocolVersion};env=${profile.env}`;
52856
+ if (profile.circuits?.length) {
52857
+ accept += `;circuitId=${profile.circuits.join(',')}`;
52858
+ }
52859
+ if (profile.alg?.length) {
52860
+ accept += `;alg=${profile.alg.join(',')}`;
52861
+ }
52862
+ result.push(accept);
52863
+ }
52864
+ return result;
52865
+ };
52866
+ const parseAcceptProfile = (profile) => {
52867
+ const params = profile.split(';');
52868
+ if (params.length < 2) {
52869
+ throw new Error('Invalid accept profile');
52870
+ }
52871
+ const protocolVersion = params[0].trim();
52872
+ if (!isProtocolVersion(protocolVersion)) {
52873
+ throw new Error(`Protocol version '${protocolVersion}' not supported`);
52874
+ }
52875
+ const envParam = params[1].split('=');
52876
+ if (envParam.length !== 2) {
52877
+ throw new Error(`Invalid accept profile 'env' parameter`);
52878
+ }
52879
+ const env = params[1].split('=')[1].trim();
52880
+ if (!isMediaType(env)) {
52881
+ throw new Error(`Envelop '${env}' not supported`);
52882
+ }
52883
+ const circuitsIndex = params.findIndex((i) => i.includes('circuitId='));
52884
+ if (env !== MediaType.ZKPMessage && circuitsIndex > 0) {
52885
+ throw new Error(`Circuits not supported for env '${env}'`);
52886
+ }
52887
+ let circuits = undefined;
52888
+ if (circuitsIndex > 0) {
52889
+ circuits = params[circuitsIndex]
52890
+ .split('=')[1]
52891
+ .split(',')
52892
+ .map((i) => i.trim())
52893
+ .map((i) => {
52894
+ if (!isAcceptAuthCircuits(i)) {
52895
+ throw new Error(`Circuit '${i}' not supported`);
52896
+ }
52897
+ return i;
52898
+ });
52899
+ }
52900
+ const algIndex = params.findIndex((i) => i.includes('alg='));
52901
+ let alg = undefined;
52902
+ if (algIndex > 0) {
52903
+ if (env === MediaType.ZKPMessage) {
52904
+ alg = params[algIndex]
52905
+ .split('=')[1]
52906
+ .split(',')
52907
+ .map((i) => {
52908
+ i = i.trim();
52909
+ if (!isAcceptJwzAlgorithms(i)) {
52910
+ throw new Error(`Algorithm '${i}' not supported for '${env}'`);
52911
+ }
52912
+ return i;
52913
+ });
52914
+ }
52915
+ else if (env === MediaType.SignedMessage) {
52916
+ alg = params[algIndex]
52917
+ .split('=')[1]
52918
+ .split(',')
52919
+ .map((i) => {
52920
+ i = i.trim();
52921
+ if (!isAcceptJwsAlgorithms(i)) {
52922
+ throw new Error(`Algorithm '${i}' not supported for '${env}'`);
52923
+ }
52924
+ return i;
52925
+ });
52926
+ }
52927
+ else {
52928
+ throw new Error(`Algorithm not supported for '${env}'`);
52929
+ }
52930
+ }
52931
+ return {
52932
+ protocolVersion,
52933
+ env,
52934
+ circuits,
52935
+ alg
52936
+ };
52937
+ };
52938
+
52550
52939
  const defaultEthConnectionConfig = {
52551
52940
  url: 'http://localhost:8545',
52552
52941
  defaultGasLimit: 600000,
@@ -52616,17 +53005,15 @@ class EthStateStorage {
52616
53005
  const { userId, oldUserState, newUserState, isOldStateGenesis } = stateTransitionPubSig;
52617
53006
  const { stateContract, provider } = this.getStateContractAndProviderForId(userId.bigInt());
52618
53007
  const contract = stateContract.connect(signer);
53008
+ const preparedZkpProof = prepareZkpProof(proof.proof);
52619
53009
  const payload = [
52620
53010
  userId.bigInt().toString(),
52621
53011
  oldUserState.bigInt().toString(),
52622
53012
  newUserState.bigInt().toString(),
52623
53013
  isOldStateGenesis,
52624
- proof.proof.pi_a.slice(0, 2),
52625
- [
52626
- [proof.proof.pi_b[0][1], proof.proof.pi_b[0][0]],
52627
- [proof.proof.pi_b[1][1], proof.proof.pi_b[1][0]]
52628
- ],
52629
- proof.proof.pi_c.slice(0, 2)
53014
+ preparedZkpProof.a,
53015
+ preparedZkpProof.b,
53016
+ preparedZkpProof.c
52630
53017
  ];
52631
53018
  const feeData = await provider.getFeeData();
52632
53019
  const maxFeePerGas = defaultEthConnectionConfig.maxFeePerGas
@@ -52733,207 +53120,719 @@ var abi$2 = [
52733
53120
  {
52734
53121
  inputs: [
52735
53122
  ],
52736
- name: "InvalidInitialization",
52737
- type: "error"
53123
+ name: "InvalidInitialization",
53124
+ type: "error"
53125
+ },
53126
+ {
53127
+ inputs: [
53128
+ {
53129
+ internalType: "string",
53130
+ name: "message",
53131
+ type: "string"
53132
+ },
53133
+ {
53134
+ internalType: "uint64",
53135
+ name: "requestId",
53136
+ type: "uint64"
53137
+ },
53138
+ {
53139
+ internalType: "uint256",
53140
+ name: "linkID",
53141
+ type: "uint256"
53142
+ },
53143
+ {
53144
+ internalType: "uint64",
53145
+ name: "requestIdToCompare",
53146
+ type: "uint64"
53147
+ },
53148
+ {
53149
+ internalType: "uint256",
53150
+ name: "linkIdToCompare",
53151
+ type: "uint256"
53152
+ }
53153
+ ],
53154
+ name: "LinkedProofError",
53155
+ type: "error"
53156
+ },
53157
+ {
53158
+ inputs: [
53159
+ ],
53160
+ name: "NotInitializing",
53161
+ type: "error"
53162
+ },
53163
+ {
53164
+ inputs: [
53165
+ {
53166
+ internalType: "address",
53167
+ name: "owner",
53168
+ type: "address"
53169
+ }
53170
+ ],
53171
+ name: "OwnableInvalidOwner",
53172
+ type: "error"
53173
+ },
53174
+ {
53175
+ inputs: [
53176
+ {
53177
+ internalType: "address",
53178
+ name: "account",
53179
+ type: "address"
53180
+ }
53181
+ ],
53182
+ name: "OwnableUnauthorizedAccount",
53183
+ type: "error"
53184
+ },
53185
+ {
53186
+ anonymous: false,
53187
+ inputs: [
53188
+ {
53189
+ indexed: false,
53190
+ internalType: "uint64",
53191
+ name: "version",
53192
+ type: "uint64"
53193
+ }
53194
+ ],
53195
+ name: "Initialized",
53196
+ type: "event"
53197
+ },
53198
+ {
53199
+ anonymous: false,
53200
+ inputs: [
53201
+ {
53202
+ indexed: true,
53203
+ internalType: "address",
53204
+ name: "previousOwner",
53205
+ type: "address"
53206
+ },
53207
+ {
53208
+ indexed: true,
53209
+ internalType: "address",
53210
+ name: "newOwner",
53211
+ type: "address"
53212
+ }
53213
+ ],
53214
+ name: "OwnershipTransferStarted",
53215
+ type: "event"
53216
+ },
53217
+ {
53218
+ anonymous: false,
53219
+ inputs: [
53220
+ {
53221
+ indexed: true,
53222
+ internalType: "address",
53223
+ name: "previousOwner",
53224
+ type: "address"
53225
+ },
53226
+ {
53227
+ indexed: true,
53228
+ internalType: "address",
53229
+ name: "newOwner",
53230
+ type: "address"
53231
+ }
53232
+ ],
53233
+ name: "OwnershipTransferred",
53234
+ type: "event"
53235
+ },
53236
+ {
53237
+ anonymous: false,
53238
+ inputs: [
53239
+ {
53240
+ indexed: true,
53241
+ internalType: "uint64",
53242
+ name: "requestId",
53243
+ type: "uint64"
53244
+ },
53245
+ {
53246
+ indexed: true,
53247
+ internalType: "address",
53248
+ name: "requestOwner",
53249
+ type: "address"
53250
+ },
53251
+ {
53252
+ indexed: false,
53253
+ internalType: "string",
53254
+ name: "metadata",
53255
+ type: "string"
53256
+ },
53257
+ {
53258
+ indexed: false,
53259
+ internalType: "address",
53260
+ name: "validator",
53261
+ type: "address"
53262
+ },
53263
+ {
53264
+ indexed: false,
53265
+ internalType: "bytes",
53266
+ name: "data",
53267
+ type: "bytes"
53268
+ }
53269
+ ],
53270
+ name: "ZKPRequestSet",
53271
+ type: "event"
53272
+ },
53273
+ {
53274
+ anonymous: false,
53275
+ inputs: [
53276
+ {
53277
+ indexed: true,
53278
+ internalType: "uint64",
53279
+ name: "requestId",
53280
+ type: "uint64"
53281
+ },
53282
+ {
53283
+ indexed: true,
53284
+ internalType: "address",
53285
+ name: "caller",
53286
+ type: "address"
53287
+ }
53288
+ ],
53289
+ name: "ZKPResponseSubmitted",
53290
+ type: "event"
53291
+ },
53292
+ {
53293
+ inputs: [
53294
+ ],
53295
+ name: "REQUESTS_RETURN_LIMIT",
53296
+ outputs: [
53297
+ {
53298
+ internalType: "uint256",
53299
+ name: "",
53300
+ type: "uint256"
53301
+ }
53302
+ ],
53303
+ stateMutability: "view",
53304
+ type: "function"
53305
+ },
53306
+ {
53307
+ inputs: [
53308
+ ],
53309
+ name: "VERSION",
53310
+ outputs: [
53311
+ {
53312
+ internalType: "string",
53313
+ name: "",
53314
+ type: "string"
53315
+ }
53316
+ ],
53317
+ stateMutability: "view",
53318
+ type: "function"
53319
+ },
53320
+ {
53321
+ inputs: [
53322
+ ],
53323
+ name: "acceptOwnership",
53324
+ outputs: [
53325
+ ],
53326
+ stateMutability: "nonpayable",
53327
+ type: "function"
53328
+ },
53329
+ {
53330
+ inputs: [
53331
+ {
53332
+ internalType: "contract ICircuitValidator",
53333
+ name: "validator",
53334
+ type: "address"
53335
+ }
53336
+ ],
53337
+ name: "addValidatorToWhitelist",
53338
+ outputs: [
53339
+ ],
53340
+ stateMutability: "nonpayable",
53341
+ type: "function"
53342
+ },
53343
+ {
53344
+ inputs: [
53345
+ {
53346
+ internalType: "uint64",
53347
+ name: "requestId",
53348
+ type: "uint64"
53349
+ }
53350
+ ],
53351
+ name: "disableZKPRequest",
53352
+ outputs: [
53353
+ ],
53354
+ stateMutability: "nonpayable",
53355
+ type: "function"
53356
+ },
53357
+ {
53358
+ inputs: [
53359
+ {
53360
+ internalType: "uint64",
53361
+ name: "requestId",
53362
+ type: "uint64"
53363
+ }
53364
+ ],
53365
+ name: "enableZKPRequest",
53366
+ outputs: [
53367
+ ],
53368
+ stateMutability: "nonpayable",
53369
+ type: "function"
53370
+ },
53371
+ {
53372
+ inputs: [
53373
+ {
53374
+ internalType: "address",
53375
+ name: "sender",
53376
+ type: "address"
53377
+ },
53378
+ {
53379
+ internalType: "uint64",
53380
+ name: "requestId",
53381
+ type: "uint64"
53382
+ }
53383
+ ],
53384
+ name: "getProofStatus",
53385
+ outputs: [
53386
+ {
53387
+ components: [
53388
+ {
53389
+ internalType: "bool",
53390
+ name: "isVerified",
53391
+ type: "bool"
53392
+ },
53393
+ {
53394
+ internalType: "string",
53395
+ name: "validatorVersion",
53396
+ type: "string"
53397
+ },
53398
+ {
53399
+ internalType: "uint256",
53400
+ name: "blockNumber",
53401
+ type: "uint256"
53402
+ },
53403
+ {
53404
+ internalType: "uint256",
53405
+ name: "blockTimestamp",
53406
+ type: "uint256"
53407
+ }
53408
+ ],
53409
+ internalType: "struct IZKPVerifier.ProofStatus",
53410
+ name: "",
53411
+ type: "tuple"
53412
+ }
53413
+ ],
53414
+ stateMutability: "view",
53415
+ type: "function"
52738
53416
  },
52739
53417
  {
52740
53418
  inputs: [
52741
53419
  {
52742
- internalType: "string",
52743
- name: "message",
52744
- type: "string"
53420
+ internalType: "address",
53421
+ name: "user",
53422
+ type: "address"
52745
53423
  },
52746
53424
  {
52747
53425
  internalType: "uint64",
52748
53426
  name: "requestId",
52749
53427
  type: "uint64"
52750
53428
  },
53429
+ {
53430
+ internalType: "string",
53431
+ name: "key",
53432
+ type: "string"
53433
+ }
53434
+ ],
53435
+ name: "getProofStorageField",
53436
+ outputs: [
52751
53437
  {
52752
53438
  internalType: "uint256",
52753
- name: "linkID",
53439
+ name: "",
52754
53440
  type: "uint256"
52755
- },
53441
+ }
53442
+ ],
53443
+ stateMutability: "view",
53444
+ type: "function"
53445
+ },
53446
+ {
53447
+ inputs: [
52756
53448
  {
52757
53449
  internalType: "uint64",
52758
- name: "requestIdToCompare",
53450
+ name: "requestId",
53451
+ type: "uint64"
53452
+ }
53453
+ ],
53454
+ name: "getRequestOwner",
53455
+ outputs: [
53456
+ {
53457
+ internalType: "address",
53458
+ name: "",
53459
+ type: "address"
53460
+ }
53461
+ ],
53462
+ stateMutability: "view",
53463
+ type: "function"
53464
+ },
53465
+ {
53466
+ inputs: [
53467
+ {
53468
+ internalType: "uint64",
53469
+ name: "requestId",
52759
53470
  type: "uint64"
53471
+ }
53472
+ ],
53473
+ name: "getZKPRequest",
53474
+ outputs: [
53475
+ {
53476
+ components: [
53477
+ {
53478
+ internalType: "string",
53479
+ name: "metadata",
53480
+ type: "string"
53481
+ },
53482
+ {
53483
+ internalType: "contract ICircuitValidator",
53484
+ name: "validator",
53485
+ type: "address"
53486
+ },
53487
+ {
53488
+ internalType: "bytes",
53489
+ name: "data",
53490
+ type: "bytes"
53491
+ }
53492
+ ],
53493
+ internalType: "struct IZKPVerifier.ZKPRequest",
53494
+ name: "zkpRequest",
53495
+ type: "tuple"
53496
+ }
53497
+ ],
53498
+ stateMutability: "view",
53499
+ type: "function"
53500
+ },
53501
+ {
53502
+ inputs: [
53503
+ {
53504
+ internalType: "uint256",
53505
+ name: "startIndex",
53506
+ type: "uint256"
52760
53507
  },
52761
53508
  {
52762
53509
  internalType: "uint256",
52763
- name: "linkIdToCompare",
53510
+ name: "length",
52764
53511
  type: "uint256"
52765
53512
  }
52766
53513
  ],
52767
- name: "LinkedProofError",
52768
- type: "error"
53514
+ name: "getZKPRequests",
53515
+ outputs: [
53516
+ {
53517
+ components: [
53518
+ {
53519
+ internalType: "string",
53520
+ name: "metadata",
53521
+ type: "string"
53522
+ },
53523
+ {
53524
+ internalType: "contract ICircuitValidator",
53525
+ name: "validator",
53526
+ type: "address"
53527
+ },
53528
+ {
53529
+ internalType: "bytes",
53530
+ name: "data",
53531
+ type: "bytes"
53532
+ }
53533
+ ],
53534
+ internalType: "struct IZKPVerifier.ZKPRequest[]",
53535
+ name: "",
53536
+ type: "tuple[]"
53537
+ }
53538
+ ],
53539
+ stateMutability: "view",
53540
+ type: "function"
52769
53541
  },
52770
53542
  {
52771
53543
  inputs: [
52772
53544
  ],
52773
- name: "NotInitializing",
52774
- type: "error"
53545
+ name: "getZKPRequestsCount",
53546
+ outputs: [
53547
+ {
53548
+ internalType: "uint256",
53549
+ name: "",
53550
+ type: "uint256"
53551
+ }
53552
+ ],
53553
+ stateMutability: "view",
53554
+ type: "function"
53555
+ },
53556
+ {
53557
+ inputs: [
53558
+ {
53559
+ internalType: "contract IStateCrossChain",
53560
+ name: "stateCrossChain",
53561
+ type: "address"
53562
+ }
53563
+ ],
53564
+ name: "initialize",
53565
+ outputs: [
53566
+ ],
53567
+ stateMutability: "nonpayable",
53568
+ type: "function"
53569
+ },
53570
+ {
53571
+ inputs: [
53572
+ {
53573
+ internalType: "address",
53574
+ name: "sender",
53575
+ type: "address"
53576
+ },
53577
+ {
53578
+ internalType: "uint64",
53579
+ name: "requestId",
53580
+ type: "uint64"
53581
+ }
53582
+ ],
53583
+ name: "isProofVerified",
53584
+ outputs: [
53585
+ {
53586
+ internalType: "bool",
53587
+ name: "",
53588
+ type: "bool"
53589
+ }
53590
+ ],
53591
+ stateMutability: "view",
53592
+ type: "function"
53593
+ },
53594
+ {
53595
+ inputs: [
53596
+ {
53597
+ internalType: "contract ICircuitValidator",
53598
+ name: "validator",
53599
+ type: "address"
53600
+ }
53601
+ ],
53602
+ name: "isWhitelistedValidator",
53603
+ outputs: [
53604
+ {
53605
+ internalType: "bool",
53606
+ name: "",
53607
+ type: "bool"
53608
+ }
53609
+ ],
53610
+ stateMutability: "view",
53611
+ type: "function"
53612
+ },
53613
+ {
53614
+ inputs: [
53615
+ {
53616
+ internalType: "uint64",
53617
+ name: "requestId",
53618
+ type: "uint64"
53619
+ }
53620
+ ],
53621
+ name: "isZKPRequestEnabled",
53622
+ outputs: [
53623
+ {
53624
+ internalType: "bool",
53625
+ name: "",
53626
+ type: "bool"
53627
+ }
53628
+ ],
53629
+ stateMutability: "view",
53630
+ type: "function"
53631
+ },
53632
+ {
53633
+ inputs: [
53634
+ ],
53635
+ name: "owner",
53636
+ outputs: [
53637
+ {
53638
+ internalType: "address",
53639
+ name: "",
53640
+ type: "address"
53641
+ }
53642
+ ],
53643
+ stateMutability: "view",
53644
+ type: "function"
52775
53645
  },
52776
53646
  {
52777
53647
  inputs: [
53648
+ ],
53649
+ name: "pendingOwner",
53650
+ outputs: [
52778
53651
  {
52779
53652
  internalType: "address",
52780
- name: "owner",
53653
+ name: "",
52781
53654
  type: "address"
52782
53655
  }
52783
53656
  ],
52784
- name: "OwnableInvalidOwner",
52785
- type: "error"
53657
+ stateMutability: "view",
53658
+ type: "function"
52786
53659
  },
52787
53660
  {
52788
53661
  inputs: [
52789
53662
  {
52790
- internalType: "address",
52791
- name: "account",
53663
+ internalType: "contract ICircuitValidator",
53664
+ name: "validator",
52792
53665
  type: "address"
52793
53666
  }
52794
53667
  ],
52795
- name: "OwnableUnauthorizedAccount",
52796
- type: "error"
53668
+ name: "removeValidatorFromWhitelist",
53669
+ outputs: [
53670
+ ],
53671
+ stateMutability: "nonpayable",
53672
+ type: "function"
53673
+ },
53674
+ {
53675
+ inputs: [
53676
+ ],
53677
+ name: "renounceOwnership",
53678
+ outputs: [
53679
+ ],
53680
+ stateMutability: "nonpayable",
53681
+ type: "function"
52797
53682
  },
52798
53683
  {
52799
- anonymous: false,
52800
53684
  inputs: [
52801
53685
  {
52802
- indexed: false,
52803
53686
  internalType: "uint64",
52804
- name: "version",
53687
+ name: "requestId",
52805
53688
  type: "uint64"
52806
53689
  }
52807
53690
  ],
52808
- name: "Initialized",
52809
- type: "event"
53691
+ name: "requestIdExists",
53692
+ outputs: [
53693
+ {
53694
+ internalType: "bool",
53695
+ name: "",
53696
+ type: "bool"
53697
+ }
53698
+ ],
53699
+ stateMutability: "view",
53700
+ type: "function"
52810
53701
  },
52811
53702
  {
52812
- anonymous: false,
52813
53703
  inputs: [
52814
53704
  {
52815
- indexed: true,
52816
- internalType: "address",
52817
- name: "previousOwner",
52818
- type: "address"
53705
+ internalType: "uint64",
53706
+ name: "requestId",
53707
+ type: "uint64"
52819
53708
  },
52820
53709
  {
52821
- indexed: true,
52822
53710
  internalType: "address",
52823
- name: "newOwner",
53711
+ name: "requestOwner",
52824
53712
  type: "address"
52825
53713
  }
52826
53714
  ],
52827
- name: "OwnershipTransferStarted",
52828
- type: "event"
53715
+ name: "setRequestOwner",
53716
+ outputs: [
53717
+ ],
53718
+ stateMutability: "nonpayable",
53719
+ type: "function"
52829
53720
  },
52830
53721
  {
52831
- anonymous: false,
52832
53722
  inputs: [
52833
53723
  {
52834
- indexed: true,
52835
- internalType: "address",
52836
- name: "previousOwner",
52837
- type: "address"
53724
+ internalType: "uint64",
53725
+ name: "requestId",
53726
+ type: "uint64"
52838
53727
  },
52839
53728
  {
52840
- indexed: true,
52841
- internalType: "address",
52842
- name: "newOwner",
52843
- type: "address"
53729
+ components: [
53730
+ {
53731
+ internalType: "string",
53732
+ name: "metadata",
53733
+ type: "string"
53734
+ },
53735
+ {
53736
+ internalType: "contract ICircuitValidator",
53737
+ name: "validator",
53738
+ type: "address"
53739
+ },
53740
+ {
53741
+ internalType: "bytes",
53742
+ name: "data",
53743
+ type: "bytes"
53744
+ }
53745
+ ],
53746
+ internalType: "struct IZKPVerifier.ZKPRequest",
53747
+ name: "request",
53748
+ type: "tuple"
52844
53749
  }
52845
53750
  ],
52846
- name: "OwnershipTransferred",
52847
- type: "event"
53751
+ name: "setZKPRequest",
53752
+ outputs: [
53753
+ ],
53754
+ stateMutability: "nonpayable",
53755
+ type: "function"
52848
53756
  },
52849
53757
  {
52850
- anonymous: false,
52851
53758
  inputs: [
52852
53759
  {
52853
- indexed: true,
52854
53760
  internalType: "uint64",
52855
53761
  name: "requestId",
52856
53762
  type: "uint64"
52857
53763
  },
52858
53764
  {
52859
- indexed: true,
52860
- internalType: "address",
52861
- name: "requestOwner",
52862
- type: "address"
53765
+ internalType: "uint256[]",
53766
+ name: "inputs",
53767
+ type: "uint256[]"
52863
53768
  },
52864
53769
  {
52865
- indexed: false,
52866
- internalType: "string",
52867
- name: "metadata",
52868
- type: "string"
53770
+ internalType: "uint256[2]",
53771
+ name: "a",
53772
+ type: "uint256[2]"
52869
53773
  },
52870
53774
  {
52871
- indexed: false,
52872
- internalType: "address",
52873
- name: "validator",
52874
- type: "address"
53775
+ internalType: "uint256[2][2]",
53776
+ name: "b",
53777
+ type: "uint256[2][2]"
52875
53778
  },
52876
53779
  {
52877
- indexed: false,
52878
- internalType: "bytes",
52879
- name: "data",
52880
- type: "bytes"
53780
+ internalType: "uint256[2]",
53781
+ name: "c",
53782
+ type: "uint256[2]"
52881
53783
  }
52882
53784
  ],
52883
- name: "ZKPRequestSet",
52884
- type: "event"
53785
+ name: "submitZKPResponse",
53786
+ outputs: [
53787
+ ],
53788
+ stateMutability: "nonpayable",
53789
+ type: "function"
52885
53790
  },
52886
53791
  {
52887
- anonymous: false,
52888
53792
  inputs: [
52889
53793
  {
52890
- indexed: true,
52891
- internalType: "uint64",
52892
- name: "requestId",
52893
- type: "uint64"
53794
+ components: [
53795
+ {
53796
+ internalType: "uint64",
53797
+ name: "requestId",
53798
+ type: "uint64"
53799
+ },
53800
+ {
53801
+ internalType: "bytes",
53802
+ name: "zkProof",
53803
+ type: "bytes"
53804
+ },
53805
+ {
53806
+ internalType: "bytes",
53807
+ name: "data",
53808
+ type: "bytes"
53809
+ }
53810
+ ],
53811
+ internalType: "struct ZKPResponse[]",
53812
+ name: "responses",
53813
+ type: "tuple[]"
52894
53814
  },
52895
53815
  {
52896
- indexed: true,
52897
- internalType: "address",
52898
- name: "caller",
52899
- type: "address"
53816
+ internalType: "bytes",
53817
+ name: "crossChainProof",
53818
+ type: "bytes"
52900
53819
  }
52901
53820
  ],
52902
- name: "ZKPResponseSubmitted",
52903
- type: "event"
52904
- },
52905
- {
52906
- inputs: [
52907
- ],
52908
- name: "REQUESTS_RETURN_LIMIT",
53821
+ name: "submitZKPResponseV2",
52909
53822
  outputs: [
52910
- {
52911
- internalType: "uint256",
52912
- name: "",
52913
- type: "uint256"
52914
- }
52915
53823
  ],
52916
- stateMutability: "view",
53824
+ stateMutability: "nonpayable",
52917
53825
  type: "function"
52918
53826
  },
52919
53827
  {
52920
53828
  inputs: [
52921
- ],
52922
- name: "VERSION",
52923
- outputs: [
52924
53829
  {
52925
- internalType: "string",
52926
- name: "",
52927
- type: "string"
53830
+ internalType: "address",
53831
+ name: "newOwner",
53832
+ type: "address"
52928
53833
  }
52929
53834
  ],
52930
- stateMutability: "view",
52931
- type: "function"
52932
- },
52933
- {
52934
- inputs: [
52935
- ],
52936
- name: "acceptOwnership",
53835
+ name: "transferOwnership",
52937
53836
  outputs: [
52938
53837
  ],
52939
53838
  stateMutability: "nonpayable",
@@ -52942,15 +53841,20 @@ var abi$2 = [
52942
53841
  {
52943
53842
  inputs: [
52944
53843
  {
52945
- internalType: "contract ICircuitValidator",
52946
- name: "validator",
53844
+ internalType: "address",
53845
+ name: "sender",
52947
53846
  type: "address"
53847
+ },
53848
+ {
53849
+ internalType: "uint64[]",
53850
+ name: "requestIds",
53851
+ type: "uint64[]"
52948
53852
  }
52949
53853
  ],
52950
- name: "addValidatorToWhitelist",
53854
+ name: "verifyLinkedProofs",
52951
53855
  outputs: [
52952
53856
  ],
52953
- stateMutability: "nonpayable",
53857
+ stateMutability: "view",
52954
53858
  type: "function"
52955
53859
  },
52956
53860
  {
@@ -52959,69 +53863,138 @@ var abi$2 = [
52959
53863
  internalType: "uint64",
52960
53864
  name: "requestId",
52961
53865
  type: "uint64"
53866
+ },
53867
+ {
53868
+ internalType: "uint256[]",
53869
+ name: "inputs",
53870
+ type: "uint256[]"
53871
+ },
53872
+ {
53873
+ internalType: "uint256[2]",
53874
+ name: "a",
53875
+ type: "uint256[2]"
53876
+ },
53877
+ {
53878
+ internalType: "uint256[2][2]",
53879
+ name: "b",
53880
+ type: "uint256[2][2]"
53881
+ },
53882
+ {
53883
+ internalType: "uint256[2]",
53884
+ name: "c",
53885
+ type: "uint256[2]"
53886
+ },
53887
+ {
53888
+ internalType: "address",
53889
+ name: "sender",
53890
+ type: "address"
52962
53891
  }
52963
53892
  ],
52964
- name: "disableZKPRequest",
53893
+ name: "verifyZKPResponse",
52965
53894
  outputs: [
53895
+ {
53896
+ components: [
53897
+ {
53898
+ internalType: "string",
53899
+ name: "key",
53900
+ type: "string"
53901
+ },
53902
+ {
53903
+ internalType: "uint256",
53904
+ name: "inputValue",
53905
+ type: "uint256"
53906
+ }
53907
+ ],
53908
+ internalType: "struct ICircuitValidator.KeyToInputValue[]",
53909
+ name: "",
53910
+ type: "tuple[]"
53911
+ }
52966
53912
  ],
52967
53913
  stateMutability: "nonpayable",
52968
53914
  type: "function"
52969
53915
  },
52970
53916
  {
52971
53917
  inputs: [
52972
- {
52973
- internalType: "uint64",
52974
- name: "requestId",
52975
- type: "uint64"
52976
- }
52977
53918
  ],
52978
- name: "enableZKPRequest",
53919
+ name: "version",
52979
53920
  outputs: [
53921
+ {
53922
+ internalType: "string",
53923
+ name: "",
53924
+ type: "string"
53925
+ }
52980
53926
  ],
52981
- stateMutability: "nonpayable",
53927
+ stateMutability: "pure",
52982
53928
  type: "function"
52983
- },
53929
+ }
53930
+ ];
53931
+
53932
+ var IVerifierABI = [
52984
53933
  {
52985
53934
  inputs: [
53935
+ {
53936
+ internalType: "uint256",
53937
+ name: "multiRequestId",
53938
+ type: "uint256"
53939
+ },
52986
53940
  {
52987
53941
  internalType: "address",
52988
- name: "sender",
53942
+ name: "userAddress",
52989
53943
  type: "address"
52990
- },
53944
+ }
53945
+ ],
53946
+ name: "areMultiRequestProofsVerified",
53947
+ outputs: [
52991
53948
  {
52992
- internalType: "uint64",
52993
- name: "requestId",
52994
- type: "uint64"
53949
+ internalType: "bool",
53950
+ name: "",
53951
+ type: "bool"
52995
53952
  }
52996
53953
  ],
52997
- name: "getProofStatus",
53954
+ stateMutability: "view",
53955
+ type: "function"
53956
+ },
53957
+ {
53958
+ inputs: [
53959
+ {
53960
+ internalType: "uint256",
53961
+ name: "groupID",
53962
+ type: "uint256"
53963
+ }
53964
+ ],
53965
+ name: "getGroupedRequests",
52998
53966
  outputs: [
52999
53967
  {
53000
53968
  components: [
53001
53969
  {
53002
- internalType: "bool",
53003
- name: "isVerified",
53004
- type: "bool"
53970
+ internalType: "uint256",
53971
+ name: "requestId",
53972
+ type: "uint256"
53005
53973
  },
53006
53974
  {
53007
53975
  internalType: "string",
53008
- name: "validatorVersion",
53976
+ name: "metadata",
53009
53977
  type: "string"
53010
53978
  },
53011
53979
  {
53012
- internalType: "uint256",
53013
- name: "blockNumber",
53014
- type: "uint256"
53980
+ internalType: "contract IRequestValidator",
53981
+ name: "validator",
53982
+ type: "address"
53015
53983
  },
53016
53984
  {
53017
- internalType: "uint256",
53018
- name: "blockTimestamp",
53019
- type: "uint256"
53985
+ internalType: "bytes",
53986
+ name: "params",
53987
+ type: "bytes"
53988
+ },
53989
+ {
53990
+ internalType: "address",
53991
+ name: "creator",
53992
+ type: "address"
53020
53993
  }
53021
53994
  ],
53022
- internalType: "struct IZKPVerifier.ProofStatus",
53995
+ internalType: "struct IVerifier.RequestInfo[]",
53023
53996
  name: "",
53024
- type: "tuple"
53997
+ type: "tuple[]"
53025
53998
  }
53026
53999
  ],
53027
54000
  stateMutability: "view",
@@ -53029,23 +54002,8 @@ var abi$2 = [
53029
54002
  },
53030
54003
  {
53031
54004
  inputs: [
53032
- {
53033
- internalType: "address",
53034
- name: "user",
53035
- type: "address"
53036
- },
53037
- {
53038
- internalType: "uint64",
53039
- name: "requestId",
53040
- type: "uint64"
53041
- },
53042
- {
53043
- internalType: "string",
53044
- name: "key",
53045
- type: "string"
53046
- }
53047
54005
  ],
53048
- name: "getProofStorageField",
54006
+ name: "getGroupsCount",
53049
54007
  outputs: [
53050
54008
  {
53051
54009
  internalType: "uint256",
@@ -53059,52 +54017,130 @@ var abi$2 = [
53059
54017
  {
53060
54018
  inputs: [
53061
54019
  {
53062
- internalType: "uint64",
53063
- name: "requestId",
53064
- type: "uint64"
54020
+ internalType: "uint256",
54021
+ name: "multiRequestId",
54022
+ type: "uint256"
53065
54023
  }
53066
54024
  ],
53067
- name: "getRequestOwner",
54025
+ name: "getMultiRequest",
53068
54026
  outputs: [
54027
+ {
54028
+ components: [
54029
+ {
54030
+ internalType: "uint256",
54031
+ name: "multiRequestId",
54032
+ type: "uint256"
54033
+ },
54034
+ {
54035
+ internalType: "uint256[]",
54036
+ name: "requestIds",
54037
+ type: "uint256[]"
54038
+ },
54039
+ {
54040
+ internalType: "uint256[]",
54041
+ name: "groupIds",
54042
+ type: "uint256[]"
54043
+ },
54044
+ {
54045
+ internalType: "bytes",
54046
+ name: "metadata",
54047
+ type: "bytes"
54048
+ }
54049
+ ],
54050
+ internalType: "struct IVerifier.MultiRequest",
54051
+ name: "multiRequest",
54052
+ type: "tuple"
54053
+ }
54054
+ ],
54055
+ stateMutability: "view",
54056
+ type: "function"
54057
+ },
54058
+ {
54059
+ inputs: [
54060
+ {
54061
+ internalType: "uint256",
54062
+ name: "multiRequestId",
54063
+ type: "uint256"
54064
+ },
53069
54065
  {
53070
54066
  internalType: "address",
53071
- name: "",
54067
+ name: "userAddress",
53072
54068
  type: "address"
53073
54069
  }
53074
54070
  ],
54071
+ name: "getMultiRequestProofsStatus",
54072
+ outputs: [
54073
+ {
54074
+ components: [
54075
+ {
54076
+ internalType: "uint256",
54077
+ name: "requestId",
54078
+ type: "uint256"
54079
+ },
54080
+ {
54081
+ internalType: "bool",
54082
+ name: "isVerified",
54083
+ type: "bool"
54084
+ },
54085
+ {
54086
+ internalType: "string",
54087
+ name: "validatorVersion",
54088
+ type: "string"
54089
+ },
54090
+ {
54091
+ internalType: "uint256",
54092
+ name: "timestamp",
54093
+ type: "uint256"
54094
+ }
54095
+ ],
54096
+ internalType: "struct IVerifier.RequestProofStatus[]",
54097
+ name: "",
54098
+ type: "tuple[]"
54099
+ }
54100
+ ],
53075
54101
  stateMutability: "view",
53076
54102
  type: "function"
53077
54103
  },
53078
54104
  {
53079
54105
  inputs: [
53080
54106
  {
53081
- internalType: "uint64",
54107
+ internalType: "uint256",
53082
54108
  name: "requestId",
53083
- type: "uint64"
54109
+ type: "uint256"
53084
54110
  }
53085
54111
  ],
53086
- name: "getZKPRequest",
54112
+ name: "getRequest",
53087
54113
  outputs: [
53088
54114
  {
53089
54115
  components: [
54116
+ {
54117
+ internalType: "uint256",
54118
+ name: "requestId",
54119
+ type: "uint256"
54120
+ },
53090
54121
  {
53091
54122
  internalType: "string",
53092
54123
  name: "metadata",
53093
54124
  type: "string"
53094
54125
  },
53095
54126
  {
53096
- internalType: "contract ICircuitValidator",
54127
+ internalType: "contract IRequestValidator",
53097
54128
  name: "validator",
53098
54129
  type: "address"
53099
54130
  },
53100
54131
  {
53101
54132
  internalType: "bytes",
53102
- name: "data",
54133
+ name: "params",
53103
54134
  type: "bytes"
54135
+ },
54136
+ {
54137
+ internalType: "address",
54138
+ name: "creator",
54139
+ type: "address"
53104
54140
  }
53105
54141
  ],
53106
- internalType: "struct IZKPVerifier.ZKPRequest",
53107
- name: "zkpRequest",
54142
+ internalType: "struct IVerifier.RequestInfo",
54143
+ name: "request",
53108
54144
  type: "tuple"
53109
54145
  }
53110
54146
  ],
@@ -53114,39 +54150,44 @@ var abi$2 = [
53114
54150
  {
53115
54151
  inputs: [
53116
54152
  {
53117
- internalType: "uint256",
53118
- name: "startIndex",
53119
- type: "uint256"
54153
+ internalType: "address",
54154
+ name: "sender",
54155
+ type: "address"
53120
54156
  },
53121
54157
  {
53122
54158
  internalType: "uint256",
53123
- name: "length",
54159
+ name: "requestId",
53124
54160
  type: "uint256"
53125
54161
  }
53126
54162
  ],
53127
- name: "getZKPRequests",
54163
+ name: "getRequestProofStatus",
53128
54164
  outputs: [
53129
54165
  {
53130
54166
  components: [
53131
54167
  {
53132
- internalType: "string",
53133
- name: "metadata",
53134
- type: "string"
54168
+ internalType: "uint256",
54169
+ name: "requestId",
54170
+ type: "uint256"
53135
54171
  },
53136
54172
  {
53137
- internalType: "contract ICircuitValidator",
53138
- name: "validator",
53139
- type: "address"
54173
+ internalType: "bool",
54174
+ name: "isVerified",
54175
+ type: "bool"
53140
54176
  },
53141
54177
  {
53142
- internalType: "bytes",
53143
- name: "data",
53144
- type: "bytes"
54178
+ internalType: "string",
54179
+ name: "validatorVersion",
54180
+ type: "string"
54181
+ },
54182
+ {
54183
+ internalType: "uint256",
54184
+ name: "timestamp",
54185
+ type: "uint256"
53145
54186
  }
53146
54187
  ],
53147
- internalType: "struct IZKPVerifier.ZKPRequest[]",
54188
+ internalType: "struct IVerifier.RequestProofStatus",
53148
54189
  name: "",
53149
- type: "tuple[]"
54190
+ type: "tuple"
53150
54191
  }
53151
54192
  ],
53152
54193
  stateMutability: "view",
@@ -53155,7 +54196,7 @@ var abi$2 = [
53155
54196
  {
53156
54197
  inputs: [
53157
54198
  ],
53158
- name: "getZKPRequestsCount",
54199
+ name: "getRequestsCount",
53159
54200
  outputs: [
53160
54201
  {
53161
54202
  internalType: "uint256",
@@ -53169,36 +54210,27 @@ var abi$2 = [
53169
54210
  {
53170
54211
  inputs: [
53171
54212
  {
53172
- internalType: "contract IStateCrossChain",
53173
- name: "stateCrossChain",
53174
- type: "address"
53175
- }
53176
- ],
53177
- name: "initialize",
53178
- outputs: [
53179
- ],
53180
- stateMutability: "nonpayable",
53181
- type: "function"
53182
- },
53183
- {
53184
- inputs: [
54213
+ internalType: "uint256",
54214
+ name: "requestId",
54215
+ type: "uint256"
54216
+ },
53185
54217
  {
53186
54218
  internalType: "address",
53187
54219
  name: "sender",
53188
54220
  type: "address"
53189
54221
  },
53190
54222
  {
53191
- internalType: "uint64",
53192
- name: "requestId",
53193
- type: "uint64"
54223
+ internalType: "string",
54224
+ name: "responseFieldName",
54225
+ type: "string"
53194
54226
  }
53195
54227
  ],
53196
- name: "isProofVerified",
54228
+ name: "getResponseFieldValue",
53197
54229
  outputs: [
53198
54230
  {
53199
- internalType: "bool",
54231
+ internalType: "uint256",
53200
54232
  name: "",
53201
- type: "bool"
54233
+ type: "uint256"
53202
54234
  }
53203
54235
  ],
53204
54236
  stateMutability: "view",
@@ -53207,17 +54239,39 @@ var abi$2 = [
53207
54239
  {
53208
54240
  inputs: [
53209
54241
  {
53210
- internalType: "contract ICircuitValidator",
53211
- name: "validator",
54242
+ internalType: "uint256",
54243
+ name: "requestId",
54244
+ type: "uint256"
54245
+ },
54246
+ {
54247
+ internalType: "address",
54248
+ name: "sender",
53212
54249
  type: "address"
53213
54250
  }
53214
54251
  ],
53215
- name: "isWhitelistedValidator",
54252
+ name: "getResponseFields",
53216
54253
  outputs: [
53217
54254
  {
53218
- internalType: "bool",
54255
+ components: [
54256
+ {
54257
+ internalType: "string",
54258
+ name: "name",
54259
+ type: "string"
54260
+ },
54261
+ {
54262
+ internalType: "uint256",
54263
+ name: "value",
54264
+ type: "uint256"
54265
+ },
54266
+ {
54267
+ internalType: "bytes",
54268
+ name: "rawValue",
54269
+ type: "bytes"
54270
+ }
54271
+ ],
54272
+ internalType: "struct IRequestValidator.ResponseField[]",
53219
54273
  name: "",
53220
- type: "bool"
54274
+ type: "tuple[]"
53221
54275
  }
53222
54276
  ],
53223
54277
  stateMutability: "view",
@@ -53226,12 +54280,12 @@ var abi$2 = [
53226
54280
  {
53227
54281
  inputs: [
53228
54282
  {
53229
- internalType: "uint64",
53230
- name: "requestId",
53231
- type: "uint64"
54283
+ internalType: "uint256",
54284
+ name: "groupId",
54285
+ type: "uint256"
53232
54286
  }
53233
54287
  ],
53234
- name: "isZKPRequestEnabled",
54288
+ name: "groupIdExists",
53235
54289
  outputs: [
53236
54290
  {
53237
54291
  internalType: "bool",
@@ -53244,27 +54298,23 @@ var abi$2 = [
53244
54298
  },
53245
54299
  {
53246
54300
  inputs: [
53247
- ],
53248
- name: "owner",
53249
- outputs: [
53250
54301
  {
53251
54302
  internalType: "address",
53252
- name: "",
54303
+ name: "sender",
53253
54304
  type: "address"
54305
+ },
54306
+ {
54307
+ internalType: "uint256",
54308
+ name: "requestId",
54309
+ type: "uint256"
53254
54310
  }
53255
54311
  ],
53256
- stateMutability: "view",
53257
- type: "function"
53258
- },
53259
- {
53260
- inputs: [
53261
- ],
53262
- name: "pendingOwner",
54312
+ name: "isRequestProofVerified",
53263
54313
  outputs: [
53264
54314
  {
53265
- internalType: "address",
54315
+ internalType: "bool",
53266
54316
  name: "",
53267
- type: "address"
54317
+ type: "bool"
53268
54318
  }
53269
54319
  ],
53270
54320
  stateMutability: "view",
@@ -53273,32 +54323,28 @@ var abi$2 = [
53273
54323
  {
53274
54324
  inputs: [
53275
54325
  {
53276
- internalType: "contract ICircuitValidator",
53277
- name: "validator",
53278
- type: "address"
54326
+ internalType: "uint256",
54327
+ name: "multiRequestId",
54328
+ type: "uint256"
53279
54329
  }
53280
54330
  ],
53281
- name: "removeValidatorFromWhitelist",
53282
- outputs: [
53283
- ],
53284
- stateMutability: "nonpayable",
53285
- type: "function"
53286
- },
53287
- {
53288
- inputs: [
53289
- ],
53290
- name: "renounceOwnership",
54331
+ name: "multiRequestIdExists",
53291
54332
  outputs: [
54333
+ {
54334
+ internalType: "bool",
54335
+ name: "",
54336
+ type: "bool"
54337
+ }
53292
54338
  ],
53293
- stateMutability: "nonpayable",
54339
+ stateMutability: "view",
53294
54340
  type: "function"
53295
54341
  },
53296
54342
  {
53297
54343
  inputs: [
53298
54344
  {
53299
- internalType: "uint64",
54345
+ internalType: "uint256",
53300
54346
  name: "requestId",
53301
- type: "uint64"
54347
+ type: "uint256"
53302
54348
  }
53303
54349
  ],
53304
54350
  name: "requestIdExists",
@@ -53314,54 +54360,30 @@ var abi$2 = [
53314
54360
  },
53315
54361
  {
53316
54362
  inputs: [
53317
- {
53318
- internalType: "uint64",
53319
- name: "requestId",
53320
- type: "uint64"
53321
- },
53322
- {
53323
- internalType: "address",
53324
- name: "requestOwner",
53325
- type: "address"
53326
- }
53327
- ],
53328
- name: "setRequestOwner",
53329
- outputs: [
53330
- ],
53331
- stateMutability: "nonpayable",
53332
- type: "function"
53333
- },
53334
- {
53335
- inputs: [
53336
- {
53337
- internalType: "uint64",
53338
- name: "requestId",
53339
- type: "uint64"
53340
- },
53341
54363
  {
53342
54364
  components: [
53343
54365
  {
53344
54366
  internalType: "string",
53345
- name: "metadata",
54367
+ name: "authMethod",
53346
54368
  type: "string"
53347
54369
  },
53348
54370
  {
53349
- internalType: "contract ICircuitValidator",
54371
+ internalType: "contract IAuthValidator",
53350
54372
  name: "validator",
53351
54373
  type: "address"
53352
54374
  },
53353
54375
  {
53354
54376
  internalType: "bytes",
53355
- name: "data",
54377
+ name: "params",
53356
54378
  type: "bytes"
53357
54379
  }
53358
54380
  ],
53359
- internalType: "struct IZKPVerifier.ZKPRequest",
53360
- name: "request",
54381
+ internalType: "struct IVerifier.AuthMethod",
54382
+ name: "authMethod",
53361
54383
  type: "tuple"
53362
54384
  }
53363
54385
  ],
53364
- name: "setZKPRequest",
54386
+ name: "setAuthMethod",
53365
54387
  outputs: [
53366
54388
  ],
53367
54389
  stateMutability: "nonpayable",
@@ -53370,32 +54392,34 @@ var abi$2 = [
53370
54392
  {
53371
54393
  inputs: [
53372
54394
  {
53373
- internalType: "uint64",
53374
- name: "requestId",
53375
- type: "uint64"
53376
- },
53377
- {
53378
- internalType: "uint256[]",
53379
- name: "inputs",
53380
- type: "uint256[]"
53381
- },
53382
- {
53383
- internalType: "uint256[2]",
53384
- name: "a",
53385
- type: "uint256[2]"
53386
- },
53387
- {
53388
- internalType: "uint256[2][2]",
53389
- name: "b",
53390
- type: "uint256[2][2]"
53391
- },
53392
- {
53393
- internalType: "uint256[2]",
53394
- name: "c",
53395
- type: "uint256[2]"
54395
+ components: [
54396
+ {
54397
+ internalType: "uint256",
54398
+ name: "multiRequestId",
54399
+ type: "uint256"
54400
+ },
54401
+ {
54402
+ internalType: "uint256[]",
54403
+ name: "requestIds",
54404
+ type: "uint256[]"
54405
+ },
54406
+ {
54407
+ internalType: "uint256[]",
54408
+ name: "groupIds",
54409
+ type: "uint256[]"
54410
+ },
54411
+ {
54412
+ internalType: "bytes",
54413
+ name: "metadata",
54414
+ type: "bytes"
54415
+ }
54416
+ ],
54417
+ internalType: "struct IVerifier.MultiRequest",
54418
+ name: "multiRequest",
54419
+ type: "tuple"
53396
54420
  }
53397
54421
  ],
53398
- name: "submitZKPResponse",
54422
+ name: "setMultiRequest",
53399
54423
  outputs: [
53400
54424
  ],
53401
54425
  stateMutability: "nonpayable",
@@ -53406,46 +54430,37 @@ var abi$2 = [
53406
54430
  {
53407
54431
  components: [
53408
54432
  {
53409
- internalType: "uint64",
54433
+ internalType: "uint256",
53410
54434
  name: "requestId",
53411
- type: "uint64"
54435
+ type: "uint256"
53412
54436
  },
53413
54437
  {
53414
- internalType: "bytes",
53415
- name: "zkProof",
53416
- type: "bytes"
54438
+ internalType: "string",
54439
+ name: "metadata",
54440
+ type: "string"
54441
+ },
54442
+ {
54443
+ internalType: "contract IRequestValidator",
54444
+ name: "validator",
54445
+ type: "address"
53417
54446
  },
53418
54447
  {
53419
54448
  internalType: "bytes",
53420
- name: "data",
54449
+ name: "params",
53421
54450
  type: "bytes"
54451
+ },
54452
+ {
54453
+ internalType: "address",
54454
+ name: "owner",
54455
+ type: "address"
53422
54456
  }
53423
54457
  ],
53424
- internalType: "struct ZKPResponse[]",
53425
- name: "responses",
54458
+ internalType: "struct IVerifier.Request[]",
54459
+ name: "requests",
53426
54460
  type: "tuple[]"
53427
- },
53428
- {
53429
- internalType: "bytes",
53430
- name: "crossChainProof",
53431
- type: "bytes"
53432
- }
53433
- ],
53434
- name: "submitZKPResponseV2",
53435
- outputs: [
53436
- ],
53437
- stateMutability: "nonpayable",
53438
- type: "function"
53439
- },
53440
- {
53441
- inputs: [
53442
- {
53443
- internalType: "address",
53444
- name: "newOwner",
53445
- type: "address"
53446
54461
  }
53447
54462
  ],
53448
- name: "transferOwnership",
54463
+ name: "setRequests",
53449
54464
  outputs: [
53450
54465
  ],
53451
54466
  stateMutability: "nonpayable",
@@ -53453,91 +54468,55 @@ var abi$2 = [
53453
54468
  },
53454
54469
  {
53455
54470
  inputs: [
53456
- {
53457
- internalType: "address",
53458
- name: "sender",
53459
- type: "address"
53460
- },
53461
- {
53462
- internalType: "uint64[]",
53463
- name: "requestIds",
53464
- type: "uint64[]"
53465
- }
53466
- ],
53467
- name: "verifyLinkedProofs",
53468
- outputs: [
53469
- ],
53470
- stateMutability: "view",
53471
- type: "function"
53472
- },
53473
- {
53474
- inputs: [
53475
- {
53476
- internalType: "uint64",
53477
- name: "requestId",
53478
- type: "uint64"
53479
- },
53480
- {
53481
- internalType: "uint256[]",
53482
- name: "inputs",
53483
- type: "uint256[]"
53484
- },
53485
- {
53486
- internalType: "uint256[2]",
53487
- name: "a",
53488
- type: "uint256[2]"
53489
- },
53490
- {
53491
- internalType: "uint256[2][2]",
53492
- name: "b",
53493
- type: "uint256[2][2]"
53494
- },
53495
- {
53496
- internalType: "uint256[2]",
53497
- name: "c",
53498
- type: "uint256[2]"
53499
- },
53500
- {
53501
- internalType: "address",
53502
- name: "sender",
53503
- type: "address"
53504
- }
53505
- ],
53506
- name: "verifyZKPResponse",
53507
- outputs: [
53508
54471
  {
53509
54472
  components: [
53510
54473
  {
53511
54474
  internalType: "string",
53512
- name: "key",
54475
+ name: "authMethod",
53513
54476
  type: "string"
53514
54477
  },
54478
+ {
54479
+ internalType: "bytes",
54480
+ name: "proof",
54481
+ type: "bytes"
54482
+ }
54483
+ ],
54484
+ internalType: "struct IVerifier.AuthResponse",
54485
+ name: "authResponse",
54486
+ type: "tuple"
54487
+ },
54488
+ {
54489
+ components: [
53515
54490
  {
53516
54491
  internalType: "uint256",
53517
- name: "inputValue",
54492
+ name: "requestId",
53518
54493
  type: "uint256"
54494
+ },
54495
+ {
54496
+ internalType: "bytes",
54497
+ name: "proof",
54498
+ type: "bytes"
54499
+ },
54500
+ {
54501
+ internalType: "bytes",
54502
+ name: "metadata",
54503
+ type: "bytes"
53519
54504
  }
53520
54505
  ],
53521
- internalType: "struct ICircuitValidator.KeyToInputValue[]",
53522
- name: "",
54506
+ internalType: "struct IVerifier.Response[]",
54507
+ name: "responses",
53523
54508
  type: "tuple[]"
53524
- }
53525
- ],
53526
- stateMutability: "nonpayable",
53527
- type: "function"
53528
- },
53529
- {
53530
- inputs: [
53531
- ],
53532
- name: "version",
53533
- outputs: [
54509
+ },
53534
54510
  {
53535
- internalType: "string",
53536
- name: "",
53537
- type: "string"
54511
+ internalType: "bytes",
54512
+ name: "crossChainProofs",
54513
+ type: "bytes"
53538
54514
  }
53539
54515
  ],
53540
- stateMutability: "pure",
54516
+ name: "submitResponse",
54517
+ outputs: [
54518
+ ],
54519
+ stateMutability: "nonpayable",
53541
54520
  type: "function"
53542
54521
  }
53543
54522
  ];
@@ -53556,6 +54535,8 @@ var FunctionSignatures;
53556
54535
  FunctionSignatures["SubmitZKPResponseV1"] = "b68967e2";
53557
54536
  //function submitZKPResponseV2(tuple[](uint64 requestId,bytes zkProof,bytes data),bytes crossChainProof)
53558
54537
  FunctionSignatures["SubmitZKPResponseV2"] = "ade09fcd";
54538
+ //function submitResponse(tuple(string authMethod,bytes proof),tuple(uint256 requestId,bytes proof,bytes metadata)[],bytes crossChainProof)
54539
+ FunctionSignatures["SubmitResponse"] = "06c86a91";
53559
54540
  })(FunctionSignatures || (FunctionSignatures = {}));
53560
54541
  /**
53561
54542
  * OnChainZKPVerifier is a class that allows to interact with the OnChainZKPVerifier contract
@@ -53581,16 +54562,8 @@ class OnChainZKPVerifier {
53581
54562
  }
53582
54563
  const requestID = zkProofResponse.id;
53583
54564
  const inputs = zkProofResponse.pub_signals;
53584
- const payload = [
53585
- requestID,
53586
- inputs,
53587
- zkProofResponse.proof.pi_a.slice(0, 2),
53588
- [
53589
- [zkProofResponse.proof.pi_b[0][1], zkProofResponse.proof.pi_b[0][0]],
53590
- [zkProofResponse.proof.pi_b[1][1], zkProofResponse.proof.pi_b[1][0]]
53591
- ],
53592
- zkProofResponse.proof.pi_c.slice(0, 2)
53593
- ];
54565
+ const preparedZkpProof = prepareZkpProof(zkProofResponse.proof);
54566
+ const payload = [requestID, inputs, preparedZkpProof.a, preparedZkpProof.b, preparedZkpProof.c];
53594
54567
  return payload;
53595
54568
  }
53596
54569
  /**
@@ -53688,6 +54661,80 @@ class OnChainZKPVerifier {
53688
54661
  const { txnHash } = await transactionService.sendTransactionRequest(ethSigner, request);
53689
54662
  return new Map().set(txnHash, zkProofResponses);
53690
54663
  }
54664
+ /**
54665
+ * {@inheritDoc IOnChainVerifierMultiQuery.submitResponse}
54666
+ */
54667
+ async submitResponse(ethSigner, txData, authResponse, responses) {
54668
+ const chainConfig = this._configs.find((i) => i.chainId == txData.chain_id);
54669
+ if (!chainConfig) {
54670
+ throw new Error(`config for chain id ${txData.chain_id} was not found`);
54671
+ }
54672
+ if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitResponse) {
54673
+ throw new Error(`submitResponse function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitResponse}' is supported.`);
54674
+ }
54675
+ if (!this._opts?.didResolverUrl) {
54676
+ throw new Error(`did resolver url required for crosschain verification`);
54677
+ }
54678
+ const provider = new JsonRpcProvider(chainConfig.url, chainConfig.chainId);
54679
+ ethSigner = ethSigner.connect(provider);
54680
+ const txDataArgs = await this.prepareTxArgsSubmit(txData, authResponse, responses);
54681
+ const feeData = await provider.getFeeData();
54682
+ const maxFeePerGas = chainConfig.maxFeePerGas
54683
+ ? BigInt(chainConfig.maxFeePerGas)
54684
+ : feeData.maxFeePerGas;
54685
+ const maxPriorityFeePerGas = chainConfig.maxPriorityFeePerGas
54686
+ ? BigInt(chainConfig.maxPriorityFeePerGas)
54687
+ : feeData.maxPriorityFeePerGas;
54688
+ const verifierContract = new Contract(txData.contract_address, IVerifierABI);
54689
+ const txRequestData = await verifierContract.submitResponse.populateTransaction(...txDataArgs);
54690
+ const request = {
54691
+ to: txData.contract_address,
54692
+ data: txRequestData.data,
54693
+ maxFeePerGas,
54694
+ maxPriorityFeePerGas
54695
+ };
54696
+ let gasLimit;
54697
+ try {
54698
+ gasLimit = await ethSigner.estimateGas(request);
54699
+ }
54700
+ catch (e) {
54701
+ gasLimit = maxGasLimit;
54702
+ }
54703
+ request.gasLimit = gasLimit;
54704
+ const transactionService = new TransactionService(provider);
54705
+ const { txnHash } = await transactionService.sendTransactionRequest(ethSigner, request);
54706
+ // return multiple responses for all the responses (single and grouped)
54707
+ return new Map().set(txnHash, {
54708
+ responses: responses,
54709
+ authProofs: [authResponse],
54710
+ crossChainProofs: [txDataArgs[2]]
54711
+ });
54712
+ }
54713
+ static async prepareTxArgsSubmit(resolverUrl, txData, authResponse, responses) {
54714
+ if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitResponse) {
54715
+ throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitResponse}' is supported.`);
54716
+ }
54717
+ const gistUpdateArr = [];
54718
+ const stateUpdateArr = [];
54719
+ const payloadResponses = [];
54720
+ // Process all the responses
54721
+ for (const zkProof of responses) {
54722
+ const { requestID, zkProofEncoded, metadata } = await this._processProof(zkProof);
54723
+ payloadResponses.push({
54724
+ requestId: requestID,
54725
+ proof: zkProofEncoded,
54726
+ metadata: metadata
54727
+ });
54728
+ }
54729
+ const crossChainProofs = this.packCrossChainProofs(gistUpdateArr, stateUpdateArr);
54730
+ return [authResponse, payloadResponses, crossChainProofs];
54731
+ }
54732
+ async prepareTxArgsSubmit(txData, authResponse, responses) {
54733
+ if (!this._opts?.didResolverUrl) {
54734
+ throw new Error(`did resolver url required for crosschain verification`);
54735
+ }
54736
+ return OnChainZKPVerifier.prepareTxArgsSubmit(this._opts.didResolverUrl, txData, authResponse, responses);
54737
+ }
53691
54738
  static getCrossChainResolvers(source, txDataChainId, type, didResolverUrl) {
53692
54739
  return [
53693
54740
  ...new Set(source.map((info) => JSON.stringify({
@@ -53729,10 +54776,8 @@ class OnChainZKPVerifier {
53729
54776
  });
53730
54777
  continue;
53731
54778
  }
53732
- const zkProofEncoded = this.packZkpProof(inputs, zkProof.proof.pi_a.slice(0, 2), [
53733
- [zkProof.proof.pi_b[0][1], zkProof.proof.pi_b[0][0]],
53734
- [zkProof.proof.pi_b[1][1], zkProof.proof.pi_b[1][0]]
53735
- ], zkProof.proof.pi_c.slice(0, 2));
54779
+ const preparedZkpProof = prepareZkpProof(zkProof.proof);
54780
+ const zkProofEncoded = packZkpProof(inputs, preparedZkpProof.a, preparedZkpProof.b, preparedZkpProof.c);
53736
54781
  const stateInfo = this.getOnChainGistRootStatePubSignals(proofCircuitId, inputs);
53737
54782
  const chainId = txData.chain_id;
53738
54783
  const gistUpdateResolutions = this.getCrossChainResolvers(stateInfo.gists, chainId, 'gist', resolverUrl);
@@ -53775,8 +54820,30 @@ class OnChainZKPVerifier {
53775
54820
  }
53776
54821
  return OnChainZKPVerifier.prepareTxArgsSubmitV2(this._opts.didResolverUrl, txData, zkProofResponses);
53777
54822
  }
53778
- static packZkpProof(inputs, a, b, c) {
53779
- return new AbiCoder().encode(['uint256[] inputs', 'uint256[2]', 'uint256[2][2]', 'uint256[2]'], [inputs, a, b, c]);
54823
+ static async _processProof(zkProof) {
54824
+ const requestID = zkProof.id;
54825
+ const inputs = zkProof.pub_signals;
54826
+ if (!this._supportedCircuits.includes(zkProof.circuitId)) {
54827
+ throw new Error(`Circuit ${zkProof.circuitId} not supported by OnChainZKPVerifier`);
54828
+ }
54829
+ const preparedZkpProof = prepareZkpProof(zkProof.proof);
54830
+ const zkProofEncoded = packZkpProof(inputs, preparedZkpProof.a, preparedZkpProof.b, preparedZkpProof.c);
54831
+ const metadataArr = [];
54832
+ if (zkProof.vp) {
54833
+ for (const key in zkProof.vp.verifiableCredential.credentialSubject) {
54834
+ if (key === '@type') {
54835
+ continue;
54836
+ }
54837
+ const metadataValue = poseidon.hashBytes(byteEncoder.encode(JSON.stringify(zkProof.vp.verifiableCredential.credentialSubject[key])));
54838
+ const bytesValue = byteEncoder.encode(metadataValue.toString());
54839
+ metadataArr.push({
54840
+ key,
54841
+ value: bytesValue
54842
+ });
54843
+ }
54844
+ }
54845
+ const metadata = metadataArr.length ? this.packMetadatas(metadataArr) : '0x';
54846
+ return { requestID, zkProofEncoded, metadata };
53780
54847
  }
53781
54848
  static packCrossChainProofs(gistUpdateArr, stateUpdateArr) {
53782
54849
  const proofs = [];
@@ -58343,129 +59410,6 @@ class CredentialStatusResolverRegistry {
58343
59410
  }
58344
59411
  }
58345
59412
 
58346
- const IDEN3_PROTOCOL = 'https://iden3-communication.io/';
58347
- const DIDCOMM_PROTOCOL = 'https://didcomm.org/';
58348
- /**
58349
- * Constants for Iden3 protocol
58350
- */
58351
- const PROTOCOL_MESSAGE_TYPE = Object.freeze({
58352
- // AuthorizationV2RequestMessageType defines auth request type of the communication protocol
58353
- AUTHORIZATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}authorization/1.0/request`,
58354
- // AuthorizationResponseMessageType defines auth response type of the communication protocol
58355
- AUTHORIZATION_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}authorization/1.0/response`,
58356
- // CredentialIssuanceRequestMessageType accepts request for credential creation
58357
- CREDENTIAL_ISSUANCE_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/issuance-request`,
58358
- // CredentialFetchRequestMessageType is type for request of credential generation
58359
- CREDENTIAL_FETCH_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/fetch-request`,
58360
- // CredentialOfferMessageType is type of message with credential offering
58361
- CREDENTIAL_OFFER_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/offer`,
58362
- // CredentialIssuanceResponseMessageType is type for message with a credential issuance
58363
- CREDENTIAL_ISSUANCE_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/issuance-response`,
58364
- // CredentialRefreshMessageType is type for message with a credential issuance
58365
- CREDENTIAL_REFRESH_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/refresh`,
58366
- // DeviceRegistrationRequestMessageType defines device registration request type of the communication protocol
58367
- DEVICE_REGISTRATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}devices/1.0/registration`,
58368
- // MessageFetMessageFetchRequestMessageType defines message fetch request type of the communication protocol.
58369
- MESSAGE_FETCH_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}messages/1.0/fetch`,
58370
- // ProofGenerationRequestMessageType is type for request of proof generation
58371
- PROOF_GENERATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/request`,
58372
- // ProofGenerationResponseMessageType is type for response of proof generation
58373
- PROOF_GENERATION_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/response`,
58374
- // RevocationStatusRequestMessageType is type for request of revocation status
58375
- REVOCATION_STATUS_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}revocation/1.0/request-status`,
58376
- // RevocationStatusResponseMessageType is type for response with a revocation status
58377
- REVOCATION_STATUS_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}revocation/1.0/status`,
58378
- // ContractInvokeRequestMessageType is type for request of contract invoke request
58379
- CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/contract-invoke-request`,
58380
- // ContractInvokeResponseMessageType is type for response of contract invoke request
58381
- CONTRACT_INVOKE_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/contract-invoke-response`,
58382
- // CredentialOnchainOfferMessageType is type of message with credential onchain offering
58383
- CREDENTIAL_ONCHAIN_OFFER_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/onchain-offer`,
58384
- // ProposalRequestMessageType is type for proposal-request message
58385
- PROPOSAL_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/proposal-request`,
58386
- // ProposalMessageType is type for proposal message
58387
- PROPOSAL_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/proposal`,
58388
- // PaymentRequestMessageType is type for payment-request message
58389
- PAYMENT_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/payment-request`,
58390
- // PaymentMessageType is type for payment message
58391
- PAYMENT_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/payment`,
58392
- // DiscoveryProtocolQueriesMessageType is type for didcomm discovery protocol queries
58393
- DISCOVERY_PROTOCOL_QUERIES_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/queries`,
58394
- // DiscoveryProtocolDiscloseMessageType is type for didcomm discovery protocol disclose
58395
- DISCOVERY_PROTOCOL_DISCLOSE_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/disclose`,
58396
- // ProblemReportMessageType is type for didcomm problem report
58397
- PROBLEM_REPORT_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}report-problem/2.0/problem-report`
58398
- });
58399
- /**
58400
- * Media types for iden3 comm communication protocol
58401
- *
58402
- * @enum {number}
58403
- */
58404
- var MediaType;
58405
- (function (MediaType) {
58406
- MediaType["ZKPMessage"] = "application/iden3-zkp-json";
58407
- MediaType["PlainMessage"] = "application/iden3comm-plain-json";
58408
- MediaType["SignedMessage"] = "application/iden3comm-signed-json";
58409
- })(MediaType || (MediaType = {}));
58410
- const SUPPORTED_PUBLIC_KEY_TYPES = {
58411
- ES256K: [
58412
- 'EcdsaSecp256k1VerificationKey2019',
58413
- /**
58414
- * Equivalent to EcdsaSecp256k1VerificationKey2019 when key is an ethereumAddress
58415
- */
58416
- 'EcdsaSecp256k1RecoveryMethod2020',
58417
- 'JsonWebKey2020'
58418
- ],
58419
- 'ES256K-R': [
58420
- 'EcdsaSecp256k1VerificationKey2019',
58421
- /**
58422
- * Equivalent to EcdsaSecp256k1VerificationKey2019 when key is an ethereumAddress
58423
- */
58424
- 'EcdsaSecp256k1RecoveryMethod2020',
58425
- 'JsonWebKey2020'
58426
- ]
58427
- };
58428
- var ProtocolVersion;
58429
- (function (ProtocolVersion) {
58430
- ProtocolVersion["V1"] = "iden3comm/v1";
58431
- })(ProtocolVersion || (ProtocolVersion = {}));
58432
- var AcceptAuthCircuits;
58433
- (function (AcceptAuthCircuits) {
58434
- AcceptAuthCircuits["AuthV2"] = "authV2";
58435
- AcceptAuthCircuits["AuthV3"] = "authV3";
58436
- })(AcceptAuthCircuits || (AcceptAuthCircuits = {}));
58437
- var AcceptJwzAlgorithms;
58438
- (function (AcceptJwzAlgorithms) {
58439
- AcceptJwzAlgorithms["Groth16"] = "groth16";
58440
- })(AcceptJwzAlgorithms || (AcceptJwzAlgorithms = {}));
58441
- var AcceptJwsAlgorithms;
58442
- (function (AcceptJwsAlgorithms) {
58443
- AcceptJwsAlgorithms["ES256K"] = "ES256K";
58444
- AcceptJwsAlgorithms["ES256KR"] = "ES256K-R";
58445
- })(AcceptJwsAlgorithms || (AcceptJwsAlgorithms = {}));
58446
- const defaultAcceptProfile = {
58447
- protocolVersion: ProtocolVersion.V1,
58448
- env: MediaType.ZKPMessage,
58449
- circuits: [AcceptAuthCircuits.AuthV2],
58450
- alg: [AcceptJwzAlgorithms.Groth16]
58451
- };
58452
- const DEFAULT_PROOF_VERIFY_DELAY = 1 * 60 * 60 * 1000; // 1 hour
58453
- const DEFAULT_AUTH_VERIFY_DELAY = 5 * 60 * 1000; // 5 minutes
58454
-
58455
- var constants = /*#__PURE__*/Object.freeze({
58456
- __proto__: null,
58457
- get AcceptAuthCircuits () { return AcceptAuthCircuits; },
58458
- get AcceptJwsAlgorithms () { return AcceptJwsAlgorithms; },
58459
- get AcceptJwzAlgorithms () { return AcceptJwzAlgorithms; },
58460
- DEFAULT_AUTH_VERIFY_DELAY: DEFAULT_AUTH_VERIFY_DELAY,
58461
- DEFAULT_PROOF_VERIFY_DELAY: DEFAULT_PROOF_VERIFY_DELAY,
58462
- get MediaType () { return MediaType; },
58463
- PROTOCOL_MESSAGE_TYPE: PROTOCOL_MESSAGE_TYPE,
58464
- get ProtocolVersion () { return ProtocolVersion; },
58465
- SUPPORTED_PUBLIC_KEY_TYPES: SUPPORTED_PUBLIC_KEY_TYPES,
58466
- defaultAcceptProfile: defaultAcceptProfile
58467
- });
58468
-
58469
59413
  /**
58470
59414
  * AgentResolver is a class that allows to interact with the issuer's agent to get revocation status.
58471
59415
  *
@@ -59409,120 +60353,26 @@ class NativeProver {
59409
60353
  if (!circuitData.wasm) {
59410
60354
  throw new Error(`wasm file doesn't exist for circuit ${circuitId}`);
59411
60355
  }
59412
- const witnessCalculator = await witnessBuilder(circuitData.wasm);
59413
- const parsedData = JSON.parse(byteDecoder.decode(inputs));
59414
- const wtnsBytes = await witnessCalculator.calculateWTNSBin(parsedData, 0);
59415
- if (!circuitData.provingKey) {
59416
- throw new Error(`proving file doesn't exist for circuit ${circuitId}`);
59417
- }
59418
- const { proof, publicSignals } = await groth16.prove(circuitData.provingKey, wtnsBytes);
59419
- // we need to terminate curve manually
59420
- await this.terminateCurve();
59421
- return {
59422
- proof,
59423
- pub_signals: publicSignals
59424
- };
59425
- }
59426
- async terminateCurve() {
59427
- const curve = await getCurveFromName(NativeProver.curveName);
59428
- curve.terminate();
59429
- }
59430
- }
59431
- NativeProver.curveName = 'bn128';
59432
-
59433
- /**
59434
- * creates empty basic message
59435
- *
59436
- * @returns BasicMessage
59437
- */
59438
- const basicMessageFactory = () => {
59439
- return {
59440
- id: '',
59441
- typ: '',
59442
- thid: '',
59443
- type: '',
59444
- body: {},
59445
- from: '',
59446
- to: ''
59447
- };
59448
- };
59449
- /**
59450
- * create empty header stub
59451
- *
59452
- * @returns {HeaderStub}
59453
- */
59454
- const headerStubFactory = () => {
59455
- return {
59456
- typ: ''
59457
- };
59458
- };
59459
-
59460
- // Envelope Errors
59461
- // Token Errors
59462
- const ErrUnknownCircuitID = "unknown circuit ID. can't verify msg sender";
59463
- const ErrSenderNotUsedTokenCreation = 'sender of message is not used for jwz token creation';
59464
- // ZKP-Packer Errors
59465
- const ErrPackedWithUnsupportedCircuit = 'message was packed with unsupported circuit';
59466
- const ErrProofIsInvalid = 'message proof is invalid';
59467
- const ErrStateVerificationFailed = 'message state verification failed';
59468
- const ErrNoProvingMethodAlg = 'unknown proving method algorithm';
59469
-
59470
- const objectIs = (obj, //eslint-disable-line @typescript-eslint/no-explicit-any
59471
- targetObj //eslint-disable-line @typescript-eslint/no-explicit-any
59472
- ) => {
59473
- Object.keys(targetObj).forEach((prop) => {
59474
- if (!obj[prop]) {
59475
- return false;
59476
- }
59477
- if (typeof targetObj[prop] !== typeof obj[prop]) {
59478
- return false;
59479
- }
59480
- });
59481
- return true;
59482
- };
59483
- //eslint-disable-next-line @typescript-eslint/no-explicit-any
59484
- const isProtocolMessage = (message) => {
59485
- const basicMessage = basicMessageFactory();
59486
- Object.keys(basicMessage).forEach((prop) => {
59487
- if (!message[prop]) {
59488
- return false;
59489
- }
59490
- if (prop !== 'body') {
59491
- const res = typeof basicMessage[prop] ===
59492
- typeof message[prop]; //eslint-disable-line @typescript-eslint/no-explicit-any
59493
- if (!res) {
59494
- return false;
59495
- }
60356
+ const witnessCalculator = await witnessBuilder(circuitData.wasm);
60357
+ const parsedData = JSON.parse(byteDecoder.decode(inputs));
60358
+ const wtnsBytes = await witnessCalculator.calculateWTNSBin(parsedData, 0);
60359
+ if (!circuitData.provingKey) {
60360
+ throw new Error(`proving file doesn't exist for circuit ${circuitId}`);
59496
60361
  }
59497
- });
59498
- return true;
59499
- };
59500
- /**
59501
- * helper function to convert serialized JSON bytes to protocol message
59502
- *
59503
- * @param {Uint8Array} bytes
59504
- * @returns {BasicMessage}
59505
- */
59506
- const bytesToProtocolMessage = (bytes) => {
59507
- const str = byteDecoder.decode(bytes);
59508
- const message = JSON.parse(str);
59509
- if (!isProtocolMessage(message)) ;
59510
- return message;
59511
- };
59512
- /**
59513
- * helper function to convert serialized JSON bytes to header stub
59514
- * so we can work with know the media type of the message
59515
- *
59516
- * @param {Uint8Array} envelope
59517
- * @returns {HeaderStub}
59518
- */
59519
- const bytesToHeaderStub = (envelope) => {
59520
- const tmpObj = headerStubFactory();
59521
- const str = byteDecoder.decode(envelope);
59522
- const message = JSON.parse(str);
59523
- if (!objectIs(message, tmpObj)) ;
59524
- return message;
59525
- };
60362
+ const { proof, publicSignals } = await groth16.prove(circuitData.provingKey, wtnsBytes);
60363
+ // we need to terminate curve manually
60364
+ await this.terminateCurve();
60365
+ return {
60366
+ proof,
60367
+ pub_signals: publicSignals
60368
+ };
60369
+ }
60370
+ async terminateCurve() {
60371
+ const curve = await getCurveFromName(NativeProver.curveName);
60372
+ curve.terminate();
60373
+ }
60374
+ }
60375
+ NativeProver.curveName = 'bn128';
59526
60376
 
59527
60377
  /**
59528
60378
  * Basic package manager for iden3 communication protocol
@@ -59634,164 +60484,6 @@ class PackageManager {
59634
60484
  }
59635
60485
  }
59636
60486
 
59637
- const DIDAuthenticationSection = 'authentication';
59638
- const resolveVerificationMethods = (didDocument) => {
59639
- const vms = didDocument.verificationMethod || [];
59640
- // prioritize: first verification methods to be chosen are from `authentication` section.
59641
- const sortedVerificationMethods = (didDocument[DIDAuthenticationSection] || [])
59642
- .map((verificationMethod) => {
59643
- if (typeof verificationMethod === 'string') {
59644
- return vms.find((i) => i.id === verificationMethod);
59645
- }
59646
- return verificationMethod;
59647
- })
59648
- .filter((key) => key);
59649
- // add all other verification methods
59650
- for (let index = 0; index < vms.length; index++) {
59651
- const id = vms[index].id;
59652
- if (sortedVerificationMethods.findIndex((vm) => vm.id === id) === -1) {
59653
- sortedVerificationMethods.push(vms[index]);
59654
- }
59655
- }
59656
- return sortedVerificationMethods;
59657
- };
59658
- const extractPublicKeyBytes = (vm) => {
59659
- const isSupportedVmType = Object.keys(SUPPORTED_PUBLIC_KEY_TYPES).some((key) => SUPPORTED_PUBLIC_KEY_TYPES[key].includes(vm.type));
59660
- if (vm.publicKeyBase58 && isSupportedVmType) {
59661
- return { publicKeyBytes: base58ToBytes$1(vm.publicKeyBase58), kmsKeyType: KmsKeyType.Secp256k1 };
59662
- }
59663
- if (vm.publicKeyBase64 && isSupportedVmType) {
59664
- return {
59665
- publicKeyBytes: base64UrlToBytes(vm.publicKeyBase64),
59666
- kmsKeyType: KmsKeyType.Secp256k1
59667
- };
59668
- }
59669
- if (vm.publicKeyHex && isSupportedVmType) {
59670
- return { publicKeyBytes: hexToBytes$3(vm.publicKeyHex), kmsKeyType: KmsKeyType.Secp256k1 };
59671
- }
59672
- if (vm.publicKeyJwk &&
59673
- vm.publicKeyJwk.crv === 'secp256k1' &&
59674
- vm.publicKeyJwk.x &&
59675
- vm.publicKeyJwk.y) {
59676
- const [xHex, yHex] = [
59677
- base64UrlToBytes(vm.publicKeyJwk.x),
59678
- base64UrlToBytes(vm.publicKeyJwk.y)
59679
- ].map(bytesToHex$3);
59680
- const x = xHex.includes('0x') ? BigInt(xHex) : BigInt(`0x${xHex}`);
59681
- const y = yHex.includes('0x') ? BigInt(yHex) : BigInt(`0x${yHex}`);
59682
- return {
59683
- publicKeyBytes: secp256k1$1.ProjectivePoint.fromAffine({
59684
- x,
59685
- y
59686
- }).toRawBytes(false),
59687
- kmsKeyType: KmsKeyType.Secp256k1
59688
- };
59689
- }
59690
- return { publicKeyBytes: null };
59691
- };
59692
-
59693
- function isProtocolVersion(value) {
59694
- return Object.values(ProtocolVersion).includes(value);
59695
- }
59696
- function isMediaType(value) {
59697
- return Object.values(MediaType).includes(value);
59698
- }
59699
- function isAcceptAuthCircuits(value) {
59700
- return Object.values(AcceptAuthCircuits).includes(value);
59701
- }
59702
- function isAcceptJwsAlgorithms(value) {
59703
- return Object.values(AcceptJwsAlgorithms).includes(value);
59704
- }
59705
- function isAcceptJwzAlgorithms(value) {
59706
- return Object.values(AcceptJwzAlgorithms).includes(value);
59707
- }
59708
- const buildAccept = (profiles) => {
59709
- const result = [];
59710
- for (const profile of profiles) {
59711
- let accept = `${profile.protocolVersion};env=${profile.env}`;
59712
- if (profile.circuits?.length) {
59713
- accept += `;circuitId=${profile.circuits.join(',')}`;
59714
- }
59715
- if (profile.alg?.length) {
59716
- accept += `;alg=${profile.alg.join(',')}`;
59717
- }
59718
- result.push(accept);
59719
- }
59720
- return result;
59721
- };
59722
- const parseAcceptProfile = (profile) => {
59723
- const params = profile.split(';');
59724
- if (params.length < 2) {
59725
- throw new Error('Invalid accept profile');
59726
- }
59727
- const protocolVersion = params[0].trim();
59728
- if (!isProtocolVersion(protocolVersion)) {
59729
- throw new Error(`Protocol version '${protocolVersion}' not supported`);
59730
- }
59731
- const envParam = params[1].split('=');
59732
- if (envParam.length !== 2) {
59733
- throw new Error(`Invalid accept profile 'env' parameter`);
59734
- }
59735
- const env = params[1].split('=')[1].trim();
59736
- if (!isMediaType(env)) {
59737
- throw new Error(`Envelop '${env}' not supported`);
59738
- }
59739
- const circuitsIndex = params.findIndex((i) => i.includes('circuitId='));
59740
- if (env !== MediaType.ZKPMessage && circuitsIndex > 0) {
59741
- throw new Error(`Circuits not supported for env '${env}'`);
59742
- }
59743
- let circuits = undefined;
59744
- if (circuitsIndex > 0) {
59745
- circuits = params[circuitsIndex]
59746
- .split('=')[1]
59747
- .split(',')
59748
- .map((i) => i.trim())
59749
- .map((i) => {
59750
- if (!isAcceptAuthCircuits(i)) {
59751
- throw new Error(`Circuit '${i}' not supported`);
59752
- }
59753
- return i;
59754
- });
59755
- }
59756
- const algIndex = params.findIndex((i) => i.includes('alg='));
59757
- let alg = undefined;
59758
- if (algIndex > 0) {
59759
- if (env === MediaType.ZKPMessage) {
59760
- alg = params[algIndex]
59761
- .split('=')[1]
59762
- .split(',')
59763
- .map((i) => {
59764
- i = i.trim();
59765
- if (!isAcceptJwzAlgorithms(i)) {
59766
- throw new Error(`Algorithm '${i}' not supported for '${env}'`);
59767
- }
59768
- return i;
59769
- });
59770
- }
59771
- else if (env === MediaType.SignedMessage) {
59772
- alg = params[algIndex]
59773
- .split('=')[1]
59774
- .split(',')
59775
- .map((i) => {
59776
- i = i.trim();
59777
- if (!isAcceptJwsAlgorithms(i)) {
59778
- throw new Error(`Algorithm '${i}' not supported for '${env}'`);
59779
- }
59780
- return i;
59781
- });
59782
- }
59783
- else {
59784
- throw new Error(`Algorithm not supported for '${env}'`);
59785
- }
59786
- }
59787
- return {
59788
- protocolVersion,
59789
- env,
59790
- circuits,
59791
- alg
59792
- };
59793
- };
59794
-
59795
60487
  const { getProvingMethod } = proving;
59796
60488
  /**
59797
60489
  * Handler to
@@ -60218,6 +60910,12 @@ var CredentialOfferStatus;
60218
60910
  CredentialOfferStatus["Rejected"] = "rejected";
60219
60911
  })(CredentialOfferStatus || (CredentialOfferStatus = {}));
60220
60912
 
60913
+ var AuthMethod;
60914
+ (function (AuthMethod) {
60915
+ AuthMethod["AUTHV2"] = "authV2";
60916
+ AuthMethod["ETH_IDENTITY"] = "ethIdentity";
60917
+ })(AuthMethod || (AuthMethod = {}));
60918
+
60221
60919
  /** @beta DiscoverFeatureQueryType is enum for query type fields */
60222
60920
  var DiscoverFeatureQueryType;
60223
60921
  (function (DiscoverFeatureQueryType) {
@@ -60311,6 +61009,59 @@ const processZeroKnowledgeProofRequests = async (to, requests, from, proofServic
60311
61009
  }
60312
61010
  return zkpResponses;
60313
61011
  };
61012
+ /**
61013
+ * Processes auth proof requests.
61014
+ *
61015
+ * @param to - The identifier of the recipient.
61016
+ * @param proofService - The proof service.
61017
+ * @param opts - Additional options for processing the requests.
61018
+ * @returns A promise that resolves to an auth proof response.
61019
+ */
61020
+ const processProofAuth = async (to, proofService, opts) => {
61021
+ if (!opts.acceptProfile) {
61022
+ opts.acceptProfile = defaultAcceptProfile;
61023
+ }
61024
+ if (!opts.skipRevocation) {
61025
+ opts.skipRevocation = true;
61026
+ }
61027
+ switch (opts.acceptProfile.env) {
61028
+ case MediaType.ZKPMessage:
61029
+ if (!opts.acceptProfile.circuits) {
61030
+ throw new Error('Circuit not specified in accept profile');
61031
+ }
61032
+ for (const circuitId of opts.acceptProfile.circuits) {
61033
+ if (!opts.supportedCircuits.includes(circuitId)) {
61034
+ throw new Error(`Circuit ${circuitId} is not supported`);
61035
+ }
61036
+ const zkpRes = await proofService.generateAuthProof(circuitId, to, { challenge: opts.challenge, skipRevocation: opts.skipRevocation });
61037
+ switch (circuitId) {
61038
+ case CircuitId.AuthV2: {
61039
+ const preparedZkpProof = prepareZkpProof(zkpRes.proof);
61040
+ const zkProofEncoded = packZkpProof(zkpRes.pub_signals, preparedZkpProof.a, preparedZkpProof.b, preparedZkpProof.c);
61041
+ return {
61042
+ authMethod: AuthMethod.AUTHV2,
61043
+ proof: zkProofEncoded
61044
+ };
61045
+ }
61046
+ }
61047
+ }
61048
+ throw new Error(`Auth method is not supported`);
61049
+ case MediaType.SignedMessage:
61050
+ if (!opts.acceptProfile.alg || opts.acceptProfile.alg.length === 0) {
61051
+ throw new Error('Algorithm not specified');
61052
+ }
61053
+ if (opts.acceptProfile.alg[0] === AcceptJwsAlgorithms.ES256KR) {
61054
+ const ethIdProof = packEthIdentityProof(to);
61055
+ return {
61056
+ authMethod: AuthMethod.ETH_IDENTITY,
61057
+ proof: ethIdProof
61058
+ };
61059
+ }
61060
+ throw new Error(`Algorithm ${opts.acceptProfile.alg[0]} not supported`);
61061
+ default:
61062
+ throw new Error('Accept env not supported');
61063
+ }
61064
+ };
60314
61065
  /**
60315
61066
  * Verifies that the expires_time field of a message is not in the past. Throws an error if it is.
60316
61067
  *
@@ -60321,6 +61072,9 @@ const verifyExpiresTime = (message) => {
60321
61072
  throw new Error('Message expired');
60322
61073
  }
60323
61074
  };
61075
+ const packEthIdentityProof = (did) => {
61076
+ return `0x${bytesToHex$3(BytesHelper.intToBytes(DID.idFromDID(did).bigInt()))}`;
61077
+ };
60324
61078
 
60325
61079
  /**
60326
61080
  * Base implementation of protocol message handler
@@ -60953,6 +61707,7 @@ class ContractRequestHandler extends AbstractMessageHandler {
60953
61707
  * @param {IPackageManager} _packerMgr - package manager to unpack message envelope
60954
61708
  * @param {IProofService} _proofService - proof service to verify zk proofs
60955
61709
  * @param {IOnChainZKPVerifier} _zkpVerifier - zkp verifier to submit response
61710
+ * @param {IOnChainVerifierMultiQuery} _verifierMultiQuery - verifier multi-query to submit response
60956
61711
  *
60957
61712
  */
60958
61713
  constructor(_packerMgr, _proofService, _zkpVerifier) {
@@ -60964,7 +61719,12 @@ class ContractRequestHandler extends AbstractMessageHandler {
60964
61719
  CircuitId.AuthV2,
60965
61720
  CircuitId.AtomicQueryMTPV2OnChain,
60966
61721
  CircuitId.AtomicQuerySigV2OnChain,
60967
- CircuitId.AtomicQueryV3OnChain
61722
+ CircuitId.AtomicQueryV3OnChain,
61723
+ // Now we support off-chain circuits on-chain
61724
+ // TODO: We need to create validators for them
61725
+ CircuitId.AuthV2,
61726
+ CircuitId.AtomicQueryV3,
61727
+ CircuitId.LinkedMultiQuery10
60968
61728
  ];
60969
61729
  }
60970
61730
  async handle(message, ctx) {
@@ -61000,19 +61760,64 @@ class ContractRequestHandler extends AbstractMessageHandler {
61000
61760
  });
61001
61761
  const methodId = message.body.transaction_data.method_id.replace('0x', '');
61002
61762
  switch (methodId) {
61003
- case FunctionSignatures.SubmitZKPResponseV2:
61004
- return this._zkpVerifier.submitZKPResponseV2(ethSigner, message.body.transaction_data, zkpResponses);
61763
+ case FunctionSignatures.SubmitZKPResponseV2: {
61764
+ const txHashZkpResponsesMap = await this._zkpVerifier.submitZKPResponseV2(ethSigner, message.body.transaction_data, zkpResponses);
61765
+ const response = new Map();
61766
+ for (const [txHash, zkpResponses] of txHashZkpResponsesMap) {
61767
+ response.set(txHash, { responses: zkpResponses });
61768
+ }
61769
+ return response;
61770
+ }
61005
61771
  case FunctionSignatures.SubmitZKPResponseV1: {
61006
61772
  const txHashZkpResponseMap = await this._zkpVerifier.submitZKPResponse(ethSigner, message.body.transaction_data, zkpResponses);
61007
61773
  const response = new Map();
61008
61774
  for (const [txHash, zkpResponse] of txHashZkpResponseMap) {
61009
- response.set(txHash, [zkpResponse]);
61775
+ response.set(txHash, { responses: [zkpResponse] });
61010
61776
  }
61011
61777
  return response;
61012
61778
  }
61779
+ case FunctionSignatures.SubmitResponse: {
61780
+ // We need to
61781
+ // 1. Generate auth proof from message.body.accept -> authResponse
61782
+ // 2. Generate proofs for each query in scope -> zkpResponses
61783
+ // Build auth response from accept
61784
+ if (!message.to) {
61785
+ throw new Error(`failed message. empty 'to' field`);
61786
+ }
61787
+ // Get first supported accept profile and pass it to processProofAuth
61788
+ const acceptProfile = this.getFirstSupportedProfile(PROTOCOL_MESSAGE_TYPE.CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE, message.body.accept);
61789
+ const identifier = DID.parse(message.to);
61790
+ const authResponse = await processProofAuth(identifier, this._proofService, {
61791
+ supportedCircuits: this._supportedCircuits,
61792
+ acceptProfile,
61793
+ challenge: challenge,
61794
+ skipRevocation: true
61795
+ });
61796
+ return this._zkpVerifier.submitResponse(ethSigner, message.body.transaction_data, authResponse, zkpResponses);
61797
+ }
61013
61798
  default:
61014
- throw new Error(`Not supported method id. Only '${FunctionSignatures.SubmitZKPResponseV1} and ${FunctionSignatures.SubmitZKPResponseV2} are supported.'`);
61799
+ throw new Error(`Not supported method id. Only '${FunctionSignatures.SubmitZKPResponseV1}, ${FunctionSignatures.SubmitZKPResponseV2} and ${FunctionSignatures.SubmitResponse} are supported.'`);
61800
+ }
61801
+ }
61802
+ getFirstSupportedProfile(responseType, profile) {
61803
+ if (profile?.length) {
61804
+ for (const acceptProfileString of profile) {
61805
+ // 1. check protocol version
61806
+ const acceptProfile = parseAcceptProfile(acceptProfileString);
61807
+ const responseTypeVersion = Number(responseType.split('/').at(-2));
61808
+ if (acceptProfile.protocolVersion !== ProtocolVersion.V1 ||
61809
+ (acceptProfile.protocolVersion === ProtocolVersion.V1 &&
61810
+ (responseTypeVersion < 1 || responseTypeVersion >= 2))) {
61811
+ continue;
61812
+ }
61813
+ // 2. check packer support
61814
+ if (this._packerMgr.isProfileSupported(acceptProfile.env, acceptProfileString)) {
61815
+ return acceptProfile;
61816
+ }
61817
+ }
61015
61818
  }
61819
+ // if we don't have supported profiles, we use default
61820
+ return defaultAcceptProfile;
61016
61821
  }
61017
61822
  /**
61018
61823
  * unpacks contract-invoke request
@@ -61034,7 +61839,7 @@ class ContractRequestHandler extends AbstractMessageHandler {
61034
61839
  * @private
61035
61840
  * @beta
61036
61841
  * @param {ContractInvokeRequest} request - ContractInvokeRequest
61037
- * @param { Map<string, ZeroKnowledgeProofResponse[]>} responses - map tx hash to array of ZeroKnowledgeProofResponses
61842
+ * @param { Map<string, ZeroKnowledgeInvokeResponse>} responses - map tx hash to array of ZeroKnowledgeInvokeResponse
61038
61843
  * @returns `Promise<ContractInvokeResponse>`
61039
61844
  */
61040
61845
  async createContractInvokeResponse(request, txHashToZkpResponseMap) {
@@ -61051,12 +61856,17 @@ class ContractRequestHandler extends AbstractMessageHandler {
61051
61856
  created_time: getUnixTimestamp(new Date())
61052
61857
  };
61053
61858
  for (const [txHash, zkpResponses] of txHashToZkpResponseMap) {
61054
- for (const zkpResponse of zkpResponses) {
61859
+ for (const zkpResponse of zkpResponses.responses) {
61055
61860
  contractInvokeResponse.body.scope.push({
61056
61861
  txHash,
61057
61862
  ...zkpResponse
61058
61863
  });
61059
61864
  }
61865
+ contractInvokeResponse.body = {
61866
+ ...contractInvokeResponse.body,
61867
+ crossChainProofs: zkpResponses.crossChainProofs ?? [],
61868
+ authProofs: zkpResponses.authProofs ?? []
61869
+ };
61060
61870
  }
61061
61871
  return contractInvokeResponse;
61062
61872
  }
@@ -63281,6 +64091,32 @@ class ProofService {
63281
64091
  pub_signals
63282
64092
  };
63283
64093
  }
64094
+ /** {@inheritdoc IProofService.generateAuthProof} */
64095
+ async generateAuthProof(circuitId, identifier, opts) {
64096
+ if (!opts) {
64097
+ opts = {
64098
+ skipRevocation: false,
64099
+ challenge: 0n
64100
+ };
64101
+ }
64102
+ let zkProof;
64103
+ switch (circuitId) {
64104
+ case CircuitId.AuthV2:
64105
+ {
64106
+ const challenge = opts.challenge
64107
+ ? BytesHelper.intToBytes(opts.challenge).reverse()
64108
+ : new Uint8Array(32);
64109
+ zkProof = await this.generateAuthV2Proof(challenge, identifier);
64110
+ }
64111
+ return {
64112
+ circuitId: circuitId,
64113
+ proof: zkProof.proof,
64114
+ pub_signals: zkProof.pub_signals
64115
+ };
64116
+ default:
64117
+ throw new Error(`CircuitId ${circuitId} is not supported`);
64118
+ }
64119
+ }
63284
64120
  /** {@inheritdoc IProofService.transitState} */
63285
64121
  async transitState(did, oldTreeState, isOldStateGenesis, stateStorage, // for compatibility with previous versions we leave this parameter
63286
64122
  ethSigner) {
@@ -64136,5 +64972,5 @@ class IdentityWallet {
64136
64972
  }
64137
64973
  }
64138
64974
 
64139
- export { AbstractMessageHandler, AbstractPrivateKeyStore, AgentResolver, AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals, AuthHandler, AuthV2Inputs, AuthV2PubSignals, BJJSignatureProof2021, BaseConfig, BjjProvider, BrowserDataSource, CircuitClaim, CircuitError, CircuitId, CircuitStorage, ContractRequestHandler, CredentialOfferStatus, CredentialProposalHandler, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DIDDocumentSignature, DataPrepareHandlerFunc, DidDocumentCredentialStatusResolver, DidResolverStateReadonlyStorage, DiscoverFeatureQueryType, DiscoveryProtocolFeatureType, DiscoveryProtocolHandler, DisplayMethodType, Ed25519Provider, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, FunctionSignatures, Iden3OnchainSmtCredentialStatusPublisher, Iden3SmtRhsCredentialStatusPublisher, Iden3SparseMerkleTreeProof, IdentityStorage, IdentityWallet, InMemoryDataSource, InMemoryMerkleTreeStorage, InMemoryPrivateKeyStore, IndexedDBDataSource, IndexedDBPrivateKeyStore, InputGenerator, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, MessageBus, MessageHandler, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, OnchainIssuer, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PaymentFeatures, PaymentHandler, PaymentRequestDataType, PaymentType, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, RevocationStatusHandler, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, SupportedCurrencies, SupportedDataFormat, SupportedPaymentProofType, TransactionService, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes$1 as base58ToBytes, base64ToBytes$1 as base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildAccept, buildDIDFromEthPubKey, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58$1 as bytesToBase58, bytesToBase64, bytesToBase64url$1 as bytesToBase64url, bytesToHex$3 as bytesToHex, cacheLoader, calculateCoreSchemaHash, calculateQueryHashV2, calculateQueryHashV3, checkCircuitOperator, checkCircuitQueriesLength, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createDiscoveryFeatureDiscloseMessage, createDiscoveryFeatureQueryMessage, createPayment, createPaymentRequest, createProblemReportMessage, createProposal, createProposalRequest, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url$1 as decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fieldValueFromVerifiablePresentation, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getERC20Decimals, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getOperatorNameByValue, getPermitSignature, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$3 as hexToBytes, isEthereumIdentity, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseAcceptProfile, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, processZeroKnowledgeProofRequests, pushHashesToRHS, resolveDIDDocumentAuth, resolveDidDocument, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateDisclosureNativeSDSupport, validateDisclosureV2Circuit, validateEmptyCredentialSubjectNoopNativeSupport, validateEmptyCredentialSubjectV2Circuit, validateOperators, validateTreeState, verifyEIP712TypedData, verifyExpiresTime, verifyFieldValueInclusionNativeExistsSupport, verifyFieldValueInclusionV2, witnessBuilder };
64975
+ export { AbstractMessageHandler, AbstractPrivateKeyStore, AgentResolver, AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals, AuthHandler, AuthMethod, AuthV2Inputs, AuthV2PubSignals, BJJSignatureProof2021, BaseConfig, BjjProvider, BrowserDataSource, CircuitClaim, CircuitError, CircuitId, CircuitStorage, ContractRequestHandler, CredentialOfferStatus, CredentialProposalHandler, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DIDDocumentSignature, DataPrepareHandlerFunc, DidDocumentCredentialStatusResolver, DidResolverStateReadonlyStorage, DiscoverFeatureQueryType, DiscoveryProtocolFeatureType, DiscoveryProtocolHandler, DisplayMethodType, Ed25519Provider, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, FunctionSignatures, Iden3OnchainSmtCredentialStatusPublisher, Iden3SmtRhsCredentialStatusPublisher, Iden3SparseMerkleTreeProof, IdentityStorage, IdentityWallet, InMemoryDataSource, InMemoryMerkleTreeStorage, InMemoryPrivateKeyStore, IndexedDBDataSource, IndexedDBPrivateKeyStore, InputGenerator, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, MessageBus, MessageHandler, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, OnchainIssuer, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PaymentFeatures, PaymentHandler, PaymentRequestDataType, PaymentType, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, RevocationStatusHandler, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, SupportedCurrencies, SupportedDataFormat, SupportedPaymentProofType, TransactionService, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes$1 as base58ToBytes, base64ToBytes$1 as base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildAccept, buildDIDFromEthPubKey, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58$1 as bytesToBase58, bytesToBase64, bytesToBase64url$1 as bytesToBase64url, bytesToHex$3 as bytesToHex, cacheLoader, calculateCoreSchemaHash, calculateQueryHashV2, calculateQueryHashV3, checkCircuitOperator, checkCircuitQueriesLength, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createDiscoveryFeatureDiscloseMessage, createDiscoveryFeatureQueryMessage, createPayment, createPaymentRequest, createProblemReportMessage, createProposal, createProposalRequest, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url$1 as decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fieldValueFromVerifiablePresentation, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getERC20Decimals, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getOperatorNameByValue, getPermitSignature, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$3 as hexToBytes, isEthereumIdentity, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, packEthIdentityProof, parseAcceptProfile, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, processProofAuth, processZeroKnowledgeProofRequests, pushHashesToRHS, resolveDIDDocumentAuth, resolveDidDocument, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateDisclosureNativeSDSupport, validateDisclosureV2Circuit, validateEmptyCredentialSubjectNoopNativeSupport, validateEmptyCredentialSubjectV2Circuit, validateOperators, validateTreeState, verifyEIP712TypedData, verifyExpiresTime, verifyFieldValueInclusionNativeExistsSupport, verifyFieldValueInclusionV2, witnessBuilder };
64140
64976
  //# sourceMappingURL=index.js.map