@zkpassport/sdk 0.8.8 → 0.9.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.
@@ -0,0 +1,14 @@
1
+ // src/constants.ts
2
+ var VERSION = "0.9.0";
3
+ var DEFAULT_VALIDITY = 7 * 24 * 60 * 60;
4
+ var DEFAULT_DATE_VALUE = /* @__PURE__ */ new Date(0);
5
+ var ZKPASSPORT_APP_ID_HASH = "0x1fa73686cf510f8f85757b0602de0dd72a13e68ae2092462be8b72662e7f179b";
6
+ var APPLE_APP_ATTEST_ROOT_KEY_HASH = "0x2532418a107c5306fa8308c22255792cf77e4a290cbce8a840a642a3e591340b";
7
+
8
+ export {
9
+ VERSION,
10
+ DEFAULT_VALIDITY,
11
+ DEFAULT_DATE_VALUE,
12
+ ZKPASSPORT_APP_ID_HASH,
13
+ APPLE_APP_ATTEST_ROOT_KEY_HASH
14
+ };
@@ -0,0 +1,7 @@
1
+ declare const VERSION = "0.9.0";
2
+ declare const DEFAULT_VALIDITY: number;
3
+ declare const DEFAULT_DATE_VALUE: Date;
4
+ declare const ZKPASSPORT_APP_ID_HASH = "0x1fa73686cf510f8f85757b0602de0dd72a13e68ae2092462be8b72662e7f179b";
5
+ declare const APPLE_APP_ATTEST_ROOT_KEY_HASH = "0x2532418a107c5306fa8308c22255792cf77e4a290cbce8a840a642a3e591340b";
6
+
7
+ export { APPLE_APP_ATTEST_ROOT_KEY_HASH, DEFAULT_DATE_VALUE, DEFAULT_VALIDITY, VERSION, ZKPASSPORT_APP_ID_HASH };
@@ -0,0 +1,14 @@
1
+ import {
2
+ APPLE_APP_ATTEST_ROOT_KEY_HASH,
3
+ DEFAULT_DATE_VALUE,
4
+ DEFAULT_VALIDITY,
5
+ VERSION,
6
+ ZKPASSPORT_APP_ID_HASH
7
+ } from "./chunk-XOQW7AOQ.js";
8
+ export {
9
+ APPLE_APP_ATTEST_ROOT_KEY_HASH,
10
+ DEFAULT_DATE_VALUE,
11
+ DEFAULT_VALIDITY,
12
+ VERSION,
13
+ ZKPASSPORT_APP_ID_HASH
14
+ };
@@ -1,195 +1,9 @@
1
- import { IDCredential, ProofResult, QueryResult, IDCredentialValue, NumericalIDCredential, DisclosableIDCredential, BoundData, SanctionsCountries, SanctionsLists, FacematchMode, ProofMode, SupportedChain } from '@zkpassport/utils';
1
+ import { QueryBuilder, QueryResultErrors, SolidityVerifierParameters } from './types.js';
2
+ export { QueryBuilderResult, QueryResultError } from './types.js';
3
+ import { ProofMode, ProofResult, QueryResult, NullifierType, SupportedChain } from '@zkpassport/utils';
2
4
  export * from '@zkpassport/utils';
3
5
  export { ASEAN_COUNTRIES, EEA_COUNTRIES, EU_COUNTRIES, MERCOSUR_COUNTRIES, SANCTIONED_COUNTRIES, SCHENGEN_COUNTRIES } from '@zkpassport/utils';
4
6
 
5
- type QueryResultError<T> = {
6
- expected?: T;
7
- received?: T;
8
- message: string;
9
- };
10
- type QueryResultErrors = {
11
- [key in IDCredential | "sig_check_dsc" | "sig_check_id_data" | "data_check_integrity" | "outer" | "disclose" | "bind" | "facematch" | "sanctions"]: {
12
- disclose?: QueryResultError<string | number | Date>;
13
- gte?: QueryResultError<number | Date>;
14
- lte?: QueryResultError<number | Date>;
15
- lt?: QueryResultError<number | Date>;
16
- range?: QueryResultError<[number | Date, number | Date]>;
17
- in?: QueryResultError<string[]>;
18
- out?: QueryResultError<string[]>;
19
- eq?: QueryResultError<string | number | Date>;
20
- commitment?: QueryResultError<string>;
21
- date?: QueryResultError<string>;
22
- certificate?: QueryResultError<string>;
23
- scope?: QueryResultError<string>;
24
- };
25
- };
26
- type SolidityVerifierParameters = {
27
- vkeyHash: string;
28
- proof: string;
29
- publicInputs: string[];
30
- committedInputs: string;
31
- committedInputCounts: number[];
32
- validityPeriodInSeconds: number;
33
- domain: string;
34
- scope: string;
35
- devMode: boolean;
36
- };
37
-
38
- type QueryBuilderResult = {
39
- /**
40
- * The URL of the request.
41
- *
42
- * You can either encode the URL in a QR code or let the user click the link
43
- * to this URL on your website if they're visiting your website on their phone.
44
- */
45
- url: string;
46
- /**
47
- * The id of the request.
48
- */
49
- requestId: string;
50
- /**
51
- * Called when the user has scanned the QR code or clicked the link to the request.
52
- *
53
- * This means the user is currently viewing the request popup with your website information
54
- * and the information requested from them.
55
- */
56
- onRequestReceived: (callback: () => void) => void;
57
- /**
58
- * Called when the user has accepted the request and
59
- * started to generate the proof on their phone.
60
- */
61
- onGeneratingProof: (callback: () => void) => void;
62
- /**
63
- * Called when the SDK successfully connects to the bridge with the mobile app.
64
- */
65
- onBridgeConnect: (callback: () => void) => void;
66
- /**
67
- * Called when the user has generated a proof.
68
- *
69
- * There is a minimum of 4 proofs, but there can be more depending
70
- * on the type of information requested from the user.
71
- */
72
- onProofGenerated: (callback: (proof: ProofResult) => void) => void;
73
- /**
74
- * Called when the user has sent the query result.
75
- *
76
- * The response contains the unique identifier associated to the user,
77
- * your domain name and chosen scope, along with the query result and whether
78
- * the proofs were successfully verified.
79
- */
80
- onResult: (callback: (response: {
81
- uniqueIdentifier: string | undefined;
82
- verified: boolean;
83
- result: QueryResult;
84
- queryResultErrors?: Partial<QueryResultErrors>;
85
- }) => void) => void;
86
- /**
87
- * Called when the user has rejected the request.
88
- */
89
- onReject: (callback: () => void) => void;
90
- /**
91
- * Called when an error occurs, such as one of the requirements not being met
92
- * or a proof failing to be generated.
93
- */
94
- onError: (callback: (error: string) => void) => void;
95
- /**
96
- * @returns true if the bridge with the mobile app is connected
97
- */
98
- isBridgeConnected: () => boolean;
99
- /**
100
- * Get if the user has scanned the QR code or the link to this request
101
- * @returns true if the request has been received by the user on their phone
102
- */
103
- requestReceived: () => boolean;
104
- };
105
- type QueryBuilder = {
106
- /**
107
- * Requires this attribute to be equal to the provided value.
108
- * @param key The attribute to compare.
109
- * @param value The value of the attribute you require.
110
- */
111
- eq: <T extends IDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
112
- /**
113
- * Requires this attribute to be greater than or equal to the provided value.
114
- * @param key The attribute to compare.
115
- * @param value The value of the attribute you require.
116
- */
117
- gte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
118
- /**
119
- * Requires this attribute to be greater than the provided value.
120
- * @param key The attribute to compare.
121
- * @param value The value of the attribute you require.
122
- */
123
- gt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
124
- /**
125
- * Requires this attribute to be less than or equal to the provided value.
126
- * @param key The attribute to compare.
127
- * @param value The value of the attribute you require.
128
- */
129
- lte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
130
- /**
131
- * Requires this attribute to be less than the provided value.
132
- * @param key The attribute to compare.
133
- * @param value The value of the attribute you require.
134
- */
135
- lt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
136
- /**
137
- * Requires this attribute to be included in the provided range.
138
- * @param key The attribute to compare.
139
- * @param start The start of the range.
140
- * @param end The end of the range.
141
- */
142
- range: <T extends NumericalIDCredential>(key: T, start: IDCredentialValue<T>, end: IDCredentialValue<T>) => QueryBuilder;
143
- /**
144
- * Requires this attribute to be included in the provided list.
145
- * @param key The attribute to compare.
146
- * @param value The list of values to check inclusion against.
147
- */
148
- in: <T extends "nationality" | "issuing_country">(key: T, value: IDCredentialValue<T>[]) => QueryBuilder;
149
- /**
150
- * Requires this attribute to be excluded from the provided list.
151
- * @param key The attribute to compare.
152
- * @param value The list of values to check exclusion against.
153
- */
154
- out: <T extends "nationality" | "issuing_country">(key: T, value: IDCredentialValue<T>[]) => QueryBuilder;
155
- /**
156
- * Requires this attribute to be disclosed.
157
- * @param key The attribute to disclose.
158
- */
159
- disclose: (key: DisclosableIDCredential) => QueryBuilder;
160
- /**
161
- * Binds a value to the request.
162
- * @param key The key of the value to bind.
163
- * @param value The value to bind the request to.
164
- */
165
- bind: (key: keyof BoundData, value: BoundData[keyof BoundData]) => QueryBuilder;
166
- /**
167
- * Requires that the ID holder is not part of any of the specified sanction lists.
168
- * @param countries The country or list of countries whose sanction lists to check against. Defaults to "all".
169
- * e.g. "US", ["US", "GB", "CH", "EU"], "all"
170
- * @param lists The specific lists from a given country to check against. Defaults to "all".
171
- * e.g. ["OFAC_SDN"], "all"
172
- */
173
- sanctions: (countries?: SanctionsCountries, lists?: SanctionsLists) => QueryBuilder;
174
- /**
175
- * This feature is not available yet in the public release of the app.
176
- * Requires that the ID holder's face matches the photo on the ID.
177
- * @param mode The mode to use for the face match. Defaults to "regular".
178
- * @param mode "strict" - The user will have to go through an extensive liveness check to prevent spoofing making it more secure.
179
- * Best for high security requirements such as KYC.
180
- * @param mode "regular" - The user will only have to go through a basic liveness check to prevent spoofing, making it faster for the user.
181
- * Best for lower security requirements that requires fast verification such as age verification.
182
- */
183
- facematch: (mode?: FacematchMode) => QueryBuilder;
184
- /**
185
- * Builds the request.
186
- *
187
- * This will return the URL of the request, which you can either encode in a QR code
188
- * or provide as a link to the user if they're visiting your website on their phone.
189
- * It also returns all the callbacks you can use to handle the user's response.
190
- */
191
- done: () => QueryBuilderResult;
192
- };
193
7
  declare class ZKPassport {
194
8
  private domain;
195
9
  private topicToConfig;
@@ -248,20 +62,6 @@ declare class ZKPassport {
248
62
  cloudProverUrl?: string;
249
63
  bridgeUrl?: string;
250
64
  }): Promise<QueryBuilder>;
251
- private checkDiscloseBytesPublicInputs;
252
- private checkAgePublicInputs;
253
- private checkBirthdatePublicInputs;
254
- private checkExpiryDatePublicInputs;
255
- private checkNationalityExclusionPublicInputs;
256
- private checkIssuingCountryExclusionPublicInputs;
257
- private checkNationalityInclusionPublicInputs;
258
- private checkIssuingCountryInclusionPublicInputs;
259
- private checkScopeFromDisclosureProof;
260
- private checkCertificateRegistryRoot;
261
- private checkCircuitRegistryRoot;
262
- private checkBindPublicInputs;
263
- private checkSanctionsExclusionPublicInputs;
264
- private checkPublicInputs;
265
65
  /**
266
66
  * @notice Verify the proofs received from the mobile app.
267
67
  * @param proofs The proofs to verify.
@@ -283,6 +83,7 @@ declare class ZKPassport {
283
83
  writingDirectory?: string;
284
84
  }): Promise<{
285
85
  uniqueIdentifier: string | undefined;
86
+ uniqueIdentifierType: NullifierType | undefined;
286
87
  verified: boolean;
287
88
  queryResultErrors?: Partial<QueryResultErrors>;
288
89
  }>;
@@ -329,4 +130,4 @@ declare class ZKPassport {
329
130
  clearAllRequests(): void;
330
131
  }
331
132
 
332
- export { type QueryBuilder, type QueryBuilderResult, type QueryResultError, type QueryResultErrors, type SolidityVerifierParameters, ZKPassport };
133
+ export { QueryBuilder, QueryResultErrors, SolidityVerifierParameters, ZKPassport };