@zkpassport/sdk 0.10.0 → 0.11.0-beta.2
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.cjs +386 -854
- package/dist/cjs/public-input-checker.cjs +164 -84
- package/dist/cjs/public-input-checker.d.cts +1 -0
- package/dist/cjs/solidity-verifier.cjs +218 -767
- package/dist/cjs/types.d.cts +11 -2
- package/dist/esm/{chunk-O7ZONMCQ.js → chunk-6IK5VUOR.js} +168 -87
- package/dist/esm/chunk-CFGZMKF7.js +2019 -0
- package/dist/esm/index.js +6 -5
- package/dist/esm/public-input-checker.d.ts +1 -0
- package/dist/esm/public-input-checker.js +1 -1
- package/dist/esm/solidity-verifier.js +1 -1
- package/dist/esm/types.d.ts +11 -2
- package/package.json +3 -3
- package/dist/esm/chunk-I7PGO4XY.js +0 -2567
package/dist/cjs/types.d.cts
CHANGED
|
@@ -175,8 +175,17 @@ type QueryBuilder = {
|
|
|
175
175
|
* e.g. "US", ["US", "GB", "CH", "EU"], "all"
|
|
176
176
|
* @param lists The specific lists from a given country to check against. Defaults to "all".
|
|
177
177
|
* e.g. ["OFAC_SDN"], "all"
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
* @param options The options to use for the sanction check.
|
|
179
|
+
* @param options.strict Whether to use a strict sanction check. Defaults to false.
|
|
180
|
+
*
|
|
181
|
+
* If set to true, this means the checks will be done against just the lastname and firstname,
|
|
182
|
+
* while when set to false, matches will need to include either the date of birth and name or
|
|
183
|
+
* the passport number and nationality.
|
|
184
|
+
* Strict mode has therefore a higher false positive rate but is harder to evade.
|
|
185
|
+
*/
|
|
186
|
+
sanctions: (countries?: SanctionsCountries, lists?: SanctionsLists, options?: {
|
|
187
|
+
strict?: boolean;
|
|
188
|
+
}) => QueryBuilder;
|
|
180
189
|
/**
|
|
181
190
|
* This feature is not available yet in the public release of the app.
|
|
182
191
|
* Requires that the ID holder's face matches the photo on the ID.
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
getCommitmentOutFromIntegrityProof,
|
|
19
19
|
getCommitmentInFromDisclosureProof,
|
|
20
20
|
getMerkleRootFromDSCProof,
|
|
21
|
-
|
|
21
|
+
getCurrentDateFromDisclosureProof,
|
|
22
22
|
DisclosedData,
|
|
23
23
|
formatName,
|
|
24
24
|
getNumberOfPublicInputs,
|
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
getDateParameterCommitment,
|
|
29
29
|
getCertificateRegistryRootFromOuterProof,
|
|
30
30
|
getParamCommitmentsFromOuterProof,
|
|
31
|
-
getCurrentDateFromCommittedInputs,
|
|
32
31
|
getMinAgeFromCommittedInputs,
|
|
33
32
|
getMaxAgeFromCommittedInputs,
|
|
34
33
|
getAgeParameterCommitment,
|
|
@@ -57,7 +56,9 @@ import {
|
|
|
57
56
|
getFacematchEvmParameterCommitment,
|
|
58
57
|
getFacematchParameterCommitment,
|
|
59
58
|
getNullifierTypeFromOuterProof,
|
|
60
|
-
getNullifierTypeFromDisclosureProof
|
|
59
|
+
getNullifierTypeFromDisclosureProof,
|
|
60
|
+
getServiceScopeFromDisclosureProof,
|
|
61
|
+
getServiceSubScopeFromDisclosureProof
|
|
61
62
|
} from "@zkpassport/utils";
|
|
62
63
|
import { RegistryClient } from "@zkpassport/registry";
|
|
63
64
|
var PublicInputChecker = class {
|
|
@@ -451,21 +452,6 @@ var PublicInputChecker = class {
|
|
|
451
452
|
}
|
|
452
453
|
};
|
|
453
454
|
}
|
|
454
|
-
const currentDate = getCurrentDateFromCommittedInputs(
|
|
455
|
-
proof.committedInputs?.compare_age ?? proof.committedInputs?.compare_age_evm
|
|
456
|
-
);
|
|
457
|
-
if (!areDatesEqual(currentDate, today) && !areDatesEqual(currentDate, today.getTime() - 864e5)) {
|
|
458
|
-
console.warn("Current date in the proof is too old");
|
|
459
|
-
isCorrect = false;
|
|
460
|
-
queryResultErrors.age = {
|
|
461
|
-
...queryResultErrors.age,
|
|
462
|
-
disclose: {
|
|
463
|
-
expected: `${today.toISOString()}`,
|
|
464
|
-
received: `${currentDate.toISOString()}`,
|
|
465
|
-
message: "Current date in the proof is too old"
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
455
|
return { isCorrect, queryResultErrors };
|
|
470
456
|
}
|
|
471
457
|
static checkBirthdatePublicInputs(proof, queryResult) {
|
|
@@ -488,9 +474,6 @@ var PublicInputChecker = class {
|
|
|
488
474
|
proof.committedInputs?.compare_birthdate ?? proof.committedInputs?.compare_birthdate_evm,
|
|
489
475
|
-1 * SECONDS_BETWEEN_1900_AND_1970
|
|
490
476
|
);
|
|
491
|
-
const currentDate = getCurrentDateFromCommittedInputs(
|
|
492
|
-
proof.committedInputs?.compare_birthdate ?? proof.committedInputs?.compare_birthdate_evm
|
|
493
|
-
);
|
|
494
477
|
if (queryResult.birthdate) {
|
|
495
478
|
if (queryResult.birthdate.gte && queryResult.birthdate.gte.result && !areDatesEqual(minDate, queryResult.birthdate.gte.expected)) {
|
|
496
479
|
console.warn("Birthdate is not greater than or equal to the expected birthdate");
|
|
@@ -564,18 +547,6 @@ var PublicInputChecker = class {
|
|
|
564
547
|
}
|
|
565
548
|
};
|
|
566
549
|
}
|
|
567
|
-
if (!areDatesEqual(currentDate, today) && !areDatesEqual(currentDate, today.getTime() - 864e5)) {
|
|
568
|
-
console.warn("Current date in the proof is too old");
|
|
569
|
-
isCorrect = false;
|
|
570
|
-
queryResultErrors.birthdate = {
|
|
571
|
-
...queryResultErrors.birthdate,
|
|
572
|
-
disclose: {
|
|
573
|
-
expected: `${today.toISOString()}`,
|
|
574
|
-
received: `${currentDate.toISOString()}`,
|
|
575
|
-
message: "Current date in the proof is too old"
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
550
|
return { isCorrect, queryResultErrors };
|
|
580
551
|
}
|
|
581
552
|
static checkExpiryDatePublicInputs(proof, queryResult) {
|
|
@@ -596,9 +567,6 @@ var PublicInputChecker = class {
|
|
|
596
567
|
const maxDate = getMaxDateFromCommittedInputs(
|
|
597
568
|
proof.committedInputs?.compare_expiry ?? proof.committedInputs?.compare_expiry_evm
|
|
598
569
|
);
|
|
599
|
-
const currentDate = getCurrentDateFromCommittedInputs(
|
|
600
|
-
proof.committedInputs?.compare_expiry ?? proof.committedInputs?.compare_expiry_evm
|
|
601
|
-
);
|
|
602
570
|
if (queryResult.expiry_date) {
|
|
603
571
|
if (queryResult.expiry_date.gte && queryResult.expiry_date.gte.result && !areDatesEqual(minDate, queryResult.expiry_date.gte.expected)) {
|
|
604
572
|
console.warn("Expiry date is not greater than or equal to the expected expiry date");
|
|
@@ -672,18 +640,6 @@ var PublicInputChecker = class {
|
|
|
672
640
|
}
|
|
673
641
|
};
|
|
674
642
|
}
|
|
675
|
-
if (!areDatesEqual(currentDate, today) && !areDatesEqual(currentDate, today.getTime() - 864e5)) {
|
|
676
|
-
console.warn("Current date in the proof is too old");
|
|
677
|
-
isCorrect = false;
|
|
678
|
-
queryResultErrors.expiry_date = {
|
|
679
|
-
...queryResultErrors.expiry_date,
|
|
680
|
-
disclose: {
|
|
681
|
-
expected: `${today.toISOString()}`,
|
|
682
|
-
received: `${currentDate.toISOString()}`,
|
|
683
|
-
message: "Current date in the proof is too old"
|
|
684
|
-
}
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
643
|
return { isCorrect, queryResultErrors };
|
|
688
644
|
}
|
|
689
645
|
static checkNationalityExclusionPublicInputs(queryResult, countryList) {
|
|
@@ -828,7 +784,7 @@ var PublicInputChecker = class {
|
|
|
828
784
|
}
|
|
829
785
|
static checkScopeFromDisclosureProof(domain, proofData, queryResultErrors, key, scope) {
|
|
830
786
|
let isCorrect = true;
|
|
831
|
-
if (domain && getServiceScopeHash(domain) !==
|
|
787
|
+
if (domain && getServiceScopeHash(domain) !== getServiceScopeFromDisclosureProof(proofData)) {
|
|
832
788
|
console.warn("The proof comes from a different domain than the one expected");
|
|
833
789
|
isCorrect = false;
|
|
834
790
|
if (!queryResultErrors[key]) {
|
|
@@ -840,7 +796,7 @@ var PublicInputChecker = class {
|
|
|
840
796
|
message: "The proof comes from a different domain than the one expected"
|
|
841
797
|
};
|
|
842
798
|
}
|
|
843
|
-
if (scope && getScopeHash(scope) !==
|
|
799
|
+
if (scope && getScopeHash(scope) !== getServiceSubScopeFromDisclosureProof(proofData)) {
|
|
844
800
|
console.warn("The proof uses a different scope than the one expected");
|
|
845
801
|
isCorrect = false;
|
|
846
802
|
if (!queryResultErrors[key]) {
|
|
@@ -1021,6 +977,36 @@ var PublicInputChecker = class {
|
|
|
1021
977
|
}
|
|
1022
978
|
return { isCorrect, queryResultErrors };
|
|
1023
979
|
}
|
|
980
|
+
static async checkCurrentDate(circuitName, proofData, validity, queryResultErrors) {
|
|
981
|
+
const currentTime = /* @__PURE__ */ new Date();
|
|
982
|
+
const today = new Date(
|
|
983
|
+
currentTime.getFullYear(),
|
|
984
|
+
currentTime.getMonth(),
|
|
985
|
+
currentTime.getDate(),
|
|
986
|
+
0,
|
|
987
|
+
0,
|
|
988
|
+
0,
|
|
989
|
+
0
|
|
990
|
+
);
|
|
991
|
+
const currentDate = getCurrentDateFromDisclosureProof(proofData);
|
|
992
|
+
const todayToCurrentDate = today.getTime() - currentDate.getTime();
|
|
993
|
+
const expectedDifference = validity ? validity * 1e3 : DEFAULT_VALIDITY * 1e3;
|
|
994
|
+
const actualDifference = today.getTime() - (today.getTime() - expectedDifference);
|
|
995
|
+
let isCorrect = true;
|
|
996
|
+
if (todayToCurrentDate >= actualDifference) {
|
|
997
|
+
console.warn("The date used to check the validity of the ID falls out of the validity period");
|
|
998
|
+
isCorrect = false;
|
|
999
|
+
if (!queryResultErrors[circuitName]) {
|
|
1000
|
+
queryResultErrors[circuitName] = {};
|
|
1001
|
+
}
|
|
1002
|
+
queryResultErrors[circuitName].date = {
|
|
1003
|
+
expected: `Difference: ${validity} seconds`,
|
|
1004
|
+
received: `Difference: ${Math.round(todayToCurrentDate / 1e3)} seconds`,
|
|
1005
|
+
message: "The date used to check the validity of the ID falls out of the validity period"
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
return { isCorrect, queryResultErrors };
|
|
1009
|
+
}
|
|
1024
1010
|
static async checkPublicInputs(domain, proofs, queryResult, validity, scope) {
|
|
1025
1011
|
let commitmentIn;
|
|
1026
1012
|
let commitmentOut;
|
|
@@ -1149,14 +1135,9 @@ var PublicInputChecker = class {
|
|
|
1149
1135
|
if (!!committedInputs?.compare_age || !!committedInputs?.compare_age_evm) {
|
|
1150
1136
|
const ageCommittedInputs = committedInputs?.compare_age ?? committedInputs?.compare_age_evm;
|
|
1151
1137
|
const ageParameterCommitment = isForEVM ? await getAgeEVMParameterCommitment(
|
|
1152
|
-
ageCommittedInputs.currentDateTimestamp,
|
|
1153
|
-
ageCommittedInputs.minAge,
|
|
1154
|
-
ageCommittedInputs.maxAge
|
|
1155
|
-
) : await getAgeParameterCommitment(
|
|
1156
|
-
ageCommittedInputs.currentDateTimestamp,
|
|
1157
1138
|
ageCommittedInputs.minAge,
|
|
1158
1139
|
ageCommittedInputs.maxAge
|
|
1159
|
-
);
|
|
1140
|
+
) : await getAgeParameterCommitment(ageCommittedInputs.minAge, ageCommittedInputs.maxAge);
|
|
1160
1141
|
if (!paramCommitments.includes(ageParameterCommitment)) {
|
|
1161
1142
|
console.warn("This proof does not verify the age");
|
|
1162
1143
|
isCorrect = false;
|
|
@@ -1180,16 +1161,12 @@ var PublicInputChecker = class {
|
|
|
1180
1161
|
const birthdateCommittedInputs = committedInputs?.compare_birthdate ?? committedInputs?.compare_birthdate_evm;
|
|
1181
1162
|
const birthdateParameterCommitment = isForEVM ? await getDateEVMParameterCommitment(
|
|
1182
1163
|
ProofType.BIRTHDATE,
|
|
1183
|
-
birthdateCommittedInputs.currentDateTimestamp,
|
|
1184
1164
|
birthdateCommittedInputs.minDateTimestamp,
|
|
1185
|
-
birthdateCommittedInputs.maxDateTimestamp
|
|
1186
|
-
0
|
|
1165
|
+
birthdateCommittedInputs.maxDateTimestamp
|
|
1187
1166
|
) : await getDateParameterCommitment(
|
|
1188
1167
|
ProofType.BIRTHDATE,
|
|
1189
|
-
birthdateCommittedInputs.currentDateTimestamp,
|
|
1190
1168
|
birthdateCommittedInputs.minDateTimestamp,
|
|
1191
|
-
birthdateCommittedInputs.maxDateTimestamp
|
|
1192
|
-
0
|
|
1169
|
+
birthdateCommittedInputs.maxDateTimestamp
|
|
1193
1170
|
);
|
|
1194
1171
|
if (!paramCommitments.includes(birthdateParameterCommitment)) {
|
|
1195
1172
|
console.warn("This proof does not verify the birthdate");
|
|
@@ -1214,12 +1191,10 @@ var PublicInputChecker = class {
|
|
|
1214
1191
|
const expiryCommittedInputs = committedInputs?.compare_expiry ?? committedInputs?.compare_expiry_evm;
|
|
1215
1192
|
const expiryParameterCommitment = isForEVM ? await getDateEVMParameterCommitment(
|
|
1216
1193
|
ProofType.EXPIRY_DATE,
|
|
1217
|
-
expiryCommittedInputs.currentDateTimestamp,
|
|
1218
1194
|
expiryCommittedInputs.minDateTimestamp,
|
|
1219
1195
|
expiryCommittedInputs.maxDateTimestamp
|
|
1220
1196
|
) : await getDateParameterCommitment(
|
|
1221
1197
|
ProofType.EXPIRY_DATE,
|
|
1222
|
-
expiryCommittedInputs.currentDateTimestamp,
|
|
1223
1198
|
expiryCommittedInputs.minDateTimestamp,
|
|
1224
1199
|
expiryCommittedInputs.maxDateTimestamp
|
|
1225
1200
|
);
|
|
@@ -1423,7 +1398,11 @@ var PublicInputChecker = class {
|
|
|
1423
1398
|
if (!!committedInputs?.exclusion_check_sanctions || !!committedInputs?.exclusion_check_sanctions_evm) {
|
|
1424
1399
|
const sanctionsBuilder = await SanctionsBuilder.create();
|
|
1425
1400
|
const exclusionCheckSanctionsCommittedInputs = committedInputs?.exclusion_check_sanctions ?? committedInputs?.exclusion_check_sanctions_evm;
|
|
1426
|
-
const exclusionCheckSanctionsParameterCommitment = isForEVM ? await sanctionsBuilder.getSanctionsEvmParameterCommitment(
|
|
1401
|
+
const exclusionCheckSanctionsParameterCommitment = isForEVM ? await sanctionsBuilder.getSanctionsEvmParameterCommitment(
|
|
1402
|
+
exclusionCheckSanctionsCommittedInputs.isStrict
|
|
1403
|
+
) : await sanctionsBuilder.getSanctionsParameterCommitment(
|
|
1404
|
+
exclusionCheckSanctionsCommittedInputs.isStrict
|
|
1405
|
+
);
|
|
1427
1406
|
if (!paramCommitments.includes(exclusionCheckSanctionsParameterCommitment)) {
|
|
1428
1407
|
console.warn("This proof does not verify the exclusion from the sanction lists");
|
|
1429
1408
|
isCorrect = false;
|
|
@@ -1532,24 +1511,6 @@ var PublicInputChecker = class {
|
|
|
1532
1511
|
};
|
|
1533
1512
|
}
|
|
1534
1513
|
commitmentOut = getCommitmentOutFromIntegrityProof(proofData);
|
|
1535
|
-
const currentDate = getCurrentDateFromIntegrityProof(proofData);
|
|
1536
|
-
const todayToCurrentDate = today.getTime() - currentDate.getTime();
|
|
1537
|
-
const expectedDifference = validity ? validity * 1e3 : DEFAULT_VALIDITY * 1e3;
|
|
1538
|
-
const actualDifference = today.getTime() - (today.getTime() - expectedDifference);
|
|
1539
|
-
if (todayToCurrentDate >= actualDifference) {
|
|
1540
|
-
console.warn(
|
|
1541
|
-
`The date used to check the validity of the ID is older than the validity period`
|
|
1542
|
-
);
|
|
1543
|
-
isCorrect = false;
|
|
1544
|
-
queryResultErrors.data_check_integrity = {
|
|
1545
|
-
...queryResultErrors.data_check_integrity,
|
|
1546
|
-
date: {
|
|
1547
|
-
expected: `Difference: ${validity} seconds`,
|
|
1548
|
-
received: `Difference: ${Math.round(todayToCurrentDate / 1e3)} seconds`,
|
|
1549
|
-
message: "The date used to check the validity of the ID is older than the validity period"
|
|
1550
|
-
}
|
|
1551
|
-
};
|
|
1552
|
-
}
|
|
1553
1514
|
} else if (proof.name === "disclose_bytes") {
|
|
1554
1515
|
commitmentIn = getCommitmentInFromDisclosureProof(proofData);
|
|
1555
1516
|
if (commitmentIn !== commitmentOut) {
|
|
@@ -1602,6 +1563,17 @@ var PublicInputChecker = class {
|
|
|
1602
1563
|
...queryResultErrorsDisclose,
|
|
1603
1564
|
...queryResultErrorsScope
|
|
1604
1565
|
};
|
|
1566
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1567
|
+
"disclose",
|
|
1568
|
+
proofData,
|
|
1569
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1570
|
+
queryResultErrors
|
|
1571
|
+
);
|
|
1572
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1573
|
+
queryResultErrors = {
|
|
1574
|
+
...queryResultErrors,
|
|
1575
|
+
...queryResultErrorsCurrentDate
|
|
1576
|
+
};
|
|
1605
1577
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
1606
1578
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
1607
1579
|
} else if (proof.name === "compare_age") {
|
|
@@ -1623,7 +1595,6 @@ var PublicInputChecker = class {
|
|
|
1623
1595
|
const paramCommitment = getParameterCommitmentFromDisclosureProof(proofData);
|
|
1624
1596
|
const committedInputs = proof.committedInputs?.compare_age;
|
|
1625
1597
|
const calculatedParamCommitment = await getAgeParameterCommitment(
|
|
1626
|
-
committedInputs.currentDateTimestamp,
|
|
1627
1598
|
committedInputs.minAge,
|
|
1628
1599
|
committedInputs.maxAge
|
|
1629
1600
|
);
|
|
@@ -1649,6 +1620,17 @@ var PublicInputChecker = class {
|
|
|
1649
1620
|
...queryResultErrorsAge,
|
|
1650
1621
|
...queryResultErrorsScope
|
|
1651
1622
|
};
|
|
1623
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1624
|
+
"age",
|
|
1625
|
+
proofData,
|
|
1626
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1627
|
+
queryResultErrors
|
|
1628
|
+
);
|
|
1629
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1630
|
+
queryResultErrors = {
|
|
1631
|
+
...queryResultErrors,
|
|
1632
|
+
...queryResultErrorsCurrentDate
|
|
1633
|
+
};
|
|
1652
1634
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
1653
1635
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
1654
1636
|
} else if (proof.name === "compare_birthdate") {
|
|
@@ -1671,7 +1653,6 @@ var PublicInputChecker = class {
|
|
|
1671
1653
|
const committedInputs = proof.committedInputs?.compare_birthdate;
|
|
1672
1654
|
const calculatedParamCommitment = await getDateParameterCommitment(
|
|
1673
1655
|
ProofType.BIRTHDATE,
|
|
1674
|
-
committedInputs.currentDateTimestamp,
|
|
1675
1656
|
committedInputs.minDateTimestamp,
|
|
1676
1657
|
committedInputs.maxDateTimestamp,
|
|
1677
1658
|
0
|
|
@@ -1704,6 +1685,17 @@ var PublicInputChecker = class {
|
|
|
1704
1685
|
...queryResultErrorsBirthdate,
|
|
1705
1686
|
...queryResultErrorsScope
|
|
1706
1687
|
};
|
|
1688
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1689
|
+
"birthdate",
|
|
1690
|
+
proofData,
|
|
1691
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1692
|
+
queryResultErrors
|
|
1693
|
+
);
|
|
1694
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1695
|
+
queryResultErrors = {
|
|
1696
|
+
...queryResultErrors,
|
|
1697
|
+
...queryResultErrorsCurrentDate
|
|
1698
|
+
};
|
|
1707
1699
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
1708
1700
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
1709
1701
|
} else if (proof.name === "compare_expiry") {
|
|
@@ -1726,7 +1718,6 @@ var PublicInputChecker = class {
|
|
|
1726
1718
|
const committedInputs = proof.committedInputs?.compare_expiry;
|
|
1727
1719
|
const calculatedParamCommitment = await getDateParameterCommitment(
|
|
1728
1720
|
ProofType.EXPIRY_DATE,
|
|
1729
|
-
committedInputs.currentDateTimestamp,
|
|
1730
1721
|
committedInputs.minDateTimestamp,
|
|
1731
1722
|
committedInputs.maxDateTimestamp
|
|
1732
1723
|
);
|
|
@@ -1758,6 +1749,17 @@ var PublicInputChecker = class {
|
|
|
1758
1749
|
...queryResultErrorsExpiryDate,
|
|
1759
1750
|
...queryResultErrorsScope
|
|
1760
1751
|
};
|
|
1752
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1753
|
+
"expiry_date",
|
|
1754
|
+
proofData,
|
|
1755
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1756
|
+
queryResultErrors
|
|
1757
|
+
);
|
|
1758
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1759
|
+
queryResultErrors = {
|
|
1760
|
+
...queryResultErrors,
|
|
1761
|
+
...queryResultErrorsCurrentDate
|
|
1762
|
+
};
|
|
1761
1763
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
1762
1764
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
1763
1765
|
} else if (proof.name === "exclusion_check_nationality") {
|
|
@@ -1814,6 +1816,17 @@ var PublicInputChecker = class {
|
|
|
1814
1816
|
...queryResultErrorsNationalityExclusion,
|
|
1815
1817
|
...queryResultErrorsScope
|
|
1816
1818
|
};
|
|
1819
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1820
|
+
"nationality",
|
|
1821
|
+
proofData,
|
|
1822
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1823
|
+
queryResultErrors
|
|
1824
|
+
);
|
|
1825
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1826
|
+
queryResultErrors = {
|
|
1827
|
+
...queryResultErrors,
|
|
1828
|
+
...queryResultErrorsCurrentDate
|
|
1829
|
+
};
|
|
1817
1830
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
1818
1831
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
1819
1832
|
} else if (proof.name === "exclusion_check_issuing_country") {
|
|
@@ -1870,6 +1883,17 @@ var PublicInputChecker = class {
|
|
|
1870
1883
|
...queryResultErrorsIssuingCountryExclusion,
|
|
1871
1884
|
...queryResultErrorsScope
|
|
1872
1885
|
};
|
|
1886
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1887
|
+
"issuing_country",
|
|
1888
|
+
proofData,
|
|
1889
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1890
|
+
queryResultErrors
|
|
1891
|
+
);
|
|
1892
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1893
|
+
queryResultErrors = {
|
|
1894
|
+
...queryResultErrors,
|
|
1895
|
+
...queryResultErrorsCurrentDate
|
|
1896
|
+
};
|
|
1873
1897
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
1874
1898
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
1875
1899
|
} else if (proof.name === "inclusion_check_nationality") {
|
|
@@ -1926,6 +1950,17 @@ var PublicInputChecker = class {
|
|
|
1926
1950
|
...queryResultErrorsNationalityInclusion,
|
|
1927
1951
|
...queryResultErrorsScope
|
|
1928
1952
|
};
|
|
1953
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
1954
|
+
"nationality",
|
|
1955
|
+
proofData,
|
|
1956
|
+
validity ?? DEFAULT_VALIDITY,
|
|
1957
|
+
queryResultErrors
|
|
1958
|
+
);
|
|
1959
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
1960
|
+
queryResultErrors = {
|
|
1961
|
+
...queryResultErrors,
|
|
1962
|
+
...queryResultErrorsCurrentDate
|
|
1963
|
+
};
|
|
1929
1964
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
1930
1965
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
1931
1966
|
} else if (proof.name === "inclusion_check_issuing_country") {
|
|
@@ -1982,6 +2017,17 @@ var PublicInputChecker = class {
|
|
|
1982
2017
|
...queryResultErrorsIssuingCountryInclusion,
|
|
1983
2018
|
...queryResultErrorsScope
|
|
1984
2019
|
};
|
|
2020
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
2021
|
+
"issuing_country",
|
|
2022
|
+
proofData,
|
|
2023
|
+
validity ?? DEFAULT_VALIDITY,
|
|
2024
|
+
queryResultErrors
|
|
2025
|
+
);
|
|
2026
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
2027
|
+
queryResultErrors = {
|
|
2028
|
+
...queryResultErrors,
|
|
2029
|
+
...queryResultErrorsCurrentDate
|
|
2030
|
+
};
|
|
1985
2031
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
1986
2032
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
1987
2033
|
} else if (proof.name === "bind") {
|
|
@@ -2008,12 +2054,25 @@ var PublicInputChecker = class {
|
|
|
2008
2054
|
...queryResultErrors,
|
|
2009
2055
|
...queryResultErrorsBind
|
|
2010
2056
|
};
|
|
2057
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
2058
|
+
"bind",
|
|
2059
|
+
proofData,
|
|
2060
|
+
validity ?? DEFAULT_VALIDITY,
|
|
2061
|
+
queryResultErrors
|
|
2062
|
+
);
|
|
2063
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
2064
|
+
queryResultErrors = {
|
|
2065
|
+
...queryResultErrors,
|
|
2066
|
+
...queryResultErrorsCurrentDate
|
|
2067
|
+
};
|
|
2011
2068
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
2012
2069
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
2013
2070
|
} else if (proof.name === "exclusion_check_sanctions") {
|
|
2014
2071
|
const sanctionsBuilder = await SanctionsBuilder.create();
|
|
2015
2072
|
const exclusionCheckSanctionsCommittedInputs = proof.committedInputs?.exclusion_check_sanctions;
|
|
2016
|
-
const calculatedParamCommitment = await sanctionsBuilder.getSanctionsParameterCommitment(
|
|
2073
|
+
const calculatedParamCommitment = await sanctionsBuilder.getSanctionsParameterCommitment(
|
|
2074
|
+
exclusionCheckSanctionsCommittedInputs.isStrict
|
|
2075
|
+
);
|
|
2017
2076
|
const paramCommittment = getParameterCommitmentFromDisclosureProof(proofData);
|
|
2018
2077
|
if (paramCommittment !== calculatedParamCommitment) {
|
|
2019
2078
|
console.warn(
|
|
@@ -2042,6 +2101,17 @@ var PublicInputChecker = class {
|
|
|
2042
2101
|
...queryResultErrors,
|
|
2043
2102
|
...queryResultErrorsSanctionsExclusion
|
|
2044
2103
|
};
|
|
2104
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
2105
|
+
"sanctions",
|
|
2106
|
+
proofData,
|
|
2107
|
+
validity ?? DEFAULT_VALIDITY,
|
|
2108
|
+
queryResultErrors
|
|
2109
|
+
);
|
|
2110
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
2111
|
+
queryResultErrors = {
|
|
2112
|
+
...queryResultErrors,
|
|
2113
|
+
...queryResultErrorsCurrentDate
|
|
2114
|
+
};
|
|
2045
2115
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
2046
2116
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
2047
2117
|
} else if (proof.name?.startsWith("facematch") && !proof.name?.endsWith("_evm")) {
|
|
@@ -2071,6 +2141,17 @@ var PublicInputChecker = class {
|
|
|
2071
2141
|
...queryResultErrors,
|
|
2072
2142
|
...queryResultErrorsFacematch
|
|
2073
2143
|
};
|
|
2144
|
+
const { isCorrect: isCorrectCurrentDate, queryResultErrors: queryResultErrorsCurrentDate } = await this.checkCurrentDate(
|
|
2145
|
+
"facematch",
|
|
2146
|
+
proofData,
|
|
2147
|
+
validity ?? DEFAULT_VALIDITY,
|
|
2148
|
+
queryResultErrors
|
|
2149
|
+
);
|
|
2150
|
+
isCorrect = isCorrect && isCorrectCurrentDate;
|
|
2151
|
+
queryResultErrors = {
|
|
2152
|
+
...queryResultErrors,
|
|
2153
|
+
...queryResultErrorsCurrentDate
|
|
2154
|
+
};
|
|
2074
2155
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
2075
2156
|
uniqueIdentifierType = getNullifierTypeFromDisclosureProof(proofData);
|
|
2076
2157
|
}
|