@zkpassport/sdk 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants.cjs +1 -1
- package/dist/cjs/constants.d.cts +1 -1
- package/dist/cjs/index.cjs +95 -73
- package/dist/cjs/public-input-checker.cjs +5 -11
- package/dist/cjs/solidity-verifier.cjs +76 -50
- package/dist/esm/chunk-I7PGO4XY.js +2567 -0
- package/dist/esm/{chunk-VJZDMGW3.js → chunk-JG37KYXW.js} +1 -1
- package/dist/esm/{chunk-OOHOBXGU.js → chunk-O7ZONMCQ.js} +6 -12
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/index.js +16 -14
- package/dist/esm/public-input-checker.js +2 -2
- package/dist/esm/solidity-verifier.js +2 -2
- package/package.json +4 -4
- package/dist/esm/chunk-OTQ7QDA2.js +0 -2541
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/constants.ts
|
|
2
|
-
var VERSION = "0.
|
|
2
|
+
var VERSION = "0.10.0";
|
|
3
3
|
var DEFAULT_VALIDITY = 7 * 24 * 60 * 60;
|
|
4
4
|
var DEFAULT_DATE_VALUE = /* @__PURE__ */ new Date(0);
|
|
5
5
|
var ZKPASSPORT_IOS_APP_ID_HASH = "0x1fa73686cf510f8f85757b0602de0dd72a13e68ae2092462be8b72662e7f179b";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
GOOGLE_APP_ATTEST_RSA_ROOT_KEY_HASH,
|
|
6
6
|
ZKPASSPORT_ANDROID_APP_ID_HASH,
|
|
7
7
|
ZKPASSPORT_IOS_APP_ID_HASH
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JG37KYXW.js";
|
|
9
9
|
|
|
10
10
|
// src/public-input-checker.ts
|
|
11
11
|
import {
|
|
@@ -992,12 +992,6 @@ var PublicInputChecker = class {
|
|
|
992
992
|
};
|
|
993
993
|
}
|
|
994
994
|
const EXPECTED_ENVIRONMENT = "production";
|
|
995
|
-
console.log("facematchCommittedInputs.environment", facematchCommittedInputs.environment);
|
|
996
|
-
console.log("EXPECTED_ENVIRONMENT", EXPECTED_ENVIRONMENT);
|
|
997
|
-
console.log(
|
|
998
|
-
"facematchCommittedInputs.environment !== EXPECTED_ENVIRONMENT",
|
|
999
|
-
facematchCommittedInputs.environment !== EXPECTED_ENVIRONMENT
|
|
1000
|
-
);
|
|
1001
995
|
if (facematchCommittedInputs.environment !== EXPECTED_ENVIRONMENT) {
|
|
1002
996
|
console.warn("Invalid facematch environment, it should be production");
|
|
1003
997
|
isCorrect = false;
|
|
@@ -1010,7 +1004,7 @@ var PublicInputChecker = class {
|
|
|
1010
1004
|
}
|
|
1011
1005
|
};
|
|
1012
1006
|
}
|
|
1013
|
-
if (facematchCommittedInputs.
|
|
1007
|
+
if (facematchCommittedInputs.appIdHash !== ZKPASSPORT_IOS_APP_ID_HASH && facematchCommittedInputs.appIdHash !== ZKPASSPORT_ANDROID_APP_ID_HASH) {
|
|
1014
1008
|
console.warn(
|
|
1015
1009
|
"Invalid facematch app id hash, the attestation should be coming from the ZKPassport app"
|
|
1016
1010
|
);
|
|
@@ -1019,7 +1013,7 @@ var PublicInputChecker = class {
|
|
|
1019
1013
|
...queryResultErrors.facematch,
|
|
1020
1014
|
eq: {
|
|
1021
1015
|
expected: `${ZKPASSPORT_IOS_APP_ID_HASH} (iOS) or ${ZKPASSPORT_ANDROID_APP_ID_HASH} (Android)`,
|
|
1022
|
-
received: facematchCommittedInputs.
|
|
1016
|
+
received: facematchCommittedInputs.appIdHash,
|
|
1023
1017
|
message: "Invalid facematch app id hash, the attestation should be coming from the ZKPassport app"
|
|
1024
1018
|
}
|
|
1025
1019
|
};
|
|
@@ -1461,12 +1455,12 @@ var PublicInputChecker = class {
|
|
|
1461
1455
|
const facematchParameterCommitment = isForEVM ? await getFacematchEvmParameterCommitment(
|
|
1462
1456
|
BigInt(facematchCommittedInputs.rootKeyLeaf),
|
|
1463
1457
|
facematchCommittedInputs.environment === "development" ? 0n : 1n,
|
|
1464
|
-
BigInt(facematchCommittedInputs.
|
|
1458
|
+
BigInt(facematchCommittedInputs.appIdHash),
|
|
1465
1459
|
facematchCommittedInputs.mode === "regular" ? 1n : 2n
|
|
1466
1460
|
) : await getFacematchParameterCommitment(
|
|
1467
1461
|
BigInt(facematchCommittedInputs.rootKeyLeaf),
|
|
1468
1462
|
facematchCommittedInputs.environment === "development" ? 0n : 1n,
|
|
1469
|
-
BigInt(facematchCommittedInputs.
|
|
1463
|
+
BigInt(facematchCommittedInputs.appIdHash),
|
|
1470
1464
|
facematchCommittedInputs.mode === "regular" ? 1n : 2n
|
|
1471
1465
|
);
|
|
1472
1466
|
if (!paramCommitments.includes(facematchParameterCommitment)) {
|
|
@@ -2056,7 +2050,7 @@ var PublicInputChecker = class {
|
|
|
2056
2050
|
const calculatedParamCommitment = await getFacematchParameterCommitment(
|
|
2057
2051
|
BigInt(facematchCommittedInputs.rootKeyLeaf),
|
|
2058
2052
|
facematchCommittedInputs.environment === "development" ? 0n : 1n,
|
|
2059
|
-
BigInt(facematchCommittedInputs.
|
|
2053
|
+
BigInt(facematchCommittedInputs.appIdHash),
|
|
2060
2054
|
facematchCommittedInputs.mode === "regular" ? 1n : 2n
|
|
2061
2055
|
);
|
|
2062
2056
|
if (paramCommittment !== calculatedParamCommitment) {
|
package/dist/esm/constants.d.ts
CHANGED
package/dist/esm/constants.js
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-AFLQN3AC.js";
|
|
4
4
|
import {
|
|
5
5
|
PublicInputChecker
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-O7ZONMCQ.js";
|
|
7
7
|
import {
|
|
8
8
|
SolidityVerifier
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-I7PGO4XY.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_VALIDITY,
|
|
12
12
|
VERSION
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JG37KYXW.js";
|
|
14
14
|
import "./chunk-6F4PWJZI.js";
|
|
15
15
|
|
|
16
16
|
// src/index.ts
|
|
@@ -448,11 +448,11 @@ var ZKPassport = class {
|
|
|
448
448
|
};
|
|
449
449
|
}
|
|
450
450
|
const formattedResult = formatQueryResultDates(queryResult);
|
|
451
|
-
const {
|
|
451
|
+
const { UltraHonkVerifierBackend } = await import("@aztec/bb.js");
|
|
452
452
|
if (typeof window === "undefined" && !writingDirectory) {
|
|
453
453
|
writingDirectory = "/tmp";
|
|
454
454
|
}
|
|
455
|
-
const verifier = new
|
|
455
|
+
const verifier = new UltraHonkVerifierBackend({
|
|
456
456
|
crsPath: writingDirectory ? writingDirectory + "/.bb-crs" : void 0
|
|
457
457
|
});
|
|
458
458
|
let verified = true;
|
|
@@ -489,11 +489,15 @@ var ZKPassport = class {
|
|
|
489
489
|
});
|
|
490
490
|
for (const proof of proofs) {
|
|
491
491
|
const isOuterEVM = proof.name?.startsWith("outer_evm_");
|
|
492
|
-
const proofName =
|
|
492
|
+
const proofName = proof.name;
|
|
493
493
|
const proofData = getProofData(proof.proof, getNumberOfPublicInputs(proofName));
|
|
494
494
|
const hostedPackagedCircuit = await registryClient.getPackagedCircuit(
|
|
495
495
|
proofName,
|
|
496
|
-
circuitManifest
|
|
496
|
+
circuitManifest,
|
|
497
|
+
// TODO: set to always validate when the issue is vkey hash calculation is fixed
|
|
498
|
+
// Not as important anyway, as the solidity verifier is the ultimate anchor for
|
|
499
|
+
// EVM outer proofs verification
|
|
500
|
+
{ validate: !isOuterEVM }
|
|
497
501
|
);
|
|
498
502
|
if (isOuterEVM) {
|
|
499
503
|
try {
|
|
@@ -525,13 +529,11 @@ var ZKPassport = class {
|
|
|
525
529
|
} else {
|
|
526
530
|
const vkeyBytes = Buffer.from(hostedPackagedCircuit.vkey, "base64");
|
|
527
531
|
try {
|
|
528
|
-
verified = await verifier.
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
new Uint8Array(vkeyBytes)
|
|
534
|
-
);
|
|
532
|
+
verified = await verifier.verifyProof({
|
|
533
|
+
proof: Buffer.from(proofData.proof.join(""), "hex"),
|
|
534
|
+
publicInputs: proofData.publicInputs,
|
|
535
|
+
verificationKey: new Uint8Array(vkeyBytes)
|
|
536
|
+
});
|
|
535
537
|
} catch (e) {
|
|
536
538
|
console.warn("Error verifying proof", e);
|
|
537
539
|
verified = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zkpassport/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Privacy-preserving identity verification using passports and ID cards",
|
|
5
5
|
"author": "ZKPassport",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"sdk"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@aztec/bb.js": "
|
|
34
|
+
"@aztec/bb.js": "2.0.3",
|
|
35
35
|
"@noble/ciphers": "^1.2.1",
|
|
36
36
|
"@noble/hashes": "^1.7.2",
|
|
37
37
|
"@noble/secp256k1": "^2.2.3",
|
|
38
38
|
"@obsidion/bridge": "^0.10.4",
|
|
39
|
-
"@zkpassport/registry": "0.
|
|
40
|
-
"@zkpassport/utils": "0.
|
|
39
|
+
"@zkpassport/registry": "0.11.1",
|
|
40
|
+
"@zkpassport/utils": "0.25.2",
|
|
41
41
|
"buffer": "^6.0.3",
|
|
42
42
|
"i18n-iso-countries": "^7.12.0",
|
|
43
43
|
"pako": "^2.1.0",
|