@zkpassport/sdk 0.16.2 → 0.17.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/README.md +96 -107
- package/dist/cjs/index-PPMt5JWF.d.cts +444 -0
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -399
- package/dist/cjs/popup.cjs +3 -0
- package/dist/cjs/popup.cjs.map +1 -0
- package/dist/cjs/popup.d.cts +91 -0
- package/dist/cjs/query.cjs +2 -0
- package/dist/cjs/query.cjs.map +1 -0
- package/dist/cjs/query.d.cts +3 -0
- package/dist/esm/index-PPMt5JWF.d.ts +444 -0
- package/dist/esm/index.d.ts +2 -399
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/popup.d.ts +91 -0
- package/dist/esm/popup.js +3 -0
- package/dist/esm/popup.js.map +1 -0
- package/dist/esm/query.d.ts +3 -0
- package/dist/esm/query.js +2 -0
- package/dist/esm/query.js.map +1 -0
- package/package.json +31 -7
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
import { Query, IDCredential, IDCredentialValue, NumericalIDCredential, DisclosableIDCredential, BoundData, SupportedChain, SanctionsCountries, SanctionsLists, FacematchMode, ProofResult, QueryResult, NullifierType, CountryName, ProofMode, Service } from '@zkpassport/utils';
|
|
2
|
+
import { Alpha3Code } from 'i18n-iso-countries';
|
|
3
|
+
|
|
4
|
+
type QueryResultError<T> = {
|
|
5
|
+
expected?: T;
|
|
6
|
+
received?: T;
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
9
|
+
type QueryResultErrors = {
|
|
10
|
+
[key in IDCredential | "sig_check_dsc" | "sig_check_id_data" | "data_check_integrity" | "outer" | "disclose" | "bind" | "facematch" | "sanctions"]: {
|
|
11
|
+
disclose?: QueryResultError<string | number | Date>;
|
|
12
|
+
gte?: QueryResultError<number | Date>;
|
|
13
|
+
gt?: 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 VerifierMode = "auto" | "local" | "api";
|
|
27
|
+
type RequestedNullifierType = NullifierType.NON_SALTED | NullifierType.SALTED | NullifierType.NONE;
|
|
28
|
+
type VerificationResult = {
|
|
29
|
+
uniqueIdentifier: string | undefined;
|
|
30
|
+
uniqueIdentifierType: NullifierType | undefined;
|
|
31
|
+
verified: boolean;
|
|
32
|
+
queryResultErrors?: Partial<QueryResultErrors>;
|
|
33
|
+
};
|
|
34
|
+
type SolidityProofVerificationData = {
|
|
35
|
+
vkeyHash: string;
|
|
36
|
+
proof: string;
|
|
37
|
+
publicInputs: string[];
|
|
38
|
+
};
|
|
39
|
+
type SolidityServiceConfig = {
|
|
40
|
+
validityPeriodInSeconds: number;
|
|
41
|
+
domain: string;
|
|
42
|
+
scope: string;
|
|
43
|
+
devMode: boolean;
|
|
44
|
+
};
|
|
45
|
+
type SolidityVerifierParameters = {
|
|
46
|
+
version: string;
|
|
47
|
+
proofVerificationData: SolidityProofVerificationData;
|
|
48
|
+
committedInputs: string;
|
|
49
|
+
serviceConfig: SolidityServiceConfig;
|
|
50
|
+
};
|
|
51
|
+
type Policy = {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
purpose: string;
|
|
55
|
+
projectId: string | null;
|
|
56
|
+
query: Query;
|
|
57
|
+
proofStorageEnabled?: boolean;
|
|
58
|
+
};
|
|
59
|
+
type DashboardConfig = {
|
|
60
|
+
project: {
|
|
61
|
+
name: string;
|
|
62
|
+
domain: string;
|
|
63
|
+
logoUrl: string | null;
|
|
64
|
+
allowedOrigins: string[];
|
|
65
|
+
};
|
|
66
|
+
policies: Policy[];
|
|
67
|
+
};
|
|
68
|
+
type RequestSuccess = {
|
|
69
|
+
proofs: ProofResult[];
|
|
70
|
+
result: QueryResult;
|
|
71
|
+
};
|
|
72
|
+
type OnSuccessVerdict = void | boolean | Promise<void | boolean>;
|
|
73
|
+
type QueryBuilderResult = {
|
|
74
|
+
/**
|
|
75
|
+
* The URL of the request.
|
|
76
|
+
*
|
|
77
|
+
* You can either encode the URL in a QR code or let the user click the link
|
|
78
|
+
* to this URL on your website if they're visiting your website on their phone.
|
|
79
|
+
*/
|
|
80
|
+
url: string;
|
|
81
|
+
/**
|
|
82
|
+
* The query object.
|
|
83
|
+
*/
|
|
84
|
+
query: Query;
|
|
85
|
+
/**
|
|
86
|
+
* The id of the request.
|
|
87
|
+
*/
|
|
88
|
+
requestId: string;
|
|
89
|
+
/**
|
|
90
|
+
* The id of the policy used to build the request, if one was provided.
|
|
91
|
+
*/
|
|
92
|
+
policy?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Called when the user has scanned the QR code or clicked the link to the request.
|
|
95
|
+
*
|
|
96
|
+
* This means the user is currently viewing the request popup with your website information
|
|
97
|
+
* and the information requested from them.
|
|
98
|
+
*/
|
|
99
|
+
onRequestReceived: (callback: () => void) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Called when the user has accepted the request and
|
|
102
|
+
* started to generate the proof on their phone.
|
|
103
|
+
*/
|
|
104
|
+
onGeneratingProof: (callback: () => void) => void;
|
|
105
|
+
/**
|
|
106
|
+
* Called when the SDK successfully connects to the bridge with the mobile app.
|
|
107
|
+
*/
|
|
108
|
+
onBridgeConnect: (callback: () => void) => void;
|
|
109
|
+
/**
|
|
110
|
+
* Called when the user has generated a proof.
|
|
111
|
+
*
|
|
112
|
+
* There is a minimum of 4 proofs, but there can be more depending
|
|
113
|
+
* on the type of information requested from the user.
|
|
114
|
+
*/
|
|
115
|
+
onProofGenerated: (callback: (proof: ProofResult) => void) => void;
|
|
116
|
+
/**
|
|
117
|
+
* Called when the user has completed the request and all proofs were received.
|
|
118
|
+
*
|
|
119
|
+
* The proofs are not verified at this point: send them along with the result
|
|
120
|
+
* to your backend and verify them there with `verify()`. The UI components wait
|
|
121
|
+
* for this callback before showing their success state; return `false` (or throw)
|
|
122
|
+
* to show the error state instead, e.g. when your backend rejects the proofs.
|
|
123
|
+
*/
|
|
124
|
+
onSuccess: (callback: (response: RequestSuccess) => OnSuccessVerdict) => void;
|
|
125
|
+
/**
|
|
126
|
+
* Called when the user has sent the query result.
|
|
127
|
+
*
|
|
128
|
+
* The response contains the unique identifier associated to the user,
|
|
129
|
+
* your domain name and chosen scope, along with the query result and whether
|
|
130
|
+
* the proofs were successfully verified.
|
|
131
|
+
*
|
|
132
|
+
* @deprecated The verified flag can be tampered with in the browser. Use `onSuccess`
|
|
133
|
+
* and verify the proofs on your backend with `verify()`.
|
|
134
|
+
*/
|
|
135
|
+
onResult: (callback: (response: {
|
|
136
|
+
uniqueIdentifier: string | undefined;
|
|
137
|
+
uniqueIdentifierType: NullifierType | undefined;
|
|
138
|
+
verified: boolean;
|
|
139
|
+
result: QueryResult;
|
|
140
|
+
queryResultErrors?: Partial<QueryResultErrors>;
|
|
141
|
+
proofs: ProofResult[];
|
|
142
|
+
sdkInstance: ZKPassport;
|
|
143
|
+
}) => void) => void;
|
|
144
|
+
/**
|
|
145
|
+
* Called when the user has rejected the request.
|
|
146
|
+
*/
|
|
147
|
+
onReject: (callback: () => void) => void;
|
|
148
|
+
/**
|
|
149
|
+
* Called when an error occurs, such as one of the requirements not being met
|
|
150
|
+
* or a proof failing to be generated.
|
|
151
|
+
*/
|
|
152
|
+
onError: (callback: (error: string) => void) => void;
|
|
153
|
+
/**
|
|
154
|
+
* @returns true if the bridge with the mobile app is connected
|
|
155
|
+
*/
|
|
156
|
+
isBridgeConnected: () => boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Get if the user has scanned the QR code or the link to this request
|
|
159
|
+
* @returns true if the request has been received by the user on their phone
|
|
160
|
+
*/
|
|
161
|
+
requestReceived: () => boolean;
|
|
162
|
+
};
|
|
163
|
+
type OfflineQueryBuilderResult = {
|
|
164
|
+
query: Query;
|
|
165
|
+
};
|
|
166
|
+
type QueryBuilder<T extends "online" | "offline" = "online"> = {
|
|
167
|
+
/**
|
|
168
|
+
* Requires this attribute to be equal to the provided value.
|
|
169
|
+
* @param key The attribute to compare.
|
|
170
|
+
* @param value The value of the attribute you require.
|
|
171
|
+
*/
|
|
172
|
+
eq: <T extends IDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
173
|
+
/**
|
|
174
|
+
* Requires this attribute to be greater than or equal to the provided value.
|
|
175
|
+
* @param key The attribute to compare.
|
|
176
|
+
* @param value The value of the attribute you require.
|
|
177
|
+
*/
|
|
178
|
+
gte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
179
|
+
/**
|
|
180
|
+
* Requires this attribute to be greater than the provided value.
|
|
181
|
+
* @param key The attribute to compare.
|
|
182
|
+
* @param value The value of the attribute you require.
|
|
183
|
+
*/
|
|
184
|
+
gt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
185
|
+
/**
|
|
186
|
+
* Requires this attribute to be less than or equal to the provided value.
|
|
187
|
+
* @param key The attribute to compare.
|
|
188
|
+
* @param value The value of the attribute you require.
|
|
189
|
+
*/
|
|
190
|
+
lte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
191
|
+
/**
|
|
192
|
+
* Requires this attribute to be less than the provided value.
|
|
193
|
+
* @param key The attribute to compare.
|
|
194
|
+
* @param value The value of the attribute you require.
|
|
195
|
+
*/
|
|
196
|
+
lt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => QueryBuilder;
|
|
197
|
+
/**
|
|
198
|
+
* Requires this attribute to be included in the provided range.
|
|
199
|
+
* @param key The attribute to compare.
|
|
200
|
+
* @param start The start of the range.
|
|
201
|
+
* @param end The end of the range.
|
|
202
|
+
*/
|
|
203
|
+
range: <T extends NumericalIDCredential>(key: T, start: IDCredentialValue<T>, end: IDCredentialValue<T>) => QueryBuilder;
|
|
204
|
+
/**
|
|
205
|
+
* Requires this attribute to be included in the provided list.
|
|
206
|
+
* @param key The attribute to compare.
|
|
207
|
+
* @param value The list of values to check inclusion against.
|
|
208
|
+
*/
|
|
209
|
+
in: <T extends "nationality" | "issuing_country">(key: T, value: IDCredentialValue<T>[]) => QueryBuilder;
|
|
210
|
+
/**
|
|
211
|
+
* Requires this attribute to be excluded from the provided list.
|
|
212
|
+
* @param key The attribute to compare.
|
|
213
|
+
* @param value The list of values to check exclusion against.
|
|
214
|
+
*/
|
|
215
|
+
out: <T extends "nationality" | "issuing_country">(key: T, value: IDCredentialValue<T>[]) => QueryBuilder;
|
|
216
|
+
/**
|
|
217
|
+
* Requires this attribute to be disclosed.
|
|
218
|
+
* @param key The attribute to disclose.
|
|
219
|
+
*/
|
|
220
|
+
disclose: (key: DisclosableIDCredential) => QueryBuilder;
|
|
221
|
+
/**
|
|
222
|
+
* Binds a value to the request.
|
|
223
|
+
* @param key The key of the value to bind.
|
|
224
|
+
* @param value The value to bind the request to.
|
|
225
|
+
*/
|
|
226
|
+
bind: <T extends keyof BoundData>(key: T, value: T extends "chain" ? SupportedChain : T extends "user_address" ? `0x${string}` : string | undefined) => QueryBuilder;
|
|
227
|
+
/**
|
|
228
|
+
* Requires that the ID holder is not part of any of the specified sanction lists.
|
|
229
|
+
* @param countries The country or list of countries whose sanction lists to check against. Defaults to "all".
|
|
230
|
+
* e.g. "US", ["US", "GB", "CH", "EU"], "all"
|
|
231
|
+
* @param lists The specific lists from a given country to check against. Defaults to "all".
|
|
232
|
+
* e.g. ["OFAC_SDN"], "all"
|
|
233
|
+
* @param options The options to use for the sanction check.
|
|
234
|
+
* @param options.strict Whether to use a strict sanction check. Defaults to false.
|
|
235
|
+
*
|
|
236
|
+
* If set to true, this means the checks will be done against just the lastname and firstname,
|
|
237
|
+
* while when set to false, matches will need to include either the date of birth and name or
|
|
238
|
+
* the passport number and nationality.
|
|
239
|
+
* Strict mode has therefore a higher false positive rate but is harder to evade.
|
|
240
|
+
*/
|
|
241
|
+
sanctions: (countries?: SanctionsCountries, lists?: SanctionsLists, options?: {
|
|
242
|
+
strict?: boolean;
|
|
243
|
+
}) => QueryBuilder;
|
|
244
|
+
/**
|
|
245
|
+
* Requires that the ID holder's face matches the photo on the ID.
|
|
246
|
+
* @param mode The mode to use for the face match. Defaults to "strict".
|
|
247
|
+
* @param mode "strict" - The user will have to go through an extensive liveness check to prevent spoofing making it more secure.
|
|
248
|
+
* Best for high security requirements such as KYC.
|
|
249
|
+
* @param mode "regular" - The user will only have to go through a basic liveness check to prevent spoofing, making it faster for the user.
|
|
250
|
+
* Best for lower security requirements that requires fast verification such as age verification.
|
|
251
|
+
*/
|
|
252
|
+
facematch: (mode?: FacematchMode) => QueryBuilder;
|
|
253
|
+
raw: (query: Query) => QueryBuilder<T>;
|
|
254
|
+
/**
|
|
255
|
+
* Applies an immutable policy fetched from the dashboard. The policy's query,
|
|
256
|
+
* purpose and scope are locked; combining with builder methods (except
|
|
257
|
+
* `.bind()`, which may follow it) or calling twice throws.
|
|
258
|
+
* @param id The policy id (e.g. `'pol_xyz'`).
|
|
259
|
+
*/
|
|
260
|
+
policy: (id: string) => QueryBuilder<T>;
|
|
261
|
+
/**
|
|
262
|
+
* Builds the request.
|
|
263
|
+
*
|
|
264
|
+
* This will return the URL of the request, which you can either encode in a QR code
|
|
265
|
+
* or provide as a link to the user if they're visiting your website on their phone.
|
|
266
|
+
* It also returns all the callbacks you can use to handle the user's response.
|
|
267
|
+
*/
|
|
268
|
+
done: () => T extends "online" ? QueryBuilderResult : OfflineQueryBuilderResult;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
declare function normalizeCountry(country: CountryName | Alpha3Code): Alpha3Code | "ZKR";
|
|
272
|
+
declare function numericalCompare(fnName: "gte" | "gt" | "lte" | "lt", key: NumericalIDCredential, value: number | Date, requestId: string, requestIdToConfig: Record<string, Query>): void;
|
|
273
|
+
declare function rangeCompare(key: NumericalIDCredential, value: [number | Date, number | Date], requestId: string, requestIdToConfig: Record<string, Query>): void;
|
|
274
|
+
declare function generalCompare(fnName: "in" | "out" | "eq", key: IDCredential, value: any, // eslint-disable-line
|
|
275
|
+
requestId: string, requestIdToConfig: Record<string, Query>): void;
|
|
276
|
+
declare function createOfflineQuery(): QueryBuilder<"offline">;
|
|
277
|
+
|
|
278
|
+
declare class ZKPassport {
|
|
279
|
+
private domain;
|
|
280
|
+
private domainProvided;
|
|
281
|
+
private topicToConfig;
|
|
282
|
+
private topicToLocalConfig;
|
|
283
|
+
private topicToPublicKey;
|
|
284
|
+
private topicToBridge;
|
|
285
|
+
private topicToRequestReceived;
|
|
286
|
+
private topicToService;
|
|
287
|
+
private topicToCallerPurpose;
|
|
288
|
+
private topicToProofs;
|
|
289
|
+
private topicToFailedProofCount;
|
|
290
|
+
private topicToResults;
|
|
291
|
+
private topicToPolicy;
|
|
292
|
+
private dashboardConfig;
|
|
293
|
+
private dashboardConfigPromise;
|
|
294
|
+
private dashboardConfigError;
|
|
295
|
+
private onRequestReceivedCallbacks;
|
|
296
|
+
private onGeneratingProofCallbacks;
|
|
297
|
+
private onBridgeConnectCallbacks;
|
|
298
|
+
private onProofGeneratedCallbacks;
|
|
299
|
+
private onSuccessCallbacks;
|
|
300
|
+
private onResultCallbacks;
|
|
301
|
+
private onRejectCallbacks;
|
|
302
|
+
private onErrorCallbacks;
|
|
303
|
+
private normalizeDomain;
|
|
304
|
+
constructor(_domain?: string);
|
|
305
|
+
private handleResult;
|
|
306
|
+
private verifyAndReportResult;
|
|
307
|
+
/**
|
|
308
|
+
* @notice Handle an encrypted message.
|
|
309
|
+
* @param request The request.
|
|
310
|
+
* @param outerRequest The outer request.
|
|
311
|
+
*/
|
|
312
|
+
private handleEncryptedMessage;
|
|
313
|
+
private assertNotPolicyLocked;
|
|
314
|
+
private getZkPassportRequest;
|
|
315
|
+
private getDashboardConfig;
|
|
316
|
+
private fetchDashboardConfig;
|
|
317
|
+
private findPolicy;
|
|
318
|
+
private assertCanApplyPolicy;
|
|
319
|
+
/**
|
|
320
|
+
* @notice Create a new request. To apply a policy, chain `.policy('<id>')` on
|
|
321
|
+
* the returned builder; a policy locks the query and scope.
|
|
322
|
+
* @param name Your service name. Defaults to the dashboard branding, then the domain.
|
|
323
|
+
* @param logo Your service logo. Defaults to the dashboard branding.
|
|
324
|
+
* @param purpose Explanation shown to the user. Defaults to the policy's purpose (if any), then a generic message.
|
|
325
|
+
* @param scope Use-case scope (drives the nullifier). Defaults to the domain. Locked by `.policy()` (to the policy id).
|
|
326
|
+
* @param projectID The project ID of your service
|
|
327
|
+
* @param validity How many seconds ago the proof checking the expiry date of the ID should have been generated
|
|
328
|
+
* @param mode The proof mode (e.g. "fast" / "compressed").
|
|
329
|
+
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
330
|
+
* @param verifierMode How the received proofs are verified: "local", "api" or "auto" (default).
|
|
331
|
+
* @returns The query builder object.
|
|
332
|
+
*/
|
|
333
|
+
request({ name, logo, purpose, scope, projectID, mode, validity, devMode, uniqueIdentifierType, oprfKeyId, topicOverride, keyPairOverride, cloudProverUrl, bridgeUrl, returnDeepLink, verifierMode, }: {
|
|
334
|
+
name?: string;
|
|
335
|
+
logo?: string;
|
|
336
|
+
purpose?: string;
|
|
337
|
+
scope?: string;
|
|
338
|
+
mode?: ProofMode;
|
|
339
|
+
projectID?: string;
|
|
340
|
+
validity?: number;
|
|
341
|
+
devMode?: boolean;
|
|
342
|
+
uniqueIdentifierType?: RequestedNullifierType;
|
|
343
|
+
oprfKeyId?: string;
|
|
344
|
+
topicOverride?: string;
|
|
345
|
+
keyPairOverride?: {
|
|
346
|
+
privateKey: Uint8Array;
|
|
347
|
+
publicKey: Uint8Array;
|
|
348
|
+
};
|
|
349
|
+
cloudProverUrl?: string;
|
|
350
|
+
bridgeUrl?: string;
|
|
351
|
+
returnDeepLink?: string;
|
|
352
|
+
verifierMode?: VerifierMode;
|
|
353
|
+
}): Promise<QueryBuilder>;
|
|
354
|
+
/**
|
|
355
|
+
* @notice Create a new offline query
|
|
356
|
+
* Unlike request(), this function does not connect to the bridge.
|
|
357
|
+
* It returns only the query object and no callbacks and no URL.
|
|
358
|
+
* This can be useful to recreate the same query server-side when calling `verify()`
|
|
359
|
+
* to ensure the original query wasn't tampered with.
|
|
360
|
+
* @returns The query builder object.
|
|
361
|
+
*/
|
|
362
|
+
createQuery(): QueryBuilder<"offline">;
|
|
363
|
+
/**
|
|
364
|
+
* @notice Verify the proofs received from the mobile app.
|
|
365
|
+
* @param proofs The proofs to verify.
|
|
366
|
+
* @param originalQuery The original query that was sent to the mobile app.
|
|
367
|
+
* @param queryResult The query result to verify against
|
|
368
|
+
* @param validity How many seconds ago the proof checking the expiry date of the ID should have been generated
|
|
369
|
+
* @param scope The scope used in the original request, if any. Proofs generated for a different scope fail verification.
|
|
370
|
+
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
371
|
+
* @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
|
|
372
|
+
* It should only be needed when running the `verify` function on a server with restricted write access (e.g. Vercel)
|
|
373
|
+
* @param oprfKeyId The OPRF key id used in the original request, if any.
|
|
374
|
+
* @param uniqueIdentifierType The unique identifier type requested in the original request, if any.
|
|
375
|
+
* Proofs using a different type fail verification.
|
|
376
|
+
* @param verifierMode "local" verifies with the verifier bundled in this SDK, "api" with the
|
|
377
|
+
* ZKPassport verifier API, and "auto" (default) verifies locally but defers to the API when
|
|
378
|
+
* the local result is not verified — e.g. proofs from a newer bb version than this SDK supports.
|
|
379
|
+
* @returns An object containing the unique identifier associated to the user
|
|
380
|
+
* and a boolean indicating whether the proofs were successfully verified.
|
|
381
|
+
*/
|
|
382
|
+
verify({ proofs, originalQuery, queryResult, validity, scope, devMode, writingDirectory, oprfKeyId, uniqueIdentifierType, verifierMode, }: {
|
|
383
|
+
proofs: Array<ProofResult>;
|
|
384
|
+
originalQuery: Query;
|
|
385
|
+
queryResult: QueryResult;
|
|
386
|
+
validity?: number;
|
|
387
|
+
scope?: string;
|
|
388
|
+
devMode?: boolean;
|
|
389
|
+
writingDirectory?: string;
|
|
390
|
+
oprfKeyId?: string;
|
|
391
|
+
uniqueIdentifierType?: RequestedNullifierType;
|
|
392
|
+
verifierMode?: VerifierMode;
|
|
393
|
+
}): Promise<VerificationResult>;
|
|
394
|
+
private verifyLocally;
|
|
395
|
+
getSolidityVerifierDetails(): {
|
|
396
|
+
address: `0x${string}`;
|
|
397
|
+
functionName: string;
|
|
398
|
+
abi: {
|
|
399
|
+
type: "function" | "event" | "constructor";
|
|
400
|
+
name: string;
|
|
401
|
+
inputs: {
|
|
402
|
+
name: string;
|
|
403
|
+
type: string;
|
|
404
|
+
internalType: string;
|
|
405
|
+
}[];
|
|
406
|
+
outputs: {
|
|
407
|
+
name: string;
|
|
408
|
+
type: string;
|
|
409
|
+
internalType: string;
|
|
410
|
+
}[];
|
|
411
|
+
}[];
|
|
412
|
+
};
|
|
413
|
+
getSolidityVerifierParameters({ proof, validityPeriodInSeconds, domain, scope, devMode, }: {
|
|
414
|
+
proof: ProofResult;
|
|
415
|
+
validityPeriodInSeconds?: number;
|
|
416
|
+
domain?: string;
|
|
417
|
+
scope?: string;
|
|
418
|
+
devMode?: boolean;
|
|
419
|
+
}): SolidityVerifierParameters;
|
|
420
|
+
private _getUrl;
|
|
421
|
+
/**
|
|
422
|
+
* @notice Returns the URL of the request.
|
|
423
|
+
* @param requestId The request ID.
|
|
424
|
+
* @returns The URL of the request.
|
|
425
|
+
*/
|
|
426
|
+
getUrl(requestId: string): string;
|
|
427
|
+
/**
|
|
428
|
+
* @notice Returns the resolved service details (name, logo, purpose) shown to the
|
|
429
|
+
* user for a pending request, including branding resolved from the dashboard config.
|
|
430
|
+
* @param requestId The request ID.
|
|
431
|
+
*/
|
|
432
|
+
getServiceDetails(requestId: string): Service | undefined;
|
|
433
|
+
/**
|
|
434
|
+
* @notice Cancels a request by closing the WebSocket connection and deleting the associated data.
|
|
435
|
+
* @param requestId The request ID.
|
|
436
|
+
*/
|
|
437
|
+
cancelRequest(requestId: string): void;
|
|
438
|
+
/**
|
|
439
|
+
* @notice Clears all requests.
|
|
440
|
+
*/
|
|
441
|
+
clearAllRequests(): void;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export { type DashboardConfig as D, type OnSuccessVerdict as O, type Policy as P, type QueryBuilder as Q, type RequestSuccess as R, type SolidityProofVerificationData as S, type VerificationResult as V, ZKPassport as Z, type QueryBuilderResult as a, numericalCompare as b, createOfflineQuery as c, type OfflineQueryBuilderResult as d, type QueryResultError as e, type QueryResultErrors as f, generalCompare as g, type RequestedNullifierType as h, type SolidityServiceConfig as i, type SolidityVerifierParameters as j, type VerifierMode as k, normalizeCountry as n, rangeCompare as r };
|