@zkpassport/sdk 0.2.12 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -411,7 +411,11 @@ class ZKPassport {
411
411
  let commitmentOut;
412
412
  let isCorrect = true;
413
413
  let uniqueIdentifier;
414
- const expectedMerkleRoot = BigInt("21301853597069384763054217328384418971999152625381818922211526730996340553696");
414
+ const VALID_CERTIFICATE_REGISTRY_ROOT = [
415
+ BigInt("20192042006788880778219739574377003123593792072535937278552252195461520776494"),
416
+ BigInt("21301853597069384763054217328384418971999152625381818922211526730996340553696"),
417
+ BigInt("10839898448097753834842514286432152806152415606387598803678317315409344029817"),
418
+ ];
415
419
  const defaultDateValue = new Date(1111, 10, 11);
416
420
  const currentTime = new Date();
417
421
  const today = new Date(currentTime.getFullYear(), currentTime.getMonth(), currentTime.getDate(), 0, 0, 0, 0);
@@ -459,11 +463,11 @@ class ZKPassport {
459
463
  if (proof.name?.startsWith("sig_check_dsc")) {
460
464
  commitmentOut = (0, utils_1.getCommitmentFromDSCProof)(proofData);
461
465
  const merkleRoot = (0, utils_1.getMerkleRootFromDSCProof)(proofData);
462
- if (merkleRoot !== expectedMerkleRoot) {
466
+ if (!VALID_CERTIFICATE_REGISTRY_ROOT.includes(merkleRoot)) {
463
467
  console.warn("The ID was signed by an unrecognized root certificate");
464
468
  isCorrect = false;
465
469
  queryResultErrors.sig_check_dsc.certificate = {
466
- expected: `Certificate registry root: ${expectedMerkleRoot.toString()}`,
470
+ expected: `Certificate registry root: ${VALID_CERTIFICATE_REGISTRY_ROOT.join(", ")}`,
467
471
  received: `Certificate registry root: ${merkleRoot.toString()}`,
468
472
  message: "The ID was signed by an unrecognized root certificate",
469
473
  };
package/dist/esm/index.js CHANGED
@@ -401,7 +401,11 @@ export class ZKPassport {
401
401
  let commitmentOut;
402
402
  let isCorrect = true;
403
403
  let uniqueIdentifier;
404
- const expectedMerkleRoot = BigInt("21301853597069384763054217328384418971999152625381818922211526730996340553696");
404
+ const VALID_CERTIFICATE_REGISTRY_ROOT = [
405
+ BigInt("20192042006788880778219739574377003123593792072535937278552252195461520776494"),
406
+ BigInt("21301853597069384763054217328384418971999152625381818922211526730996340553696"),
407
+ BigInt("10839898448097753834842514286432152806152415606387598803678317315409344029817"),
408
+ ];
405
409
  const defaultDateValue = new Date(1111, 10, 11);
406
410
  const currentTime = new Date();
407
411
  const today = new Date(currentTime.getFullYear(), currentTime.getMonth(), currentTime.getDate(), 0, 0, 0, 0);
@@ -449,11 +453,11 @@ export class ZKPassport {
449
453
  if (proof.name?.startsWith("sig_check_dsc")) {
450
454
  commitmentOut = getCommitmentFromDSCProof(proofData);
451
455
  const merkleRoot = getMerkleRootFromDSCProof(proofData);
452
- if (merkleRoot !== expectedMerkleRoot) {
456
+ if (!VALID_CERTIFICATE_REGISTRY_ROOT.includes(merkleRoot)) {
453
457
  console.warn("The ID was signed by an unrecognized root certificate");
454
458
  isCorrect = false;
455
459
  queryResultErrors.sig_check_dsc.certificate = {
456
- expected: `Certificate registry root: ${expectedMerkleRoot.toString()}`,
460
+ expected: `Certificate registry root: ${VALID_CERTIFICATE_REGISTRY_ROOT.join(", ")}`,
457
461
  received: `Certificate registry root: ${merkleRoot.toString()}`,
458
462
  message: "The ID was signed by an unrecognized root certificate",
459
463
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zkpassport/sdk",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "Privacy-preserving identity verification using passports and ID cards",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -41,7 +41,7 @@
41
41
  "@aztec/bb.js": "^0.76.4",
42
42
  "@noble/ciphers": "^1.2.1",
43
43
  "@noble/secp256k1": "^2.2.3",
44
- "@zkpassport/utils": "^0.2.24",
44
+ "@zkpassport/utils": "^0.2.26",
45
45
  "buffer": "^6.0.3",
46
46
  "i18n-iso-countries": "^7.12.0",
47
47
  "pako": "^2.1.0",
package/src/index.ts CHANGED
@@ -738,9 +738,11 @@ export class ZKPassport {
738
738
  let commitmentOut: bigint | undefined
739
739
  let isCorrect = true
740
740
  let uniqueIdentifier: string | undefined
741
- const expectedMerkleRoot = BigInt(
742
- "21301853597069384763054217328384418971999152625381818922211526730996340553696",
743
- )
741
+ const VALID_CERTIFICATE_REGISTRY_ROOT = [
742
+ BigInt("20192042006788880778219739574377003123593792072535937278552252195461520776494"),
743
+ BigInt("21301853597069384763054217328384418971999152625381818922211526730996340553696"),
744
+ BigInt("10839898448097753834842514286432152806152415606387598803678317315409344029817"),
745
+ ]
744
746
  const defaultDateValue = new Date(1111, 10, 11)
745
747
  const currentTime = new Date()
746
748
  const today = new Date(
@@ -798,11 +800,11 @@ export class ZKPassport {
798
800
  if (proof.name?.startsWith("sig_check_dsc")) {
799
801
  commitmentOut = getCommitmentFromDSCProof(proofData)
800
802
  const merkleRoot = getMerkleRootFromDSCProof(proofData)
801
- if (merkleRoot !== expectedMerkleRoot) {
803
+ if (!VALID_CERTIFICATE_REGISTRY_ROOT.includes(merkleRoot)) {
802
804
  console.warn("The ID was signed by an unrecognized root certificate")
803
805
  isCorrect = false
804
806
  queryResultErrors.sig_check_dsc.certificate = {
805
- expected: `Certificate registry root: ${expectedMerkleRoot.toString()}`,
807
+ expected: `Certificate registry root: ${VALID_CERTIFICATE_REGISTRY_ROOT.join(", ")}`,
806
808
  received: `Certificate registry root: ${merkleRoot.toString()}`,
807
809
  message: "The ID was signed by an unrecognized root certificate",
808
810
  }