@0xpolygonid/js-sdk 1.8.3 → 1.9.1

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 (70) hide show
  1. package/dist/browser/esm/index.js +420 -189
  2. package/dist/browser/esm/index.js.map +1 -1
  3. package/dist/browser/umd/index.js +425 -189
  4. package/dist/browser/umd/index.js.map +1 -1
  5. package/dist/node/cjs/circuits/atomic-query-v3-on-chain.js +8 -25
  6. package/dist/node/cjs/circuits/atomic-query-v3.js +6 -5
  7. package/dist/node/cjs/circuits/common.js +1 -1
  8. package/dist/node/cjs/circuits/comparer.js +24 -3
  9. package/dist/node/cjs/circuits/linked-multi-query.js +6 -17
  10. package/dist/node/cjs/circuits/models.js +47 -3
  11. package/dist/node/cjs/iden3comm/handlers/auth.js +14 -55
  12. package/dist/node/cjs/iden3comm/handlers/common.js +85 -0
  13. package/dist/node/cjs/iden3comm/handlers/contract-request.js +6 -25
  14. package/dist/node/cjs/iden3comm/handlers/index.js +2 -0
  15. package/dist/node/cjs/iden3comm/handlers/revocation-status.js +119 -0
  16. package/dist/node/cjs/identity/identity-wallet.js +4 -0
  17. package/dist/node/cjs/proof/common.js +11 -5
  18. package/dist/node/cjs/proof/provers/inputs-generator.js +6 -10
  19. package/dist/node/cjs/proof/verifiers/index.js +1 -0
  20. package/dist/node/cjs/proof/verifiers/pub-signals-verifier.js +37 -22
  21. package/dist/node/cjs/proof/verifiers/query-hash.js +40 -0
  22. package/dist/node/cjs/proof/verifiers/query.js +24 -16
  23. package/dist/node/cjs/schema-processor/utils.js +2 -2
  24. package/dist/node/cjs/storage/filters/jsonQuery.js +28 -2
  25. package/dist/node/cjs/verifiable/core-utils.js +3 -3
  26. package/dist/node/cjs/verifiable/credential.js +1 -1
  27. package/dist/node/esm/circuits/atomic-query-v3-on-chain.js +9 -26
  28. package/dist/node/esm/circuits/atomic-query-v3.js +7 -6
  29. package/dist/node/esm/circuits/common.js +1 -1
  30. package/dist/node/esm/circuits/comparer.js +24 -3
  31. package/dist/node/esm/circuits/linked-multi-query.js +7 -18
  32. package/dist/node/esm/circuits/models.js +48 -4
  33. package/dist/node/esm/iden3comm/handlers/auth.js +15 -56
  34. package/dist/node/esm/iden3comm/handlers/common.js +81 -0
  35. package/dist/node/esm/iden3comm/handlers/contract-request.js +7 -26
  36. package/dist/node/esm/iden3comm/handlers/index.js +2 -0
  37. package/dist/node/esm/iden3comm/handlers/revocation-status.js +92 -0
  38. package/dist/node/esm/identity/identity-wallet.js +4 -0
  39. package/dist/node/esm/proof/common.js +12 -6
  40. package/dist/node/esm/proof/provers/inputs-generator.js +7 -11
  41. package/dist/node/esm/proof/verifiers/index.js +1 -0
  42. package/dist/node/esm/proof/verifiers/pub-signals-verifier.js +41 -26
  43. package/dist/node/esm/proof/verifiers/query-hash.js +35 -0
  44. package/dist/node/esm/proof/verifiers/query.js +23 -16
  45. package/dist/node/esm/schema-processor/utils.js +3 -3
  46. package/dist/node/esm/storage/filters/jsonQuery.js +28 -2
  47. package/dist/node/esm/verifiable/core-utils.js +1 -1
  48. package/dist/node/esm/verifiable/credential.js +2 -2
  49. package/dist/types/circuits/atomic-query-v3-on-chain.d.ts +4 -8
  50. package/dist/types/circuits/atomic-query-v3.d.ts +2 -2
  51. package/dist/types/circuits/common.d.ts +1 -1
  52. package/dist/types/circuits/comparer.d.ts +4 -0
  53. package/dist/types/circuits/linked-multi-query.d.ts +0 -1
  54. package/dist/types/circuits/models.d.ts +7 -4
  55. package/dist/types/iden3comm/handlers/auth.d.ts +1 -0
  56. package/dist/types/iden3comm/handlers/common.d.ts +23 -0
  57. package/dist/types/iden3comm/handlers/contract-request.d.ts +1 -1
  58. package/dist/types/iden3comm/handlers/index.d.ts +2 -0
  59. package/dist/types/iden3comm/handlers/revocation-status.d.ts +59 -0
  60. package/dist/types/iden3comm/types/protocol/contract-request.d.ts +1 -0
  61. package/dist/types/identity/identity-wallet.d.ts +13 -1
  62. package/dist/types/proof/verifiers/index.d.ts +1 -0
  63. package/dist/types/proof/verifiers/query-hash.d.ts +3 -0
  64. package/dist/types/proof/verifiers/query.d.ts +1 -0
  65. package/dist/types/schema-processor/utils.d.ts +1 -1
  66. package/dist/types/storage/filters/jsonQuery.d.ts +1 -1
  67. package/dist/types/verifiable/core-utils.d.ts +1 -1
  68. package/dist/types/verifiable/credential.d.ts +1 -1
  69. package/dist/types/verifiable/proof.d.ts +5 -1
  70. package/package.json +1 -1
@@ -27300,7 +27300,7 @@ const parseCoreClaimSlots = async (ldCtx, mz, credentialType) => {
27300
27300
  * @param {Uint8Array} schemaId
27301
27301
  * @returns {*} {SchemaHash}
27302
27302
  */
27303
- const caclulateCoreSchemaHash = (schemaId) => {
27303
+ const calculateCoreSchemaHash = (schemaId) => {
27304
27304
  const sHash = Hex.decodeString(sha3Exports.keccak256(schemaId));
27305
27305
  return new SchemaHash(sHash.slice(sHash.length - 16, sHash.length));
27306
27306
  };
@@ -27415,7 +27415,7 @@ class W3CCredential {
27415
27415
  if (!nonMerklized && opts.merklizedRootPosition === MerklizedRootPosition.None) {
27416
27416
  opts.merklizedRootPosition = MerklizedRootPosition.Index;
27417
27417
  }
27418
- const schemaHash = caclulateCoreSchemaHash(byteEncoder.encode(credentialType));
27418
+ const schemaHash = calculateCoreSchemaHash(byteEncoder.encode(credentialType));
27419
27419
  const claim = Claim.newClaim(schemaHash, ClaimOptions.withIndexDataBytes(slots.indexA, slots.indexB), ClaimOptions.withValueDataBytes(slots.valueA, slots.valueB), ClaimOptions.withRevocationNonce(BigInt(opts.revNonce)), ClaimOptions.withVersion(opts.version));
27420
27420
  if (opts.updatable) {
27421
27421
  claim.setFlagUpdatable(opts.updatable);
@@ -28347,14 +28347,14 @@ function checkDataInField(data) {
28347
28347
  }
28348
28348
  /**
28349
28349
  *
28350
- * @deprecated The method should not be used. Use caclulateCoreSchemaHash from verifiable.
28350
+ * @deprecated The method should not be used. Use calculateCoreSchemaHash from verifiable.
28351
28351
  * Calculates schema hash
28352
28352
  *
28353
28353
  * @param {Uint8Array} schemaId
28354
28354
  * @returns {*} {SchemaHash}
28355
28355
  */
28356
28356
  const createSchemaHash = (schemaId) => {
28357
- return caclulateCoreSchemaHash(schemaId);
28357
+ return calculateCoreSchemaHash(schemaId);
28358
28358
  };
28359
28359
  /**
28360
28360
  *
@@ -55685,7 +55685,7 @@ class BaseConfig {
55685
55685
  * @returns number
55686
55686
  */
55687
55687
  getValueArrSize() {
55688
- return this.valueArraySize ? this.valueArraySize : defaultValueArraySize;
55688
+ return this.maxValueArraySize ? this.maxValueArraySize : defaultValueArraySize;
55689
55689
  }
55690
55690
  /**
55691
55691
  * getMTLevelOnChain return level on chain for given circuit
@@ -55853,6 +55853,8 @@ var Operators;
55853
55853
  Operators[Operators["LTE"] = 7] = "LTE";
55854
55854
  Operators[Operators["GTE"] = 8] = "GTE";
55855
55855
  Operators[Operators["BETWEEN"] = 9] = "BETWEEN";
55856
+ Operators[Operators["NONBETWEEN"] = 10] = "NONBETWEEN";
55857
+ Operators[Operators["EXISTS"] = 11] = "EXISTS";
55856
55858
  Operators[Operators["SD"] = 16] = "SD";
55857
55859
  Operators[Operators["NULLIFY"] = 17] = "NULLIFY";
55858
55860
  })(Operators || (Operators = {}));
@@ -55868,12 +55870,17 @@ const QueryOperators = {
55868
55870
  $lte: Operators.LTE,
55869
55871
  $gte: Operators.GTE,
55870
55872
  $between: Operators.BETWEEN,
55873
+ $nonbetween: Operators.NONBETWEEN,
55874
+ $exists: Operators.EXISTS,
55871
55875
  $sd: Operators.SD,
55872
55876
  $nullify: Operators.NULLIFY
55873
55877
  };
55874
55878
  const allOperations$1 = Object.values(QueryOperators);
55875
55879
  const availableTypesOperators = new Map([
55876
- [XSDNS.Boolean, [QueryOperators.$eq, QueryOperators.$ne, QueryOperators.$sd]],
55880
+ [
55881
+ XSDNS.Boolean,
55882
+ [QueryOperators.$eq, QueryOperators.$ne, QueryOperators.$sd, QueryOperators.$exists]
55883
+ ],
55877
55884
  [XSDNS.Integer, allOperations$1],
55878
55885
  [XSDNS.NonNegativeInteger, allOperations$1],
55879
55886
  [XSDNS.PositiveInteger, allOperations$1],
@@ -55884,7 +55891,8 @@ const availableTypesOperators = new Map([
55884
55891
  QueryOperators.$ne,
55885
55892
  QueryOperators.$in,
55886
55893
  QueryOperators.$nin,
55887
- QueryOperators.$sd
55894
+ QueryOperators.$sd,
55895
+ QueryOperators.$exists
55888
55896
  ]
55889
55897
  ],
55890
55898
  [
@@ -55894,7 +55902,8 @@ const availableTypesOperators = new Map([
55894
55902
  QueryOperators.$ne,
55895
55903
  QueryOperators.$in,
55896
55904
  QueryOperators.$nin,
55897
- QueryOperators.$sd
55905
+ QueryOperators.$sd,
55906
+ QueryOperators.$exists
55898
55907
  ]
55899
55908
  ],
55900
55909
  [XSDNS.DateTime, allOperations$1]
@@ -55985,6 +55994,16 @@ class Vector {
55985
55994
  return this.y.includes(this.x);
55986
55995
  case Operators.NIN:
55987
55996
  return !this.y.includes(this.x);
55997
+ case Operators.BETWEEN:
55998
+ if (this.y.length !== 2) {
55999
+ return false;
56000
+ }
56001
+ return this.x >= this.y[0] && this.x <= this.y[1];
56002
+ case Operators.NONBETWEEN:
56003
+ if (this.y.length !== 2) {
56004
+ return false;
56005
+ }
56006
+ return this.x < this.y[0] || this.x > this.y[1];
55988
56007
  default:
55989
56008
  throw new Error('unknown compare type for vector');
55990
56009
  }
@@ -56010,6 +56029,8 @@ const factoryComparer = (x, y, operator) => {
56010
56029
  return new Scalar(x, y[0]);
56011
56030
  case Operators.IN:
56012
56031
  case Operators.NIN:
56032
+ case Operators.BETWEEN:
56033
+ case Operators.NONBETWEEN:
56013
56034
  return new Vector(x, y);
56014
56035
  default:
56015
56036
  throw new Error('unknown compare type');
@@ -56033,6 +56054,48 @@ class Query {
56033
56054
  this.values?.some((v) => typeof v !== 'bigint'))
56034
56055
  throw new Error(CircuitError.EmptyQueryValue);
56035
56056
  }
56057
+ validateValueArraySize(maxArrSize) {
56058
+ switch (this.values.length) {
56059
+ case 0: {
56060
+ const zeroArrSizeOps = [Operators.NOOP, Operators.SD, Operators.NULLIFY];
56061
+ if (!zeroArrSizeOps.includes(this.operator)) {
56062
+ throw new Error(CircuitError.InvalidValuesArrSize);
56063
+ }
56064
+ return;
56065
+ }
56066
+ case 1: {
56067
+ const oneArrSizeOps = [
56068
+ Operators.EQ,
56069
+ Operators.LT,
56070
+ Operators.GT,
56071
+ Operators.NE,
56072
+ Operators.LTE,
56073
+ Operators.GTE,
56074
+ Operators.EXISTS
56075
+ ];
56076
+ if (!oneArrSizeOps.includes(this.operator)) {
56077
+ throw new Error(CircuitError.InvalidValuesArrSize);
56078
+ }
56079
+ return;
56080
+ }
56081
+ case 2: {
56082
+ const twoArrSizeOps = [Operators.BETWEEN, Operators.NONBETWEEN];
56083
+ if (!twoArrSizeOps.includes(this.operator)) {
56084
+ throw new Error(CircuitError.InvalidValuesArrSize);
56085
+ }
56086
+ return;
56087
+ }
56088
+ default: {
56089
+ const maxArrSizeOps = [Operators.IN, Operators.NIN];
56090
+ if (!maxArrSizeOps.includes(this.operator)) {
56091
+ throw new Error(CircuitError.InvalidOperationType);
56092
+ }
56093
+ if (!this.values.length || this.values.length > maxArrSize) {
56094
+ throw new Error(CircuitError.InvalidValuesArrSize);
56095
+ }
56096
+ }
56097
+ }
56098
+ }
56036
56099
  }
56037
56100
  /**
56038
56101
  * CircuitID is alias for circuit identifier
@@ -56057,17 +56120,17 @@ var CircuitId;
56057
56120
  * @beta
56058
56121
  */
56059
56122
  // AtomicQueryV3CircuitID is a type for credentialAtomicQueryV3.circom
56060
- CircuitId["AtomicQueryV3"] = "credentialAtomicQueryV3-beta.0";
56123
+ CircuitId["AtomicQueryV3"] = "credentialAtomicQueryV3-beta.1";
56061
56124
  /**
56062
56125
  * @beta
56063
56126
  */
56064
56127
  // AtomicQueryV3OnChainCircuitID is a type for credentialAtomicQueryV3OnChain.circom
56065
- CircuitId["AtomicQueryV3OnChain"] = "credentialAtomicQueryV3OnChain-beta.0";
56128
+ CircuitId["AtomicQueryV3OnChain"] = "credentialAtomicQueryV3OnChain-beta.1";
56066
56129
  /**
56067
56130
  * @beta
56068
56131
  */
56069
56132
  // LinkedMultiQuery is a type for linkedMultiQuery.circom
56070
- CircuitId["LinkedMultiQuery10"] = "linkedMultiQuery10-beta.0";
56133
+ CircuitId["LinkedMultiQuery10"] = "linkedMultiQuery10-beta.1";
56071
56134
  })(CircuitId || (CircuitId = {}));
56072
56135
  /**
56073
56136
  * Claim structure for circuit inputs
@@ -56104,6 +56167,8 @@ var CircuitError;
56104
56167
  CircuitError["EmptyTreeState"] = "empty tree state";
56105
56168
  CircuitError["EmptyRequestID"] = "empty request ID";
56106
56169
  CircuitError["InvalidProofType"] = "invalid proof type";
56170
+ CircuitError["InvalidValuesArrSize"] = "invalid query Values array size";
56171
+ CircuitError["InvalidOperationType"] = "invalid operation type";
56107
56172
  })(CircuitError || (CircuitError = {}));
56108
56173
  /**
56109
56174
  * ValueProof represents a Merkle Proof for a value stored as MT
@@ -56713,6 +56778,7 @@ class AtomicQueryV3Inputs extends BaseConfig {
56713
56778
  if (!this.query.values) {
56714
56779
  throw new Error(CircuitError.EmptyQueryValue);
56715
56780
  }
56781
+ this.query.validateValueArraySize(this.getValueArrSize());
56716
56782
  if (!this.proofType) {
56717
56783
  throw new Error(CircuitError.InvalidProofType);
56718
56784
  }
@@ -56842,12 +56908,12 @@ class AtomicQueryV3Inputs extends BaseConfig {
56842
56908
  s.issuerClaimNonRevMtpAuxHi = nodeAuxNonRev.key.bigInt().toString();
56843
56909
  s.issuerClaimNonRevMtpAuxHv = nodeAuxNonRev.value.bigInt().toString();
56844
56910
  s.issuerClaimNonRevMtpNoAux = nodeAuxNonRev.noAux;
56845
- s.claimPathNotExists = existenceToInt(valueProof.mtp.existence);
56846
56911
  const nodAuxJSONLD = getNodeAuxValue(valueProof.mtp);
56847
56912
  s.claimPathMtpNoAux = nodAuxJSONLD.noAux;
56848
56913
  s.claimPathMtpAuxHi = nodAuxJSONLD.key.bigInt().toString();
56849
56914
  s.claimPathMtpAuxHv = nodAuxJSONLD.value.bigInt().toString();
56850
56915
  s.claimPathKey = valueProof.path.toString();
56916
+ s.valueArraySize = this.query.values.length;
56851
56917
  const values = prepareCircuitArrayValues(this.query.values, this.getValueArrSize());
56852
56918
  s.value = bigIntArrayToStringArray(values);
56853
56919
  s.linkNonce = this.linkNonce.toString();
@@ -56881,11 +56947,11 @@ class AtomicQueryV3PubSignals extends BaseConfig {
56881
56947
  // issuerClaimNonRevState
56882
56948
  // timestamp
56883
56949
  // claimSchema
56884
- // claimPathNotExists
56885
56950
  // claimPathKey
56886
56951
  // slotIndex
56887
56952
  // operator
56888
56953
  // value
56954
+ // valueArraySize
56889
56955
  // verifierID
56890
56956
  // nullifierSessionID
56891
56957
  // 19 is a number of fields in AtomicQueryV3PubSignals before values, values is last element in the proof and
@@ -56936,9 +57002,6 @@ class AtomicQueryV3PubSignals extends BaseConfig {
56936
57002
  // - claimSchema
56937
57003
  this.claimSchema = SchemaHash.newSchemaHashFromInt(BigInt(sVals[fieldIdx]));
56938
57004
  fieldIdx++;
56939
- // - ClaimPathNotExists
56940
- this.claimPathNotExists = parseInt(sVals[fieldIdx]);
56941
- fieldIdx++;
56942
57005
  // - ClaimPathKey
56943
57006
  this.claimPathKey = BigInt(sVals[fieldIdx]);
56944
57007
  fieldIdx++;
@@ -56953,6 +57016,9 @@ class AtomicQueryV3PubSignals extends BaseConfig {
56953
57016
  this.value.push(BigInt(sVals[fieldIdx]));
56954
57017
  fieldIdx++;
56955
57018
  }
57019
+ // - valueArraySize
57020
+ this.valueArraySize = parseInt(sVals[fieldIdx]);
57021
+ fieldIdx++;
56956
57022
  // - verifierID
56957
57023
  if (sVals[fieldIdx] !== '0') {
56958
57024
  this.verifierID = Id.fromBigInt(BigInt(sVals[fieldIdx]));
@@ -56983,13 +57049,14 @@ class AtomicQueryV3OnChainInputs extends BaseConfig {
56983
57049
  if (!this.query.values) {
56984
57050
  throw new Error(CircuitError.EmptyQueryValue);
56985
57051
  }
57052
+ this.query.validateValueArraySize(this.getValueArrSize());
56986
57053
  if (!this.proofType) {
56987
57054
  throw new Error(CircuitError.InvalidProofType);
56988
57055
  }
56989
57056
  if (!this.challenge) {
56990
57057
  throw new Error(CircuitError.EmptyChallenge);
56991
57058
  }
56992
- if (this.authEnabled === 1) {
57059
+ if (this.isBJJAuthEnabled === 1) {
56993
57060
  if (!this.authClaimIncMtp) {
56994
57061
  throw new Error(CircuitError.EmptyAuthClaimProof);
56995
57062
  }
@@ -57105,7 +57172,7 @@ class AtomicQueryV3OnChainInputs extends BaseConfig {
57105
57172
  isRevocationChecked: 1
57106
57173
  };
57107
57174
  s.challenge = this.challenge?.toString();
57108
- if (this.authEnabled === 1) {
57175
+ if (this.isBJJAuthEnabled === 1) {
57109
57176
  s.authClaim = this.authClaim?.marshalJson();
57110
57177
  s.userClaimsTreeRoot = this.treeState.claimsRoot?.bigInt().toString();
57111
57178
  s.userRevTreeRoot = this.treeState.revocationRoot?.bigInt().toString();
@@ -57180,18 +57247,18 @@ class AtomicQueryV3OnChainInputs extends BaseConfig {
57180
57247
  s.issuerClaimNonRevMtpAuxHi = nodeAuxNonRev.key.bigInt().toString();
57181
57248
  s.issuerClaimNonRevMtpAuxHv = nodeAuxNonRev.value.bigInt().toString();
57182
57249
  s.issuerClaimNonRevMtpNoAux = nodeAuxNonRev.noAux;
57183
- s.claimPathNotExists = existenceToInt(valueProof.mtp.existence);
57184
57250
  const nodAuxJSONLD = getNodeAuxValue(valueProof.mtp);
57185
57251
  s.claimPathMtpNoAux = nodAuxJSONLD.noAux;
57186
57252
  s.claimPathMtpAuxHi = nodAuxJSONLD.key.bigInt().toString();
57187
57253
  s.claimPathMtpAuxHv = nodAuxJSONLD.value.bigInt().toString();
57188
57254
  s.claimPathKey = valueProof.path.toString();
57255
+ s.valueArraySize = this.query.values.length;
57189
57256
  const values = prepareCircuitArrayValues(this.query.values, this.getValueArrSize());
57190
57257
  s.value = bigIntArrayToStringArray(values);
57191
57258
  s.linkNonce = this.linkNonce.toString();
57192
57259
  s.verifierID = this.verifierID?.bigInt().toString() ?? '0';
57193
57260
  s.nullifierSessionID = this.nullifierSessionID.toString();
57194
- s.authEnabled = this.authEnabled.toString();
57261
+ s.isBJJAuthEnabled = this.isBJJAuthEnabled.toString();
57195
57262
  return byteEncoder.encode(JSON.stringify(s));
57196
57263
  }
57197
57264
  }
@@ -57203,7 +57270,6 @@ class AtomicQueryV3OnChainPubSignals extends BaseConfig {
57203
57270
  // PubSignalsUnmarshal unmarshal credentialAtomicQueryV3.circom public signals
57204
57271
  pubSignalsUnmarshal(data) {
57205
57272
  // expected order:
57206
- // merklized
57207
57273
  // userID
57208
57274
  // circuitQueryHash
57209
57275
  // issuerState
@@ -57215,17 +57281,11 @@ class AtomicQueryV3OnChainPubSignals extends BaseConfig {
57215
57281
  // challenge
57216
57282
  // gistRoot
57217
57283
  // issuerID
57218
- // isRevocationChecked
57219
57284
  // issuerClaimNonRevState
57220
57285
  // timestamp
57221
- // verifierID
57222
- // nullifierSessionID
57223
- // authEnabled
57286
+ // isBJJAuthEnabled
57224
57287
  const sVals = JSON.parse(byteDecoder.decode(data));
57225
57288
  let fieldIdx = 0;
57226
- // -- merklized
57227
- this.merklized = parseInt(sVals[fieldIdx]);
57228
- fieldIdx++;
57229
57289
  // - userID
57230
57290
  this.userID = Id.fromBigInt(BigInt(sVals[fieldIdx]));
57231
57291
  fieldIdx++;
@@ -57259,25 +57319,14 @@ class AtomicQueryV3OnChainPubSignals extends BaseConfig {
57259
57319
  // - issuerID
57260
57320
  this.issuerID = Id.fromBigInt(BigInt(sVals[fieldIdx]));
57261
57321
  fieldIdx++;
57262
- // - isRevocationChecked
57263
- this.isRevocationChecked = parseInt(sVals[fieldIdx]);
57264
- fieldIdx++;
57265
57322
  // - issuerClaimNonRevState
57266
57323
  this.issuerClaimNonRevState = Hash$1.fromString(sVals[fieldIdx]);
57267
57324
  fieldIdx++;
57268
57325
  // - timestamp
57269
57326
  this.timestamp = parseInt(sVals[fieldIdx]);
57270
57327
  fieldIdx++;
57271
- // - verifierID
57272
- if (sVals[fieldIdx] !== '0') {
57273
- this.verifierID = Id.fromBigInt(BigInt(sVals[fieldIdx]));
57274
- }
57275
- fieldIdx++;
57276
- // - nullifierSessionID
57277
- this.nullifierSessionID = BigInt(sVals[fieldIdx]);
57278
- fieldIdx++;
57279
- // - authEnabled
57280
- this.authEnabled = parseInt(sVals[fieldIdx]);
57328
+ // - isBJJAuthEnabled
57329
+ this.isBJJAuthEnabled = parseInt(sVals[fieldIdx]);
57281
57330
  return this;
57282
57331
  }
57283
57332
  }
@@ -57687,8 +57736,6 @@ class StateTransitionPubSignals {
57687
57736
  class LinkedMultiQueryInputs extends BaseConfig {
57688
57737
  // InputsMarshal returns Circom private inputs for linkedMultiQueryInputs.circom
57689
57738
  inputsMarshal() {
57690
- const enabled = [];
57691
- const claimPathNotExists = [];
57692
57739
  const claimPathMtp = [];
57693
57740
  const claimPathMtpNoAux = [];
57694
57741
  const claimPathMtpAuxHi = [];
@@ -57698,10 +57745,9 @@ class LinkedMultiQueryInputs extends BaseConfig {
57698
57745
  const slotIndex = [];
57699
57746
  const operator = [];
57700
57747
  const value = [];
57748
+ const valueArraySize = [];
57701
57749
  for (let i = 0; i < LinkedMultiQueryInputs.queryCount; i++) {
57702
57750
  if (!this.query[i]) {
57703
- enabled.push(0);
57704
- claimPathNotExists.push(0);
57705
57751
  claimPathMtp.push(new Array(this.getMTLevelsClaim()).fill('0'));
57706
57752
  claimPathMtpNoAux.push('0');
57707
57753
  claimPathMtpAuxHi.push('0');
@@ -57712,9 +57758,9 @@ class LinkedMultiQueryInputs extends BaseConfig {
57712
57758
  operator.push(0);
57713
57759
  const valuesArr = prepareCircuitArrayValues([], this.getValueArrSize());
57714
57760
  value.push(bigIntArrayToStringArray(valuesArr));
57761
+ valueArraySize.push(0);
57715
57762
  continue;
57716
57763
  }
57717
- enabled.push(1);
57718
57764
  let valueProof = this.query[i].valueProof;
57719
57765
  if (!valueProof) {
57720
57766
  valueProof = new ValueProof();
@@ -57722,7 +57768,6 @@ class LinkedMultiQueryInputs extends BaseConfig {
57722
57768
  valueProof.value = 0n;
57723
57769
  valueProof.mtp = new Proof();
57724
57770
  }
57725
- claimPathNotExists.push(existenceToInt(valueProof.mtp.existence));
57726
57771
  claimPathMtp.push(prepareSiblingsStr(valueProof.mtp, this.getMTLevelsClaim()));
57727
57772
  const nodAuxJSONLD = getNodeAuxValue(valueProof.mtp);
57728
57773
  claimPathMtpNoAux.push(nodAuxJSONLD.noAux);
@@ -57732,15 +57777,14 @@ class LinkedMultiQueryInputs extends BaseConfig {
57732
57777
  claimPathValue.push(valueProof.value.toString());
57733
57778
  slotIndex.push(this.query[i].slotIndex);
57734
57779
  operator.push(this.query[i].operator);
57780
+ valueArraySize.push(this.query[i].values.length);
57735
57781
  const valuesArr = prepareCircuitArrayValues(this.query[i].values, this.getValueArrSize());
57736
57782
  value.push(bigIntArrayToStringArray(valuesArr));
57737
57783
  }
57738
57784
  const s = {
57739
57785
  linkNonce: this.linkNonce.toString(),
57740
57786
  issuerClaim: this.claim.marshalJson(),
57741
- enabled,
57742
57787
  claimSchema: this.claim.getSchemaHash().bigInt().toString(),
57743
- claimPathNotExists,
57744
57788
  claimPathMtp,
57745
57789
  claimPathMtpNoAux,
57746
57790
  claimPathMtpAuxHi,
@@ -57749,7 +57793,8 @@ class LinkedMultiQueryInputs extends BaseConfig {
57749
57793
  claimPathValue,
57750
57794
  slotIndex,
57751
57795
  operator,
57752
- value
57796
+ value,
57797
+ valueArraySize
57753
57798
  };
57754
57799
  return byteEncoder.encode(JSON.stringify(s));
57755
57800
  }
@@ -57771,7 +57816,7 @@ class LinkedMultiQueryPubSignals {
57771
57816
  * @returns LinkedMultiQueryPubSignals
57772
57817
  */
57773
57818
  pubSignalsUnmarshal(data) {
57774
- const len = 32;
57819
+ const len = 22;
57775
57820
  const queryLength = LinkedMultiQueryInputs.queryCount;
57776
57821
  const sVals = JSON.parse(byteDecoder.decode(data));
57777
57822
  if (sVals.length !== len) {
@@ -57796,13 +57841,6 @@ class LinkedMultiQueryPubSignals {
57796
57841
  this.circuitQueryHash.push(BigInt(sVals[fieldIdx]));
57797
57842
  fieldIdx++;
57798
57843
  }
57799
- // - enabled
57800
- this.enabled = [];
57801
- for (let i = 0; i < queryLength; i++) {
57802
- const enabledNum = parseInt(sVals[fieldIdx]);
57803
- this.enabled.push(enabledNum === 1);
57804
- fieldIdx++;
57805
- }
57806
57844
  return this;
57807
57845
  }
57808
57846
  }
@@ -59835,6 +59873,19 @@ const lessThanOrEqual = (a, b) => {
59835
59873
  }
59836
59874
  return a <= b;
59837
59875
  };
59876
+ // a - field value
59877
+ // b - true / false (exists operator values)
59878
+ const existsComparator = (a, b) => {
59879
+ if (truthyValues.includes(b) && typeof a !== 'undefined') {
59880
+ // if exists val is true , a field val exists
59881
+ return true;
59882
+ }
59883
+ // if exists val is false , a field val doesn't exist
59884
+ if (falsyValues.includes(b) && (a === undefined || (Array.isArray(a) && !a.length))) {
59885
+ return true;
59886
+ }
59887
+ return false;
59888
+ };
59838
59889
  const inOperator = (a, b) => {
59839
59890
  if (Array.isArray(a) && Array.isArray(b)) {
59840
59891
  return a.every((val) => b.includes(val));
@@ -59847,9 +59898,19 @@ const inOperator = (a, b) => {
59847
59898
  }
59848
59899
  return false;
59849
59900
  };
59901
+ const betweenOperator = (a, b) => {
59902
+ if (!Array.isArray(b) || b.length !== 2) {
59903
+ throw new Error('$between/$nonbetween operator value should be 2 elements array');
59904
+ }
59905
+ if (Array.isArray(a)) {
59906
+ return a.every((val) => val >= b[0] && val <= b[1]);
59907
+ }
59908
+ return a >= b[0] && a <= b[1];
59909
+ };
59850
59910
  const comparatorOptions = {
59851
59911
  $noop: () => true,
59852
59912
  $sd: () => true,
59913
+ $exists: (a, b) => existsComparator(a, b),
59853
59914
  $eq: (a, b) => equalsComparator(a, b),
59854
59915
  $in: (a, b) => inOperator(a, b),
59855
59916
  $nin: (a, b) => !inOperator(a, b),
@@ -59857,7 +59918,9 @@ const comparatorOptions = {
59857
59918
  $lt: (a, b) => !greaterThan(a, b),
59858
59919
  $ne: (a, b) => !equalsComparator(a, b),
59859
59920
  $gte: (a, b) => greaterThanOrEqual(a, b),
59860
- $lte: (a, b) => lessThanOrEqual(a, b)
59921
+ $lte: (a, b) => lessThanOrEqual(a, b),
59922
+ $between: (a, b) => betweenOperator(a, b),
59923
+ $nonbetween: (a, b) => !betweenOperator(a, b)
59861
59924
  };
59862
59925
  /**
59863
59926
  * credential search path resolver
@@ -59905,7 +59968,8 @@ class FilterQuery {
59905
59968
  throw new Error(SearchError.NotDefinedComparator);
59906
59969
  }
59907
59970
  const credentialPathValue = resolvePath(credential, this.path);
59908
- if (credentialPathValue === null || credentialPathValue === undefined) {
59971
+ if ((credentialPathValue === null || credentialPathValue === undefined) &&
59972
+ this.operatorFunc !== existsComparator) {
59909
59973
  return false;
59910
59974
  }
59911
59975
  if (this.isReverseParams) {
@@ -61926,6 +61990,10 @@ class IdentityWallet {
61926
61990
  async generateNonRevocationMtp(did, credential, treeState) {
61927
61991
  const coreClaim = await this.getCoreClaimFromCredential(credential);
61928
61992
  const revNonce = coreClaim.getRevocationNonce();
61993
+ return this.generateNonRevocationMtpWithNonce(did, revNonce, treeState);
61994
+ }
61995
+ /** {@inheritDoc IIdentityWallet.generateNonRevocationMtpWithNonce} */
61996
+ async generateNonRevocationMtpWithNonce(did, revNonce, treeState) {
61929
61997
  const treesModel = await this.getDIDTreeModel(did);
61930
61998
  const revocationTree = await this._storage.mt.getMerkleTreeByIdentifierAndType(did.string(), MerkleTreeType.Revocations);
61931
61999
  const claimsRoot = await treesModel.claimsTree.root();
@@ -62290,16 +62358,21 @@ const parseCredentialSubject = (credentialSubject) => {
62290
62358
  return queries;
62291
62359
  };
62292
62360
  const parseQueryMetadata = async (propertyQuery, ldContextJSON, credentialType, options) => {
62293
- const datatype = await Path.newTypeFromContext(ldContextJSON, `${credentialType}.${propertyQuery.fieldName}`, options);
62294
62361
  const query = {
62295
62362
  ...propertyQuery,
62296
62363
  slotIndex: 0,
62297
62364
  merklizedSchema: false,
62298
- datatype: datatype,
62365
+ datatype: '',
62299
62366
  claimPathKey: BigInt(0),
62300
62367
  values: [],
62301
62368
  path: new Path()
62302
62369
  };
62370
+ if (!propertyQuery.fieldName && propertyQuery.operator !== Operators.NOOP) {
62371
+ throw new Error('query must have a field name if operator is not $noop');
62372
+ }
62373
+ if (propertyQuery.fieldName) {
62374
+ query.datatype = await Path.newTypeFromContext(ldContextJSON, `${credentialType}.${propertyQuery.fieldName}`, options);
62375
+ }
62303
62376
  const serAttr = await getSerializationAttrFromContext(JSON.parse(ldContextJSON), options, credentialType);
62304
62377
  if (!serAttr) {
62305
62378
  query.merklizedSchema = true;
@@ -62321,9 +62394,10 @@ const parseQueryMetadata = async (propertyQuery, ldContextJSON, credentialType,
62321
62394
  }
62322
62395
  }
62323
62396
  if (propertyQuery.operatorValue) {
62324
- if (!isValidOperation(datatype, propertyQuery.operator)) {
62325
- throw new Error(`operator ${propertyQuery.operator} is not supported for datatype ${datatype}`);
62397
+ if (!isValidOperation(query.datatype, propertyQuery.operator)) {
62398
+ throw new Error(`operator ${propertyQuery.operator} is not supported for datatype ${query.datatype}`);
62326
62399
  }
62400
+ const datatype = propertyQuery.operator === Operators.EXISTS ? XSDNS.Boolean : query.datatype;
62327
62401
  query.values = await transformQueryValueToBigInts(propertyQuery.operatorValue, datatype);
62328
62402
  }
62329
62403
  return query;
@@ -62333,7 +62407,7 @@ const parseQueriesMetadata = async (credentialType, ldContextJSON, credentialSub
62333
62407
  return Promise.all(queriesMetadata.map((m) => parseQueryMetadata(m, ldContextJSON, credentialType, options)));
62334
62408
  };
62335
62409
  const transformQueryValueToBigInts = async (value, ldType) => {
62336
- const values = new Array(64).fill(BigInt(0));
62410
+ const values = [];
62337
62411
  if (Array.isArray(value)) {
62338
62412
  for (let index = 0; index < value.length; index++) {
62339
62413
  values[index] = await Merklizer.hashValue(ldType, value[index]);
@@ -62889,10 +62963,8 @@ class InputGenerator {
62889
62963
  circuitInputs.profileNonce = BigInt(params.authProfileNonce);
62890
62964
  circuitInputs.skipClaimRevocationCheck = params.skipRevocation;
62891
62965
  const query = circuitQueries[0];
62892
- query.values =
62893
- query.operator === Operators.SD || query.operator === Operators.NOOP
62894
- ? new Array(defaultValueArraySize).fill(0)
62895
- : query.values;
62966
+ query.values = [Operators.SD, Operators.NOOP].includes(query.operator) ? [] : query.values;
62967
+ query.valueProof = query.operator === Operators.NOOP ? new ValueProof() : query.valueProof;
62896
62968
  circuitInputs.query = query;
62897
62969
  circuitInputs.currentTimeStamp = getUnixTimestamp(new Date());
62898
62970
  circuitInputs.proofType = proofType;
@@ -62940,10 +63012,8 @@ class InputGenerator {
62940
63012
  circuitInputs.profileNonce = BigInt(params.authProfileNonce);
62941
63013
  circuitInputs.skipClaimRevocationCheck = params.skipRevocation;
62942
63014
  const query = circuitQueries[0];
62943
- query.values =
62944
- query.operator === Operators.SD || query.operator === Operators.NOOP
62945
- ? new Array(defaultValueArraySize).fill(0)
62946
- : query.values;
63015
+ query.values = [Operators.SD, Operators.NOOP].includes(query.operator) ? [] : query.values;
63016
+ query.valueProof = query.operator === Operators.NOOP ? new ValueProof() : query.valueProof;
62947
63017
  circuitInputs.query = query;
62948
63018
  circuitInputs.currentTimeStamp = getUnixTimestamp(new Date());
62949
63019
  circuitInputs.proofType = proofType;
@@ -62959,7 +63029,7 @@ class InputGenerator {
62959
63029
  catch {
62960
63030
  isEthIdentity = false;
62961
63031
  }
62962
- circuitInputs.authEnabled = isEthIdentity ? 0 : 1;
63032
+ circuitInputs.isBJJAuthEnabled = isEthIdentity ? 0 : 1;
62963
63033
  circuitInputs.challenge = BigInt(params.challenge ?? 0);
62964
63034
  const { nonce: authProfileNonce, genesisDID } = await this._identityWallet.getGenesisDIDMetadata(identifier);
62965
63035
  const id = DID.idFromDID(genesisDID);
@@ -62967,7 +63037,7 @@ class InputGenerator {
62967
63037
  const gistProof = toGISTProof(stateProof);
62968
63038
  circuitInputs.gistProof = gistProof;
62969
63039
  // auth inputs
62970
- if (circuitInputs.authEnabled === 1) {
63040
+ if (circuitInputs.isBJJAuthEnabled === 1) {
62971
63041
  const authPrepared = await this.prepareAuthBJJCredential(genesisDID);
62972
63042
  const authClaimData = await this.newCircuitClaimData({
62973
63043
  credential: authPrepared.credential,
@@ -63100,7 +63170,7 @@ async function checkQueryRequest(query, outputs, circuitId, schemaLoader, verifi
63100
63170
  const schemaId = await Path.getTypeIDFromContext(JSON.stringify(schema), query.type, {
63101
63171
  documentLoader: schemaLoader
63102
63172
  });
63103
- const schemaHash = caclulateCoreSchemaHash(byteEncoder.encode(schemaId));
63173
+ const schemaHash = calculateCoreSchemaHash(byteEncoder.encode(schemaId));
63104
63174
  if (schemaHash.bigInt() !== outputs.schemaHash.bigInt()) {
63105
63175
  throw new Error(`schema that was used is not equal to requested in query`);
63106
63176
  }
@@ -63118,7 +63188,8 @@ async function checkQueryRequest(query, outputs, circuitId, schemaLoader, verifi
63118
63188
  if (notSupportedOpIndx > -1) {
63119
63189
  throw new Error(`circuit ${circuitId} not support ${queriesMetadata[notSupportedOpIndx].operator} operator`);
63120
63190
  }
63121
- queriesMetadata.forEach(async (metadata) => {
63191
+ for (let i = 0; i < queriesMetadata.length; i++) {
63192
+ const metadata = queriesMetadata[i];
63122
63193
  if (!query.type) {
63123
63194
  throw new Error(`proof query type is undefined`);
63124
63195
  }
@@ -63171,7 +63242,7 @@ async function checkQueryRequest(query, outputs, circuitId, schemaLoader, verifi
63171
63242
  if (timeDiff > acceptedProofGenerationDelay) {
63172
63243
  throw new Error('generated proof is outdated');
63173
63244
  }
63174
- });
63245
+ }
63175
63246
  return;
63176
63247
  }
63177
63248
  async function validateEmptyCredentialSubject(cq, outputs) {
@@ -63200,14 +63271,14 @@ async function validateOperators(cq, outputs) {
63200
63271
  }
63201
63272
  for (let index = 0; index < outputs.value.length; index++) {
63202
63273
  if (outputs.value[index] !== cq.values[index]) {
63274
+ if (outputs.value[index] === 0n && cq.values[index] === undefined) {
63275
+ continue;
63276
+ }
63203
63277
  throw new Error(`comparison value that was used is not equal to requested in query`);
63204
63278
  }
63205
63279
  }
63206
63280
  }
63207
63281
  async function validateDisclosure(cq, outputs, verifiablePresentation, ldLoader) {
63208
- if (!verifiablePresentation) {
63209
- throw new Error(`verifiablePresentation is required for selective disclosure request`);
63210
- }
63211
63282
  if (outputs.operator !== Operators.EQ) {
63212
63283
  throw new Error(`operator for selective disclosure must be $eq`);
63213
63284
  }
@@ -63216,6 +63287,15 @@ async function validateDisclosure(cq, outputs, verifiablePresentation, ldLoader)
63216
63287
  throw new Error(`selective disclosure not available for array of values`);
63217
63288
  }
63218
63289
  }
63290
+ const bi = await fieldValueFromVerifiablePresentation(cq.fieldName, verifiablePresentation, ldLoader);
63291
+ if (bi !== outputs.value[0]) {
63292
+ throw new Error(`value that was used is not equal to requested in query`);
63293
+ }
63294
+ }
63295
+ const fieldValueFromVerifiablePresentation = async (fieldName, verifiablePresentation, ldLoader) => {
63296
+ if (!verifiablePresentation) {
63297
+ throw new Error(`verifiablePresentation is required for selective disclosure request`);
63298
+ }
63219
63299
  let mz;
63220
63300
  const strVerifiablePresentation = JSON.stringify(verifiablePresentation);
63221
63301
  try {
@@ -63228,13 +63308,13 @@ async function validateDisclosure(cq, outputs, verifiablePresentation, ldLoader)
63228
63308
  }
63229
63309
  let merklizedPath;
63230
63310
  try {
63231
- const p = `verifiableCredential.credentialSubject.${cq.fieldName}`;
63311
+ const p = `verifiableCredential.credentialSubject.${fieldName}`;
63232
63312
  merklizedPath = await Path.fromDocument(null, strVerifiablePresentation, p, {
63233
63313
  documentLoader: ldLoader
63234
63314
  });
63235
63315
  }
63236
63316
  catch (e) {
63237
- throw new Error(`can't build path to '${cq.fieldName}' key`);
63317
+ throw new Error(`can't build path to '${fieldName}' key`);
63238
63318
  }
63239
63319
  let proof;
63240
63320
  let value;
@@ -63242,18 +63322,49 @@ async function validateDisclosure(cq, outputs, verifiablePresentation, ldLoader)
63242
63322
  ({ proof, value } = await mz.proof(merklizedPath));
63243
63323
  }
63244
63324
  catch (e) {
63245
- throw new Error(`can't get value by path '${cq.fieldName}'`);
63325
+ throw new Error(`can't get value by path '${fieldName}'`);
63246
63326
  }
63247
63327
  if (!value) {
63248
- throw new Error(`can't get merkle value for field '${cq.fieldName}'`);
63328
+ throw new Error(`can't get merkle value for field '${fieldName}'`);
63249
63329
  }
63250
63330
  if (!proof.existence) {
63251
63331
  throw new Error(`path [${merklizedPath.parts}] doesn't exist in verifiablePresentation document`);
63252
63332
  }
63253
- const bi = await value.mtEntry();
63254
- if (bi !== outputs.value[0]) {
63255
- throw new Error(`value that was used is not equal to requested in query`);
63256
- }
63333
+ return await value.mtEntry();
63334
+ };
63335
+
63336
+ function calculateQueryHashV2(values, schema, slotIndex, operator, claimPathKey, claimPathNotExists) {
63337
+ const expValue = prepareCircuitArrayValues(values, 64);
63338
+ const valueHash = poseidon.spongeHashX(expValue, 6);
63339
+ return poseidon.hash([
63340
+ schema.bigInt(),
63341
+ BigInt(slotIndex),
63342
+ BigInt(operator),
63343
+ BigInt(claimPathKey),
63344
+ BigInt(claimPathNotExists),
63345
+ valueHash
63346
+ ]);
63347
+ }
63348
+ function calculateQueryHashV3(values, schema, slotIndex, operator, claimPathKey, valueArraySize, merklized, isRevocationChecked, verifierID, nullifierSessionID) {
63349
+ const expValue = prepareCircuitArrayValues(values, defaultValueArraySize);
63350
+ const valueHash = poseidon.spongeHashX(expValue, 6);
63351
+ const firstPartQueryHash = poseidon.hash([
63352
+ schema.bigInt(),
63353
+ BigInt(slotIndex),
63354
+ BigInt(operator),
63355
+ BigInt(claimPathKey),
63356
+ BigInt(merklized),
63357
+ valueHash
63358
+ ]);
63359
+ const queryHash = poseidon.hash([
63360
+ firstPartQueryHash,
63361
+ BigInt(valueArraySize),
63362
+ BigInt(isRevocationChecked),
63363
+ BigInt(verifierID),
63364
+ BigInt(nullifierSessionID),
63365
+ 0n
63366
+ ]);
63367
+ return queryHash;
63257
63368
  }
63258
63369
 
63259
63370
  const userStateError = new Error(`user state is not valid`);
@@ -63353,7 +63464,6 @@ class PubSignalsVerifier {
63353
63464
  timestamp: v3PubSignals.timestamp,
63354
63465
  merklized: v3PubSignals.merklized,
63355
63466
  claimPathKey: v3PubSignals.claimPathKey,
63356
- claimPathNotExists: v3PubSignals.claimPathNotExists,
63357
63467
  valueArraySize: v3PubSignals.getValueArrSize(),
63358
63468
  isRevocationChecked: v3PubSignals.isRevocationChecked
63359
63469
  };
@@ -63430,7 +63540,7 @@ class PubSignalsVerifier {
63430
63540
  this.verifyIdOwnership(sender, challenge);
63431
63541
  return new BaseConfig();
63432
63542
  };
63433
- this.linkedMultiQuery10Verify = async ({ query, pubSignals }) => {
63543
+ this.linkedMultiQuery10Verify = async ({ query, verifiablePresentation, pubSignals }) => {
63434
63544
  let multiQueryPubSignals = new LinkedMultiQueryPubSignals();
63435
63545
  multiQueryPubSignals = multiQueryPubSignals.pubSignalsUnmarshal(byteEncoder.encode(JSON.stringify(pubSignals)));
63436
63546
  // verify query
@@ -63444,26 +63554,41 @@ class PubSignalsVerifier {
63444
63554
  }
63445
63555
  const ldContextJSON = JSON.stringify(schema);
63446
63556
  const credentialSubject = query.credentialSubject;
63447
- const schemaId = await Path.getTypeIDFromContext(JSON.stringify(schema), query.type || '', ldOpts);
63448
- const schemaHash = caclulateCoreSchemaHash(byteEncoder.encode(schemaId));
63557
+ const schemaId = await Path.getTypeIDFromContext(ldContextJSON, query.type || '', ldOpts);
63558
+ const schemaHash = calculateCoreSchemaHash(byteEncoder.encode(schemaId));
63449
63559
  const queriesMetadata = await parseQueriesMetadata(query.type || '', ldContextJSON, credentialSubject, ldOpts);
63450
- const queryHashes = queriesMetadata.map((queryMeta) => {
63451
- const valueHash = poseidon.spongeHashX(queryMeta.values, 6);
63452
- return poseidon.hash([
63453
- schemaHash.bigInt(),
63454
- BigInt(queryMeta.slotIndex),
63455
- BigInt(queryMeta.operator),
63456
- BigInt(queryMeta.claimPathKey),
63457
- queryMeta.merklizedSchema ? 0n : 1n,
63458
- valueHash
63459
- ]);
63460
- });
63461
- const circuitQueryHashes = multiQueryPubSignals.circuitQueryHash
63462
- .filter((i) => i !== 0n)
63463
- .sort(bigIntCompare);
63464
- queryHashes.sort(bigIntCompare);
63465
- if (!queryHashes.every((queryHash, i) => queryHash === circuitQueryHashes[i])) {
63466
- throw new Error('query hashes do not match');
63560
+ const request = [];
63561
+ const merklized = queriesMetadata[0]?.merklizedSchema ? 1 : 0;
63562
+ for (let i = 0; i < LinkedMultiQueryInputs.queryCount; i++) {
63563
+ const queryMeta = queriesMetadata[i];
63564
+ const values = queryMeta?.values ?? [];
63565
+ const valArrSize = values.length;
63566
+ const queryHash = calculateQueryHashV3(values, schemaHash, queryMeta?.slotIndex ?? 0, queryMeta?.operator ?? 0, queryMeta?.claimPathKey.toString() ?? 0, valArrSize, merklized, 0, 0, 0);
63567
+ request.push({ queryHash, queryMeta });
63568
+ }
63569
+ const queryHashCompare = (a, b) => {
63570
+ if (a.queryHash < b.queryHash)
63571
+ return -1;
63572
+ if (a.queryHash > b.queryHash)
63573
+ return 1;
63574
+ return 0;
63575
+ };
63576
+ const pubSignalsMeta = multiQueryPubSignals.circuitQueryHash.map((queryHash, index) => ({
63577
+ queryHash,
63578
+ operatorOutput: multiQueryPubSignals.operatorOutput[index]
63579
+ }));
63580
+ pubSignalsMeta.sort(queryHashCompare);
63581
+ request.sort(queryHashCompare);
63582
+ for (let i = 0; i < LinkedMultiQueryInputs.queryCount; i++) {
63583
+ if (request[i].queryHash != pubSignalsMeta[i].queryHash) {
63584
+ throw new Error('query hashes do not match');
63585
+ }
63586
+ if (request[i].queryMeta?.operator === Operators.SD) {
63587
+ const disclosedValue = await fieldValueFromVerifiablePresentation(request[i].queryMeta.fieldName, verifiablePresentation, this._documentLoader);
63588
+ if (disclosedValue != pubSignalsMeta[i].operatorOutput) {
63589
+ throw new Error('disclosed value is not in the proof outputs');
63590
+ }
63591
+ }
63467
63592
  }
63468
63593
  return multiQueryPubSignals;
63469
63594
  };
@@ -64432,6 +64557,86 @@ class JWSPacker {
64432
64557
  }
64433
64558
  }
64434
64559
 
64560
+ /**
64561
+ * Groups the ZeroKnowledgeProofRequest objects based on their groupId.
64562
+ * Returns a Map where the key is the groupId and the value is an object containing the query and linkNonce.
64563
+ *
64564
+ * @param requestScope - An array of ZeroKnowledgeProofRequest objects.
64565
+ * @returns A Map<number, { query: JSONObject; linkNonce: number }> representing the grouped queries.
64566
+ */
64567
+ const getGroupedQueries = (requestScope) => requestScope.reduce((acc, proofReq) => {
64568
+ const groupId = proofReq.query.groupId;
64569
+ if (!groupId) {
64570
+ return acc;
64571
+ }
64572
+ const existedData = acc.get(groupId);
64573
+ if (!existedData) {
64574
+ const seed = getRandomBytes(12);
64575
+ const dataView = new DataView(seed.buffer);
64576
+ const linkNonce = dataView.getUint32(0);
64577
+ acc.set(groupId, { query: proofReq.query, linkNonce });
64578
+ return acc;
64579
+ }
64580
+ const credentialSubject = mergeObjects(existedData.query.credentialSubject, proofReq.query.credentialSubject);
64581
+ acc.set(groupId, {
64582
+ ...existedData,
64583
+ query: {
64584
+ skipClaimRevocationCheck: existedData.query.skipClaimRevocationCheck || proofReq.query.skipClaimRevocationCheck,
64585
+ ...existedData.query,
64586
+ credentialSubject
64587
+ }
64588
+ });
64589
+ return acc;
64590
+ }, new Map());
64591
+ /**
64592
+ * Processes zero knowledge proof requests.
64593
+ *
64594
+ * @param senderIdentifier - The identifier of the sender.
64595
+ * @param requests - An array of zero knowledge proof requests.
64596
+ * @param from - The identifier of the sender.
64597
+ * @param proofService - The proof service.
64598
+ * @param opts - Additional options for processing the requests.
64599
+ * @returns A promise that resolves to an array of zero knowledge proof responses.
64600
+ */
64601
+ const processZeroKnowledgeProofRequests = async (senderIdentifier, requests, from, proofService, opts) => {
64602
+ const requestScope = requests ?? [];
64603
+ const combinedQueries = getGroupedQueries(requestScope);
64604
+ const groupedCredentialsCache = new Map();
64605
+ const zkpResponses = [];
64606
+ for (const proofReq of requestScope) {
64607
+ if (!opts.supportedCircuits.includes(proofReq.circuitId)) {
64608
+ throw new Error(`Circuit ${proofReq.circuitId} is not allowed`);
64609
+ }
64610
+ const query = proofReq.query;
64611
+ const groupId = query.groupId;
64612
+ const combinedQueryData = combinedQueries.get(groupId);
64613
+ if (groupId) {
64614
+ if (!combinedQueryData) {
64615
+ throw new Error(`Invalid group id ${query.groupId}`);
64616
+ }
64617
+ const combinedQuery = combinedQueryData.query;
64618
+ if (!groupedCredentialsCache.has(groupId)) {
64619
+ const credWithRevStatus = await proofService.findCredentialByProofQuery(senderIdentifier, combinedQueryData.query);
64620
+ if (!credWithRevStatus.cred) {
64621
+ throw new Error(`Credential not found for query ${JSON.stringify(combinedQuery)}`);
64622
+ }
64623
+ groupedCredentialsCache.set(groupId, credWithRevStatus);
64624
+ }
64625
+ }
64626
+ const credWithRevStatus = groupedCredentialsCache.get(groupId);
64627
+ const zkpRes = await proofService.generateProof(proofReq, senderIdentifier, {
64628
+ verifierDid: from,
64629
+ challenge: opts.challenge,
64630
+ skipRevocation: Boolean(query.skipClaimRevocationCheck),
64631
+ credential: credWithRevStatus?.cred,
64632
+ credentialRevocationStatus: credWithRevStatus?.revStatus,
64633
+ linkNonce: combinedQueryData?.linkNonce ? BigInt(combinedQueryData.linkNonce) : undefined
64634
+ });
64635
+ zkpResponses.push(zkpRes);
64636
+ }
64637
+ return zkpResponses;
64638
+ };
64639
+
64435
64640
  /**
64436
64641
  * createAuthorizationRequest is a function to create protocol authorization request
64437
64642
  * @param {string} reason - reason to request proof
@@ -64486,6 +64691,12 @@ class AuthHandler {
64486
64691
  constructor(_packerMgr, _proofService) {
64487
64692
  this._packerMgr = _packerMgr;
64488
64693
  this._proofService = _proofService;
64694
+ this._supportedCircuits = [
64695
+ CircuitId.AtomicQueryV3,
64696
+ CircuitId.AtomicQuerySigV2,
64697
+ CircuitId.AtomicQueryMTPV2,
64698
+ CircuitId.LinkedMultiQuery10
64699
+ ];
64489
64700
  }
64490
64701
  /**
64491
64702
  * @inheritdoc IAuthHandler#parseAuthorizationRequest
@@ -64520,6 +64731,11 @@ class AuthHandler {
64520
64731
  did = DID.parse(authRequest.to);
64521
64732
  }
64522
64733
  const guid = v4();
64734
+ if (!authRequest.from) {
64735
+ throw new Error('auth request should contain from field');
64736
+ }
64737
+ const from = DID.parse(authRequest.from);
64738
+ const responseScope = await processZeroKnowledgeProofRequests(did, authRequest?.body.scope, from, this._proofService, { ...opts, supportedCircuits: this._supportedCircuits });
64523
64739
  const authResponse = {
64524
64740
  id: guid,
64525
64741
  typ: opts.mediaType,
@@ -64527,64 +64743,11 @@ class AuthHandler {
64527
64743
  thid: authRequest.thid ?? guid,
64528
64744
  body: {
64529
64745
  message: authRequest?.body?.message,
64530
- scope: []
64746
+ scope: responseScope
64531
64747
  },
64532
64748
  from: did.string(),
64533
64749
  to: authRequest.from
64534
64750
  };
64535
- const requestScope = authRequest.body.scope;
64536
- const combinedQueries = requestScope.reduce((acc, proofReq) => {
64537
- const groupId = proofReq.query.groupId;
64538
- if (!groupId) {
64539
- return acc;
64540
- }
64541
- const existedData = acc.get(groupId);
64542
- if (!existedData) {
64543
- const seed = getRandomBytes(12);
64544
- const dataView = new DataView(seed.buffer);
64545
- const linkNonce = dataView.getUint32(0);
64546
- acc.set(groupId, { query: proofReq.query, linkNonce });
64547
- return acc;
64548
- }
64549
- const credentialSubject = mergeObjects(existedData.query.credentialSubject, proofReq.query.credentialSubject);
64550
- acc.set(groupId, {
64551
- ...existedData,
64552
- query: {
64553
- skipClaimRevocationCheck: existedData.query.skipClaimRevocationCheck || proofReq.query.skipClaimRevocationCheck,
64554
- ...existedData.query,
64555
- credentialSubject
64556
- }
64557
- });
64558
- return acc;
64559
- }, new Map());
64560
- const groupedCredentialsCache = new Map();
64561
- for (const proofReq of requestScope) {
64562
- const query = proofReq.query;
64563
- const groupId = query.groupId;
64564
- const combinedQueryData = combinedQueries.get(groupId);
64565
- if (groupId) {
64566
- if (!combinedQueryData) {
64567
- throw new Error(`Invalid group id ${query.groupId}`);
64568
- }
64569
- const combinedQuery = combinedQueryData.query;
64570
- if (!groupedCredentialsCache.has(groupId)) {
64571
- const credWithRevStatus = await this._proofService.findCredentialByProofQuery(did, combinedQueryData.query);
64572
- if (!credWithRevStatus.cred) {
64573
- throw new Error(`Credential not found for query ${JSON.stringify(combinedQuery)}`);
64574
- }
64575
- groupedCredentialsCache.set(groupId, credWithRevStatus);
64576
- }
64577
- }
64578
- const credWithRevStatus = groupedCredentialsCache.get(groupId);
64579
- const zkpRes = await this._proofService.generateProof(proofReq, did, {
64580
- verifierDid: DID.parse(authRequest.from),
64581
- skipRevocation: Boolean(query.skipClaimRevocationCheck),
64582
- credential: credWithRevStatus?.cred,
64583
- credentialRevocationStatus: credWithRevStatus?.revStatus,
64584
- linkNonce: combinedQueryData?.linkNonce ? BigInt(combinedQueryData.linkNonce) : undefined
64585
- });
64586
- authResponse.body.scope.push(zkpRes);
64587
- }
64588
64751
  const msgBytes = byteEncoder.encode(JSON.stringify(authResponse));
64589
64752
  const packerOpts = opts.mediaType === MediaType.SignedMessage
64590
64753
  ? opts.packerOptions
@@ -64853,7 +65016,7 @@ class ContractRequestHandler {
64853
65016
  this._packerMgr = _packerMgr;
64854
65017
  this._proofService = _proofService;
64855
65018
  this._zkpVerifier = _zkpVerifier;
64856
- this._allowedCircuits = [
65019
+ this._supportedCircuits = [
64857
65020
  CircuitId.AtomicQueryMTPV2OnChain,
64858
65021
  CircuitId.AtomicQuerySigV2OnChain,
64859
65022
  CircuitId.AtomicQueryV3OnChain
@@ -64890,33 +65053,14 @@ class ContractRequestHandler {
64890
65053
  if (!opts.ethSigner) {
64891
65054
  throw new Error("Can't sign transaction. Provide Signer in options.");
64892
65055
  }
64893
- const zkRequests = [];
64894
- const { contract_address, chain_id } = ciRequest.body.transaction_data;
65056
+ const { chain_id } = ciRequest.body.transaction_data;
64895
65057
  const networkFlag = Object.keys(ChainIds).find((key) => ChainIds[key] === chain_id);
64896
65058
  if (!networkFlag) {
64897
65059
  throw new Error(`Invalid chain id ${chain_id}`);
64898
65060
  }
64899
- const [blockchain, networkId] = networkFlag.split(':');
64900
- const verifierId = buildVerifierId(contract_address, {
64901
- blockchain,
64902
- networkId,
64903
- // DidMethod.Iden3 is used based on discussions: all onchain issuers have iden3 did method by default. This can be changed in the release of v3 circuit.
64904
- method: DidMethod.Iden3
64905
- });
64906
- const verifierDid = DID.parseFromId(verifierId);
64907
- for (const proofReq of ciRequest.body.scope) {
64908
- if (!this._allowedCircuits.includes(proofReq.circuitId)) {
64909
- throw new Error(`Can't handle circuit ${proofReq.circuitId}. Only onchain circuits are allowed.`);
64910
- }
64911
- const query = proofReq.query;
64912
- const zkpRes = await this._proofService.generateProof(proofReq, did, {
64913
- skipRevocation: query.skipClaimRevocationCheck ?? false,
64914
- challenge: opts.challenge,
64915
- verifierDid
64916
- });
64917
- zkRequests.push(zkpRes);
64918
- }
64919
- return this._zkpVerifier.submitZKPResponse(opts.ethSigner, ciRequest.body.transaction_data, zkRequests);
65061
+ const verifierDid = ciRequest.from ? DID.parse(ciRequest.from) : undefined;
65062
+ const zkpResponses = await processZeroKnowledgeProofRequests(did, ciRequest?.body?.scope, verifierDid, this._proofService, { ...opts, supportedCircuits: this._supportedCircuits });
65063
+ return this._zkpVerifier.submitZKPResponse(opts.ethSigner, ciRequest.body.transaction_data, zkpResponses);
64920
65064
  }
64921
65065
  }
64922
65066
 
@@ -64985,5 +65129,92 @@ class RefreshHandler {
64985
65129
  }
64986
65130
  }
64987
65131
 
64988
- export { 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, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DataPrepareHandlerFunc, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, 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, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes, base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58, bytesToBase64, bytesToBase64url, bytesToHex$1 as bytesToHex, cacheLoader, caclulateCoreSchemaHash, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$1 as hexToBytes, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, pushHashesToRHS, resolveDIDDocumentAuth, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateTreeState, witnessBuilder };
65132
+ /**
65133
+ *
65134
+ * Allows to process RevocationStatusRequest protocol message
65135
+ *
65136
+
65137
+ * @class RevocationStatusHandler
65138
+ * @implements implements IRevocationStatusHandler interface
65139
+ */
65140
+ class RevocationStatusHandler {
65141
+ /**
65142
+ * Creates an instance of RevocationStatusHandler.
65143
+ * @param {IPackageManager} _packerMgr - package manager to unpack message envelope
65144
+ * @param {IIdentityWallet} _identityWallet - identity wallet
65145
+ *
65146
+ */
65147
+ constructor(_packerMgr, _identityWallet) {
65148
+ this._packerMgr = _packerMgr;
65149
+ this._identityWallet = _identityWallet;
65150
+ }
65151
+ /**
65152
+ * @inheritdoc IRevocationStatusHandler#parseRevocationStatusRequest
65153
+ */
65154
+ async parseRevocationStatusRequest(request) {
65155
+ const { unpackedMessage: message } = await this._packerMgr.unpack(request);
65156
+ const ciRequest = message;
65157
+ if (message.type !== PROTOCOL_MESSAGE_TYPE.REVOCATION_STATUS_REQUEST_MESSAGE_TYPE) {
65158
+ throw new Error('Invalid media type');
65159
+ }
65160
+ return ciRequest;
65161
+ }
65162
+ /**
65163
+ * @inheritdoc IRevocationStatusHandler#handleRevocationStatusRequest
65164
+ */
65165
+ async handleRevocationStatusRequest(did, request, opts) {
65166
+ if (!opts) {
65167
+ opts = {
65168
+ mediaType: MediaType.PlainMessage
65169
+ };
65170
+ }
65171
+ if (opts.mediaType === MediaType.SignedMessage && !opts.packerOptions) {
65172
+ throw new Error(`jws packer options are required for ${MediaType.SignedMessage}`);
65173
+ }
65174
+ const rsRequest = await this.parseRevocationStatusRequest(request);
65175
+ if (!rsRequest.to) {
65176
+ throw new Error(`failed request. empty 'to' field`);
65177
+ }
65178
+ if (!rsRequest.from) {
65179
+ throw new Error(`failed request. empty 'from' field`);
65180
+ }
65181
+ if (!rsRequest.body?.revocation_nonce) {
65182
+ throw new Error(`failed request. empty 'revocation_nonce' field`);
65183
+ }
65184
+ const issuerDID = DID.parse(rsRequest.to);
65185
+ const mtpWithTreeState = await this._identityWallet.generateNonRevocationMtpWithNonce(issuerDID, BigInt(rsRequest.body.revocation_nonce), opts?.treeState);
65186
+ const treeState = mtpWithTreeState.treeState;
65187
+ const revStatus = {
65188
+ issuer: {
65189
+ state: treeState?.state.string(),
65190
+ claimsTreeRoot: treeState.claimsRoot.string(),
65191
+ revocationTreeRoot: treeState.revocationRoot.string(),
65192
+ rootOfRoots: treeState.rootOfRoots.string()
65193
+ },
65194
+ mtp: mtpWithTreeState.proof
65195
+ };
65196
+ const packerOpts = opts.mediaType === MediaType.SignedMessage
65197
+ ? opts.packerOptions
65198
+ : {
65199
+ provingMethodAlg: proving.provingMethodGroth16AuthV2Instance.methodAlg
65200
+ };
65201
+ const senderDID = DID.parse(rsRequest.to);
65202
+ const guid = v4();
65203
+ const response = {
65204
+ id: guid,
65205
+ typ: MediaType.PlainMessage,
65206
+ type: PROTOCOL_MESSAGE_TYPE.REVOCATION_STATUS_RESPONSE_MESSAGE_TYPE,
65207
+ thid: rsRequest.thid ?? guid,
65208
+ body: revStatus,
65209
+ from: did.string(),
65210
+ to: rsRequest.from
65211
+ };
65212
+ return this._packerMgr.pack(opts.mediaType, byteEncoder.encode(JSON.stringify(response)), {
65213
+ senderDID,
65214
+ ...packerOpts
65215
+ });
65216
+ }
65217
+ }
65218
+
65219
+ export { 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, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DataPrepareHandlerFunc, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, 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, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, RevocationStatusHandler, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes, base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58, bytesToBase64, bytesToBase64url, bytesToHex$1 as bytesToHex, cacheLoader, calculateCoreSchemaHash, calculateQueryHashV2, calculateQueryHashV3, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fieldValueFromVerifiablePresentation, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$1 as hexToBytes, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, processZeroKnowledgeProofRequests, pushHashesToRHS, resolveDIDDocumentAuth, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateTreeState, witnessBuilder };
64989
65220
  //# sourceMappingURL=index.js.map