@zkpassport/sdk 0.9.1 → 0.11.0-beta.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.
- package/dist/cjs/constants.cjs +1 -1
- package/dist/cjs/constants.d.cts +1 -1
- package/dist/cjs/index.cjs +260 -115
- package/dist/cjs/public-input-checker.cjs +167 -47
- package/dist/cjs/public-input-checker.d.cts +1 -0
- package/dist/cjs/solidity-verifier.cjs +79 -56
- package/dist/esm/{chunk-OOHOBXGU.js → chunk-6FIXE2II.js} +169 -49
- package/dist/esm/chunk-7UUZHRZ3.js +2564 -0
- package/dist/esm/{chunk-VJZDMGW3.js → chunk-JG37KYXW.js} +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/index.js +16 -14
- package/dist/esm/public-input-checker.d.ts +1 -0
- package/dist/esm/public-input-checker.js +2 -2
- package/dist/esm/solidity-verifier.js +2 -2
- package/package.json +5 -5
- package/dist/esm/chunk-OTQ7QDA2.js +0 -2541
|
@@ -967,12 +967,6 @@ var PublicInputChecker = class {
|
|
|
967
967
|
};
|
|
968
968
|
}
|
|
969
969
|
const EXPECTED_ENVIRONMENT = "production";
|
|
970
|
-
console.log("facematchCommittedInputs.environment", facematchCommittedInputs.environment);
|
|
971
|
-
console.log("EXPECTED_ENVIRONMENT", EXPECTED_ENVIRONMENT);
|
|
972
|
-
console.log(
|
|
973
|
-
"facematchCommittedInputs.environment !== EXPECTED_ENVIRONMENT",
|
|
974
|
-
facematchCommittedInputs.environment !== EXPECTED_ENVIRONMENT
|
|
975
|
-
);
|
|
976
970
|
if (facematchCommittedInputs.environment !== EXPECTED_ENVIRONMENT) {
|
|
977
971
|
console.warn("Invalid facematch environment, it should be production");
|
|
978
972
|
isCorrect = false;
|
|
@@ -985,7 +979,7 @@ var PublicInputChecker = class {
|
|
|
985
979
|
}
|
|
986
980
|
};
|
|
987
981
|
}
|
|
988
|
-
if (facematchCommittedInputs.
|
|
982
|
+
if (facematchCommittedInputs.appIdHash !== ZKPASSPORT_IOS_APP_ID_HASH && facematchCommittedInputs.appIdHash !== ZKPASSPORT_ANDROID_APP_ID_HASH) {
|
|
989
983
|
console.warn(
|
|
990
984
|
"Invalid facematch app id hash, the attestation should be coming from the ZKPassport app"
|
|
991
985
|
);
|
|
@@ -994,7 +988,7 @@ var PublicInputChecker = class {
|
|
|
994
988
|
...queryResultErrors.facematch,
|
|
995
989
|
eq: {
|
|
996
990
|
expected: `${ZKPASSPORT_IOS_APP_ID_HASH} (iOS) or ${ZKPASSPORT_ANDROID_APP_ID_HASH} (Android)`,
|
|
997
|
-
received: facematchCommittedInputs.
|
|
991
|
+
received: facematchCommittedInputs.appIdHash,
|
|
998
992
|
message: "Invalid facematch app id hash, the attestation should be coming from the ZKPassport app"
|
|
999
993
|
}
|
|
1000
994
|
};
|
|
@@ -1002,6 +996,36 @@ var PublicInputChecker = class {
|
|
|
1002
996
|
}
|
|
1003
997
|
return { isCorrect, queryResultErrors };
|
|
1004
998
|
}
|
|
999
|
+
static async checkCurrentDate(circuitName, proofData, validity, queryResultErrors) {
|
|
1000
|
+
const currentTime = /* @__PURE__ */ new Date();
|
|
1001
|
+
const today = new Date(
|
|
1002
|
+
currentTime.getFullYear(),
|
|
1003
|
+
currentTime.getMonth(),
|
|
1004
|
+
currentTime.getDate(),
|
|
1005
|
+
0,
|
|
1006
|
+
0,
|
|
1007
|
+
0,
|
|
1008
|
+
0
|
|
1009
|
+
);
|
|
1010
|
+
const currentDate = (0, import_utils.getCurrentDateFromDisclosureProof)(proofData);
|
|
1011
|
+
const todayToCurrentDate = today.getTime() - currentDate.getTime();
|
|
1012
|
+
const expectedDifference = validity ? validity * 1e3 : DEFAULT_VALIDITY * 1e3;
|
|
1013
|
+
const actualDifference = today.getTime() - (today.getTime() - expectedDifference);
|
|
1014
|
+
let isCorrect = true;
|
|
1015
|
+
if (todayToCurrentDate >= actualDifference) {
|
|
1016
|
+
console.warn("The date used to check the validity of the ID falls out of the validity period");
|
|
1017
|
+
isCorrect = false;
|
|
1018
|
+
if (!queryResultErrors[circuitName]) {
|
|
1019
|
+
queryResultErrors[circuitName] = {};
|
|
1020
|
+
}
|
|
1021
|
+
queryResultErrors[circuitName].date = {
|
|
1022
|
+
expected: `Difference: ${validity} seconds`,
|
|
1023
|
+
received: `Difference: ${Math.round(todayToCurrentDate / 1e3)} seconds`,
|
|
1024
|
+
message: "The date used to check the validity of the ID falls out of the validity period"
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
return { isCorrect, queryResultErrors };
|
|
1028
|
+
}
|
|
1005
1029
|
static async checkPublicInputs(domain, proofs, queryResult, validity, scope) {
|
|
1006
1030
|
let commitmentIn;
|
|
1007
1031
|
let commitmentOut;
|
|
@@ -1130,14 +1154,9 @@ var PublicInputChecker = class {
|
|
|
1130
1154
|
if (!!committedInputs?.compare_age || !!committedInputs?.compare_age_evm) {
|
|
1131
1155
|
const ageCommittedInputs = committedInputs?.compare_age ?? committedInputs?.compare_age_evm;
|
|
1132
1156
|
const ageParameterCommitment = isForEVM ? await (0, import_utils.getAgeEVMParameterCommitment)(
|
|
1133
|
-
ageCommittedInputs.currentDateTimestamp,
|
|
1134
|
-
ageCommittedInputs.minAge,
|
|
1135
|
-
ageCommittedInputs.maxAge
|
|
1136
|
-
) : await (0, import_utils.getAgeParameterCommitment)(
|
|
1137
|
-
ageCommittedInputs.currentDateTimestamp,
|
|
1138
1157
|
ageCommittedInputs.minAge,
|
|
1139
1158
|
ageCommittedInputs.maxAge
|
|
1140
|
-
);
|
|
1159
|
+
) : await (0, import_utils.getAgeParameterCommitment)(ageCommittedInputs.minAge, ageCommittedInputs.maxAge);
|
|
1141
1160
|
if (!paramCommitments.includes(ageParameterCommitment)) {
|
|
1142
1161
|
console.warn("This proof does not verify the age");
|
|
1143
1162
|
isCorrect = false;
|
|
@@ -1161,16 +1180,12 @@ var PublicInputChecker = class {
|
|
|
1161
1180
|
const birthdateCommittedInputs = committedInputs?.compare_birthdate ?? committedInputs?.compare_birthdate_evm;
|
|
1162
1181
|
const birthdateParameterCommitment = isForEVM ? await (0, import_utils.getDateEVMParameterCommitment)(
|
|
1163
1182
|
import_utils.ProofType.BIRTHDATE,
|
|
1164
|
-
birthdateCommittedInputs.currentDateTimestamp,
|
|
1165
1183
|
birthdateCommittedInputs.minDateTimestamp,
|
|
1166
|
-
birthdateCommittedInputs.maxDateTimestamp
|
|
1167
|
-
0
|
|
1184
|
+
birthdateCommittedInputs.maxDateTimestamp
|
|
1168
1185
|
) : await (0, import_utils.getDateParameterCommitment)(
|
|
1169
1186
|
import_utils.ProofType.BIRTHDATE,
|
|
1170
|
-
birthdateCommittedInputs.currentDateTimestamp,
|
|
1171
1187
|
birthdateCommittedInputs.minDateTimestamp,
|
|
1172
|
-
birthdateCommittedInputs.maxDateTimestamp
|
|
1173
|
-
0
|
|
1188
|
+
birthdateCommittedInputs.maxDateTimestamp
|
|
1174
1189
|
);
|
|
1175
1190
|
if (!paramCommitments.includes(birthdateParameterCommitment)) {
|
|
1176
1191
|
console.warn("This proof does not verify the birthdate");
|
|
@@ -1200,7 +1215,6 @@ var PublicInputChecker = class {
|
|
|
1200
1215
|
expiryCommittedInputs.maxDateTimestamp
|
|
1201
1216
|
) : await (0, import_utils.getDateParameterCommitment)(
|
|
1202
1217
|
import_utils.ProofType.EXPIRY_DATE,
|
|
1203
|
-
expiryCommittedInputs.currentDateTimestamp,
|
|
1204
1218
|
expiryCommittedInputs.minDateTimestamp,
|
|
1205
1219
|
expiryCommittedInputs.maxDateTimestamp
|
|
1206
1220
|
);
|
|
@@ -1404,7 +1418,11 @@ var PublicInputChecker = class {
|
|
|
1404
1418
|
if (!!committedInputs?.exclusion_check_sanctions || !!committedInputs?.exclusion_check_sanctions_evm) {
|
|
1405
1419
|
const sanctionsBuilder = await import_utils.SanctionsBuilder.create();
|
|
1406
1420
|
const exclusionCheckSanctionsCommittedInputs = committedInputs?.exclusion_check_sanctions ?? committedInputs?.exclusion_check_sanctions_evm;
|
|
1407
|
-
const exclusionCheckSanctionsParameterCommitment = isForEVM ? await sanctionsBuilder.getSanctionsEvmParameterCommitment(
|
|
1421
|
+
const exclusionCheckSanctionsParameterCommitment = isForEVM ? await sanctionsBuilder.getSanctionsEvmParameterCommitment(
|
|
1422
|
+
exclusionCheckSanctionsCommittedInputs.isStrict
|
|
1423
|
+
) : await sanctionsBuilder.getSanctionsParameterCommitment(
|
|
1424
|
+
exclusionCheckSanctionsCommittedInputs.isStrict
|
|
1425
|
+
);
|
|
1408
1426
|
if (!paramCommitments.includes(exclusionCheckSanctionsParameterCommitment)) {
|
|
1409
1427
|
console.warn("This proof does not verify the exclusion from the sanction lists");
|
|
1410
1428
|
isCorrect = false;
|
|
@@ -1436,12 +1454,12 @@ var PublicInputChecker = class {
|
|
|
1436
1454
|
const facematchParameterCommitment = isForEVM ? await (0, import_utils.getFacematchEvmParameterCommitment)(
|
|
1437
1455
|
BigInt(facematchCommittedInputs.rootKeyLeaf),
|
|
1438
1456
|
facematchCommittedInputs.environment === "development" ? 0n : 1n,
|
|
1439
|
-
BigInt(facematchCommittedInputs.
|
|
1457
|
+
BigInt(facematchCommittedInputs.appIdHash),
|
|
1440
1458
|
facematchCommittedInputs.mode === "regular" ? 1n : 2n
|
|
1441
1459
|
) : await (0, import_utils.getFacematchParameterCommitment)(
|
|
1442
1460
|
BigInt(facematchCommittedInputs.rootKeyLeaf),
|
|
1443
1461
|
facematchCommittedInputs.environment === "development" ? 0n : 1n,
|
|
1444
|
-
BigInt(facematchCommittedInputs.
|
|
1462
|
+
BigInt(facematchCommittedInputs.appIdHash),
|
|
1445
1463
|
facematchCommittedInputs.mode === "regular" ? 1n : 2n
|
|
1446
1464
|
);
|
|
1447
1465
|
if (!paramCommitments.includes(facematchParameterCommitment)) {
|
|
@@ -1513,24 +1531,6 @@ var PublicInputChecker = class {
|
|
|
1513
1531
|
};
|
|
1514
1532
|
}
|
|
1515
1533
|
commitmentOut = (0, import_utils.getCommitmentOutFromIntegrityProof)(proofData);
|
|
1516
|
-
const currentDate = (0, import_utils.getCurrentDateFromIntegrityProof)(proofData);
|
|
1517
|
-
const todayToCurrentDate = today.getTime() - currentDate.getTime();
|
|
1518
|
-
const expectedDifference = validity ? validity * 1e3 : DEFAULT_VALIDITY * 1e3;
|
|
1519
|
-
const actualDifference = today.getTime() - (today.getTime() - expectedDifference);
|
|
1520
|
-
if (todayToCurrentDate >= actualDifference) {
|
|
1521
|
-
console.warn(
|
|
1522
|
-
`The date used to check the validity of the ID is older than the validity period`
|
|
1523
|
-
);
|
|
1524
|
-
isCorrect = false;
|
|
1525
|
-
queryResultErrors.data_check_integrity = {
|
|
1526
|
-
...queryResultErrors.data_check_integrity,
|
|
1527
|
-
date: {
|
|
1528
|
-
expected: `Difference: ${validity} seconds`,
|
|
1529
|
-
received: `Difference: ${Math.round(todayToCurrentDate / 1e3)} seconds`,
|
|
1530
|
-
message: "The date used to check the validity of the ID is older than the validity period"
|
|
1531
|
-
}
|
|
1532
|
-
};
|
|
1533
|
-
}
|
|
1534
1534
|
} else if (proof.name === "disclose_bytes") {
|
|
1535
1535
|
commitmentIn = (0, import_utils.getCommitmentInFromDisclosureProof)(proofData);
|
|
1536
1536
|
if (commitmentIn !== commitmentOut) {
|
|
@@ -1583,6 +1583,17 @@ var PublicInputChecker = class {
|
|
|
1583
1583
|
...queryResultErrorsDisclose,
|
|
1584
1584
|
...queryResultErrorsScope
|
|
1585
1585
|
};
|
|
1586
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1587
|
+
"disclose",
|
|
1588
|
+
proofData,
|
|
1589
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1590
|
+
queryResultErrors
|
|
1591
|
+
);
|
|
1592
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1593
|
+
queryResultErrors = {
|
|
1594
|
+
...queryResultErrors,
|
|
1595
|
+
...queryResultErrorsCurrentDate
|
|
1596
|
+
};
|
|
1586
1597
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
1587
1598
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
1588
1599
|
} else if (proof.name === "compare_age") {
|
|
@@ -1604,7 +1615,6 @@ var PublicInputChecker = class {
|
|
|
1604
1615
|
const paramCommitment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
|
|
1605
1616
|
const committedInputs = proof.committedInputs?.compare_age;
|
|
1606
1617
|
const calculatedParamCommitment = await (0, import_utils.getAgeParameterCommitment)(
|
|
1607
|
-
committedInputs.currentDateTimestamp,
|
|
1608
1618
|
committedInputs.minAge,
|
|
1609
1619
|
committedInputs.maxAge
|
|
1610
1620
|
);
|
|
@@ -1630,6 +1640,17 @@ var PublicInputChecker = class {
|
|
|
1630
1640
|
...queryResultErrorsAge,
|
|
1631
1641
|
...queryResultErrorsScope
|
|
1632
1642
|
};
|
|
1643
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1644
|
+
"age",
|
|
1645
|
+
proofData,
|
|
1646
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1647
|
+
queryResultErrors
|
|
1648
|
+
);
|
|
1649
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1650
|
+
queryResultErrors = {
|
|
1651
|
+
...queryResultErrors,
|
|
1652
|
+
...queryResultErrorsCurrentDate
|
|
1653
|
+
};
|
|
1633
1654
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
1634
1655
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
1635
1656
|
} else if (proof.name === "compare_birthdate") {
|
|
@@ -1652,7 +1673,6 @@ var PublicInputChecker = class {
|
|
|
1652
1673
|
const committedInputs = proof.committedInputs?.compare_birthdate;
|
|
1653
1674
|
const calculatedParamCommitment = await (0, import_utils.getDateParameterCommitment)(
|
|
1654
1675
|
import_utils.ProofType.BIRTHDATE,
|
|
1655
|
-
committedInputs.currentDateTimestamp,
|
|
1656
1676
|
committedInputs.minDateTimestamp,
|
|
1657
1677
|
committedInputs.maxDateTimestamp,
|
|
1658
1678
|
0
|
|
@@ -1685,6 +1705,17 @@ var PublicInputChecker = class {
|
|
|
1685
1705
|
...queryResultErrorsBirthdate,
|
|
1686
1706
|
...queryResultErrorsScope
|
|
1687
1707
|
};
|
|
1708
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1709
|
+
"birthdate",
|
|
1710
|
+
proofData,
|
|
1711
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1712
|
+
queryResultErrors
|
|
1713
|
+
);
|
|
1714
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1715
|
+
queryResultErrors = {
|
|
1716
|
+
...queryResultErrors,
|
|
1717
|
+
...queryResultErrorsCurrentDate
|
|
1718
|
+
};
|
|
1688
1719
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
1689
1720
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
1690
1721
|
} else if (proof.name === "compare_expiry") {
|
|
@@ -1707,7 +1738,6 @@ var PublicInputChecker = class {
|
|
|
1707
1738
|
const committedInputs = proof.committedInputs?.compare_expiry;
|
|
1708
1739
|
const calculatedParamCommitment = await (0, import_utils.getDateParameterCommitment)(
|
|
1709
1740
|
import_utils.ProofType.EXPIRY_DATE,
|
|
1710
|
-
committedInputs.currentDateTimestamp,
|
|
1711
1741
|
committedInputs.minDateTimestamp,
|
|
1712
1742
|
committedInputs.maxDateTimestamp
|
|
1713
1743
|
);
|
|
@@ -1739,6 +1769,17 @@ var PublicInputChecker = class {
|
|
|
1739
1769
|
...queryResultErrorsExpiryDate,
|
|
1740
1770
|
...queryResultErrorsScope
|
|
1741
1771
|
};
|
|
1772
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1773
|
+
"expiry_date",
|
|
1774
|
+
proofData,
|
|
1775
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1776
|
+
queryResultErrors
|
|
1777
|
+
);
|
|
1778
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1779
|
+
queryResultErrors = {
|
|
1780
|
+
...queryResultErrors,
|
|
1781
|
+
...queryResultErrorsCurrentDate
|
|
1782
|
+
};
|
|
1742
1783
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
1743
1784
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
1744
1785
|
} else if (proof.name === "exclusion_check_nationality") {
|
|
@@ -1795,6 +1836,17 @@ var PublicInputChecker = class {
|
|
|
1795
1836
|
...queryResultErrorsNationalityExclusion,
|
|
1796
1837
|
...queryResultErrorsScope
|
|
1797
1838
|
};
|
|
1839
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1840
|
+
"nationality",
|
|
1841
|
+
proofData,
|
|
1842
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1843
|
+
queryResultErrors
|
|
1844
|
+
);
|
|
1845
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1846
|
+
queryResultErrors = {
|
|
1847
|
+
...queryResultErrors,
|
|
1848
|
+
...queryResultErrorsCurrentDate
|
|
1849
|
+
};
|
|
1798
1850
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
1799
1851
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
1800
1852
|
} else if (proof.name === "exclusion_check_issuing_country") {
|
|
@@ -1851,6 +1903,17 @@ var PublicInputChecker = class {
|
|
|
1851
1903
|
...queryResultErrorsIssuingCountryExclusion,
|
|
1852
1904
|
...queryResultErrorsScope
|
|
1853
1905
|
};
|
|
1906
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1907
|
+
"issuing_country",
|
|
1908
|
+
proofData,
|
|
1909
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1910
|
+
queryResultErrors
|
|
1911
|
+
);
|
|
1912
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1913
|
+
queryResultErrors = {
|
|
1914
|
+
...queryResultErrors,
|
|
1915
|
+
...queryResultErrorsCurrentDate
|
|
1916
|
+
};
|
|
1854
1917
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
1855
1918
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
1856
1919
|
} else if (proof.name === "inclusion_check_nationality") {
|
|
@@ -1907,6 +1970,17 @@ var PublicInputChecker = class {
|
|
|
1907
1970
|
...queryResultErrorsNationalityInclusion,
|
|
1908
1971
|
...queryResultErrorsScope
|
|
1909
1972
|
};
|
|
1973
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1974
|
+
"nationality",
|
|
1975
|
+
proofData,
|
|
1976
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1977
|
+
queryResultErrors
|
|
1978
|
+
);
|
|
1979
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1980
|
+
queryResultErrors = {
|
|
1981
|
+
...queryResultErrors,
|
|
1982
|
+
...queryResultErrorsCurrentDate
|
|
1983
|
+
};
|
|
1910
1984
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
1911
1985
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
1912
1986
|
} else if (proof.name === "inclusion_check_issuing_country") {
|
|
@@ -1963,6 +2037,17 @@ var PublicInputChecker = class {
|
|
|
1963
2037
|
...queryResultErrorsIssuingCountryInclusion,
|
|
1964
2038
|
...queryResultErrorsScope
|
|
1965
2039
|
};
|
|
2040
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
2041
|
+
"issuing_country",
|
|
2042
|
+
proofData,
|
|
2043
|
+
validity ?? DEFAULT_VALIDITY,
|
|
2044
|
+
queryResultErrors
|
|
2045
|
+
);
|
|
2046
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
2047
|
+
queryResultErrors = {
|
|
2048
|
+
...queryResultErrors,
|
|
2049
|
+
...queryResultErrorsCurrentDate
|
|
2050
|
+
};
|
|
1966
2051
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
1967
2052
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
1968
2053
|
} else if (proof.name === "bind") {
|
|
@@ -1989,12 +2074,25 @@ var PublicInputChecker = class {
|
|
|
1989
2074
|
...queryResultErrors,
|
|
1990
2075
|
...queryResultErrorsBind
|
|
1991
2076
|
};
|
|
2077
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
2078
|
+
"bind",
|
|
2079
|
+
proofData,
|
|
2080
|
+
validity ?? DEFAULT_VALIDITY,
|
|
2081
|
+
queryResultErrors
|
|
2082
|
+
);
|
|
2083
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
2084
|
+
queryResultErrors = {
|
|
2085
|
+
...queryResultErrors,
|
|
2086
|
+
...queryResultErrorsCurrentDate
|
|
2087
|
+
};
|
|
1992
2088
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
1993
2089
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
1994
2090
|
} else if (proof.name === "exclusion_check_sanctions") {
|
|
1995
2091
|
const sanctionsBuilder = await import_utils.SanctionsBuilder.create();
|
|
1996
2092
|
const exclusionCheckSanctionsCommittedInputs = proof.committedInputs?.exclusion_check_sanctions;
|
|
1997
|
-
const calculatedParamCommitment = await sanctionsBuilder.getSanctionsParameterCommitment(
|
|
2093
|
+
const calculatedParamCommitment = await sanctionsBuilder.getSanctionsParameterCommitment(
|
|
2094
|
+
exclusionCheckSanctionsCommittedInputs.isStrict
|
|
2095
|
+
);
|
|
1998
2096
|
const paramCommittment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
|
|
1999
2097
|
if (paramCommittment !== calculatedParamCommitment) {
|
|
2000
2098
|
console.warn(
|
|
@@ -2023,6 +2121,17 @@ var PublicInputChecker = class {
|
|
|
2023
2121
|
...queryResultErrors,
|
|
2024
2122
|
...queryResultErrorsSanctionsExclusion
|
|
2025
2123
|
};
|
|
2124
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
2125
|
+
"sanctions",
|
|
2126
|
+
proofData,
|
|
2127
|
+
validity ?? DEFAULT_VALIDITY,
|
|
2128
|
+
queryResultErrors
|
|
2129
|
+
);
|
|
2130
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
2131
|
+
queryResultErrors = {
|
|
2132
|
+
...queryResultErrors,
|
|
2133
|
+
...queryResultErrorsCurrentDate
|
|
2134
|
+
};
|
|
2026
2135
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
2027
2136
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
2028
2137
|
} else if (proof.name?.startsWith("facematch") && !proof.name?.endsWith("_evm")) {
|
|
@@ -2031,7 +2140,7 @@ var PublicInputChecker = class {
|
|
|
2031
2140
|
const calculatedParamCommitment = await (0, import_utils.getFacematchParameterCommitment)(
|
|
2032
2141
|
BigInt(facematchCommittedInputs.rootKeyLeaf),
|
|
2033
2142
|
facematchCommittedInputs.environment === "development" ? 0n : 1n,
|
|
2034
|
-
BigInt(facematchCommittedInputs.
|
|
2143
|
+
BigInt(facematchCommittedInputs.appIdHash),
|
|
2035
2144
|
facematchCommittedInputs.mode === "regular" ? 1n : 2n
|
|
2036
2145
|
);
|
|
2037
2146
|
if (paramCommittment !== calculatedParamCommitment) {
|
|
@@ -2052,6 +2161,17 @@ var PublicInputChecker = class {
|
|
|
2052
2161
|
...queryResultErrors,
|
|
2053
2162
|
...queryResultErrorsFacematch
|
|
2054
2163
|
};
|
|
2164
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
2165
|
+
"facematch",
|
|
2166
|
+
proofData,
|
|
2167
|
+
validity ?? DEFAULT_VALIDITY,
|
|
2168
|
+
queryResultErrors
|
|
2169
|
+
);
|
|
2170
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
2171
|
+
queryResultErrors = {
|
|
2172
|
+
...queryResultErrors,
|
|
2173
|
+
...queryResultErrorsCurrentDate
|
|
2174
|
+
};
|
|
2055
2175
|
uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
|
|
2056
2176
|
uniqueIdentifierType = (0, import_utils.getNullifierTypeFromDisclosureProof)(proofData);
|
|
2057
2177
|
}
|
|
@@ -58,6 +58,7 @@ declare class PublicInputChecker {
|
|
|
58
58
|
isCorrect: boolean;
|
|
59
59
|
queryResultErrors: Partial<QueryResultErrors>;
|
|
60
60
|
}>;
|
|
61
|
+
private static checkCurrentDate;
|
|
61
62
|
static checkPublicInputs(domain: string, proofs: Array<ProofResult>, queryResult: QueryResult, validity?: number, scope?: string): Promise<{
|
|
62
63
|
isCorrect: boolean;
|
|
63
64
|
uniqueIdentifier: string | undefined;
|