@zkpassport/sdk 0.8.0-beta.1 → 0.8.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 +738 -555
- package/dist/cjs/index.d.cts +11 -10
- package/dist/esm/index.d.ts +11 -10
- package/dist/esm/index.js +742 -556
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -48,7 +48,10 @@ import {
|
|
|
48
48
|
formatBoundData,
|
|
49
49
|
getCircuitRegistryRootFromOuterProof,
|
|
50
50
|
areDatesEqual,
|
|
51
|
-
formatQueryResultDates
|
|
51
|
+
formatQueryResultDates,
|
|
52
|
+
getBirthdateMinDateTimestamp,
|
|
53
|
+
getBirthdateMaxDateTimestamp,
|
|
54
|
+
SanctionsBuilder
|
|
52
55
|
} from "@zkpassport/utils";
|
|
53
56
|
import { bytesToHex, numberToBytesBE } from "@noble/ciphers/utils";
|
|
54
57
|
import i18en from "i18n-iso-countries/langs/en.json";
|
|
@@ -817,6 +820,7 @@ import {
|
|
|
817
820
|
} from "@zkpassport/utils";
|
|
818
821
|
var VERSION = "0.8.0";
|
|
819
822
|
var DEFAULT_DATE_VALUE = /* @__PURE__ */ new Date(0);
|
|
823
|
+
var DEFAULT_VALIDITY = 7 * 24 * 60 * 60;
|
|
820
824
|
if (typeof globalThis.Buffer === "undefined") {
|
|
821
825
|
globalThis.Buffer = Buffer;
|
|
822
826
|
if (typeof window !== "undefined") {
|
|
@@ -865,7 +869,6 @@ function generalCompare(fnName, key, value, requestId, requestIdToConfig) {
|
|
|
865
869
|
};
|
|
866
870
|
}
|
|
867
871
|
var ZKPassport = class {
|
|
868
|
-
//private wasmVerifierInit: boolean = false
|
|
869
872
|
constructor(_domain) {
|
|
870
873
|
this.topicToConfig = {};
|
|
871
874
|
this.topicToLocalConfig = {};
|
|
@@ -887,7 +890,11 @@ var ZKPassport = class {
|
|
|
887
890
|
if (!_domain && typeof window === "undefined") {
|
|
888
891
|
throw new Error("Domain argument is required in Node.js environment");
|
|
889
892
|
}
|
|
890
|
-
this.domain = _domain || window.location.hostname;
|
|
893
|
+
this.domain = this.normalizeDomain(_domain || window.location.hostname);
|
|
894
|
+
}
|
|
895
|
+
//private wasmVerifierInit: boolean = false
|
|
896
|
+
normalizeDomain(domain) {
|
|
897
|
+
return domain.trim().replace(/^https?:\/\//, "").replace(/^.*\.([a-zA-Z0-9\-]+\.[a-zA-Z0-9\-]+)/, "$1").replace(/\/[^/]*$/, "").replace(/:[0-9]+/, "").replace(/\?.*$/, "").replace(/#.*$/, "").toLowerCase();
|
|
891
898
|
}
|
|
892
899
|
async handleResult(topic) {
|
|
893
900
|
const result = this.topicToResults[topic];
|
|
@@ -970,7 +977,7 @@ var ZKPassport = class {
|
|
|
970
977
|
neededCircuits.push("bind");
|
|
971
978
|
}
|
|
972
979
|
if (this.topicToConfig[topic].sanctions) {
|
|
973
|
-
neededCircuits.push("
|
|
980
|
+
neededCircuits.push("exclusion_check_sanctions");
|
|
974
981
|
}
|
|
975
982
|
if (this.topicToConfig[topic].facematch) {
|
|
976
983
|
neededCircuits.push("facematch");
|
|
@@ -1094,12 +1101,13 @@ var ZKPassport = class {
|
|
|
1094
1101
|
};
|
|
1095
1102
|
return this.getZkPassportRequest(topic);
|
|
1096
1103
|
},
|
|
1097
|
-
|
|
1104
|
+
// TODO: Uncomment this when the facematch is ready
|
|
1105
|
+
/*facematch: (mode: FacematchMode = "regular") => {
|
|
1098
1106
|
this.topicToConfig[topic].facematch = {
|
|
1099
|
-
mode
|
|
1100
|
-
}
|
|
1101
|
-
return this.getZkPassportRequest(topic)
|
|
1102
|
-
}
|
|
1107
|
+
mode,
|
|
1108
|
+
}
|
|
1109
|
+
return this.getZkPassportRequest(topic)
|
|
1110
|
+
},*/
|
|
1103
1111
|
done: () => {
|
|
1104
1112
|
this.setExpectedProofCount(topic);
|
|
1105
1113
|
return {
|
|
@@ -1124,7 +1132,7 @@ var ZKPassport = class {
|
|
|
1124
1132
|
* @param logo The logo of your service
|
|
1125
1133
|
* @param purpose To explain what you want to do with the user's data
|
|
1126
1134
|
* @param scope Scope this request to a specific use case
|
|
1127
|
-
* @param validity How many
|
|
1135
|
+
* @param validity How many seconds ago the proof checking the expiry date of the ID should have been generated
|
|
1128
1136
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
1129
1137
|
* @returns The query builder object.
|
|
1130
1138
|
*/
|
|
@@ -1159,8 +1167,8 @@ var ZKPassport = class {
|
|
|
1159
1167
|
this.topicToProofs[topic] = [];
|
|
1160
1168
|
this.topicToExpectedProofCount[topic] = 0;
|
|
1161
1169
|
this.topicToLocalConfig[topic] = {
|
|
1162
|
-
// Default to
|
|
1163
|
-
validity: validity ||
|
|
1170
|
+
// Default to 7 days
|
|
1171
|
+
validity: validity || DEFAULT_VALIDITY,
|
|
1164
1172
|
mode: mode || "fast",
|
|
1165
1173
|
devMode: devMode || false
|
|
1166
1174
|
};
|
|
@@ -1189,25 +1197,7 @@ var ZKPassport = class {
|
|
|
1189
1197
|
return this.getZkPassportRequest(topic);
|
|
1190
1198
|
}
|
|
1191
1199
|
checkDiscloseBytesPublicInputs(proof, queryResult) {
|
|
1192
|
-
const queryResultErrors = {
|
|
1193
|
-
sig_check_dsc: {},
|
|
1194
|
-
sig_check_id_data: {},
|
|
1195
|
-
data_check_integrity: {},
|
|
1196
|
-
disclose: {},
|
|
1197
|
-
age: {},
|
|
1198
|
-
birthdate: {},
|
|
1199
|
-
expiry_date: {},
|
|
1200
|
-
document_type: {},
|
|
1201
|
-
issuing_country: {},
|
|
1202
|
-
gender: {},
|
|
1203
|
-
nationality: {},
|
|
1204
|
-
firstname: {},
|
|
1205
|
-
lastname: {},
|
|
1206
|
-
fullname: {},
|
|
1207
|
-
document_number: {},
|
|
1208
|
-
outer: {},
|
|
1209
|
-
bind: {}
|
|
1210
|
-
};
|
|
1200
|
+
const queryResultErrors = {};
|
|
1211
1201
|
let isCorrect = true;
|
|
1212
1202
|
const disclosedDataPassport = DisclosedData.fromDisclosedBytes(
|
|
1213
1203
|
(proof.committedInputs?.disclose_bytes).disclosedBytes,
|
|
@@ -1221,19 +1211,25 @@ var ZKPassport = class {
|
|
|
1221
1211
|
if (queryResult.document_type.eq && queryResult.document_type.eq.result && queryResult.document_type.eq.expected !== disclosedDataPassport.documentType) {
|
|
1222
1212
|
console.warn("Document type does not match the expected document type");
|
|
1223
1213
|
isCorrect = false;
|
|
1224
|
-
queryResultErrors.document_type
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1214
|
+
queryResultErrors.document_type = {
|
|
1215
|
+
...queryResultErrors.document_type,
|
|
1216
|
+
eq: {
|
|
1217
|
+
expected: `${queryResult.document_type.eq.expected}`,
|
|
1218
|
+
received: `${disclosedDataPassport.documentType ?? disclosedDataIDCard.documentType}`,
|
|
1219
|
+
message: "Document type does not match the expected document type"
|
|
1220
|
+
}
|
|
1228
1221
|
};
|
|
1229
1222
|
}
|
|
1230
1223
|
if (queryResult.document_type.disclose?.result !== disclosedDataIDCard.documentType) {
|
|
1231
1224
|
console.warn("Document type does not match the disclosed document type in query result");
|
|
1232
1225
|
isCorrect = false;
|
|
1233
|
-
queryResultErrors.document_type
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1226
|
+
queryResultErrors.document_type = {
|
|
1227
|
+
...queryResultErrors.document_type,
|
|
1228
|
+
disclose: {
|
|
1229
|
+
expected: `${queryResult.document_type.disclose?.result}`,
|
|
1230
|
+
received: `${disclosedDataIDCard.documentType ?? disclosedDataPassport.documentType}`,
|
|
1231
|
+
message: "Document type does not match the disclosed document type in query result"
|
|
1232
|
+
}
|
|
1237
1233
|
};
|
|
1238
1234
|
}
|
|
1239
1235
|
}
|
|
@@ -1243,19 +1239,25 @@ var ZKPassport = class {
|
|
|
1243
1239
|
if (queryResult.birthdate.eq && queryResult.birthdate.eq.result && !areDatesEqual(queryResult.birthdate.eq.expected, birthdatePassport) && !areDatesEqual(queryResult.birthdate.eq.expected, birthdateIDCard)) {
|
|
1244
1240
|
console.warn("Birthdate does not match the expected birthdate");
|
|
1245
1241
|
isCorrect = false;
|
|
1246
|
-
queryResultErrors.birthdate
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1242
|
+
queryResultErrors.birthdate = {
|
|
1243
|
+
...queryResultErrors.birthdate,
|
|
1244
|
+
eq: {
|
|
1245
|
+
expected: `${queryResult.birthdate.eq.expected.toISOString()}`,
|
|
1246
|
+
received: `${birthdatePassport?.toISOString() ?? birthdateIDCard?.toISOString()}`,
|
|
1247
|
+
message: "Birthdate does not match the expected birthdate"
|
|
1248
|
+
}
|
|
1250
1249
|
};
|
|
1251
1250
|
}
|
|
1252
1251
|
if (queryResult.birthdate.disclose && !areDatesEqual(queryResult.birthdate.disclose.result, birthdatePassport) && !areDatesEqual(queryResult.birthdate.disclose.result, birthdateIDCard)) {
|
|
1253
1252
|
console.warn("Birthdate does not match the disclosed birthdate in query result");
|
|
1254
1253
|
isCorrect = false;
|
|
1255
|
-
queryResultErrors.birthdate
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1254
|
+
queryResultErrors.birthdate = {
|
|
1255
|
+
...queryResultErrors.birthdate,
|
|
1256
|
+
disclose: {
|
|
1257
|
+
expected: `${queryResult.birthdate.disclose.result.toISOString()}`,
|
|
1258
|
+
received: `${birthdatePassport?.toISOString() ?? birthdateIDCard?.toISOString()}`,
|
|
1259
|
+
message: "Birthdate does not match the disclosed birthdate in query result"
|
|
1260
|
+
}
|
|
1259
1261
|
};
|
|
1260
1262
|
}
|
|
1261
1263
|
}
|
|
@@ -1265,19 +1267,25 @@ var ZKPassport = class {
|
|
|
1265
1267
|
if (queryResult.expiry_date.eq && queryResult.expiry_date.eq.result && !areDatesEqual(queryResult.expiry_date.eq.expected, expiryDatePassport) && !areDatesEqual(queryResult.expiry_date.eq.expected, expiryDateIDCard)) {
|
|
1266
1268
|
console.warn("Expiry date does not match the expected expiry date");
|
|
1267
1269
|
isCorrect = false;
|
|
1268
|
-
queryResultErrors.expiry_date
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1270
|
+
queryResultErrors.expiry_date = {
|
|
1271
|
+
...queryResultErrors.expiry_date,
|
|
1272
|
+
eq: {
|
|
1273
|
+
expected: `${queryResult.expiry_date.eq.expected.toISOString()}`,
|
|
1274
|
+
received: `${expiryDatePassport?.toISOString() ?? expiryDateIDCard?.toISOString()}`,
|
|
1275
|
+
message: "Expiry date does not match the expected expiry date"
|
|
1276
|
+
}
|
|
1272
1277
|
};
|
|
1273
1278
|
}
|
|
1274
1279
|
if (queryResult.expiry_date.disclose && !areDatesEqual(queryResult.expiry_date.disclose.result, expiryDatePassport) && !areDatesEqual(queryResult.expiry_date.disclose.result, expiryDateIDCard)) {
|
|
1275
1280
|
console.warn("Expiry date does not match the disclosed expiry date in query result");
|
|
1276
1281
|
isCorrect = false;
|
|
1277
|
-
queryResultErrors.expiry_date
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1282
|
+
queryResultErrors.expiry_date = {
|
|
1283
|
+
...queryResultErrors.expiry_date,
|
|
1284
|
+
disclose: {
|
|
1285
|
+
expected: `${queryResult.expiry_date.disclose.result.toISOString()}`,
|
|
1286
|
+
received: `${expiryDatePassport?.toISOString() ?? expiryDateIDCard?.toISOString()}`,
|
|
1287
|
+
message: "Expiry date does not match the disclosed expiry date in query result"
|
|
1288
|
+
}
|
|
1281
1289
|
};
|
|
1282
1290
|
}
|
|
1283
1291
|
}
|
|
@@ -1287,19 +1295,25 @@ var ZKPassport = class {
|
|
|
1287
1295
|
if (queryResult.nationality.eq && queryResult.nationality.eq.result && queryResult.nationality.eq.expected !== nationalityPassport && queryResult.nationality.eq.expected !== nationalityIDCard) {
|
|
1288
1296
|
console.warn("Nationality does not match the expected nationality");
|
|
1289
1297
|
isCorrect = false;
|
|
1290
|
-
queryResultErrors.nationality
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1298
|
+
queryResultErrors.nationality = {
|
|
1299
|
+
...queryResultErrors.nationality,
|
|
1300
|
+
eq: {
|
|
1301
|
+
expected: `${queryResult.nationality.eq.expected}`,
|
|
1302
|
+
received: `${nationalityPassport ?? nationalityIDCard}`,
|
|
1303
|
+
message: "Nationality does not match the expected nationality"
|
|
1304
|
+
}
|
|
1294
1305
|
};
|
|
1295
1306
|
}
|
|
1296
1307
|
if (queryResult.nationality.disclose && queryResult.nationality.disclose.result !== nationalityPassport && queryResult.nationality.disclose.result !== nationalityIDCard) {
|
|
1297
1308
|
console.warn("Nationality does not match the disclosed nationality in query result");
|
|
1298
1309
|
isCorrect = false;
|
|
1299
|
-
queryResultErrors.nationality
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1310
|
+
queryResultErrors.nationality = {
|
|
1311
|
+
...queryResultErrors.nationality,
|
|
1312
|
+
disclose: {
|
|
1313
|
+
expected: `${queryResult.nationality.disclose.result}`,
|
|
1314
|
+
received: `${nationalityPassport ?? nationalityIDCard}`,
|
|
1315
|
+
message: "Nationality does not match the disclosed nationality in query result"
|
|
1316
|
+
}
|
|
1303
1317
|
};
|
|
1304
1318
|
}
|
|
1305
1319
|
}
|
|
@@ -1309,19 +1323,25 @@ var ZKPassport = class {
|
|
|
1309
1323
|
if (queryResult.document_number.eq && queryResult.document_number.eq.result && queryResult.document_number.eq.expected !== documentNumberPassport && queryResult.document_number.eq.expected !== documentNumberIDCard) {
|
|
1310
1324
|
console.warn("Document number does not match the expected document number");
|
|
1311
1325
|
isCorrect = false;
|
|
1312
|
-
queryResultErrors.document_number
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1326
|
+
queryResultErrors.document_number = {
|
|
1327
|
+
...queryResultErrors.document_number,
|
|
1328
|
+
eq: {
|
|
1329
|
+
expected: `${queryResult.document_number.eq.expected}`,
|
|
1330
|
+
received: `${documentNumberPassport ?? documentNumberIDCard}`,
|
|
1331
|
+
message: "Document number does not match the expected document number"
|
|
1332
|
+
}
|
|
1316
1333
|
};
|
|
1317
1334
|
}
|
|
1318
1335
|
if (queryResult.document_number.disclose && queryResult.document_number.disclose.result !== documentNumberPassport && queryResult.document_number.disclose.result !== documentNumberIDCard) {
|
|
1319
1336
|
console.warn("Document number does not match the disclosed document number in query result");
|
|
1320
1337
|
isCorrect = false;
|
|
1321
|
-
queryResultErrors.document_number
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1338
|
+
queryResultErrors.document_number = {
|
|
1339
|
+
...queryResultErrors.document_number,
|
|
1340
|
+
disclose: {
|
|
1341
|
+
expected: `${queryResult.document_number.disclose.result}`,
|
|
1342
|
+
received: `${documentNumberPassport ?? documentNumberIDCard}`,
|
|
1343
|
+
message: "Document number does not match the disclosed document number in query result"
|
|
1344
|
+
}
|
|
1325
1345
|
};
|
|
1326
1346
|
}
|
|
1327
1347
|
}
|
|
@@ -1331,19 +1351,25 @@ var ZKPassport = class {
|
|
|
1331
1351
|
if (queryResult.gender.eq && queryResult.gender.eq.result && queryResult.gender.eq.expected !== genderPassport && queryResult.gender.eq.expected !== genderIDCard) {
|
|
1332
1352
|
console.warn("Gender does not match the expected gender");
|
|
1333
1353
|
isCorrect = false;
|
|
1334
|
-
queryResultErrors.gender
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1354
|
+
queryResultErrors.gender = {
|
|
1355
|
+
...queryResultErrors.gender,
|
|
1356
|
+
eq: {
|
|
1357
|
+
expected: `${queryResult.gender.eq.expected}`,
|
|
1358
|
+
received: `${genderPassport ?? genderIDCard}`,
|
|
1359
|
+
message: "Gender does not match the expected gender"
|
|
1360
|
+
}
|
|
1338
1361
|
};
|
|
1339
1362
|
}
|
|
1340
1363
|
if (queryResult.gender.disclose && queryResult.gender.disclose.result !== genderPassport && queryResult.gender.disclose.result !== genderIDCard) {
|
|
1341
1364
|
console.warn("Gender does not match the disclosed gender in query result");
|
|
1342
1365
|
isCorrect = false;
|
|
1343
|
-
queryResultErrors.gender
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1366
|
+
queryResultErrors.gender = {
|
|
1367
|
+
...queryResultErrors.gender,
|
|
1368
|
+
disclose: {
|
|
1369
|
+
expected: `${queryResult.gender.disclose.result}`,
|
|
1370
|
+
received: `${genderPassport ?? genderIDCard}`,
|
|
1371
|
+
message: "Gender does not match the disclosed gender in query result"
|
|
1372
|
+
}
|
|
1347
1373
|
};
|
|
1348
1374
|
}
|
|
1349
1375
|
}
|
|
@@ -1353,19 +1379,25 @@ var ZKPassport = class {
|
|
|
1353
1379
|
if (queryResult.issuing_country.eq && queryResult.issuing_country.eq.result && queryResult.issuing_country.eq.expected !== issuingCountryPassport && queryResult.issuing_country.eq.expected !== issuingCountryIDCard) {
|
|
1354
1380
|
console.warn("Issuing country does not match the expected issuing country");
|
|
1355
1381
|
isCorrect = false;
|
|
1356
|
-
queryResultErrors.issuing_country
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1382
|
+
queryResultErrors.issuing_country = {
|
|
1383
|
+
...queryResultErrors.issuing_country,
|
|
1384
|
+
eq: {
|
|
1385
|
+
expected: `${queryResult.issuing_country.eq.expected}`,
|
|
1386
|
+
received: `${issuingCountryPassport ?? issuingCountryIDCard}`,
|
|
1387
|
+
message: "Issuing country does not match the expected issuing country"
|
|
1388
|
+
}
|
|
1360
1389
|
};
|
|
1361
1390
|
}
|
|
1362
1391
|
if (queryResult.issuing_country.disclose && queryResult.issuing_country.disclose.result !== issuingCountryPassport && queryResult.issuing_country.disclose.result !== issuingCountryIDCard) {
|
|
1363
1392
|
console.warn("Issuing country does not match the disclosed issuing country in query result");
|
|
1364
1393
|
isCorrect = false;
|
|
1365
|
-
queryResultErrors.issuing_country
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1394
|
+
queryResultErrors.issuing_country = {
|
|
1395
|
+
...queryResultErrors.issuing_country,
|
|
1396
|
+
disclose: {
|
|
1397
|
+
expected: `${queryResult.issuing_country.disclose.result}`,
|
|
1398
|
+
received: `${issuingCountryPassport ?? issuingCountryIDCard}`,
|
|
1399
|
+
message: "Issuing country does not match the disclosed issuing country in query result"
|
|
1400
|
+
}
|
|
1369
1401
|
};
|
|
1370
1402
|
}
|
|
1371
1403
|
}
|
|
@@ -1375,19 +1407,25 @@ var ZKPassport = class {
|
|
|
1375
1407
|
if (queryResult.fullname.eq && queryResult.fullname.eq.result && formatName(queryResult.fullname.eq.expected).toLowerCase() !== fullnamePassport.toLowerCase() && formatName(queryResult.fullname.eq.expected).toLowerCase() !== fullnameIDCard.toLowerCase()) {
|
|
1376
1408
|
console.warn("Fullname does not match the expected fullname");
|
|
1377
1409
|
isCorrect = false;
|
|
1378
|
-
queryResultErrors.fullname
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1410
|
+
queryResultErrors.fullname = {
|
|
1411
|
+
...queryResultErrors.fullname,
|
|
1412
|
+
eq: {
|
|
1413
|
+
expected: `${queryResult.fullname.eq.expected}`,
|
|
1414
|
+
received: `${fullnamePassport ?? fullnameIDCard}`,
|
|
1415
|
+
message: "Fullname does not match the expected fullname"
|
|
1416
|
+
}
|
|
1382
1417
|
};
|
|
1383
1418
|
}
|
|
1384
1419
|
if (queryResult.fullname.disclose && formatName(queryResult.fullname.disclose.result).toLowerCase() !== fullnamePassport.toLowerCase() && formatName(queryResult.fullname.disclose.result).toLowerCase() !== fullnameIDCard.toLowerCase()) {
|
|
1385
1420
|
console.warn("Fullname does not match the disclosed fullname in query result");
|
|
1386
1421
|
isCorrect = false;
|
|
1387
|
-
queryResultErrors.fullname
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1422
|
+
queryResultErrors.fullname = {
|
|
1423
|
+
...queryResultErrors.fullname,
|
|
1424
|
+
disclose: {
|
|
1425
|
+
expected: `${queryResult.fullname.disclose.result}`,
|
|
1426
|
+
received: `${fullnamePassport ?? fullnameIDCard}`,
|
|
1427
|
+
message: "Fullname does not match the disclosed fullname in query result"
|
|
1428
|
+
}
|
|
1391
1429
|
};
|
|
1392
1430
|
}
|
|
1393
1431
|
}
|
|
@@ -1397,19 +1435,25 @@ var ZKPassport = class {
|
|
|
1397
1435
|
if (queryResult.firstname.eq && queryResult.firstname.eq.result && formatName(queryResult.firstname.eq.expected).toLowerCase() !== firstnamePassport.toLowerCase() && formatName(queryResult.firstname.eq.expected).toLowerCase() !== firstnameIDCard.toLowerCase()) {
|
|
1398
1436
|
console.warn("Firstname does not match the expected firstname");
|
|
1399
1437
|
isCorrect = false;
|
|
1400
|
-
queryResultErrors.firstname
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1438
|
+
queryResultErrors.firstname = {
|
|
1439
|
+
...queryResultErrors.firstname,
|
|
1440
|
+
eq: {
|
|
1441
|
+
expected: `${queryResult.firstname.eq.expected}`,
|
|
1442
|
+
received: `${firstnamePassport ?? firstnameIDCard}`,
|
|
1443
|
+
message: "Firstname does not match the expected firstname"
|
|
1444
|
+
}
|
|
1404
1445
|
};
|
|
1405
1446
|
}
|
|
1406
1447
|
if (queryResult.firstname.disclose && formatName(queryResult.firstname.disclose.result).toLowerCase() !== firstnamePassport.toLowerCase() && formatName(queryResult.firstname.disclose.result).toLowerCase() !== firstnameIDCard.toLowerCase()) {
|
|
1407
1448
|
console.warn("Firstname does not match the disclosed firstname in query result");
|
|
1408
1449
|
isCorrect = false;
|
|
1409
|
-
queryResultErrors.firstname
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1450
|
+
queryResultErrors.firstname = {
|
|
1451
|
+
...queryResultErrors.firstname,
|
|
1452
|
+
disclose: {
|
|
1453
|
+
expected: `${queryResult.firstname.disclose.result}`,
|
|
1454
|
+
received: `${firstnamePassport ?? firstnameIDCard}`,
|
|
1455
|
+
message: "Firstname does not match the disclosed firstname in query result"
|
|
1456
|
+
}
|
|
1413
1457
|
};
|
|
1414
1458
|
}
|
|
1415
1459
|
}
|
|
@@ -1419,44 +1463,32 @@ var ZKPassport = class {
|
|
|
1419
1463
|
if (queryResult.lastname.eq && queryResult.lastname.eq.result && formatName(queryResult.lastname.eq.expected).toLowerCase() !== lastnamePassport.toLowerCase() && formatName(queryResult.lastname.eq.expected).toLowerCase() !== lastnameIDCard.toLowerCase()) {
|
|
1420
1464
|
console.warn("Lastname does not match the expected lastname");
|
|
1421
1465
|
isCorrect = false;
|
|
1422
|
-
queryResultErrors.lastname
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1466
|
+
queryResultErrors.lastname = {
|
|
1467
|
+
...queryResultErrors.lastname,
|
|
1468
|
+
eq: {
|
|
1469
|
+
expected: `${queryResult.lastname.eq.expected}`,
|
|
1470
|
+
received: `${lastnamePassport ?? lastnameIDCard}`,
|
|
1471
|
+
message: "Lastname does not match the expected lastname"
|
|
1472
|
+
}
|
|
1426
1473
|
};
|
|
1427
1474
|
}
|
|
1428
1475
|
if (queryResult.lastname.disclose && formatName(queryResult.lastname.disclose.result).toLowerCase() !== lastnamePassport.toLowerCase() && formatName(queryResult.lastname.disclose.result).toLowerCase() !== lastnameIDCard.toLowerCase()) {
|
|
1429
1476
|
console.warn("Lastname does not match the disclosed lastname in query result");
|
|
1430
1477
|
isCorrect = false;
|
|
1431
|
-
queryResultErrors.lastname
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1478
|
+
queryResultErrors.lastname = {
|
|
1479
|
+
...queryResultErrors.lastname,
|
|
1480
|
+
disclose: {
|
|
1481
|
+
expected: `${queryResult.lastname.disclose.result}`,
|
|
1482
|
+
received: `${lastnamePassport ?? lastnameIDCard}`,
|
|
1483
|
+
message: "Lastname does not match the disclosed lastname in query result"
|
|
1484
|
+
}
|
|
1435
1485
|
};
|
|
1436
1486
|
}
|
|
1437
1487
|
}
|
|
1438
1488
|
return { isCorrect, queryResultErrors };
|
|
1439
1489
|
}
|
|
1440
1490
|
checkAgePublicInputs(proof, queryResult) {
|
|
1441
|
-
const queryResultErrors = {
|
|
1442
|
-
sig_check_dsc: {},
|
|
1443
|
-
sig_check_id_data: {},
|
|
1444
|
-
data_check_integrity: {},
|
|
1445
|
-
disclose: {},
|
|
1446
|
-
age: {},
|
|
1447
|
-
birthdate: {},
|
|
1448
|
-
expiry_date: {},
|
|
1449
|
-
document_type: {},
|
|
1450
|
-
issuing_country: {},
|
|
1451
|
-
gender: {},
|
|
1452
|
-
nationality: {},
|
|
1453
|
-
firstname: {},
|
|
1454
|
-
lastname: {},
|
|
1455
|
-
fullname: {},
|
|
1456
|
-
document_number: {},
|
|
1457
|
-
outer: {},
|
|
1458
|
-
bind: {}
|
|
1459
|
-
};
|
|
1491
|
+
const queryResultErrors = {};
|
|
1460
1492
|
let isCorrect = true;
|
|
1461
1493
|
const currentTime = /* @__PURE__ */ new Date();
|
|
1462
1494
|
const today = new Date(
|
|
@@ -1478,64 +1510,85 @@ var ZKPassport = class {
|
|
|
1478
1510
|
if (queryResult.age.gte && queryResult.age.gte.result && minAge !== queryResult.age.gte.expected) {
|
|
1479
1511
|
console.warn("Age is not greater than or equal to the expected age");
|
|
1480
1512
|
isCorrect = false;
|
|
1481
|
-
queryResultErrors.age
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1513
|
+
queryResultErrors.age = {
|
|
1514
|
+
...queryResultErrors.age,
|
|
1515
|
+
gte: {
|
|
1516
|
+
expected: queryResult.age.gte.expected,
|
|
1517
|
+
received: minAge,
|
|
1518
|
+
message: "Age is not greater than or equal to the expected age"
|
|
1519
|
+
}
|
|
1485
1520
|
};
|
|
1486
1521
|
}
|
|
1487
1522
|
if (queryResult.age.lt && queryResult.age.lt.result && maxAge !== queryResult.age.lt.expected) {
|
|
1488
1523
|
console.warn("Age is not less than the expected age");
|
|
1489
1524
|
isCorrect = false;
|
|
1490
|
-
queryResultErrors.age
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1525
|
+
queryResultErrors.age = {
|
|
1526
|
+
...queryResultErrors.age,
|
|
1527
|
+
lt: {
|
|
1528
|
+
expected: queryResult.age.lt.expected,
|
|
1529
|
+
received: maxAge,
|
|
1530
|
+
message: "Age is not less than the expected age"
|
|
1531
|
+
}
|
|
1494
1532
|
};
|
|
1495
1533
|
}
|
|
1496
1534
|
if (queryResult.age.range) {
|
|
1497
1535
|
if (queryResult.age.range.result && (minAge !== queryResult.age.range.expected[0] || maxAge !== queryResult.age.range.expected[1])) {
|
|
1498
1536
|
console.warn("Age is not in the expected range");
|
|
1499
1537
|
isCorrect = false;
|
|
1500
|
-
queryResultErrors.age
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1538
|
+
queryResultErrors.age = {
|
|
1539
|
+
...queryResultErrors.age,
|
|
1540
|
+
range: {
|
|
1541
|
+
expected: queryResult.age.range.expected,
|
|
1542
|
+
received: [minAge, maxAge],
|
|
1543
|
+
message: "Age is not in the expected range"
|
|
1544
|
+
}
|
|
1504
1545
|
};
|
|
1505
1546
|
}
|
|
1506
1547
|
}
|
|
1507
1548
|
if (!queryResult.age.lt && !queryResult.age.range && maxAge != 0) {
|
|
1508
1549
|
console.warn("Maximum age should be equal to 0");
|
|
1509
1550
|
isCorrect = false;
|
|
1510
|
-
queryResultErrors.age
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1551
|
+
queryResultErrors.age = {
|
|
1552
|
+
...queryResultErrors.age,
|
|
1553
|
+
disclose: {
|
|
1554
|
+
expected: 0,
|
|
1555
|
+
received: maxAge,
|
|
1556
|
+
message: "Maximum age should be equal to 0"
|
|
1557
|
+
}
|
|
1514
1558
|
};
|
|
1515
1559
|
}
|
|
1516
1560
|
if (!queryResult.age.gte && !queryResult.age.range && minAge != 0) {
|
|
1517
1561
|
console.warn("Minimum age should be equal to 0");
|
|
1518
1562
|
isCorrect = false;
|
|
1519
|
-
queryResultErrors.age
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1563
|
+
queryResultErrors.age = {
|
|
1564
|
+
...queryResultErrors.age,
|
|
1565
|
+
disclose: {
|
|
1566
|
+
expected: 0,
|
|
1567
|
+
received: minAge,
|
|
1568
|
+
message: "Minimum age should be equal to 0"
|
|
1569
|
+
}
|
|
1523
1570
|
};
|
|
1524
1571
|
}
|
|
1525
1572
|
if (queryResult.age.disclose && (queryResult.age.disclose.result !== minAge || queryResult.age.disclose.result !== maxAge)) {
|
|
1526
1573
|
console.warn("Age does not match the disclosed age in query result");
|
|
1527
1574
|
isCorrect = false;
|
|
1528
|
-
queryResultErrors.age
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1575
|
+
queryResultErrors.age = {
|
|
1576
|
+
...queryResultErrors.age,
|
|
1577
|
+
disclose: {
|
|
1578
|
+
expected: `${minAge}`,
|
|
1579
|
+
received: `${queryResult.age.disclose.result}`,
|
|
1580
|
+
message: "Age does not match the disclosed age in query result"
|
|
1581
|
+
}
|
|
1532
1582
|
};
|
|
1533
1583
|
}
|
|
1534
1584
|
} else {
|
|
1535
1585
|
console.warn("Age is not set in the query result");
|
|
1536
1586
|
isCorrect = false;
|
|
1537
|
-
queryResultErrors.age
|
|
1538
|
-
|
|
1587
|
+
queryResultErrors.age = {
|
|
1588
|
+
...queryResultErrors.age,
|
|
1589
|
+
disclose: {
|
|
1590
|
+
message: "Age is not set in the query result"
|
|
1591
|
+
}
|
|
1539
1592
|
};
|
|
1540
1593
|
}
|
|
1541
1594
|
const currentDate = getCurrentDateFromCommittedInputs(
|
|
@@ -1544,34 +1597,19 @@ var ZKPassport = class {
|
|
|
1544
1597
|
if (!areDatesEqual(currentDate, today) && !areDatesEqual(currentDate, today.getTime() - 864e5)) {
|
|
1545
1598
|
console.warn("Current date in the proof is too old");
|
|
1546
1599
|
isCorrect = false;
|
|
1547
|
-
queryResultErrors.age
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1600
|
+
queryResultErrors.age = {
|
|
1601
|
+
...queryResultErrors.age,
|
|
1602
|
+
disclose: {
|
|
1603
|
+
expected: `${today.toISOString()}`,
|
|
1604
|
+
received: `${currentDate.toISOString()}`,
|
|
1605
|
+
message: "Current date in the proof is too old"
|
|
1606
|
+
}
|
|
1551
1607
|
};
|
|
1552
1608
|
}
|
|
1553
1609
|
return { isCorrect, queryResultErrors };
|
|
1554
1610
|
}
|
|
1555
1611
|
checkBirthdatePublicInputs(proof, queryResult) {
|
|
1556
|
-
const queryResultErrors = {
|
|
1557
|
-
sig_check_dsc: {},
|
|
1558
|
-
sig_check_id_data: {},
|
|
1559
|
-
data_check_integrity: {},
|
|
1560
|
-
disclose: {},
|
|
1561
|
-
age: {},
|
|
1562
|
-
birthdate: {},
|
|
1563
|
-
expiry_date: {},
|
|
1564
|
-
document_type: {},
|
|
1565
|
-
issuing_country: {},
|
|
1566
|
-
gender: {},
|
|
1567
|
-
nationality: {},
|
|
1568
|
-
firstname: {},
|
|
1569
|
-
lastname: {},
|
|
1570
|
-
fullname: {},
|
|
1571
|
-
document_number: {},
|
|
1572
|
-
outer: {},
|
|
1573
|
-
bind: {}
|
|
1574
|
-
};
|
|
1612
|
+
const queryResultErrors = {};
|
|
1575
1613
|
let isCorrect = true;
|
|
1576
1614
|
const currentTime = /* @__PURE__ */ new Date();
|
|
1577
1615
|
const today = new Date(
|
|
@@ -1582,10 +1620,10 @@ var ZKPassport = class {
|
|
|
1582
1620
|
0,
|
|
1583
1621
|
0
|
|
1584
1622
|
);
|
|
1585
|
-
const minDate =
|
|
1623
|
+
const minDate = getBirthdateMinDateTimestamp(
|
|
1586
1624
|
proof.committedInputs?.compare_birthdate
|
|
1587
1625
|
);
|
|
1588
|
-
const maxDate =
|
|
1626
|
+
const maxDate = getBirthdateMaxDateTimestamp(
|
|
1589
1627
|
proof.committedInputs?.compare_birthdate
|
|
1590
1628
|
);
|
|
1591
1629
|
const currentDate = getCurrentDateFromCommittedInputs(
|
|
@@ -1595,88 +1633,91 @@ var ZKPassport = class {
|
|
|
1595
1633
|
if (queryResult.birthdate.gte && queryResult.birthdate.gte.result && minDate !== queryResult.birthdate.gte.expected) {
|
|
1596
1634
|
console.warn("Birthdate is not greater than or equal to the expected birthdate");
|
|
1597
1635
|
isCorrect = false;
|
|
1598
|
-
queryResultErrors.birthdate
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1636
|
+
queryResultErrors.birthdate = {
|
|
1637
|
+
...queryResultErrors.birthdate,
|
|
1638
|
+
gte: {
|
|
1639
|
+
expected: queryResult.birthdate.gte.expected,
|
|
1640
|
+
received: minDate,
|
|
1641
|
+
message: "Birthdate is not greater than or equal to the expected birthdate"
|
|
1642
|
+
}
|
|
1602
1643
|
};
|
|
1603
1644
|
}
|
|
1604
1645
|
if (queryResult.birthdate.lte && queryResult.birthdate.lte.result && maxDate !== queryResult.birthdate.lte.expected) {
|
|
1605
1646
|
console.warn("Birthdate is not less than the expected birthdate");
|
|
1606
1647
|
isCorrect = false;
|
|
1607
|
-
queryResultErrors.birthdate
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1648
|
+
queryResultErrors.birthdate = {
|
|
1649
|
+
...queryResultErrors.birthdate,
|
|
1650
|
+
lte: {
|
|
1651
|
+
expected: queryResult.birthdate.lte.expected,
|
|
1652
|
+
received: maxDate,
|
|
1653
|
+
message: "Birthdate is not less than the expected birthdate"
|
|
1654
|
+
}
|
|
1611
1655
|
};
|
|
1612
1656
|
}
|
|
1613
1657
|
if (queryResult.birthdate.range) {
|
|
1614
1658
|
if (queryResult.birthdate.range.result && (minDate !== queryResult.birthdate.range.expected[0] || maxDate !== queryResult.birthdate.range.expected[1])) {
|
|
1615
1659
|
console.warn("Birthdate is not in the expected range");
|
|
1616
1660
|
isCorrect = false;
|
|
1617
|
-
queryResultErrors.birthdate
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1661
|
+
queryResultErrors.birthdate = {
|
|
1662
|
+
...queryResultErrors.birthdate,
|
|
1663
|
+
range: {
|
|
1664
|
+
expected: queryResult.birthdate.range.expected,
|
|
1665
|
+
received: [minDate, maxDate],
|
|
1666
|
+
message: "Birthdate is not in the expected range"
|
|
1667
|
+
}
|
|
1621
1668
|
};
|
|
1622
1669
|
}
|
|
1623
1670
|
}
|
|
1624
1671
|
if (!queryResult.birthdate.lte && !queryResult.birthdate.range && !areDatesEqual(maxDate, DEFAULT_DATE_VALUE)) {
|
|
1625
1672
|
console.warn("Maximum birthdate should be equal to default date value");
|
|
1626
1673
|
isCorrect = false;
|
|
1627
|
-
queryResultErrors.birthdate
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1674
|
+
queryResultErrors.birthdate = {
|
|
1675
|
+
...queryResultErrors.birthdate,
|
|
1676
|
+
disclose: {
|
|
1677
|
+
expected: `${DEFAULT_DATE_VALUE.toISOString()}`,
|
|
1678
|
+
received: `${maxDate.toISOString()}`,
|
|
1679
|
+
message: "Maximum birthdate should be equal to default date value"
|
|
1680
|
+
}
|
|
1631
1681
|
};
|
|
1632
1682
|
}
|
|
1633
1683
|
if (!queryResult.birthdate.gte && !queryResult.birthdate.range && !areDatesEqual(minDate, DEFAULT_DATE_VALUE)) {
|
|
1634
1684
|
console.warn("Minimum birthdate should be equal to default date value");
|
|
1635
1685
|
isCorrect = false;
|
|
1636
|
-
queryResultErrors.birthdate
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1686
|
+
queryResultErrors.birthdate = {
|
|
1687
|
+
...queryResultErrors.birthdate,
|
|
1688
|
+
disclose: {
|
|
1689
|
+
expected: `${DEFAULT_DATE_VALUE.toISOString()}`,
|
|
1690
|
+
received: `${minDate.toISOString()}`,
|
|
1691
|
+
message: "Minimum birthdate should be equal to default date value"
|
|
1692
|
+
}
|
|
1640
1693
|
};
|
|
1641
1694
|
}
|
|
1642
1695
|
} else {
|
|
1643
1696
|
console.warn("Birthdate is not set in the query result");
|
|
1644
1697
|
isCorrect = false;
|
|
1645
|
-
queryResultErrors.birthdate
|
|
1646
|
-
|
|
1698
|
+
queryResultErrors.birthdate = {
|
|
1699
|
+
...queryResultErrors.birthdate,
|
|
1700
|
+
disclose: {
|
|
1701
|
+
message: "Birthdate is not set in the query result"
|
|
1702
|
+
}
|
|
1647
1703
|
};
|
|
1648
1704
|
}
|
|
1649
1705
|
if (!areDatesEqual(currentDate, today) && !areDatesEqual(currentDate, today.getTime() - 864e5)) {
|
|
1650
1706
|
console.warn("Current date in the proof is too old");
|
|
1651
1707
|
isCorrect = false;
|
|
1652
|
-
queryResultErrors.
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1708
|
+
queryResultErrors.birthdate = {
|
|
1709
|
+
...queryResultErrors.birthdate,
|
|
1710
|
+
disclose: {
|
|
1711
|
+
expected: `${today.toISOString()}`,
|
|
1712
|
+
received: `${currentDate.toISOString()}`,
|
|
1713
|
+
message: "Current date in the proof is too old"
|
|
1714
|
+
}
|
|
1656
1715
|
};
|
|
1657
1716
|
}
|
|
1658
1717
|
return { isCorrect, queryResultErrors };
|
|
1659
1718
|
}
|
|
1660
1719
|
checkExpiryDatePublicInputs(proof, queryResult) {
|
|
1661
|
-
const queryResultErrors = {
|
|
1662
|
-
sig_check_dsc: {},
|
|
1663
|
-
sig_check_id_data: {},
|
|
1664
|
-
data_check_integrity: {},
|
|
1665
|
-
disclose: {},
|
|
1666
|
-
age: {},
|
|
1667
|
-
birthdate: {},
|
|
1668
|
-
expiry_date: {},
|
|
1669
|
-
document_type: {},
|
|
1670
|
-
issuing_country: {},
|
|
1671
|
-
gender: {},
|
|
1672
|
-
nationality: {},
|
|
1673
|
-
firstname: {},
|
|
1674
|
-
lastname: {},
|
|
1675
|
-
fullname: {},
|
|
1676
|
-
document_number: {},
|
|
1677
|
-
outer: {},
|
|
1678
|
-
bind: {}
|
|
1679
|
-
};
|
|
1720
|
+
const queryResultErrors = {};
|
|
1680
1721
|
let isCorrect = true;
|
|
1681
1722
|
const currentTime = /* @__PURE__ */ new Date();
|
|
1682
1723
|
const today = new Date(
|
|
@@ -1700,104 +1741,113 @@ var ZKPassport = class {
|
|
|
1700
1741
|
if (queryResult.expiry_date.gte && queryResult.expiry_date.gte.result && minDate !== queryResult.expiry_date.gte.expected) {
|
|
1701
1742
|
console.warn("Expiry date is not greater than or equal to the expected expiry date");
|
|
1702
1743
|
isCorrect = false;
|
|
1703
|
-
queryResultErrors.expiry_date
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1744
|
+
queryResultErrors.expiry_date = {
|
|
1745
|
+
...queryResultErrors.expiry_date,
|
|
1746
|
+
gte: {
|
|
1747
|
+
expected: queryResult.expiry_date.gte.expected,
|
|
1748
|
+
received: minDate,
|
|
1749
|
+
message: "Expiry date is not greater than or equal to the expected expiry date"
|
|
1750
|
+
}
|
|
1707
1751
|
};
|
|
1708
1752
|
}
|
|
1709
1753
|
if (queryResult.expiry_date.lte && queryResult.expiry_date.lte.result && maxDate !== queryResult.expiry_date.lte.expected) {
|
|
1710
1754
|
console.warn("Expiry date is not less than the expected expiry date");
|
|
1711
1755
|
isCorrect = false;
|
|
1712
|
-
queryResultErrors.expiry_date
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1756
|
+
queryResultErrors.expiry_date = {
|
|
1757
|
+
...queryResultErrors.expiry_date,
|
|
1758
|
+
lte: {
|
|
1759
|
+
expected: queryResult.expiry_date.lte.expected,
|
|
1760
|
+
received: maxDate,
|
|
1761
|
+
message: "Expiry date is not less than the expected expiry date"
|
|
1762
|
+
}
|
|
1716
1763
|
};
|
|
1717
1764
|
}
|
|
1718
1765
|
if (queryResult.expiry_date.range) {
|
|
1719
1766
|
if (queryResult.expiry_date.range.result && (minDate !== queryResult.expiry_date.range.expected[0] || maxDate !== queryResult.expiry_date.range.expected[1])) {
|
|
1720
1767
|
console.warn("Expiry date is not in the expected range");
|
|
1721
1768
|
isCorrect = false;
|
|
1722
|
-
queryResultErrors.expiry_date
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1769
|
+
queryResultErrors.expiry_date = {
|
|
1770
|
+
...queryResultErrors.expiry_date,
|
|
1771
|
+
range: {
|
|
1772
|
+
expected: queryResult.expiry_date.range.expected,
|
|
1773
|
+
received: [minDate, maxDate],
|
|
1774
|
+
message: "Expiry date is not in the expected range"
|
|
1775
|
+
}
|
|
1726
1776
|
};
|
|
1727
1777
|
}
|
|
1728
1778
|
}
|
|
1729
1779
|
if (!queryResult.expiry_date.lte && !queryResult.expiry_date.range && !areDatesEqual(maxDate, DEFAULT_DATE_VALUE)) {
|
|
1730
1780
|
console.warn("Maximum expiry date should be equal to default date value");
|
|
1731
1781
|
isCorrect = false;
|
|
1732
|
-
queryResultErrors.expiry_date
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1782
|
+
queryResultErrors.expiry_date = {
|
|
1783
|
+
...queryResultErrors.expiry_date,
|
|
1784
|
+
disclose: {
|
|
1785
|
+
expected: `${DEFAULT_DATE_VALUE.toISOString()}`,
|
|
1786
|
+
received: `${maxDate.toISOString()}`,
|
|
1787
|
+
message: "Maximum expiry date should be equal to default date value"
|
|
1788
|
+
}
|
|
1736
1789
|
};
|
|
1737
1790
|
}
|
|
1738
1791
|
if (!queryResult.expiry_date.gte && !queryResult.expiry_date.range && !areDatesEqual(minDate, DEFAULT_DATE_VALUE)) {
|
|
1739
1792
|
console.warn("Minimum expiry date should be equal to default date value");
|
|
1740
1793
|
isCorrect = false;
|
|
1741
|
-
queryResultErrors.expiry_date
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1794
|
+
queryResultErrors.expiry_date = {
|
|
1795
|
+
...queryResultErrors.expiry_date,
|
|
1796
|
+
disclose: {
|
|
1797
|
+
expected: `${DEFAULT_DATE_VALUE.toISOString()}`,
|
|
1798
|
+
received: `${minDate.toISOString()}`,
|
|
1799
|
+
message: "Minimum expiry date should be equal to default date value"
|
|
1800
|
+
}
|
|
1745
1801
|
};
|
|
1746
1802
|
}
|
|
1747
1803
|
} else {
|
|
1748
1804
|
console.warn("Expiry date is not set in the query result");
|
|
1749
1805
|
isCorrect = false;
|
|
1750
|
-
queryResultErrors.expiry_date
|
|
1751
|
-
|
|
1806
|
+
queryResultErrors.expiry_date = {
|
|
1807
|
+
...queryResultErrors.expiry_date,
|
|
1808
|
+
disclose: {
|
|
1809
|
+
message: "Expiry date is not set in the query result"
|
|
1810
|
+
}
|
|
1752
1811
|
};
|
|
1753
1812
|
}
|
|
1754
1813
|
if (!areDatesEqual(currentDate, today) && !areDatesEqual(currentDate, today.getTime() - 864e5)) {
|
|
1755
1814
|
console.warn("Current date in the proof is too old");
|
|
1756
1815
|
isCorrect = false;
|
|
1757
|
-
queryResultErrors.
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1816
|
+
queryResultErrors.expiry_date = {
|
|
1817
|
+
...queryResultErrors.expiry_date,
|
|
1818
|
+
disclose: {
|
|
1819
|
+
expected: `${today.toISOString()}`,
|
|
1820
|
+
received: `${currentDate.toISOString()}`,
|
|
1821
|
+
message: "Current date in the proof is too old"
|
|
1822
|
+
}
|
|
1761
1823
|
};
|
|
1762
1824
|
}
|
|
1763
1825
|
return { isCorrect, queryResultErrors };
|
|
1764
1826
|
}
|
|
1765
1827
|
checkNationalityExclusionPublicInputs(queryResult, countryList) {
|
|
1766
|
-
const queryResultErrors = {
|
|
1767
|
-
sig_check_dsc: {},
|
|
1768
|
-
sig_check_id_data: {},
|
|
1769
|
-
data_check_integrity: {},
|
|
1770
|
-
disclose: {},
|
|
1771
|
-
age: {},
|
|
1772
|
-
birthdate: {},
|
|
1773
|
-
expiry_date: {},
|
|
1774
|
-
document_type: {},
|
|
1775
|
-
issuing_country: {},
|
|
1776
|
-
gender: {},
|
|
1777
|
-
nationality: {},
|
|
1778
|
-
firstname: {},
|
|
1779
|
-
lastname: {},
|
|
1780
|
-
fullname: {},
|
|
1781
|
-
document_number: {},
|
|
1782
|
-
outer: {},
|
|
1783
|
-
bind: {}
|
|
1784
|
-
};
|
|
1828
|
+
const queryResultErrors = {};
|
|
1785
1829
|
let isCorrect = true;
|
|
1786
1830
|
if (queryResult.nationality && queryResult.nationality.out && queryResult.nationality.out.result) {
|
|
1787
1831
|
if (!queryResult.nationality.out.expected?.every((country) => countryList.includes(country))) {
|
|
1788
1832
|
console.warn("Nationality exclusion list does not match the one from the query results");
|
|
1789
1833
|
isCorrect = false;
|
|
1790
|
-
queryResultErrors.nationality
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1834
|
+
queryResultErrors.nationality = {
|
|
1835
|
+
...queryResultErrors.nationality,
|
|
1836
|
+
out: {
|
|
1837
|
+
expected: queryResult.nationality.out.expected,
|
|
1838
|
+
received: countryList,
|
|
1839
|
+
message: "Nationality exclusion list does not match the one from the query results"
|
|
1840
|
+
}
|
|
1794
1841
|
};
|
|
1795
1842
|
}
|
|
1796
1843
|
} else if (!queryResult.nationality || !queryResult.nationality.out) {
|
|
1797
1844
|
console.warn("Nationality exclusion is not set in the query result");
|
|
1798
1845
|
isCorrect = false;
|
|
1799
|
-
queryResultErrors.nationality
|
|
1800
|
-
|
|
1846
|
+
queryResultErrors.nationality = {
|
|
1847
|
+
...queryResultErrors.nationality,
|
|
1848
|
+
out: {
|
|
1849
|
+
message: "Nationality exclusion is not set in the query result"
|
|
1850
|
+
}
|
|
1801
1851
|
};
|
|
1802
1852
|
}
|
|
1803
1853
|
for (let i = 1; i < countryList.length; i++) {
|
|
@@ -1806,49 +1856,40 @@ var ZKPassport = class {
|
|
|
1806
1856
|
"The nationality exclusion list has not been sorted, and thus the proof cannot be trusted"
|
|
1807
1857
|
);
|
|
1808
1858
|
isCorrect = false;
|
|
1809
|
-
queryResultErrors.nationality
|
|
1810
|
-
|
|
1859
|
+
queryResultErrors.nationality = {
|
|
1860
|
+
...queryResultErrors.nationality,
|
|
1861
|
+
out: {
|
|
1862
|
+
message: "The nationality exclusion list has not been sorted, and thus the proof cannot be trusted"
|
|
1863
|
+
}
|
|
1811
1864
|
};
|
|
1812
1865
|
}
|
|
1813
1866
|
}
|
|
1814
1867
|
return { isCorrect, queryResultErrors };
|
|
1815
1868
|
}
|
|
1816
1869
|
checkIssuingCountryExclusionPublicInputs(queryResult, countryList) {
|
|
1817
|
-
const queryResultErrors = {
|
|
1818
|
-
sig_check_dsc: {},
|
|
1819
|
-
sig_check_id_data: {},
|
|
1820
|
-
data_check_integrity: {},
|
|
1821
|
-
disclose: {},
|
|
1822
|
-
age: {},
|
|
1823
|
-
birthdate: {},
|
|
1824
|
-
expiry_date: {},
|
|
1825
|
-
document_type: {},
|
|
1826
|
-
issuing_country: {},
|
|
1827
|
-
gender: {},
|
|
1828
|
-
nationality: {},
|
|
1829
|
-
firstname: {},
|
|
1830
|
-
lastname: {},
|
|
1831
|
-
fullname: {},
|
|
1832
|
-
document_number: {},
|
|
1833
|
-
outer: {},
|
|
1834
|
-
bind: {}
|
|
1835
|
-
};
|
|
1870
|
+
const queryResultErrors = {};
|
|
1836
1871
|
let isCorrect = true;
|
|
1837
1872
|
if (queryResult.issuing_country && queryResult.issuing_country.out && queryResult.issuing_country.out.result) {
|
|
1838
1873
|
if (!queryResult.issuing_country.out.expected?.every((country) => countryList.includes(country))) {
|
|
1839
1874
|
console.warn("Issuing country exclusion list does not match the one from the query results");
|
|
1840
1875
|
isCorrect = false;
|
|
1841
|
-
queryResultErrors.issuing_country
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1876
|
+
queryResultErrors.issuing_country = {
|
|
1877
|
+
...queryResultErrors.issuing_country,
|
|
1878
|
+
out: {
|
|
1879
|
+
expected: queryResult.issuing_country.out.expected,
|
|
1880
|
+
received: countryList,
|
|
1881
|
+
message: "Issuing country exclusion list does not match the one from the query results"
|
|
1882
|
+
}
|
|
1845
1883
|
};
|
|
1846
1884
|
}
|
|
1847
1885
|
} else if (!queryResult.issuing_country || !queryResult.issuing_country.out) {
|
|
1848
1886
|
console.warn("Issuing country exclusion is not set in the query result");
|
|
1849
1887
|
isCorrect = false;
|
|
1850
|
-
queryResultErrors.issuing_country
|
|
1851
|
-
|
|
1888
|
+
queryResultErrors.issuing_country = {
|
|
1889
|
+
...queryResultErrors.issuing_country,
|
|
1890
|
+
out: {
|
|
1891
|
+
message: "Issuing country exclusion is not set in the query result"
|
|
1892
|
+
}
|
|
1852
1893
|
};
|
|
1853
1894
|
}
|
|
1854
1895
|
for (let i = 1; i < countryList.length; i++) {
|
|
@@ -1857,98 +1898,80 @@ var ZKPassport = class {
|
|
|
1857
1898
|
"The issuing country exclusion list has not been sorted, and thus the proof cannot be trusted"
|
|
1858
1899
|
);
|
|
1859
1900
|
isCorrect = false;
|
|
1860
|
-
queryResultErrors.issuing_country
|
|
1861
|
-
|
|
1901
|
+
queryResultErrors.issuing_country = {
|
|
1902
|
+
...queryResultErrors.issuing_country,
|
|
1903
|
+
out: {
|
|
1904
|
+
message: "The issuing country exclusion list has not been sorted, and thus the proof cannot be trusted"
|
|
1905
|
+
}
|
|
1862
1906
|
};
|
|
1863
1907
|
}
|
|
1864
1908
|
}
|
|
1865
1909
|
return { isCorrect, queryResultErrors };
|
|
1866
1910
|
}
|
|
1867
1911
|
checkNationalityInclusionPublicInputs(queryResult, countryList) {
|
|
1868
|
-
const queryResultErrors = {
|
|
1869
|
-
sig_check_dsc: {},
|
|
1870
|
-
sig_check_id_data: {},
|
|
1871
|
-
data_check_integrity: {},
|
|
1872
|
-
disclose: {},
|
|
1873
|
-
age: {},
|
|
1874
|
-
birthdate: {},
|
|
1875
|
-
expiry_date: {},
|
|
1876
|
-
document_type: {},
|
|
1877
|
-
issuing_country: {},
|
|
1878
|
-
gender: {},
|
|
1879
|
-
nationality: {},
|
|
1880
|
-
firstname: {},
|
|
1881
|
-
lastname: {},
|
|
1882
|
-
fullname: {},
|
|
1883
|
-
document_number: {},
|
|
1884
|
-
outer: {},
|
|
1885
|
-
bind: {}
|
|
1886
|
-
};
|
|
1912
|
+
const queryResultErrors = {};
|
|
1887
1913
|
let isCorrect = true;
|
|
1888
1914
|
if (queryResult.nationality && queryResult.nationality.in && queryResult.nationality.in.result) {
|
|
1889
1915
|
if (!queryResult.nationality.in.expected?.every((country) => countryList.includes(country))) {
|
|
1890
1916
|
console.warn("Nationality inclusion list does not match the one from the query results");
|
|
1891
1917
|
isCorrect = false;
|
|
1892
|
-
queryResultErrors.nationality
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1918
|
+
queryResultErrors.nationality = {
|
|
1919
|
+
...queryResultErrors.nationality,
|
|
1920
|
+
in: {
|
|
1921
|
+
expected: queryResult.nationality.in.expected,
|
|
1922
|
+
received: countryList,
|
|
1923
|
+
message: "Nationality inclusion list does not match the one from the query results"
|
|
1924
|
+
}
|
|
1896
1925
|
};
|
|
1897
1926
|
}
|
|
1898
1927
|
} else if (!queryResult.nationality || !queryResult.nationality.in) {
|
|
1899
1928
|
console.warn("Nationality inclusion is not set in the query result");
|
|
1900
1929
|
isCorrect = false;
|
|
1901
|
-
queryResultErrors.nationality
|
|
1902
|
-
|
|
1930
|
+
queryResultErrors.nationality = {
|
|
1931
|
+
...queryResultErrors.nationality,
|
|
1932
|
+
in: {
|
|
1933
|
+
message: "Nationality inclusion is not set in the query result"
|
|
1934
|
+
}
|
|
1903
1935
|
};
|
|
1904
1936
|
}
|
|
1905
1937
|
return { isCorrect, queryResultErrors };
|
|
1906
1938
|
}
|
|
1907
1939
|
checkIssuingCountryInclusionPublicInputs(queryResult, countryList) {
|
|
1908
|
-
const queryResultErrors = {
|
|
1909
|
-
sig_check_dsc: {},
|
|
1910
|
-
sig_check_id_data: {},
|
|
1911
|
-
data_check_integrity: {},
|
|
1912
|
-
disclose: {},
|
|
1913
|
-
age: {},
|
|
1914
|
-
birthdate: {},
|
|
1915
|
-
expiry_date: {},
|
|
1916
|
-
document_type: {},
|
|
1917
|
-
issuing_country: {},
|
|
1918
|
-
gender: {},
|
|
1919
|
-
nationality: {},
|
|
1920
|
-
firstname: {},
|
|
1921
|
-
lastname: {},
|
|
1922
|
-
fullname: {},
|
|
1923
|
-
document_number: {},
|
|
1924
|
-
outer: {},
|
|
1925
|
-
bind: {}
|
|
1926
|
-
};
|
|
1940
|
+
const queryResultErrors = {};
|
|
1927
1941
|
let isCorrect = true;
|
|
1928
1942
|
if (queryResult.issuing_country && queryResult.issuing_country.in && queryResult.issuing_country.in.result) {
|
|
1929
1943
|
if (!queryResult.issuing_country.in.expected?.every((country) => countryList.includes(country))) {
|
|
1930
1944
|
console.warn("Issuing country inclusion list does not match the one from the query results");
|
|
1931
1945
|
isCorrect = false;
|
|
1932
|
-
queryResultErrors.issuing_country
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1946
|
+
queryResultErrors.issuing_country = {
|
|
1947
|
+
...queryResultErrors.issuing_country,
|
|
1948
|
+
in: {
|
|
1949
|
+
expected: queryResult.issuing_country.in.expected,
|
|
1950
|
+
received: countryList,
|
|
1951
|
+
message: "Issuing country inclusion list does not match the one from the query results"
|
|
1952
|
+
}
|
|
1936
1953
|
};
|
|
1937
1954
|
}
|
|
1938
1955
|
} else if (!queryResult.issuing_country || !queryResult.issuing_country.in) {
|
|
1939
1956
|
console.warn("Issuing country inclusion is not set in the query result");
|
|
1940
1957
|
isCorrect = false;
|
|
1941
|
-
queryResultErrors.issuing_country
|
|
1942
|
-
|
|
1958
|
+
queryResultErrors.issuing_country = {
|
|
1959
|
+
...queryResultErrors.issuing_country,
|
|
1960
|
+
in: {
|
|
1961
|
+
message: "Issuing country inclusion is not set in the query result"
|
|
1962
|
+
}
|
|
1943
1963
|
};
|
|
1944
1964
|
}
|
|
1945
1965
|
return { isCorrect, queryResultErrors };
|
|
1946
1966
|
}
|
|
1947
|
-
checkScopeFromDisclosureProof(proofData, queryResultErrors, key, scope
|
|
1967
|
+
checkScopeFromDisclosureProof(proofData, queryResultErrors, key, scope) {
|
|
1948
1968
|
let isCorrect = true;
|
|
1949
1969
|
if (this.domain && getServiceScopeHash(this.domain) !== BigInt(proofData.publicInputs[1])) {
|
|
1950
1970
|
console.warn("The proof comes from a different domain than the one expected");
|
|
1951
1971
|
isCorrect = false;
|
|
1972
|
+
if (!queryResultErrors[key]) {
|
|
1973
|
+
queryResultErrors[key] = {};
|
|
1974
|
+
}
|
|
1952
1975
|
queryResultErrors[key].scope = {
|
|
1953
1976
|
expected: `Scope: ${getServiceScopeHash(this.domain).toString()}`,
|
|
1954
1977
|
received: `Scope: ${BigInt(proofData.publicInputs[1]).toString()}`,
|
|
@@ -1958,6 +1981,9 @@ var ZKPassport = class {
|
|
|
1958
1981
|
if (scope && getScopeHash(scope) !== BigInt(proofData.publicInputs[2])) {
|
|
1959
1982
|
console.warn("The proof uses a different scope than the one expected");
|
|
1960
1983
|
isCorrect = false;
|
|
1984
|
+
if (!queryResultErrors[key]) {
|
|
1985
|
+
queryResultErrors[key] = {};
|
|
1986
|
+
}
|
|
1961
1987
|
queryResultErrors[key].scope = {
|
|
1962
1988
|
expected: `Scope: ${getScopeHash(scope).toString()}`,
|
|
1963
1989
|
received: `Scope: ${BigInt(proofData.publicInputs[2]).toString()}`,
|
|
@@ -1974,6 +2000,9 @@ var ZKPassport = class {
|
|
|
1974
2000
|
if (!isValid) {
|
|
1975
2001
|
console.warn("The ID was signed by an unrecognized root certificate");
|
|
1976
2002
|
isCorrect = false;
|
|
2003
|
+
if (!queryResultErrors[outer ? "outer" : "sig_check_dsc"]) {
|
|
2004
|
+
queryResultErrors[outer ? "outer" : "sig_check_dsc"] = {};
|
|
2005
|
+
}
|
|
1977
2006
|
queryResultErrors[outer ? "outer" : "sig_check_dsc"].certificate = {
|
|
1978
2007
|
expected: `A valid root from ZKPassport Registry`,
|
|
1979
2008
|
received: `Got invalid certificate registry root: ${root}`,
|
|
@@ -1984,6 +2013,9 @@ var ZKPassport = class {
|
|
|
1984
2013
|
console.warn(error);
|
|
1985
2014
|
console.warn("The ID was signed by an unrecognized root certificate");
|
|
1986
2015
|
isCorrect = false;
|
|
2016
|
+
if (!queryResultErrors[outer ? "outer" : "sig_check_dsc"]) {
|
|
2017
|
+
queryResultErrors[outer ? "outer" : "sig_check_dsc"] = {};
|
|
2018
|
+
}
|
|
1987
2019
|
queryResultErrors[outer ? "outer" : "sig_check_dsc"].certificate = {
|
|
1988
2020
|
expected: `A valid root from ZKPassport Registry`,
|
|
1989
2021
|
received: `Got invalid certificate registry root: ${root}`,
|
|
@@ -2019,52 +2051,63 @@ var ZKPassport = class {
|
|
|
2019
2051
|
return { isCorrect, queryResultErrors };
|
|
2020
2052
|
}
|
|
2021
2053
|
checkBindPublicInputs(queryResult, boundData) {
|
|
2022
|
-
const queryResultErrors = {
|
|
2023
|
-
sig_check_dsc: {},
|
|
2024
|
-
sig_check_id_data: {},
|
|
2025
|
-
data_check_integrity: {},
|
|
2026
|
-
disclose: {},
|
|
2027
|
-
age: {},
|
|
2028
|
-
birthdate: {},
|
|
2029
|
-
expiry_date: {},
|
|
2030
|
-
document_type: {},
|
|
2031
|
-
issuing_country: {},
|
|
2032
|
-
gender: {},
|
|
2033
|
-
nationality: {},
|
|
2034
|
-
firstname: {},
|
|
2035
|
-
lastname: {},
|
|
2036
|
-
fullname: {},
|
|
2037
|
-
document_number: {},
|
|
2038
|
-
outer: {},
|
|
2039
|
-
bind: {}
|
|
2040
|
-
};
|
|
2054
|
+
const queryResultErrors = {};
|
|
2041
2055
|
let isCorrect = true;
|
|
2042
2056
|
if (queryResult.bind) {
|
|
2043
2057
|
if (queryResult.bind.user_address?.toLowerCase().replace("0x", "") !== boundData.user_address?.toLowerCase().replace("0x", "")) {
|
|
2044
2058
|
console.warn("Bound user address does not match the one from the query results");
|
|
2045
2059
|
isCorrect = false;
|
|
2046
|
-
queryResultErrors.bind
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2060
|
+
queryResultErrors.bind = {
|
|
2061
|
+
...queryResultErrors.bind,
|
|
2062
|
+
eq: {
|
|
2063
|
+
expected: queryResult.bind.user_address,
|
|
2064
|
+
received: boundData.user_address,
|
|
2065
|
+
message: "Bound user address does not match the one from the query results"
|
|
2066
|
+
}
|
|
2050
2067
|
};
|
|
2051
2068
|
}
|
|
2052
2069
|
if (queryResult.bind.chain !== boundData.chain) {
|
|
2053
2070
|
console.warn("Bound chain id does not match the one from the query results");
|
|
2054
2071
|
isCorrect = false;
|
|
2055
|
-
queryResultErrors.bind
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2072
|
+
queryResultErrors.bind = {
|
|
2073
|
+
...queryResultErrors.bind,
|
|
2074
|
+
eq: {
|
|
2075
|
+
expected: queryResult.bind.chain,
|
|
2076
|
+
received: boundData.chain,
|
|
2077
|
+
message: "Bound chain id does not match the one from the query results"
|
|
2078
|
+
}
|
|
2059
2079
|
};
|
|
2060
2080
|
}
|
|
2061
2081
|
if (queryResult.bind.custom_data?.trim().toLowerCase() !== boundData.custom_data?.trim().toLowerCase()) {
|
|
2062
2082
|
console.warn("Bound custom data does not match the one from the query results");
|
|
2063
2083
|
isCorrect = false;
|
|
2064
|
-
queryResultErrors.bind
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2084
|
+
queryResultErrors.bind = {
|
|
2085
|
+
...queryResultErrors.bind,
|
|
2086
|
+
eq: {
|
|
2087
|
+
expected: queryResult.bind.custom_data,
|
|
2088
|
+
received: boundData.custom_data,
|
|
2089
|
+
message: "Bound custom data does not match the one from the query results"
|
|
2090
|
+
}
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
return { isCorrect, queryResultErrors };
|
|
2095
|
+
}
|
|
2096
|
+
async checkSanctionsExclusionPublicInputs(queryResult, root, sanctionsBuilder) {
|
|
2097
|
+
const queryResultErrors = {};
|
|
2098
|
+
let isCorrect = true;
|
|
2099
|
+
if (queryResult.sanctions && queryResult.sanctions.passed) {
|
|
2100
|
+
const EXPECTED_ROOT = await sanctionsBuilder.getRoot();
|
|
2101
|
+
if (root !== BigInt(EXPECTED_ROOT)) {
|
|
2102
|
+
console.warn("Invalid sanctions registry root");
|
|
2103
|
+
isCorrect = false;
|
|
2104
|
+
queryResultErrors.sanctions = {
|
|
2105
|
+
...queryResultErrors.sanctions,
|
|
2106
|
+
eq: {
|
|
2107
|
+
expected: EXPECTED_ROOT,
|
|
2108
|
+
received: root.toString(16),
|
|
2109
|
+
message: "Invalid sanctions registry root"
|
|
2110
|
+
}
|
|
2068
2111
|
};
|
|
2069
2112
|
}
|
|
2070
2113
|
}
|
|
@@ -2085,25 +2128,7 @@ var ZKPassport = class {
|
|
|
2085
2128
|
0,
|
|
2086
2129
|
0
|
|
2087
2130
|
);
|
|
2088
|
-
let queryResultErrors = {
|
|
2089
|
-
sig_check_dsc: {},
|
|
2090
|
-
sig_check_id_data: {},
|
|
2091
|
-
data_check_integrity: {},
|
|
2092
|
-
disclose: {},
|
|
2093
|
-
age: {},
|
|
2094
|
-
birthdate: {},
|
|
2095
|
-
expiry_date: {},
|
|
2096
|
-
document_type: {},
|
|
2097
|
-
issuing_country: {},
|
|
2098
|
-
gender: {},
|
|
2099
|
-
nationality: {},
|
|
2100
|
-
firstname: {},
|
|
2101
|
-
lastname: {},
|
|
2102
|
-
fullname: {},
|
|
2103
|
-
document_number: {},
|
|
2104
|
-
outer: {},
|
|
2105
|
-
bind: {}
|
|
2106
|
-
};
|
|
2131
|
+
let queryResultErrors = {};
|
|
2107
2132
|
const sortedProofs = proofs.sort((a, b) => {
|
|
2108
2133
|
const proofOrder = [
|
|
2109
2134
|
"sig_check_dsc",
|
|
@@ -2117,7 +2142,8 @@ var ZKPassport = class {
|
|
|
2117
2142
|
"inclusion_check_nationality",
|
|
2118
2143
|
"exclusion_check_issuing_country",
|
|
2119
2144
|
"inclusion_check_issuing_country",
|
|
2120
|
-
"bind"
|
|
2145
|
+
"bind",
|
|
2146
|
+
"exclusion_check_sanctions"
|
|
2121
2147
|
];
|
|
2122
2148
|
const getIndex = (proof) => {
|
|
2123
2149
|
const name = proof.name || "";
|
|
@@ -2155,18 +2181,20 @@ var ZKPassport = class {
|
|
|
2155
2181
|
};
|
|
2156
2182
|
const currentDate = getCurrentDateFromOuterProof(proofData);
|
|
2157
2183
|
const todayToCurrentDate = today.getTime() - currentDate.getTime();
|
|
2158
|
-
const
|
|
2159
|
-
const expectedDifference = differenceInDays * 864e5;
|
|
2184
|
+
const expectedDifference = validity ? validity * 1e3 : DEFAULT_VALIDITY * 1e3;
|
|
2160
2185
|
const actualDifference = today.getTime() - (today.getTime() - expectedDifference);
|
|
2161
2186
|
if (todayToCurrentDate >= actualDifference) {
|
|
2162
2187
|
console.warn(
|
|
2163
|
-
`The date used to check the validity of the ID is older than
|
|
2188
|
+
`The date used to check the validity of the ID is older than the validity period`
|
|
2164
2189
|
);
|
|
2165
2190
|
isCorrect = false;
|
|
2166
|
-
queryResultErrors.outer
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2191
|
+
queryResultErrors.outer = {
|
|
2192
|
+
...queryResultErrors.outer,
|
|
2193
|
+
date: {
|
|
2194
|
+
expected: `Difference: ${validity} seconds`,
|
|
2195
|
+
received: `Difference: ${Math.round(todayToCurrentDate / 1e3)} seconds`,
|
|
2196
|
+
message: "The date used to check the validity of the ID is older than the validity period"
|
|
2197
|
+
}
|
|
2170
2198
|
};
|
|
2171
2199
|
}
|
|
2172
2200
|
const paramCommitments = getParamCommitmentsFromOuterProof(proofData);
|
|
@@ -2175,28 +2203,37 @@ var ZKPassport = class {
|
|
|
2175
2203
|
if (keysInCommittedInputs.length !== paramCommitments.length) {
|
|
2176
2204
|
console.warn("The proof does not verify all the requested conditions and information");
|
|
2177
2205
|
isCorrect = false;
|
|
2178
|
-
queryResultErrors.outer
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2206
|
+
queryResultErrors.outer = {
|
|
2207
|
+
...queryResultErrors.outer,
|
|
2208
|
+
commitment: {
|
|
2209
|
+
expected: `Number of parameter commitments: ${paramCommitments.length}`,
|
|
2210
|
+
received: `Number of disclosure proofs provided: ${keysInCommittedInputs.length}`,
|
|
2211
|
+
message: "The proof does not verify all the requested conditions and information"
|
|
2212
|
+
}
|
|
2182
2213
|
};
|
|
2183
2214
|
}
|
|
2184
2215
|
if (this.domain && getServiceScopeHash(this.domain) !== getScopeFromOuterProof(proofData)) {
|
|
2185
2216
|
console.warn("The proof comes from a different domain than the one expected");
|
|
2186
2217
|
isCorrect = false;
|
|
2187
|
-
queryResultErrors.outer
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2218
|
+
queryResultErrors.outer = {
|
|
2219
|
+
...queryResultErrors.outer,
|
|
2220
|
+
scope: {
|
|
2221
|
+
expected: `Scope: ${getServiceScopeHash(this.domain).toString()}`,
|
|
2222
|
+
received: `Scope: ${getScopeFromOuterProof(proofData).toString()}`,
|
|
2223
|
+
message: "The proof comes from a different domain than the one expected"
|
|
2224
|
+
}
|
|
2191
2225
|
};
|
|
2192
2226
|
}
|
|
2193
2227
|
if (scope && getScopeHash(scope) !== getSubscopeFromOuterProof(proofData)) {
|
|
2194
2228
|
console.warn("The proof uses a different scope than the one expected");
|
|
2195
2229
|
isCorrect = false;
|
|
2196
|
-
queryResultErrors.outer
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2230
|
+
queryResultErrors.outer = {
|
|
2231
|
+
...queryResultErrors.outer,
|
|
2232
|
+
scope: {
|
|
2233
|
+
expected: `Scope: ${getScopeHash(scope).toString()}`,
|
|
2234
|
+
received: `Scope: ${getSubscopeFromOuterProof(proofData).toString()}`,
|
|
2235
|
+
message: "The proof uses a different scope than the one expected"
|
|
2236
|
+
}
|
|
2200
2237
|
};
|
|
2201
2238
|
}
|
|
2202
2239
|
if (!!committedInputs?.compare_age) {
|
|
@@ -2213,10 +2250,13 @@ var ZKPassport = class {
|
|
|
2213
2250
|
if (!paramCommitments.includes(ageParameterCommitment)) {
|
|
2214
2251
|
console.warn("This proof does not verify the age");
|
|
2215
2252
|
isCorrect = false;
|
|
2216
|
-
queryResultErrors.age
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2253
|
+
queryResultErrors.age = {
|
|
2254
|
+
...queryResultErrors.age,
|
|
2255
|
+
commitment: {
|
|
2256
|
+
expected: `Age parameter commitment: ${ageParameterCommitment.toString()}`,
|
|
2257
|
+
received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
|
|
2258
|
+
message: "This proof does not verify the age"
|
|
2259
|
+
}
|
|
2220
2260
|
};
|
|
2221
2261
|
}
|
|
2222
2262
|
const { isCorrect: isCorrectAge, queryResultErrors: queryResultErrorsAge } = this.checkAgePublicInputs(proof, queryResult);
|
|
@@ -2241,10 +2281,13 @@ var ZKPassport = class {
|
|
|
2241
2281
|
if (!paramCommitments.includes(birthdateParameterCommitment)) {
|
|
2242
2282
|
console.warn("This proof does not verify the birthdate");
|
|
2243
2283
|
isCorrect = false;
|
|
2244
|
-
queryResultErrors.birthdate
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2284
|
+
queryResultErrors.birthdate = {
|
|
2285
|
+
...queryResultErrors.birthdate,
|
|
2286
|
+
commitment: {
|
|
2287
|
+
expected: `Birthdate parameter commitment: ${birthdateParameterCommitment.toString()}`,
|
|
2288
|
+
received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
|
|
2289
|
+
message: "This proof does not verify the birthdate"
|
|
2290
|
+
}
|
|
2248
2291
|
};
|
|
2249
2292
|
}
|
|
2250
2293
|
const { isCorrect: isCorrectBirthdate, queryResultErrors: queryResultErrorsBirthdate } = this.checkBirthdatePublicInputs(proof, queryResult);
|
|
@@ -2269,10 +2312,13 @@ var ZKPassport = class {
|
|
|
2269
2312
|
if (!paramCommitments.includes(expiryParameterCommitment)) {
|
|
2270
2313
|
console.warn("This proof does not verify the expiry date");
|
|
2271
2314
|
isCorrect = false;
|
|
2272
|
-
queryResultErrors.expiry_date
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2315
|
+
queryResultErrors.expiry_date = {
|
|
2316
|
+
...queryResultErrors.expiry_date,
|
|
2317
|
+
commitment: {
|
|
2318
|
+
expected: `Expiry date parameter commitment: ${expiryParameterCommitment.toString()}`,
|
|
2319
|
+
received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
|
|
2320
|
+
message: "This proof does not verify the expiry date"
|
|
2321
|
+
}
|
|
2276
2322
|
};
|
|
2277
2323
|
}
|
|
2278
2324
|
const { isCorrect: isCorrectExpiryDate, queryResultErrors: queryResultErrorsExpiryDate } = this.checkExpiryDatePublicInputs(proof, queryResult);
|
|
@@ -2293,10 +2339,13 @@ var ZKPassport = class {
|
|
|
2293
2339
|
if (!paramCommitments.includes(discloseParameterCommitment)) {
|
|
2294
2340
|
console.warn("This proof does not verify any of the data disclosed");
|
|
2295
2341
|
isCorrect = false;
|
|
2296
|
-
queryResultErrors.disclose
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2342
|
+
queryResultErrors.disclose = {
|
|
2343
|
+
...queryResultErrors.disclose,
|
|
2344
|
+
commitment: {
|
|
2345
|
+
expected: `Disclosure parameter commitment: ${discloseParameterCommitment.toString()}`,
|
|
2346
|
+
received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
|
|
2347
|
+
message: "This proof does not verify any of the data disclosed"
|
|
2348
|
+
}
|
|
2300
2349
|
};
|
|
2301
2350
|
}
|
|
2302
2351
|
const { isCorrect: isCorrectDisclose, queryResultErrors: queryResultErrorsDisclose } = this.checkDiscloseBytesPublicInputs(proof, queryResult);
|
|
@@ -2317,10 +2366,13 @@ var ZKPassport = class {
|
|
|
2317
2366
|
if (!paramCommitments.includes(inclusionCheckNationalityParameterCommitment)) {
|
|
2318
2367
|
console.warn("This proof does not verify the inclusion of the nationality");
|
|
2319
2368
|
isCorrect = false;
|
|
2320
|
-
queryResultErrors.nationality
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2369
|
+
queryResultErrors.nationality = {
|
|
2370
|
+
...queryResultErrors.nationality,
|
|
2371
|
+
commitment: {
|
|
2372
|
+
expected: `Nationality parameter commitment: ${inclusionCheckNationalityParameterCommitment.toString()}`,
|
|
2373
|
+
received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
|
|
2374
|
+
message: "This proof does not verify the inclusion of the nationality"
|
|
2375
|
+
}
|
|
2324
2376
|
};
|
|
2325
2377
|
}
|
|
2326
2378
|
const countryList = inclusionCheckNationalityCommittedInputs.countries;
|
|
@@ -2345,10 +2397,13 @@ var ZKPassport = class {
|
|
|
2345
2397
|
if (!paramCommitments.includes(inclusionCheckIssuingCountryParameterCommitment)) {
|
|
2346
2398
|
console.warn("This proof does not verify the inclusion of the issuing country");
|
|
2347
2399
|
isCorrect = false;
|
|
2348
|
-
queryResultErrors.issuing_country
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2400
|
+
queryResultErrors.issuing_country = {
|
|
2401
|
+
...queryResultErrors.issuing_country,
|
|
2402
|
+
commitment: {
|
|
2403
|
+
expected: `Issuing country parameter commitment: ${inclusionCheckIssuingCountryParameterCommitment.toString()}`,
|
|
2404
|
+
received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
|
|
2405
|
+
message: "This proof does not verify the inclusion of the issuing country"
|
|
2406
|
+
}
|
|
2352
2407
|
};
|
|
2353
2408
|
}
|
|
2354
2409
|
const countryList = inclusionCheckIssuingCountryCommittedInputs.countries;
|
|
@@ -2373,10 +2428,13 @@ var ZKPassport = class {
|
|
|
2373
2428
|
if (!paramCommitments.includes(exclusionCheckNationalityParameterCommitment)) {
|
|
2374
2429
|
console.warn("This proof does not verify the exclusion of the nationality");
|
|
2375
2430
|
isCorrect = false;
|
|
2376
|
-
queryResultErrors.nationality
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2431
|
+
queryResultErrors.nationality = {
|
|
2432
|
+
...queryResultErrors.nationality,
|
|
2433
|
+
commitment: {
|
|
2434
|
+
expected: `Nationality parameter commitment: ${exclusionCheckNationalityParameterCommitment.toString()}`,
|
|
2435
|
+
received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
|
|
2436
|
+
message: "This proof does not verify the exclusion of the nationality"
|
|
2437
|
+
}
|
|
2380
2438
|
};
|
|
2381
2439
|
}
|
|
2382
2440
|
const countryList = exclusionCheckNationalityCommittedInputs.countries;
|
|
@@ -2401,10 +2459,13 @@ var ZKPassport = class {
|
|
|
2401
2459
|
if (!paramCommitments.includes(exclusionCheckIssuingCountryParameterCommitment)) {
|
|
2402
2460
|
console.warn("This proof does not verify the exclusion of the issuing country");
|
|
2403
2461
|
isCorrect = false;
|
|
2404
|
-
queryResultErrors.issuing_country
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2462
|
+
queryResultErrors.issuing_country = {
|
|
2463
|
+
...queryResultErrors.issuing_country,
|
|
2464
|
+
commitment: {
|
|
2465
|
+
expected: `Issuing country parameter commitment: ${exclusionCheckIssuingCountryParameterCommitment.toString()}`,
|
|
2466
|
+
received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
|
|
2467
|
+
message: "This proof does not verify the exclusion of the issuing country"
|
|
2468
|
+
}
|
|
2408
2469
|
};
|
|
2409
2470
|
}
|
|
2410
2471
|
const countryList = exclusionCheckIssuingCountryCommittedInputs.countries;
|
|
@@ -2423,10 +2484,13 @@ var ZKPassport = class {
|
|
|
2423
2484
|
if (!paramCommitments.includes(bindParameterCommitment)) {
|
|
2424
2485
|
console.warn("This proof does not verify the bound data");
|
|
2425
2486
|
isCorrect = false;
|
|
2426
|
-
queryResultErrors.bind
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2487
|
+
queryResultErrors.bind = {
|
|
2488
|
+
...queryResultErrors.bind,
|
|
2489
|
+
commitment: {
|
|
2490
|
+
expected: `Bind parameter commitment: ${bindParameterCommitment.toString()}`,
|
|
2491
|
+
received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
|
|
2492
|
+
message: "This proof does not verify the bound data"
|
|
2493
|
+
}
|
|
2430
2494
|
};
|
|
2431
2495
|
}
|
|
2432
2496
|
const { isCorrect: isCorrectBind, queryResultErrors: queryResultErrorsBind } = this.checkBindPublicInputs(queryResult, bindCommittedInputs.data);
|
|
@@ -2435,6 +2499,35 @@ var ZKPassport = class {
|
|
|
2435
2499
|
...queryResultErrors,
|
|
2436
2500
|
...queryResultErrorsBind
|
|
2437
2501
|
};
|
|
2502
|
+
} else if (!!committedInputs?.exclusion_check_sanctions) {
|
|
2503
|
+
const sanctionsBuilder = await SanctionsBuilder.create();
|
|
2504
|
+
const exclusionCheckSanctionsCommittedInputs = committedInputs?.exclusion_check_sanctions;
|
|
2505
|
+
const exclusionCheckSanctionsParameterCommitment = isForEVM ? await sanctionsBuilder.getSanctionsEvmParameterCommitment() : await sanctionsBuilder.getSanctionsParameterCommitment();
|
|
2506
|
+
if (!paramCommitments.includes(exclusionCheckSanctionsParameterCommitment)) {
|
|
2507
|
+
console.warn("This proof does not verify the exclusion from the sanction lists");
|
|
2508
|
+
isCorrect = false;
|
|
2509
|
+
queryResultErrors.sanctions = {
|
|
2510
|
+
...queryResultErrors.sanctions,
|
|
2511
|
+
commitment: {
|
|
2512
|
+
expected: `Sanctions parameter commitment: ${exclusionCheckSanctionsParameterCommitment.toString()}`,
|
|
2513
|
+
received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
|
|
2514
|
+
message: "This proof does not verify the exclusion from the sanction lists"
|
|
2515
|
+
}
|
|
2516
|
+
};
|
|
2517
|
+
}
|
|
2518
|
+
const {
|
|
2519
|
+
isCorrect: isCorrectSanctionsExclusion,
|
|
2520
|
+
queryResultErrors: queryResultErrorsSanctionsExclusion
|
|
2521
|
+
} = await this.checkSanctionsExclusionPublicInputs(
|
|
2522
|
+
queryResult,
|
|
2523
|
+
BigInt(exclusionCheckSanctionsCommittedInputs.rootHash),
|
|
2524
|
+
sanctionsBuilder
|
|
2525
|
+
);
|
|
2526
|
+
isCorrect = isCorrect && isCorrectSanctionsExclusion;
|
|
2527
|
+
queryResultErrors = {
|
|
2528
|
+
...queryResultErrors,
|
|
2529
|
+
...queryResultErrorsSanctionsExclusion
|
|
2530
|
+
};
|
|
2438
2531
|
}
|
|
2439
2532
|
uniqueIdentifier = getNullifierFromOuterProof(proofData).toString(10);
|
|
2440
2533
|
} else if (proof.name?.startsWith("sig_check_dsc")) {
|
|
@@ -2460,10 +2553,13 @@ var ZKPassport = class {
|
|
|
2460
2553
|
"Failed to check the link between the certificate signature and ID signature"
|
|
2461
2554
|
);
|
|
2462
2555
|
isCorrect = false;
|
|
2463
|
-
queryResultErrors.sig_check_id_data
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2556
|
+
queryResultErrors.sig_check_id_data = {
|
|
2557
|
+
...queryResultErrors.sig_check_id_data,
|
|
2558
|
+
commitment: {
|
|
2559
|
+
expected: `Commitment: ${commitmentOut?.toString() || "undefined"}`,
|
|
2560
|
+
received: `Commitment: ${commitmentIn?.toString() || "undefined"}`,
|
|
2561
|
+
message: "Failed to check the link between the certificate signature and ID signature"
|
|
2562
|
+
}
|
|
2467
2563
|
};
|
|
2468
2564
|
}
|
|
2469
2565
|
commitmentOut = getCommitmentOutFromIDDataProof(proofData);
|
|
@@ -2472,27 +2568,32 @@ var ZKPassport = class {
|
|
|
2472
2568
|
if (commitmentIn !== commitmentOut) {
|
|
2473
2569
|
console.warn("Failed to check the link between the ID signature and the data signed");
|
|
2474
2570
|
isCorrect = false;
|
|
2475
|
-
queryResultErrors.data_check_integrity
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2571
|
+
queryResultErrors.data_check_integrity = {
|
|
2572
|
+
...queryResultErrors.data_check_integrity,
|
|
2573
|
+
commitment: {
|
|
2574
|
+
expected: `Commitment: ${commitmentOut?.toString() || "undefined"}`,
|
|
2575
|
+
received: `Commitment: ${commitmentIn?.toString() || "undefined"}`,
|
|
2576
|
+
message: "Failed to check the link between the ID signature and the data signed"
|
|
2577
|
+
}
|
|
2479
2578
|
};
|
|
2480
2579
|
}
|
|
2481
2580
|
commitmentOut = getCommitmentOutFromIntegrityProof(proofData);
|
|
2482
2581
|
const currentDate = getCurrentDateFromIntegrityProof(proofData);
|
|
2483
2582
|
const todayToCurrentDate = today.getTime() - currentDate.getTime();
|
|
2484
|
-
const
|
|
2485
|
-
const expectedDifference = differenceInDays * 864e5;
|
|
2583
|
+
const expectedDifference = validity ? validity * 1e3 : DEFAULT_VALIDITY * 1e3;
|
|
2486
2584
|
const actualDifference = today.getTime() - (today.getTime() - expectedDifference);
|
|
2487
2585
|
if (todayToCurrentDate >= actualDifference) {
|
|
2488
2586
|
console.warn(
|
|
2489
|
-
`The date used to check the validity of the ID is older than
|
|
2587
|
+
`The date used to check the validity of the ID is older than the validity period`
|
|
2490
2588
|
);
|
|
2491
2589
|
isCorrect = false;
|
|
2492
|
-
queryResultErrors.data_check_integrity
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2590
|
+
queryResultErrors.data_check_integrity = {
|
|
2591
|
+
...queryResultErrors.data_check_integrity,
|
|
2592
|
+
date: {
|
|
2593
|
+
expected: `Difference: ${validity} seconds`,
|
|
2594
|
+
received: `Difference: ${Math.round(todayToCurrentDate / 1e3)} seconds`,
|
|
2595
|
+
message: "The date used to check the validity of the ID is older than the validity period"
|
|
2596
|
+
}
|
|
2496
2597
|
};
|
|
2497
2598
|
}
|
|
2498
2599
|
} else if (proof.name === "disclose_bytes") {
|
|
@@ -2502,10 +2603,13 @@ var ZKPassport = class {
|
|
|
2502
2603
|
"Failed to check the link between the validity of the ID and the data to disclose"
|
|
2503
2604
|
);
|
|
2504
2605
|
isCorrect = false;
|
|
2505
|
-
queryResultErrors.disclose
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2606
|
+
queryResultErrors.disclose = {
|
|
2607
|
+
...queryResultErrors.disclose,
|
|
2608
|
+
commitment: {
|
|
2609
|
+
expected: `Commitment: ${commitmentOut?.toString() || "undefined"}`,
|
|
2610
|
+
received: `Commitment: ${commitmentIn?.toString() || "undefined"}`,
|
|
2611
|
+
message: "Failed to check the link between the validity of the ID and the data to disclose"
|
|
2612
|
+
}
|
|
2509
2613
|
};
|
|
2510
2614
|
}
|
|
2511
2615
|
const paramCommitment = getParameterCommitmentFromDisclosureProof(proofData);
|
|
@@ -2516,10 +2620,13 @@ var ZKPassport = class {
|
|
|
2516
2620
|
if (paramCommitment !== calculatedParamCommitment) {
|
|
2517
2621
|
console.warn("The disclosed data does not match the data committed by the proof");
|
|
2518
2622
|
isCorrect = false;
|
|
2519
|
-
queryResultErrors.disclose
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2623
|
+
queryResultErrors.disclose = {
|
|
2624
|
+
...queryResultErrors.disclose,
|
|
2625
|
+
commitment: {
|
|
2626
|
+
expected: `Commitment: ${calculatedParamCommitment}`,
|
|
2627
|
+
received: `Commitment: ${paramCommitment}`,
|
|
2628
|
+
message: "The disclosed data does not match the data committed by the proof"
|
|
2629
|
+
}
|
|
2523
2630
|
};
|
|
2524
2631
|
}
|
|
2525
2632
|
const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "disclose", scope);
|
|
@@ -2543,10 +2650,13 @@ var ZKPassport = class {
|
|
|
2543
2650
|
"Failed to check the link between the validity of the ID and the age derived from it"
|
|
2544
2651
|
);
|
|
2545
2652
|
isCorrect = false;
|
|
2546
|
-
queryResultErrors.age
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2653
|
+
queryResultErrors.age = {
|
|
2654
|
+
...queryResultErrors.age,
|
|
2655
|
+
commitment: {
|
|
2656
|
+
expected: `Commitment: ${commitmentOut}`,
|
|
2657
|
+
received: `Commitment: ${commitmentIn}`,
|
|
2658
|
+
message: "Failed to check the link between the validity of the ID and the age derived from it"
|
|
2659
|
+
}
|
|
2550
2660
|
};
|
|
2551
2661
|
}
|
|
2552
2662
|
const paramCommitment = getParameterCommitmentFromDisclosureProof(proofData);
|
|
@@ -2561,10 +2671,13 @@ var ZKPassport = class {
|
|
|
2561
2671
|
"The conditions for the age check do not match the conditions checked by the proof"
|
|
2562
2672
|
);
|
|
2563
2673
|
isCorrect = false;
|
|
2564
|
-
queryResultErrors.age
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2674
|
+
queryResultErrors.age = {
|
|
2675
|
+
...queryResultErrors.age,
|
|
2676
|
+
commitment: {
|
|
2677
|
+
expected: `Commitment: ${calculatedParamCommitment}`,
|
|
2678
|
+
received: `Commitment: ${paramCommitment}`,
|
|
2679
|
+
message: "The conditions for the age check do not match the conditions checked by the proof"
|
|
2680
|
+
}
|
|
2568
2681
|
};
|
|
2569
2682
|
}
|
|
2570
2683
|
const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "age", scope);
|
|
@@ -2583,10 +2696,13 @@ var ZKPassport = class {
|
|
|
2583
2696
|
"Failed to check the link between the validity of the ID and the birthdate derived from it"
|
|
2584
2697
|
);
|
|
2585
2698
|
isCorrect = false;
|
|
2586
|
-
queryResultErrors.birthdate
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2699
|
+
queryResultErrors.birthdate = {
|
|
2700
|
+
...queryResultErrors.birthdate,
|
|
2701
|
+
commitment: {
|
|
2702
|
+
expected: `Commitment: ${commitmentOut}`,
|
|
2703
|
+
received: `Commitment: ${commitmentIn}`,
|
|
2704
|
+
message: "Failed to check the link between the validity of the ID and the birthdate derived from it"
|
|
2705
|
+
}
|
|
2590
2706
|
};
|
|
2591
2707
|
}
|
|
2592
2708
|
const paramCommitment = getParameterCommitmentFromDisclosureProof(proofData);
|
|
@@ -2602,10 +2718,13 @@ var ZKPassport = class {
|
|
|
2602
2718
|
"The conditions for the birthdate check do not match the conditions checked by the proof"
|
|
2603
2719
|
);
|
|
2604
2720
|
isCorrect = false;
|
|
2605
|
-
queryResultErrors.birthdate
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2721
|
+
queryResultErrors.birthdate = {
|
|
2722
|
+
...queryResultErrors.birthdate,
|
|
2723
|
+
commitment: {
|
|
2724
|
+
expected: `Commitment: ${calculatedParamCommitment}`,
|
|
2725
|
+
received: `Commitment: ${paramCommitment}`,
|
|
2726
|
+
message: "The conditions for the birthdate check do not match the conditions checked by the proof"
|
|
2727
|
+
}
|
|
2609
2728
|
};
|
|
2610
2729
|
}
|
|
2611
2730
|
const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "birthdate", scope);
|
|
@@ -2624,10 +2743,13 @@ var ZKPassport = class {
|
|
|
2624
2743
|
"Failed to check the link between the validity of the ID and its expiry date"
|
|
2625
2744
|
);
|
|
2626
2745
|
isCorrect = false;
|
|
2627
|
-
queryResultErrors.expiry_date
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2746
|
+
queryResultErrors.expiry_date = {
|
|
2747
|
+
...queryResultErrors.expiry_date,
|
|
2748
|
+
commitment: {
|
|
2749
|
+
expected: `Commitment: ${commitmentOut}`,
|
|
2750
|
+
received: `Commitment: ${commitmentIn}`,
|
|
2751
|
+
message: "Failed to check the link between the validity of the ID and its expiry date"
|
|
2752
|
+
}
|
|
2631
2753
|
};
|
|
2632
2754
|
}
|
|
2633
2755
|
const paramCommitment = getParameterCommitmentFromDisclosureProof(proofData);
|
|
@@ -2643,10 +2765,13 @@ var ZKPassport = class {
|
|
|
2643
2765
|
"The conditions for the expiry date check do not match the conditions checked by the proof"
|
|
2644
2766
|
);
|
|
2645
2767
|
isCorrect = false;
|
|
2646
|
-
queryResultErrors.expiry_date
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2768
|
+
queryResultErrors.expiry_date = {
|
|
2769
|
+
...queryResultErrors.expiry_date,
|
|
2770
|
+
commitment: {
|
|
2771
|
+
expected: `Commitment: ${calculatedParamCommitment}`,
|
|
2772
|
+
received: `Commitment: ${paramCommitment}`,
|
|
2773
|
+
message: "The conditions for the expiry date check do not match the conditions checked by the proof"
|
|
2774
|
+
}
|
|
2650
2775
|
};
|
|
2651
2776
|
}
|
|
2652
2777
|
const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "expiry_date", scope);
|
|
@@ -2665,10 +2790,13 @@ var ZKPassport = class {
|
|
|
2665
2790
|
"Failed to check the link between the validity of the ID and the nationality exclusion check"
|
|
2666
2791
|
);
|
|
2667
2792
|
isCorrect = false;
|
|
2668
|
-
queryResultErrors.nationality
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2793
|
+
queryResultErrors.nationality = {
|
|
2794
|
+
...queryResultErrors.nationality,
|
|
2795
|
+
commitment: {
|
|
2796
|
+
expected: `Commitment: ${commitmentOut}`,
|
|
2797
|
+
received: `Commitment: ${commitmentIn}`,
|
|
2798
|
+
message: "Failed to check the link between the validity of the ID and the nationality exclusion check"
|
|
2799
|
+
}
|
|
2672
2800
|
};
|
|
2673
2801
|
}
|
|
2674
2802
|
const countryList = (proof.committedInputs?.exclusion_check_nationality).countries;
|
|
@@ -2683,10 +2811,13 @@ var ZKPassport = class {
|
|
|
2683
2811
|
"The committed country list for the exclusion check does not match the one from the proof"
|
|
2684
2812
|
);
|
|
2685
2813
|
isCorrect = false;
|
|
2686
|
-
queryResultErrors.nationality
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2814
|
+
queryResultErrors.nationality = {
|
|
2815
|
+
...queryResultErrors.nationality,
|
|
2816
|
+
commitment: {
|
|
2817
|
+
expected: `Commitment: ${calculatedParamCommitment}`,
|
|
2818
|
+
received: `Commitment: ${paramCommittment}`,
|
|
2819
|
+
message: "The committed country list for the exclusion check does not match the one from the proof"
|
|
2820
|
+
}
|
|
2690
2821
|
};
|
|
2691
2822
|
}
|
|
2692
2823
|
const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "nationality", scope);
|
|
@@ -2708,10 +2839,13 @@ var ZKPassport = class {
|
|
|
2708
2839
|
"Failed to check the link between the validity of the ID and the issuing country exclusion check"
|
|
2709
2840
|
);
|
|
2710
2841
|
isCorrect = false;
|
|
2711
|
-
queryResultErrors.nationality
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2842
|
+
queryResultErrors.nationality = {
|
|
2843
|
+
...queryResultErrors.nationality,
|
|
2844
|
+
commitment: {
|
|
2845
|
+
expected: `Commitment: ${commitmentOut}`,
|
|
2846
|
+
received: `Commitment: ${commitmentIn}`,
|
|
2847
|
+
message: "Failed to check the link between the validity of the ID and the issuing country exclusion check"
|
|
2848
|
+
}
|
|
2715
2849
|
};
|
|
2716
2850
|
}
|
|
2717
2851
|
const countryList = (proof.committedInputs?.exclusion_check_issuing_country).countries;
|
|
@@ -2726,10 +2860,13 @@ var ZKPassport = class {
|
|
|
2726
2860
|
"The committed country list for the issuing country exclusion check does not match the one from the proof"
|
|
2727
2861
|
);
|
|
2728
2862
|
isCorrect = false;
|
|
2729
|
-
queryResultErrors.issuing_country
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2863
|
+
queryResultErrors.issuing_country = {
|
|
2864
|
+
...queryResultErrors.issuing_country,
|
|
2865
|
+
commitment: {
|
|
2866
|
+
expected: `Commitment: ${calculatedParamCommitment}`,
|
|
2867
|
+
received: `Commitment: ${paramCommittment}`,
|
|
2868
|
+
message: "The committed country list for the issuing country exclusion check does not match the one from the proof"
|
|
2869
|
+
}
|
|
2733
2870
|
};
|
|
2734
2871
|
}
|
|
2735
2872
|
const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "nationality", scope);
|
|
@@ -2751,10 +2888,13 @@ var ZKPassport = class {
|
|
|
2751
2888
|
"Failed to check the link between the validity of the ID and the nationality inclusion check"
|
|
2752
2889
|
);
|
|
2753
2890
|
isCorrect = false;
|
|
2754
|
-
queryResultErrors.nationality
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2891
|
+
queryResultErrors.nationality = {
|
|
2892
|
+
...queryResultErrors.nationality,
|
|
2893
|
+
commitment: {
|
|
2894
|
+
expected: `Commitment: ${commitmentOut}`,
|
|
2895
|
+
received: `Commitment: ${commitmentIn}`,
|
|
2896
|
+
message: "Failed to check the link between the validity of the ID and the nationality inclusion check"
|
|
2897
|
+
}
|
|
2758
2898
|
};
|
|
2759
2899
|
}
|
|
2760
2900
|
const countryList = (proof.committedInputs?.inclusion_check_nationality).countries;
|
|
@@ -2769,10 +2909,13 @@ var ZKPassport = class {
|
|
|
2769
2909
|
"The committed country list for the nationality inclusion check does not match the one from the proof"
|
|
2770
2910
|
);
|
|
2771
2911
|
isCorrect = false;
|
|
2772
|
-
queryResultErrors.nationality
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2912
|
+
queryResultErrors.nationality = {
|
|
2913
|
+
...queryResultErrors.nationality,
|
|
2914
|
+
commitment: {
|
|
2915
|
+
expected: `Commitment: ${calculatedParamCommitment}`,
|
|
2916
|
+
received: `Commitment: ${paramCommittment}`,
|
|
2917
|
+
message: "The committed country list for the nationality inclusion check does not match the one from the proof"
|
|
2918
|
+
}
|
|
2776
2919
|
};
|
|
2777
2920
|
}
|
|
2778
2921
|
const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "nationality", scope);
|
|
@@ -2794,10 +2937,13 @@ var ZKPassport = class {
|
|
|
2794
2937
|
"Failed to check the link between the validity of the ID and the issuing country inclusion check"
|
|
2795
2938
|
);
|
|
2796
2939
|
isCorrect = false;
|
|
2797
|
-
queryResultErrors.nationality
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2940
|
+
queryResultErrors.nationality = {
|
|
2941
|
+
...queryResultErrors.nationality,
|
|
2942
|
+
commitment: {
|
|
2943
|
+
expected: `Commitment: ${commitmentOut}`,
|
|
2944
|
+
received: `Commitment: ${commitmentIn}`,
|
|
2945
|
+
message: "Failed to check the link between the validity of the ID and the issuing country inclusion check"
|
|
2946
|
+
}
|
|
2801
2947
|
};
|
|
2802
2948
|
}
|
|
2803
2949
|
const countryList = (proof.committedInputs?.inclusion_check_issuing_country).countries;
|
|
@@ -2812,10 +2958,13 @@ var ZKPassport = class {
|
|
|
2812
2958
|
"The committed country list for the issuing country inclusion check does not match the one from the proof"
|
|
2813
2959
|
);
|
|
2814
2960
|
isCorrect = false;
|
|
2815
|
-
queryResultErrors.issuing_country
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2961
|
+
queryResultErrors.issuing_country = {
|
|
2962
|
+
...queryResultErrors.issuing_country,
|
|
2963
|
+
commitment: {
|
|
2964
|
+
expected: `Commitment: ${calculatedParamCommitment}`,
|
|
2965
|
+
received: `Commitment: ${paramCommittment}`,
|
|
2966
|
+
message: "The committed country list for the issuing country inclusion check does not match the one from the proof"
|
|
2967
|
+
}
|
|
2819
2968
|
};
|
|
2820
2969
|
}
|
|
2821
2970
|
const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "nationality", scope);
|
|
@@ -2839,10 +2988,13 @@ var ZKPassport = class {
|
|
|
2839
2988
|
if (paramCommittment !== calculatedParamCommitment) {
|
|
2840
2989
|
console.warn("The bound data does not match the one from the proof");
|
|
2841
2990
|
isCorrect = false;
|
|
2842
|
-
queryResultErrors.bind
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2991
|
+
queryResultErrors.bind = {
|
|
2992
|
+
...queryResultErrors.bind,
|
|
2993
|
+
commitment: {
|
|
2994
|
+
expected: `Commitment: ${calculatedParamCommitment}`,
|
|
2995
|
+
received: `Commitment: ${paramCommittment}`,
|
|
2996
|
+
message: "The bound data does not match the one from the proof"
|
|
2997
|
+
}
|
|
2846
2998
|
};
|
|
2847
2999
|
}
|
|
2848
3000
|
const { isCorrect: isCorrectBind, queryResultErrors: queryResultErrorsBind } = this.checkBindPublicInputs(queryResult, bindCommittedInputs.data);
|
|
@@ -2852,6 +3004,39 @@ var ZKPassport = class {
|
|
|
2852
3004
|
...queryResultErrorsBind
|
|
2853
3005
|
};
|
|
2854
3006
|
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
3007
|
+
} else if (proof.name === "exclusion_check_sanctions") {
|
|
3008
|
+
const sanctionsBuilder = await SanctionsBuilder.create();
|
|
3009
|
+
const exclusionCheckSanctionsCommittedInputs = proof.committedInputs?.exclusion_check_sanctions;
|
|
3010
|
+
const calculatedParamCommitment = await sanctionsBuilder.getSanctionsParameterCommitment();
|
|
3011
|
+
const paramCommittment = getParameterCommitmentFromDisclosureProof(proofData);
|
|
3012
|
+
if (paramCommittment !== calculatedParamCommitment) {
|
|
3013
|
+
console.warn(
|
|
3014
|
+
"The sanction lists check against do not match the sanction lists from the proof"
|
|
3015
|
+
);
|
|
3016
|
+
isCorrect = false;
|
|
3017
|
+
queryResultErrors.sanctions = {
|
|
3018
|
+
...queryResultErrors.sanctions,
|
|
3019
|
+
commitment: {
|
|
3020
|
+
expected: `Commitment: ${calculatedParamCommitment.toString()}`,
|
|
3021
|
+
received: `Commitment: ${paramCommittment.toString()}`,
|
|
3022
|
+
message: "The sanction lists check against do not match the sanction lists from the proof"
|
|
3023
|
+
}
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
const {
|
|
3027
|
+
isCorrect: isCorrectSanctionsExclusion,
|
|
3028
|
+
queryResultErrors: queryResultErrorsSanctionsExclusion
|
|
3029
|
+
} = await this.checkSanctionsExclusionPublicInputs(
|
|
3030
|
+
queryResult,
|
|
3031
|
+
BigInt(exclusionCheckSanctionsCommittedInputs.rootHash),
|
|
3032
|
+
sanctionsBuilder
|
|
3033
|
+
);
|
|
3034
|
+
isCorrect = isCorrect && isCorrectSanctionsExclusion;
|
|
3035
|
+
queryResultErrors = {
|
|
3036
|
+
...queryResultErrors,
|
|
3037
|
+
...queryResultErrorsSanctionsExclusion
|
|
3038
|
+
};
|
|
3039
|
+
uniqueIdentifier = getNullifierFromDisclosureProof(proofData).toString(10);
|
|
2855
3040
|
}
|
|
2856
3041
|
}
|
|
2857
3042
|
return { isCorrect, uniqueIdentifier, queryResultErrors };
|
|
@@ -2860,7 +3045,7 @@ var ZKPassport = class {
|
|
|
2860
3045
|
* @notice Verify the proofs received from the mobile app.
|
|
2861
3046
|
* @param proofs The proofs to verify.
|
|
2862
3047
|
* @param queryResult The query result to verify against
|
|
2863
|
-
* @param validity How many
|
|
3048
|
+
* @param validity How many seconds ago the proof checking the expiry date of the ID should have been generated
|
|
2864
3049
|
* @param scope Scope this request to a specific use case
|
|
2865
3050
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
2866
3051
|
* @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
|
|
@@ -2991,7 +3176,7 @@ var ZKPassport = class {
|
|
|
2991
3176
|
}
|
|
2992
3177
|
getSolidityVerifierParameters({
|
|
2993
3178
|
proof,
|
|
2994
|
-
validityPeriodInSeconds =
|
|
3179
|
+
validityPeriodInSeconds = DEFAULT_VALIDITY,
|
|
2995
3180
|
domain,
|
|
2996
3181
|
scope,
|
|
2997
3182
|
devMode = false
|
|
@@ -3033,19 +3218,19 @@ var ZKPassport = class {
|
|
|
3033
3218
|
).map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
3034
3219
|
} else if (circuitName === "compare_age_evm") {
|
|
3035
3220
|
const value = proof.committedInputs[circuitName];
|
|
3036
|
-
const currentDateBytes = Array.from(numberToBytesBE(value.currentDateTimestamp,
|
|
3221
|
+
const currentDateBytes = Array.from(numberToBytesBE(value.currentDateTimestamp, 8));
|
|
3037
3222
|
compressedCommittedInputs2 = ProofType.AGE.toString(16).padStart(2, "0") + currentDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("") + value.minAge.toString(16).padStart(2, "0") + value.maxAge.toString(16).padStart(2, "0");
|
|
3038
3223
|
} else if (circuitName === "compare_birthdate_evm") {
|
|
3039
3224
|
const value = proof.committedInputs[circuitName];
|
|
3040
|
-
const currentDateBytes = Array.from(numberToBytesBE(value.currentDateTimestamp,
|
|
3041
|
-
const minDateBytes = Array.from(numberToBytesBE(value.minDateTimestamp,
|
|
3042
|
-
const maxDateBytes = Array.from(numberToBytesBE(value.maxDateTimestamp,
|
|
3225
|
+
const currentDateBytes = Array.from(numberToBytesBE(value.currentDateTimestamp, 8));
|
|
3226
|
+
const minDateBytes = Array.from(numberToBytesBE(value.minDateTimestamp, 8));
|
|
3227
|
+
const maxDateBytes = Array.from(numberToBytesBE(value.maxDateTimestamp, 8));
|
|
3043
3228
|
compressedCommittedInputs2 = ProofType.BIRTHDATE.toString(16).padStart(2, "0") + currentDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("") + minDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("") + maxDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
3044
3229
|
} else if (circuitName === "compare_expiry_evm") {
|
|
3045
3230
|
const value = proof.committedInputs[circuitName];
|
|
3046
|
-
const currentDateBytes = Array.from(numberToBytesBE(value.currentDateTimestamp,
|
|
3047
|
-
const minDateBytes = Array.from(numberToBytesBE(value.minDateTimestamp,
|
|
3048
|
-
const maxDateBytes = Array.from(numberToBytesBE(value.maxDateTimestamp,
|
|
3231
|
+
const currentDateBytes = Array.from(numberToBytesBE(value.currentDateTimestamp, 8));
|
|
3232
|
+
const minDateBytes = Array.from(numberToBytesBE(value.minDateTimestamp, 8));
|
|
3233
|
+
const maxDateBytes = Array.from(numberToBytesBE(value.maxDateTimestamp, 8));
|
|
3049
3234
|
compressedCommittedInputs2 = ProofType.EXPIRY_DATE.toString(16).padStart(2, "0") + currentDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("") + minDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("") + maxDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
3050
3235
|
} else if (circuitName === "disclose_bytes_evm") {
|
|
3051
3236
|
const value = proof.committedInputs[circuitName];
|
|
@@ -3107,7 +3292,8 @@ var ZKPassport = class {
|
|
|
3107
3292
|
"base64"
|
|
3108
3293
|
);
|
|
3109
3294
|
const pubkey = this.topicToPublicKey[requestId];
|
|
3110
|
-
|
|
3295
|
+
const timestamp = Math.floor(Date.now() / 1e3) - this.topicToLocalConfig[requestId].validity;
|
|
3296
|
+
return `https://zkpassport.id/r?d=${this.domain}&t=${requestId}&c=${base64Config}&s=${base64Service}&p=${pubkey}&m=${this.topicToLocalConfig[requestId].mode}&v=${VERSION}&d=${timestamp}`;
|
|
3111
3297
|
}
|
|
3112
3298
|
/**
|
|
3113
3299
|
* @notice Returns the URL of the request.
|