@zkpassport/sdk 0.11.0 → 0.12.1

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.
@@ -1,32 +0,0 @@
1
- import { SupportedChain, ProofResult } from '@zkpassport/utils';
2
- import { SolidityVerifierParameters } from './types.cjs';
3
-
4
- declare class SolidityVerifier {
5
- static getDetails(network: SupportedChain): {
6
- address: `0x${string}`;
7
- functionName: string;
8
- abi: {
9
- type: "function" | "event" | "constructor";
10
- name: string;
11
- inputs: {
12
- name: string;
13
- type: string;
14
- internalType: string;
15
- }[];
16
- outputs: {
17
- name: string;
18
- type: string;
19
- internalType: string;
20
- }[];
21
- }[];
22
- };
23
- static getParameters({ proof, validityPeriodInSeconds, domain, scope, devMode, }: {
24
- proof: ProofResult;
25
- validityPeriodInSeconds?: number;
26
- domain: string;
27
- scope?: string;
28
- devMode?: boolean;
29
- }): SolidityVerifierParameters;
30
- }
31
-
32
- export { SolidityVerifier };
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/types.ts
17
- var types_exports = {};
18
- module.exports = __toCommonJS(types_exports);
@@ -1,208 +0,0 @@
1
- import { IDCredential, IDCredentialValue, NumericalIDCredential, DisclosableIDCredential, BoundData, SanctionsCountries, SanctionsLists, FacematchMode, ProofResult, QueryResult } from '@zkpassport/utils';
2
-
3
- type QueryResultError<T> = {
4
- expected?: T;
5
- received?: T;
6
- message: string;
7
- };
8
- type QueryResultErrors = {
9
- [key in IDCredential | "sig_check_dsc" | "sig_check_id_data" | "data_check_integrity" | "outer" | "disclose" | "bind" | "facematch" | "sanctions"]: {
10
- disclose?: QueryResultError<string | number | Date>;
11
- gte?: QueryResultError<number | Date>;
12
- lte?: QueryResultError<number | Date>;
13
- lt?: QueryResultError<number | Date>;
14
- range?: QueryResultError<[number | Date, number | Date]>;
15
- in?: QueryResultError<string[]>;
16
- out?: QueryResultError<string[]>;
17
- eq?: QueryResultError<string | number | Date>;
18
- commitment?: QueryResultError<string>;
19
- date?: QueryResultError<string>;
20
- certificate?: QueryResultError<string>;
21
- scope?: QueryResultError<string>;
22
- };
23
- };
24
- type SolidityProofVerificationData = {
25
- vkeyHash: string;
26
- proof: string;
27
- publicInputs: string[];
28
- };
29
- type SolidityCommitments = {
30
- committedInputs: string;
31
- };
32
- type SolidityServiceConfig = {
33
- validityPeriodInSeconds: number;
34
- domain: string;
35
- scope: string;
36
- devMode: boolean;
37
- };
38
- type SolidityVerifierParameters = {
39
- proofVerificationData: SolidityProofVerificationData;
40
- commitments: SolidityCommitments;
41
- serviceConfig: SolidityServiceConfig;
42
- };
43
- type QueryBuilderResult = {
44
- /**
45
- * The URL of the request.
46
- *
47
- * You can either encode the URL in a QR code or let the user click the link
48
- * to this URL on your website if they're visiting your website on their phone.
49
- */
50
- url: string;
51
- /**
52
- * The id of the request.
53
- */
54
- requestId: string;
55
- /**
56
- * Called when the user has scanned the QR code or clicked the link to the request.
57
- *
58
- * This means the user is currently viewing the request popup with your website information
59
- * and the information requested from them.
60
- */
61
- onRequestReceived: (callback: () => void) => void;
62
- /**
63
- * Called when the user has accepted the request and
64
- * started to generate the proof on their phone.
65
- */
66
- onGeneratingProof: (callback: () => void) => void;
67
- /**
68
- * Called when the SDK successfully connects to the bridge with the mobile app.
69
- */
70
- onBridgeConnect: (callback: () => void) => void;
71
- /**
72
- * Called when the user has generated a proof.
73
- *
74
- * There is a minimum of 4 proofs, but there can be more depending
75
- * on the type of information requested from the user.
76
- */
77
- onProofGenerated: (callback: (proof: ProofResult) => void) => void;
78
- /**
79
- * Called when the user has sent the query result.
80
- *
81
- * The response contains the unique identifier associated to the user,
82
- * your domain name and chosen scope, along with the query result and whether
83
- * the proofs were successfully verified.
84
- */
85
- onResult: (callback: (response: {
86
- uniqueIdentifier: string | undefined;
87
- verified: boolean;
88
- result: QueryResult;
89
- queryResultErrors?: Partial<QueryResultErrors>;
90
- }) => void) => void;
91
- /**
92
- * Called when the user has rejected the request.
93
- */
94
- onReject: (callback: () => void) => void;
95
- /**
96
- * Called when an error occurs, such as one of the requirements not being met
97
- * or a proof failing to be generated.
98
- */
99
- onError: (callback: (error: string) => void) => void;
100
- /**
101
- * @returns true if the bridge with the mobile app is connected
102
- */
103
- isBridgeConnected: () => boolean;
104
- /**
105
- * Get if the user has scanned the QR code or the link to this request
106
- * @returns true if the request has been received by the user on their phone
107
- */
108
- requestReceived: () => boolean;
109
- };
110
- type QueryBuilder = {
111
- /**
112
- * Requires this attribute to be equal to the provided value.
113
- * @param key The attribute to compare.
114
- * @param value The value of the attribute you require.
115
- */
116
- eq: <T extends IDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
117
- /**
118
- * Requires this attribute to be greater than or equal to the provided value.
119
- * @param key The attribute to compare.
120
- * @param value The value of the attribute you require.
121
- */
122
- gte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
123
- /**
124
- * Requires this attribute to be greater than the provided value.
125
- * @param key The attribute to compare.
126
- * @param value The value of the attribute you require.
127
- */
128
- gt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
129
- /**
130
- * Requires this attribute to be less than or equal to the provided value.
131
- * @param key The attribute to compare.
132
- * @param value The value of the attribute you require.
133
- */
134
- lte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
135
- /**
136
- * Requires this attribute to be less than the provided value.
137
- * @param key The attribute to compare.
138
- * @param value The value of the attribute you require.
139
- */
140
- lt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
141
- /**
142
- * Requires this attribute to be included in the provided range.
143
- * @param key The attribute to compare.
144
- * @param start The start of the range.
145
- * @param end The end of the range.
146
- */
147
- range: <T extends NumericalIDCredential>(key: T, start: IDCredentialValue<T>, end: IDCredentialValue<T>) => QueryBuilder;
148
- /**
149
- * Requires this attribute to be included in the provided list.
150
- * @param key The attribute to compare.
151
- * @param value The list of values to check inclusion against.
152
- */
153
- in: <T extends "nationality" | "issuing_country">(key: T, value: IDCredentialValue<T>[]) => QueryBuilder;
154
- /**
155
- * Requires this attribute to be excluded from the provided list.
156
- * @param key The attribute to compare.
157
- * @param value The list of values to check exclusion against.
158
- */
159
- out: <T extends "nationality" | "issuing_country">(key: T, value: IDCredentialValue<T>[]) => QueryBuilder;
160
- /**
161
- * Requires this attribute to be disclosed.
162
- * @param key The attribute to disclose.
163
- */
164
- disclose: (key: DisclosableIDCredential) => QueryBuilder;
165
- /**
166
- * Binds a value to the request.
167
- * @param key The key of the value to bind.
168
- * @param value The value to bind the request to.
169
- */
170
- bind: (key: keyof BoundData, value: BoundData[keyof BoundData]) => QueryBuilder;
171
- /**
172
- * Requires that the ID holder is not part of any of the specified sanction lists.
173
- * @param countries The country or list of countries whose sanction lists to check against. Defaults to "all".
174
- * e.g. "US", ["US", "GB", "CH", "EU"], "all"
175
- * @param lists The specific lists from a given country to check against. Defaults to "all".
176
- * e.g. ["OFAC_SDN"], "all"
177
- * @param options The options to use for the sanction check.
178
- * @param options.strict Whether to use a strict sanction check. Defaults to false.
179
- *
180
- * If set to true, this means the checks will be done against just the lastname and firstname,
181
- * while when set to false, matches will need to include either the date of birth and name or
182
- * the passport number and nationality.
183
- * Strict mode has therefore a higher false positive rate but is harder to evade.
184
- */
185
- sanctions: (countries?: SanctionsCountries, lists?: SanctionsLists, options?: {
186
- strict?: boolean;
187
- }) => QueryBuilder;
188
- /**
189
- * This feature is not available yet in the public release of the app.
190
- * Requires that the ID holder's face matches the photo on the ID.
191
- * @param mode The mode to use for the face match. Defaults to "regular".
192
- * @param mode "strict" - The user will have to go through an extensive liveness check to prevent spoofing making it more secure.
193
- * Best for high security requirements such as KYC.
194
- * @param mode "regular" - The user will only have to go through a basic liveness check to prevent spoofing, making it faster for the user.
195
- * Best for lower security requirements that requires fast verification such as age verification.
196
- */
197
- facematch: (mode?: FacematchMode) => QueryBuilder;
198
- /**
199
- * Builds the request.
200
- *
201
- * This will return the URL of the request, which you can either encode in a QR code
202
- * or provide as a link to the user if they're visiting your website on their phone.
203
- * It also returns all the callbacks you can use to handle the user's response.
204
- */
205
- done: () => QueryBuilderResult;
206
- };
207
-
208
- export type { QueryBuilder, QueryBuilderResult, QueryResultError, QueryResultErrors, SolidityCommitments, SolidityProofVerificationData, SolidityServiceConfig, SolidityVerifierParameters };
File without changes
@@ -1,22 +0,0 @@
1
- // src/logger.ts
2
- var customLogger = {
3
- debug: (message, ...args) => console.debug(message, ...args),
4
- info: (message, ...args) => console.info(message, ...args),
5
- warn: (message, ...args) => console.warn(message, ...args),
6
- error: (message, ...args) => console.error(message, ...args)
7
- };
8
- var noLogger = {
9
- debug: (..._) => {
10
- },
11
- info: (..._) => {
12
- },
13
- warn: (..._) => {
14
- },
15
- error: (..._) => {
16
- }
17
- };
18
-
19
- export {
20
- customLogger,
21
- noLogger
22
- };
@@ -1,18 +0,0 @@
1
- // src/constants.ts
2
- var VERSION = "0.11.0";
3
- var DEFAULT_VALIDITY = 7 * 24 * 60 * 60;
4
- var DEFAULT_DATE_VALUE = /* @__PURE__ */ new Date(0);
5
- var ZKPASSPORT_IOS_APP_ID_HASH = "0x1fa73686cf510f8f85757b0602de0dd72a13e68ae2092462be8b72662e7f179b";
6
- var ZKPASSPORT_ANDROID_APP_ID_HASH = "0x24d9929b248be7eeecaa98e105c034a50539610f3fdd4cb9c8983ef4100d615d";
7
- var APPLE_APP_ATTEST_ROOT_KEY_HASH = "0x2532418a107c5306fa8308c22255792cf77e4a290cbce8a840a642a3e591340b";
8
- var GOOGLE_APP_ATTEST_RSA_ROOT_KEY_HASH = "0x16700a2d9168a194fc85f237af5829b5a2be05b8ae8ac4879ada34cf54a9c211";
9
-
10
- export {
11
- VERSION,
12
- DEFAULT_VALIDITY,
13
- DEFAULT_DATE_VALUE,
14
- ZKPASSPORT_IOS_APP_ID_HASH,
15
- ZKPASSPORT_ANDROID_APP_ID_HASH,
16
- APPLE_APP_ATTEST_ROOT_KEY_HASH,
17
- GOOGLE_APP_ATTEST_RSA_ROOT_KEY_HASH
18
- };