@zkpassport/sdk 0.8.3 → 0.8.5
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 +38 -23
- package/dist/cjs/index.d.cts +8 -2
- package/dist/esm/index.d.ts +8 -2
- package/dist/esm/index.js +40 -24
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -856,7 +856,7 @@ var ZKPassportVerifier_default = {
|
|
|
856
856
|
var import_registry = require("@zkpassport/registry");
|
|
857
857
|
var import_bridge = require("@obsidion/bridge");
|
|
858
858
|
var import_utils4 = require("@zkpassport/utils");
|
|
859
|
-
var VERSION = "0.8.
|
|
859
|
+
var VERSION = "0.8.5";
|
|
860
860
|
var DEFAULT_DATE_VALUE = /* @__PURE__ */ new Date(0);
|
|
861
861
|
var DEFAULT_VALIDITY = 7 * 24 * 60 * 60;
|
|
862
862
|
if (typeof globalThis.Buffer === "undefined") {
|
|
@@ -973,7 +973,6 @@ var ZKPassport = class {
|
|
|
973
973
|
for (const field of fields) {
|
|
974
974
|
for (const key in this.topicToConfig[topic][field]) {
|
|
975
975
|
switch (key) {
|
|
976
|
-
case "eq":
|
|
977
976
|
case "disclose":
|
|
978
977
|
if (field !== "age" && !neededCircuits.includes("disclose_bytes")) {
|
|
979
978
|
neededCircuits.push("disclose_bytes");
|
|
@@ -981,6 +980,17 @@ var ZKPassport = class {
|
|
|
981
980
|
neededCircuits.push("compare_age");
|
|
982
981
|
}
|
|
983
982
|
break;
|
|
983
|
+
case "eq":
|
|
984
|
+
if (field !== "age" && field !== "birthdate" && field !== "expiry_date" && !neededCircuits.includes("disclose_bytes")) {
|
|
985
|
+
neededCircuits.push("disclose_bytes");
|
|
986
|
+
} else if (field === "age" && !neededCircuits.includes("compare_age")) {
|
|
987
|
+
neededCircuits.push("compare_age");
|
|
988
|
+
} else if (field === "birthdate" && !neededCircuits.includes("compare_birthdate")) {
|
|
989
|
+
neededCircuits.push("compare_birthdate");
|
|
990
|
+
} else if (field === "expiry_date" && !neededCircuits.includes("compare_expiry")) {
|
|
991
|
+
neededCircuits.push("compare_expiry");
|
|
992
|
+
}
|
|
993
|
+
break;
|
|
984
994
|
case "gte":
|
|
985
995
|
case "gt":
|
|
986
996
|
case "lte":
|
|
@@ -1085,10 +1095,10 @@ var ZKPassport = class {
|
|
|
1085
1095
|
}
|
|
1086
1096
|
return this.getZkPassportRequest(topic);
|
|
1087
1097
|
},
|
|
1088
|
-
|
|
1089
|
-
numericalCompare(
|
|
1090
|
-
return this.getZkPassportRequest(topic)
|
|
1091
|
-
}
|
|
1098
|
+
gt: (key, value) => {
|
|
1099
|
+
numericalCompare("gt", key, value, topic, this.topicToConfig);
|
|
1100
|
+
return this.getZkPassportRequest(topic);
|
|
1101
|
+
},
|
|
1092
1102
|
lte: (key, value) => {
|
|
1093
1103
|
numericalCompare("lte", key, value, topic, this.topicToConfig);
|
|
1094
1104
|
return this.getZkPassportRequest(topic);
|
|
@@ -1582,7 +1592,7 @@ var ZKPassport = class {
|
|
|
1582
1592
|
};
|
|
1583
1593
|
}
|
|
1584
1594
|
}
|
|
1585
|
-
if (!queryResult.age.lt && !queryResult.age.range && maxAge != 0) {
|
|
1595
|
+
if (!queryResult.age.lt && !queryResult.age.lte && !queryResult.age.eq && !queryResult.age.range && maxAge != 0) {
|
|
1586
1596
|
console.warn("Maximum age should be equal to 0");
|
|
1587
1597
|
isCorrect = false;
|
|
1588
1598
|
queryResultErrors.age = {
|
|
@@ -1594,7 +1604,7 @@ var ZKPassport = class {
|
|
|
1594
1604
|
}
|
|
1595
1605
|
};
|
|
1596
1606
|
}
|
|
1597
|
-
if (!queryResult.age.gte && !queryResult.age.range && minAge != 0) {
|
|
1607
|
+
if (!queryResult.age.gte && !queryResult.age.gt && !queryResult.age.eq && !queryResult.age.range && minAge != 0) {
|
|
1598
1608
|
console.warn("Minimum age should be equal to 0");
|
|
1599
1609
|
isCorrect = false;
|
|
1600
1610
|
queryResultErrors.age = {
|
|
@@ -1658,16 +1668,18 @@ var ZKPassport = class {
|
|
|
1658
1668
|
0
|
|
1659
1669
|
);
|
|
1660
1670
|
const minDate = (0, import_utils.getBirthdateMinDateTimestamp)(
|
|
1661
|
-
proof.committedInputs?.compare_birthdate
|
|
1671
|
+
proof.committedInputs?.compare_birthdate,
|
|
1672
|
+
-1 * import_utils.SECONDS_BETWEEN_1900_AND_1970
|
|
1662
1673
|
);
|
|
1663
1674
|
const maxDate = (0, import_utils.getBirthdateMaxDateTimestamp)(
|
|
1664
|
-
proof.committedInputs?.compare_birthdate
|
|
1675
|
+
proof.committedInputs?.compare_birthdate,
|
|
1676
|
+
-1 * import_utils.SECONDS_BETWEEN_1900_AND_1970
|
|
1665
1677
|
);
|
|
1666
1678
|
const currentDate = (0, import_utils.getCurrentDateFromCommittedInputs)(
|
|
1667
1679
|
proof.committedInputs?.compare_birthdate
|
|
1668
1680
|
);
|
|
1669
1681
|
if (queryResult.birthdate) {
|
|
1670
|
-
if (queryResult.birthdate.gte && queryResult.birthdate.gte.result && minDate
|
|
1682
|
+
if (queryResult.birthdate.gte && queryResult.birthdate.gte.result && !(0, import_utils.areDatesEqual)(minDate, queryResult.birthdate.gte.expected)) {
|
|
1671
1683
|
console.warn("Birthdate is not greater than or equal to the expected birthdate");
|
|
1672
1684
|
isCorrect = false;
|
|
1673
1685
|
queryResultErrors.birthdate = {
|
|
@@ -1679,7 +1691,7 @@ var ZKPassport = class {
|
|
|
1679
1691
|
}
|
|
1680
1692
|
};
|
|
1681
1693
|
}
|
|
1682
|
-
if (queryResult.birthdate.lte && queryResult.birthdate.lte.result && maxDate
|
|
1694
|
+
if (queryResult.birthdate.lte && queryResult.birthdate.lte.result && !(0, import_utils.areDatesEqual)(maxDate, queryResult.birthdate.lte.expected)) {
|
|
1683
1695
|
console.warn("Birthdate is not less than the expected birthdate");
|
|
1684
1696
|
isCorrect = false;
|
|
1685
1697
|
queryResultErrors.birthdate = {
|
|
@@ -1692,7 +1704,7 @@ var ZKPassport = class {
|
|
|
1692
1704
|
};
|
|
1693
1705
|
}
|
|
1694
1706
|
if (queryResult.birthdate.range) {
|
|
1695
|
-
if (queryResult.birthdate.range.result && (minDate
|
|
1707
|
+
if (queryResult.birthdate.range.result && (!(0, import_utils.areDatesEqual)(minDate, queryResult.birthdate.range.expected[0]) || !(0, import_utils.areDatesEqual)(maxDate, queryResult.birthdate.range.expected[1]))) {
|
|
1696
1708
|
console.warn("Birthdate is not in the expected range");
|
|
1697
1709
|
isCorrect = false;
|
|
1698
1710
|
queryResultErrors.birthdate = {
|
|
@@ -1705,7 +1717,7 @@ var ZKPassport = class {
|
|
|
1705
1717
|
};
|
|
1706
1718
|
}
|
|
1707
1719
|
}
|
|
1708
|
-
if (!queryResult.birthdate.lte && !queryResult.birthdate.range && !(0, import_utils.areDatesEqual)(maxDate, DEFAULT_DATE_VALUE)) {
|
|
1720
|
+
if (!queryResult.birthdate.lte && !queryResult.birthdate.lt && !queryResult.birthdate.eq && !queryResult.birthdate.range && !(0, import_utils.areDatesEqual)(maxDate, DEFAULT_DATE_VALUE)) {
|
|
1709
1721
|
console.warn("Maximum birthdate should be equal to default date value");
|
|
1710
1722
|
isCorrect = false;
|
|
1711
1723
|
queryResultErrors.birthdate = {
|
|
@@ -1717,7 +1729,7 @@ var ZKPassport = class {
|
|
|
1717
1729
|
}
|
|
1718
1730
|
};
|
|
1719
1731
|
}
|
|
1720
|
-
if (!queryResult.birthdate.gte && !queryResult.birthdate.range && !(0, import_utils.areDatesEqual)(minDate, DEFAULT_DATE_VALUE)) {
|
|
1732
|
+
if (!queryResult.birthdate.gte && !queryResult.birthdate.gt && !queryResult.birthdate.eq && !queryResult.birthdate.range && !(0, import_utils.areDatesEqual)(minDate, DEFAULT_DATE_VALUE)) {
|
|
1721
1733
|
console.warn("Minimum birthdate should be equal to default date value");
|
|
1722
1734
|
isCorrect = false;
|
|
1723
1735
|
queryResultErrors.birthdate = {
|
|
@@ -1775,7 +1787,7 @@ var ZKPassport = class {
|
|
|
1775
1787
|
proof.committedInputs?.compare_expiry
|
|
1776
1788
|
);
|
|
1777
1789
|
if (queryResult.expiry_date) {
|
|
1778
|
-
if (queryResult.expiry_date.gte && queryResult.expiry_date.gte.result && minDate
|
|
1790
|
+
if (queryResult.expiry_date.gte && queryResult.expiry_date.gte.result && !(0, import_utils.areDatesEqual)(minDate, queryResult.expiry_date.gte.expected)) {
|
|
1779
1791
|
console.warn("Expiry date is not greater than or equal to the expected expiry date");
|
|
1780
1792
|
isCorrect = false;
|
|
1781
1793
|
queryResultErrors.expiry_date = {
|
|
@@ -1787,7 +1799,7 @@ var ZKPassport = class {
|
|
|
1787
1799
|
}
|
|
1788
1800
|
};
|
|
1789
1801
|
}
|
|
1790
|
-
if (queryResult.expiry_date.lte && queryResult.expiry_date.lte.result && maxDate
|
|
1802
|
+
if (queryResult.expiry_date.lte && queryResult.expiry_date.lte.result && !(0, import_utils.areDatesEqual)(maxDate, queryResult.expiry_date.lte.expected)) {
|
|
1791
1803
|
console.warn("Expiry date is not less than the expected expiry date");
|
|
1792
1804
|
isCorrect = false;
|
|
1793
1805
|
queryResultErrors.expiry_date = {
|
|
@@ -1800,7 +1812,7 @@ var ZKPassport = class {
|
|
|
1800
1812
|
};
|
|
1801
1813
|
}
|
|
1802
1814
|
if (queryResult.expiry_date.range) {
|
|
1803
|
-
if (queryResult.expiry_date.range.result && (minDate
|
|
1815
|
+
if (queryResult.expiry_date.range.result && (!(0, import_utils.areDatesEqual)(minDate, queryResult.expiry_date.range.expected[0]) || !(0, import_utils.areDatesEqual)(maxDate, queryResult.expiry_date.range.expected[1]))) {
|
|
1804
1816
|
console.warn("Expiry date is not in the expected range");
|
|
1805
1817
|
isCorrect = false;
|
|
1806
1818
|
queryResultErrors.expiry_date = {
|
|
@@ -1813,7 +1825,7 @@ var ZKPassport = class {
|
|
|
1813
1825
|
};
|
|
1814
1826
|
}
|
|
1815
1827
|
}
|
|
1816
|
-
if (!queryResult.expiry_date.lte && !queryResult.expiry_date.range && !(0, import_utils.areDatesEqual)(maxDate, DEFAULT_DATE_VALUE)) {
|
|
1828
|
+
if (!queryResult.expiry_date.lte && !queryResult.expiry_date.lt && !queryResult.expiry_date.eq && !queryResult.expiry_date.range && !(0, import_utils.areDatesEqual)(maxDate, DEFAULT_DATE_VALUE)) {
|
|
1817
1829
|
console.warn("Maximum expiry date should be equal to default date value");
|
|
1818
1830
|
isCorrect = false;
|
|
1819
1831
|
queryResultErrors.expiry_date = {
|
|
@@ -1825,7 +1837,7 @@ var ZKPassport = class {
|
|
|
1825
1837
|
}
|
|
1826
1838
|
};
|
|
1827
1839
|
}
|
|
1828
|
-
if (!queryResult.expiry_date.gte && !queryResult.expiry_date.range && !(0, import_utils.areDatesEqual)(minDate, DEFAULT_DATE_VALUE)) {
|
|
1840
|
+
if (!queryResult.expiry_date.gte && !queryResult.expiry_date.gt && !queryResult.expiry_date.eq && !queryResult.expiry_date.range && !(0, import_utils.areDatesEqual)(minDate, DEFAULT_DATE_VALUE)) {
|
|
1829
1841
|
console.warn("Minimum expiry date should be equal to default date value");
|
|
1830
1842
|
isCorrect = false;
|
|
1831
1843
|
queryResultErrors.expiry_date = {
|
|
@@ -2308,12 +2320,14 @@ var ZKPassport = class {
|
|
|
2308
2320
|
import_utils.ProofType.BIRTHDATE,
|
|
2309
2321
|
birthdateCommittedInputs.currentDateTimestamp,
|
|
2310
2322
|
birthdateCommittedInputs.minDateTimestamp,
|
|
2311
|
-
birthdateCommittedInputs.maxDateTimestamp
|
|
2323
|
+
birthdateCommittedInputs.maxDateTimestamp,
|
|
2324
|
+
0
|
|
2312
2325
|
) : await (0, import_utils.getDateParameterCommitment)(
|
|
2313
2326
|
import_utils.ProofType.BIRTHDATE,
|
|
2314
2327
|
birthdateCommittedInputs.currentDateTimestamp,
|
|
2315
2328
|
birthdateCommittedInputs.minDateTimestamp,
|
|
2316
|
-
birthdateCommittedInputs.maxDateTimestamp
|
|
2329
|
+
birthdateCommittedInputs.maxDateTimestamp,
|
|
2330
|
+
0
|
|
2317
2331
|
);
|
|
2318
2332
|
if (!paramCommitments.includes(birthdateParameterCommitment)) {
|
|
2319
2333
|
console.warn("This proof does not verify the birthdate");
|
|
@@ -2748,7 +2762,8 @@ var ZKPassport = class {
|
|
|
2748
2762
|
import_utils.ProofType.BIRTHDATE,
|
|
2749
2763
|
committedInputs.currentDateTimestamp,
|
|
2750
2764
|
committedInputs.minDateTimestamp,
|
|
2751
|
-
committedInputs.maxDateTimestamp
|
|
2765
|
+
committedInputs.maxDateTimestamp,
|
|
2766
|
+
0
|
|
2752
2767
|
);
|
|
2753
2768
|
if (paramCommitment !== calculatedParamCommitment) {
|
|
2754
2769
|
console.warn(
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -115,18 +115,24 @@ type QueryBuilder = {
|
|
|
115
115
|
* @param value The value of the attribute you require.
|
|
116
116
|
*/
|
|
117
117
|
gte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
118
|
+
/**
|
|
119
|
+
* Requires this attribute to be greater than the provided value.
|
|
120
|
+
* @param key The attribute to compare.
|
|
121
|
+
* @param value The value of the attribute you require.
|
|
122
|
+
*/
|
|
123
|
+
gt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
118
124
|
/**
|
|
119
125
|
* Requires this attribute to be less than or equal to the provided value.
|
|
120
126
|
* @param key The attribute to compare.
|
|
121
127
|
* @param value The value of the attribute you require.
|
|
122
128
|
*/
|
|
123
|
-
lte: <T extends
|
|
129
|
+
lte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
124
130
|
/**
|
|
125
131
|
* Requires this attribute to be less than the provided value.
|
|
126
132
|
* @param key The attribute to compare.
|
|
127
133
|
* @param value The value of the attribute you require.
|
|
128
134
|
*/
|
|
129
|
-
lt: <T extends
|
|
135
|
+
lt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
130
136
|
/**
|
|
131
137
|
* Requires this attribute to be included in the provided range.
|
|
132
138
|
* @param key The attribute to compare.
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -115,18 +115,24 @@ type QueryBuilder = {
|
|
|
115
115
|
* @param value The value of the attribute you require.
|
|
116
116
|
*/
|
|
117
117
|
gte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
118
|
+
/**
|
|
119
|
+
* Requires this attribute to be greater than the provided value.
|
|
120
|
+
* @param key The attribute to compare.
|
|
121
|
+
* @param value The value of the attribute you require.
|
|
122
|
+
*/
|
|
123
|
+
gt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
118
124
|
/**
|
|
119
125
|
* Requires this attribute to be less than or equal to the provided value.
|
|
120
126
|
* @param key The attribute to compare.
|
|
121
127
|
* @param value The value of the attribute you require.
|
|
122
128
|
*/
|
|
123
|
-
lte: <T extends
|
|
129
|
+
lte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
124
130
|
/**
|
|
125
131
|
* Requires this attribute to be less than the provided value.
|
|
126
132
|
* @param key The attribute to compare.
|
|
127
133
|
* @param value The value of the attribute you require.
|
|
128
134
|
*/
|
|
129
|
-
lt: <T extends
|
|
135
|
+
lt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
130
136
|
/**
|
|
131
137
|
* Requires this attribute to be included in the provided range.
|
|
132
138
|
* @param key The attribute to compare.
|
package/dist/esm/index.js
CHANGED
|
@@ -51,7 +51,8 @@ import {
|
|
|
51
51
|
formatQueryResultDates,
|
|
52
52
|
getBirthdateMinDateTimestamp,
|
|
53
53
|
getBirthdateMaxDateTimestamp,
|
|
54
|
-
SanctionsBuilder
|
|
54
|
+
SanctionsBuilder,
|
|
55
|
+
SECONDS_BETWEEN_1900_AND_1970
|
|
55
56
|
} from "@zkpassport/utils";
|
|
56
57
|
import { bytesToHex, numberToBytesBE } from "@noble/ciphers/utils";
|
|
57
58
|
import i18en from "i18n-iso-countries/langs/en.json";
|
|
@@ -861,7 +862,7 @@ import {
|
|
|
861
862
|
ASEAN_COUNTRIES,
|
|
862
863
|
MERCOSUR_COUNTRIES
|
|
863
864
|
} from "@zkpassport/utils";
|
|
864
|
-
var VERSION = "0.8.
|
|
865
|
+
var VERSION = "0.8.5";
|
|
865
866
|
var DEFAULT_DATE_VALUE = /* @__PURE__ */ new Date(0);
|
|
866
867
|
var DEFAULT_VALIDITY = 7 * 24 * 60 * 60;
|
|
867
868
|
if (typeof globalThis.Buffer === "undefined") {
|
|
@@ -978,7 +979,6 @@ var ZKPassport = class {
|
|
|
978
979
|
for (const field of fields) {
|
|
979
980
|
for (const key in this.topicToConfig[topic][field]) {
|
|
980
981
|
switch (key) {
|
|
981
|
-
case "eq":
|
|
982
982
|
case "disclose":
|
|
983
983
|
if (field !== "age" && !neededCircuits.includes("disclose_bytes")) {
|
|
984
984
|
neededCircuits.push("disclose_bytes");
|
|
@@ -986,6 +986,17 @@ var ZKPassport = class {
|
|
|
986
986
|
neededCircuits.push("compare_age");
|
|
987
987
|
}
|
|
988
988
|
break;
|
|
989
|
+
case "eq":
|
|
990
|
+
if (field !== "age" && field !== "birthdate" && field !== "expiry_date" && !neededCircuits.includes("disclose_bytes")) {
|
|
991
|
+
neededCircuits.push("disclose_bytes");
|
|
992
|
+
} else if (field === "age" && !neededCircuits.includes("compare_age")) {
|
|
993
|
+
neededCircuits.push("compare_age");
|
|
994
|
+
} else if (field === "birthdate" && !neededCircuits.includes("compare_birthdate")) {
|
|
995
|
+
neededCircuits.push("compare_birthdate");
|
|
996
|
+
} else if (field === "expiry_date" && !neededCircuits.includes("compare_expiry")) {
|
|
997
|
+
neededCircuits.push("compare_expiry");
|
|
998
|
+
}
|
|
999
|
+
break;
|
|
989
1000
|
case "gte":
|
|
990
1001
|
case "gt":
|
|
991
1002
|
case "lte":
|
|
@@ -1090,10 +1101,10 @@ var ZKPassport = class {
|
|
|
1090
1101
|
}
|
|
1091
1102
|
return this.getZkPassportRequest(topic);
|
|
1092
1103
|
},
|
|
1093
|
-
|
|
1094
|
-
numericalCompare(
|
|
1095
|
-
return this.getZkPassportRequest(topic)
|
|
1096
|
-
}
|
|
1104
|
+
gt: (key, value) => {
|
|
1105
|
+
numericalCompare("gt", key, value, topic, this.topicToConfig);
|
|
1106
|
+
return this.getZkPassportRequest(topic);
|
|
1107
|
+
},
|
|
1097
1108
|
lte: (key, value) => {
|
|
1098
1109
|
numericalCompare("lte", key, value, topic, this.topicToConfig);
|
|
1099
1110
|
return this.getZkPassportRequest(topic);
|
|
@@ -1587,7 +1598,7 @@ var ZKPassport = class {
|
|
|
1587
1598
|
};
|
|
1588
1599
|
}
|
|
1589
1600
|
}
|
|
1590
|
-
if (!queryResult.age.lt && !queryResult.age.range && maxAge != 0) {
|
|
1601
|
+
if (!queryResult.age.lt && !queryResult.age.lte && !queryResult.age.eq && !queryResult.age.range && maxAge != 0) {
|
|
1591
1602
|
console.warn("Maximum age should be equal to 0");
|
|
1592
1603
|
isCorrect = false;
|
|
1593
1604
|
queryResultErrors.age = {
|
|
@@ -1599,7 +1610,7 @@ var ZKPassport = class {
|
|
|
1599
1610
|
}
|
|
1600
1611
|
};
|
|
1601
1612
|
}
|
|
1602
|
-
if (!queryResult.age.gte && !queryResult.age.range && minAge != 0) {
|
|
1613
|
+
if (!queryResult.age.gte && !queryResult.age.gt && !queryResult.age.eq && !queryResult.age.range && minAge != 0) {
|
|
1603
1614
|
console.warn("Minimum age should be equal to 0");
|
|
1604
1615
|
isCorrect = false;
|
|
1605
1616
|
queryResultErrors.age = {
|
|
@@ -1663,16 +1674,18 @@ var ZKPassport = class {
|
|
|
1663
1674
|
0
|
|
1664
1675
|
);
|
|
1665
1676
|
const minDate = getBirthdateMinDateTimestamp(
|
|
1666
|
-
proof.committedInputs?.compare_birthdate
|
|
1677
|
+
proof.committedInputs?.compare_birthdate,
|
|
1678
|
+
-1 * SECONDS_BETWEEN_1900_AND_1970
|
|
1667
1679
|
);
|
|
1668
1680
|
const maxDate = getBirthdateMaxDateTimestamp(
|
|
1669
|
-
proof.committedInputs?.compare_birthdate
|
|
1681
|
+
proof.committedInputs?.compare_birthdate,
|
|
1682
|
+
-1 * SECONDS_BETWEEN_1900_AND_1970
|
|
1670
1683
|
);
|
|
1671
1684
|
const currentDate = getCurrentDateFromCommittedInputs(
|
|
1672
1685
|
proof.committedInputs?.compare_birthdate
|
|
1673
1686
|
);
|
|
1674
1687
|
if (queryResult.birthdate) {
|
|
1675
|
-
if (queryResult.birthdate.gte && queryResult.birthdate.gte.result && minDate
|
|
1688
|
+
if (queryResult.birthdate.gte && queryResult.birthdate.gte.result && !areDatesEqual(minDate, queryResult.birthdate.gte.expected)) {
|
|
1676
1689
|
console.warn("Birthdate is not greater than or equal to the expected birthdate");
|
|
1677
1690
|
isCorrect = false;
|
|
1678
1691
|
queryResultErrors.birthdate = {
|
|
@@ -1684,7 +1697,7 @@ var ZKPassport = class {
|
|
|
1684
1697
|
}
|
|
1685
1698
|
};
|
|
1686
1699
|
}
|
|
1687
|
-
if (queryResult.birthdate.lte && queryResult.birthdate.lte.result && maxDate
|
|
1700
|
+
if (queryResult.birthdate.lte && queryResult.birthdate.lte.result && !areDatesEqual(maxDate, queryResult.birthdate.lte.expected)) {
|
|
1688
1701
|
console.warn("Birthdate is not less than the expected birthdate");
|
|
1689
1702
|
isCorrect = false;
|
|
1690
1703
|
queryResultErrors.birthdate = {
|
|
@@ -1697,7 +1710,7 @@ var ZKPassport = class {
|
|
|
1697
1710
|
};
|
|
1698
1711
|
}
|
|
1699
1712
|
if (queryResult.birthdate.range) {
|
|
1700
|
-
if (queryResult.birthdate.range.result && (minDate
|
|
1713
|
+
if (queryResult.birthdate.range.result && (!areDatesEqual(minDate, queryResult.birthdate.range.expected[0]) || !areDatesEqual(maxDate, queryResult.birthdate.range.expected[1]))) {
|
|
1701
1714
|
console.warn("Birthdate is not in the expected range");
|
|
1702
1715
|
isCorrect = false;
|
|
1703
1716
|
queryResultErrors.birthdate = {
|
|
@@ -1710,7 +1723,7 @@ var ZKPassport = class {
|
|
|
1710
1723
|
};
|
|
1711
1724
|
}
|
|
1712
1725
|
}
|
|
1713
|
-
if (!queryResult.birthdate.lte && !queryResult.birthdate.range && !areDatesEqual(maxDate, DEFAULT_DATE_VALUE)) {
|
|
1726
|
+
if (!queryResult.birthdate.lte && !queryResult.birthdate.lt && !queryResult.birthdate.eq && !queryResult.birthdate.range && !areDatesEqual(maxDate, DEFAULT_DATE_VALUE)) {
|
|
1714
1727
|
console.warn("Maximum birthdate should be equal to default date value");
|
|
1715
1728
|
isCorrect = false;
|
|
1716
1729
|
queryResultErrors.birthdate = {
|
|
@@ -1722,7 +1735,7 @@ var ZKPassport = class {
|
|
|
1722
1735
|
}
|
|
1723
1736
|
};
|
|
1724
1737
|
}
|
|
1725
|
-
if (!queryResult.birthdate.gte && !queryResult.birthdate.range && !areDatesEqual(minDate, DEFAULT_DATE_VALUE)) {
|
|
1738
|
+
if (!queryResult.birthdate.gte && !queryResult.birthdate.gt && !queryResult.birthdate.eq && !queryResult.birthdate.range && !areDatesEqual(minDate, DEFAULT_DATE_VALUE)) {
|
|
1726
1739
|
console.warn("Minimum birthdate should be equal to default date value");
|
|
1727
1740
|
isCorrect = false;
|
|
1728
1741
|
queryResultErrors.birthdate = {
|
|
@@ -1780,7 +1793,7 @@ var ZKPassport = class {
|
|
|
1780
1793
|
proof.committedInputs?.compare_expiry
|
|
1781
1794
|
);
|
|
1782
1795
|
if (queryResult.expiry_date) {
|
|
1783
|
-
if (queryResult.expiry_date.gte && queryResult.expiry_date.gte.result && minDate
|
|
1796
|
+
if (queryResult.expiry_date.gte && queryResult.expiry_date.gte.result && !areDatesEqual(minDate, queryResult.expiry_date.gte.expected)) {
|
|
1784
1797
|
console.warn("Expiry date is not greater than or equal to the expected expiry date");
|
|
1785
1798
|
isCorrect = false;
|
|
1786
1799
|
queryResultErrors.expiry_date = {
|
|
@@ -1792,7 +1805,7 @@ var ZKPassport = class {
|
|
|
1792
1805
|
}
|
|
1793
1806
|
};
|
|
1794
1807
|
}
|
|
1795
|
-
if (queryResult.expiry_date.lte && queryResult.expiry_date.lte.result && maxDate
|
|
1808
|
+
if (queryResult.expiry_date.lte && queryResult.expiry_date.lte.result && !areDatesEqual(maxDate, queryResult.expiry_date.lte.expected)) {
|
|
1796
1809
|
console.warn("Expiry date is not less than the expected expiry date");
|
|
1797
1810
|
isCorrect = false;
|
|
1798
1811
|
queryResultErrors.expiry_date = {
|
|
@@ -1805,7 +1818,7 @@ var ZKPassport = class {
|
|
|
1805
1818
|
};
|
|
1806
1819
|
}
|
|
1807
1820
|
if (queryResult.expiry_date.range) {
|
|
1808
|
-
if (queryResult.expiry_date.range.result && (minDate
|
|
1821
|
+
if (queryResult.expiry_date.range.result && (!areDatesEqual(minDate, queryResult.expiry_date.range.expected[0]) || !areDatesEqual(maxDate, queryResult.expiry_date.range.expected[1]))) {
|
|
1809
1822
|
console.warn("Expiry date is not in the expected range");
|
|
1810
1823
|
isCorrect = false;
|
|
1811
1824
|
queryResultErrors.expiry_date = {
|
|
@@ -1818,7 +1831,7 @@ var ZKPassport = class {
|
|
|
1818
1831
|
};
|
|
1819
1832
|
}
|
|
1820
1833
|
}
|
|
1821
|
-
if (!queryResult.expiry_date.lte && !queryResult.expiry_date.range && !areDatesEqual(maxDate, DEFAULT_DATE_VALUE)) {
|
|
1834
|
+
if (!queryResult.expiry_date.lte && !queryResult.expiry_date.lt && !queryResult.expiry_date.eq && !queryResult.expiry_date.range && !areDatesEqual(maxDate, DEFAULT_DATE_VALUE)) {
|
|
1822
1835
|
console.warn("Maximum expiry date should be equal to default date value");
|
|
1823
1836
|
isCorrect = false;
|
|
1824
1837
|
queryResultErrors.expiry_date = {
|
|
@@ -1830,7 +1843,7 @@ var ZKPassport = class {
|
|
|
1830
1843
|
}
|
|
1831
1844
|
};
|
|
1832
1845
|
}
|
|
1833
|
-
if (!queryResult.expiry_date.gte && !queryResult.expiry_date.range && !areDatesEqual(minDate, DEFAULT_DATE_VALUE)) {
|
|
1846
|
+
if (!queryResult.expiry_date.gte && !queryResult.expiry_date.gt && !queryResult.expiry_date.eq && !queryResult.expiry_date.range && !areDatesEqual(minDate, DEFAULT_DATE_VALUE)) {
|
|
1834
1847
|
console.warn("Minimum expiry date should be equal to default date value");
|
|
1835
1848
|
isCorrect = false;
|
|
1836
1849
|
queryResultErrors.expiry_date = {
|
|
@@ -2313,12 +2326,14 @@ var ZKPassport = class {
|
|
|
2313
2326
|
ProofType.BIRTHDATE,
|
|
2314
2327
|
birthdateCommittedInputs.currentDateTimestamp,
|
|
2315
2328
|
birthdateCommittedInputs.minDateTimestamp,
|
|
2316
|
-
birthdateCommittedInputs.maxDateTimestamp
|
|
2329
|
+
birthdateCommittedInputs.maxDateTimestamp,
|
|
2330
|
+
0
|
|
2317
2331
|
) : await getDateParameterCommitment(
|
|
2318
2332
|
ProofType.BIRTHDATE,
|
|
2319
2333
|
birthdateCommittedInputs.currentDateTimestamp,
|
|
2320
2334
|
birthdateCommittedInputs.minDateTimestamp,
|
|
2321
|
-
birthdateCommittedInputs.maxDateTimestamp
|
|
2335
|
+
birthdateCommittedInputs.maxDateTimestamp,
|
|
2336
|
+
0
|
|
2322
2337
|
);
|
|
2323
2338
|
if (!paramCommitments.includes(birthdateParameterCommitment)) {
|
|
2324
2339
|
console.warn("This proof does not verify the birthdate");
|
|
@@ -2753,7 +2768,8 @@ var ZKPassport = class {
|
|
|
2753
2768
|
ProofType.BIRTHDATE,
|
|
2754
2769
|
committedInputs.currentDateTimestamp,
|
|
2755
2770
|
committedInputs.minDateTimestamp,
|
|
2756
|
-
committedInputs.maxDateTimestamp
|
|
2771
|
+
committedInputs.maxDateTimestamp,
|
|
2772
|
+
0
|
|
2757
2773
|
);
|
|
2758
2774
|
if (paramCommitment !== calculatedParamCommitment) {
|
|
2759
2775
|
console.warn(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zkpassport/sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "Privacy-preserving identity verification using passports and ID cards",
|
|
5
5
|
"author": "ZKPassport",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@noble/secp256k1": "^2.2.3",
|
|
38
38
|
"@obsidion/bridge": "^0.10.4",
|
|
39
39
|
"@zkpassport/registry": "0.10.2",
|
|
40
|
-
"@zkpassport/utils": "0.22.
|
|
40
|
+
"@zkpassport/utils": "0.22.10",
|
|
41
41
|
"buffer": "^6.0.3",
|
|
42
42
|
"i18n-iso-countries": "^7.12.0",
|
|
43
43
|
"pako": "^2.1.0",
|