@zkpassport/sdk 0.5.1 → 0.5.3
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.d.ts +4 -1
- package/dist/cjs/index.js +12 -3
- package/dist/esm/index.d.ts +4 -1
- package/dist/esm/index.js +12 -3
- package/package.json +1 -1
- package/src/index.ts +13 -2
package/dist/cjs/index.d.ts
CHANGED
|
@@ -243,16 +243,19 @@ export declare class ZKPassport {
|
|
|
243
243
|
* @param scope Scope this request to a specific use case
|
|
244
244
|
* @param evmChain The EVM chain to use for the verification (if using the proof onchain)
|
|
245
245
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
246
|
+
* @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
|
|
247
|
+
* It should only be needed when running the `verify` function on a server with restricted write access (e.g. Vercel)
|
|
246
248
|
* @returns An object containing the unique identifier associated to the user
|
|
247
249
|
* and a boolean indicating whether the proofs were successfully verified.
|
|
248
250
|
*/
|
|
249
|
-
verify({ proofs, queryResult, validity, scope, evmChain, devMode, }: {
|
|
251
|
+
verify({ proofs, queryResult, validity, scope, evmChain, devMode, writingDirectory, }: {
|
|
250
252
|
proofs: Array<ProofResult>;
|
|
251
253
|
queryResult: QueryResult;
|
|
252
254
|
validity?: number;
|
|
253
255
|
scope?: string;
|
|
254
256
|
evmChain?: EVMChain;
|
|
255
257
|
devMode?: boolean;
|
|
258
|
+
writingDirectory?: string;
|
|
256
259
|
}): Promise<{
|
|
257
260
|
uniqueIdentifier: string | undefined;
|
|
258
261
|
verified: boolean;
|
package/dist/cjs/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const utils_3 = require("@noble/hashes/utils");
|
|
|
13
13
|
const ZKPassportVerifier_json_1 = tslib_1.__importDefault(require("./assets/abi/ZKPassportVerifier.json"));
|
|
14
14
|
const registry_1 = require("@zkpassport/registry");
|
|
15
15
|
const bridge_1 = require("@obsidion/bridge");
|
|
16
|
-
const VERSION = "0.5.
|
|
16
|
+
const VERSION = "0.5.3";
|
|
17
17
|
const DEFAULT_DATE_VALUE = new Date(1111, 10, 11);
|
|
18
18
|
// If Buffer is not defined, then we use the Buffer from the buffer package
|
|
19
19
|
if (typeof globalThis.Buffer === "undefined") {
|
|
@@ -2025,10 +2025,12 @@ class ZKPassport {
|
|
|
2025
2025
|
* @param scope Scope this request to a specific use case
|
|
2026
2026
|
* @param evmChain The EVM chain to use for the verification (if using the proof onchain)
|
|
2027
2027
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
2028
|
+
* @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
|
|
2029
|
+
* It should only be needed when running the `verify` function on a server with restricted write access (e.g. Vercel)
|
|
2028
2030
|
* @returns An object containing the unique identifier associated to the user
|
|
2029
2031
|
* and a boolean indicating whether the proofs were successfully verified.
|
|
2030
2032
|
*/
|
|
2031
|
-
async verify({ proofs, queryResult, validity, scope, evmChain, devMode = false, }) {
|
|
2033
|
+
async verify({ proofs, queryResult, validity, scope, evmChain, devMode = false, writingDirectory, }) {
|
|
2032
2034
|
// If no proofs were generated, the results can't be trusted.
|
|
2033
2035
|
// We still return it but verified will be false
|
|
2034
2036
|
if (!proofs || proofs.length === 0) {
|
|
@@ -2046,7 +2048,14 @@ class ZKPassport {
|
|
|
2046
2048
|
formattedResult.expiry_date.disclose.result = new Date(formattedResult.expiry_date.disclose.result);
|
|
2047
2049
|
}
|
|
2048
2050
|
const { BarretenbergVerifier } = await Promise.resolve().then(() => tslib_1.__importStar(require("@aztec/bb.js")));
|
|
2049
|
-
|
|
2051
|
+
// Automatically set the writing directory to `/tmp` if it is not provided
|
|
2052
|
+
// and the code is not running in the browser
|
|
2053
|
+
if (typeof window === "undefined" && !writingDirectory) {
|
|
2054
|
+
writingDirectory = "/tmp";
|
|
2055
|
+
}
|
|
2056
|
+
const verifier = new BarretenbergVerifier({
|
|
2057
|
+
crsPath: writingDirectory ? writingDirectory + "/.bb-crs" : undefined,
|
|
2058
|
+
});
|
|
2050
2059
|
let verified = true;
|
|
2051
2060
|
let uniqueIdentifier;
|
|
2052
2061
|
let queryResultErrors;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -243,16 +243,19 @@ export declare class ZKPassport {
|
|
|
243
243
|
* @param scope Scope this request to a specific use case
|
|
244
244
|
* @param evmChain The EVM chain to use for the verification (if using the proof onchain)
|
|
245
245
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
246
|
+
* @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
|
|
247
|
+
* It should only be needed when running the `verify` function on a server with restricted write access (e.g. Vercel)
|
|
246
248
|
* @returns An object containing the unique identifier associated to the user
|
|
247
249
|
* and a boolean indicating whether the proofs were successfully verified.
|
|
248
250
|
*/
|
|
249
|
-
verify({ proofs, queryResult, validity, scope, evmChain, devMode, }: {
|
|
251
|
+
verify({ proofs, queryResult, validity, scope, evmChain, devMode, writingDirectory, }: {
|
|
250
252
|
proofs: Array<ProofResult>;
|
|
251
253
|
queryResult: QueryResult;
|
|
252
254
|
validity?: number;
|
|
253
255
|
scope?: string;
|
|
254
256
|
evmChain?: EVMChain;
|
|
255
257
|
devMode?: boolean;
|
|
258
|
+
writingDirectory?: string;
|
|
256
259
|
}): Promise<{
|
|
257
260
|
uniqueIdentifier: string | undefined;
|
|
258
261
|
verified: boolean;
|
package/dist/esm/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { hexToBytes } from "@noble/hashes/utils";
|
|
|
9
9
|
import ZKPassportVerifierAbi from "./assets/abi/ZKPassportVerifier.json";
|
|
10
10
|
import { RegistryClient } from "@zkpassport/registry";
|
|
11
11
|
import { Bridge } from "@obsidion/bridge";
|
|
12
|
-
const VERSION = "0.5.
|
|
12
|
+
const VERSION = "0.5.3";
|
|
13
13
|
const DEFAULT_DATE_VALUE = new Date(1111, 10, 11);
|
|
14
14
|
// If Buffer is not defined, then we use the Buffer from the buffer package
|
|
15
15
|
if (typeof globalThis.Buffer === "undefined") {
|
|
@@ -2015,10 +2015,12 @@ export class ZKPassport {
|
|
|
2015
2015
|
* @param scope Scope this request to a specific use case
|
|
2016
2016
|
* @param evmChain The EVM chain to use for the verification (if using the proof onchain)
|
|
2017
2017
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
2018
|
+
* @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
|
|
2019
|
+
* It should only be needed when running the `verify` function on a server with restricted write access (e.g. Vercel)
|
|
2018
2020
|
* @returns An object containing the unique identifier associated to the user
|
|
2019
2021
|
* and a boolean indicating whether the proofs were successfully verified.
|
|
2020
2022
|
*/
|
|
2021
|
-
async verify({ proofs, queryResult, validity, scope, evmChain, devMode = false, }) {
|
|
2023
|
+
async verify({ proofs, queryResult, validity, scope, evmChain, devMode = false, writingDirectory, }) {
|
|
2022
2024
|
// If no proofs were generated, the results can't be trusted.
|
|
2023
2025
|
// We still return it but verified will be false
|
|
2024
2026
|
if (!proofs || proofs.length === 0) {
|
|
@@ -2036,7 +2038,14 @@ export class ZKPassport {
|
|
|
2036
2038
|
formattedResult.expiry_date.disclose.result = new Date(formattedResult.expiry_date.disclose.result);
|
|
2037
2039
|
}
|
|
2038
2040
|
const { BarretenbergVerifier } = await import("@aztec/bb.js");
|
|
2039
|
-
|
|
2041
|
+
// Automatically set the writing directory to `/tmp` if it is not provided
|
|
2042
|
+
// and the code is not running in the browser
|
|
2043
|
+
if (typeof window === "undefined" && !writingDirectory) {
|
|
2044
|
+
writingDirectory = "/tmp";
|
|
2045
|
+
}
|
|
2046
|
+
const verifier = new BarretenbergVerifier({
|
|
2047
|
+
crsPath: writingDirectory ? writingDirectory + "/.bb-crs" : undefined,
|
|
2048
|
+
});
|
|
2040
2049
|
let verified = true;
|
|
2041
2050
|
let uniqueIdentifier;
|
|
2042
2051
|
let queryResultErrors;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -76,7 +76,7 @@ import ZKPassportVerifierAbi from "./assets/abi/ZKPassportVerifier.json"
|
|
|
76
76
|
import { RegistryClient } from "@zkpassport/registry"
|
|
77
77
|
import { Bridge, BridgeInterface } from "@obsidion/bridge"
|
|
78
78
|
|
|
79
|
-
const VERSION = "0.5.
|
|
79
|
+
const VERSION = "0.5.3"
|
|
80
80
|
|
|
81
81
|
const DEFAULT_DATE_VALUE = new Date(1111, 10, 11)
|
|
82
82
|
|
|
@@ -2782,6 +2782,8 @@ export class ZKPassport {
|
|
|
2782
2782
|
* @param scope Scope this request to a specific use case
|
|
2783
2783
|
* @param evmChain The EVM chain to use for the verification (if using the proof onchain)
|
|
2784
2784
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
2785
|
+
* @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
|
|
2786
|
+
* It should only be needed when running the `verify` function on a server with restricted write access (e.g. Vercel)
|
|
2785
2787
|
* @returns An object containing the unique identifier associated to the user
|
|
2786
2788
|
* and a boolean indicating whether the proofs were successfully verified.
|
|
2787
2789
|
*/
|
|
@@ -2792,6 +2794,7 @@ export class ZKPassport {
|
|
|
2792
2794
|
scope,
|
|
2793
2795
|
evmChain,
|
|
2794
2796
|
devMode = false,
|
|
2797
|
+
writingDirectory,
|
|
2795
2798
|
}: {
|
|
2796
2799
|
proofs: Array<ProofResult>
|
|
2797
2800
|
queryResult: QueryResult
|
|
@@ -2799,6 +2802,7 @@ export class ZKPassport {
|
|
|
2799
2802
|
scope?: string
|
|
2800
2803
|
evmChain?: EVMChain
|
|
2801
2804
|
devMode?: boolean
|
|
2805
|
+
writingDirectory?: string
|
|
2802
2806
|
}): Promise<{
|
|
2803
2807
|
uniqueIdentifier: string | undefined
|
|
2804
2808
|
verified: boolean
|
|
@@ -2826,7 +2830,14 @@ export class ZKPassport {
|
|
|
2826
2830
|
}
|
|
2827
2831
|
|
|
2828
2832
|
const { BarretenbergVerifier } = await import("@aztec/bb.js")
|
|
2829
|
-
|
|
2833
|
+
// Automatically set the writing directory to `/tmp` if it is not provided
|
|
2834
|
+
// and the code is not running in the browser
|
|
2835
|
+
if (typeof window === "undefined" && !writingDirectory) {
|
|
2836
|
+
writingDirectory = "/tmp"
|
|
2837
|
+
}
|
|
2838
|
+
const verifier = new BarretenbergVerifier({
|
|
2839
|
+
crsPath: writingDirectory ? writingDirectory + "/.bb-crs" : undefined,
|
|
2840
|
+
})
|
|
2830
2841
|
let verified = true
|
|
2831
2842
|
let uniqueIdentifier: string | undefined
|
|
2832
2843
|
let queryResultErrors: QueryResultErrors | undefined
|