@zkpassport/sdk 0.2.15 → 0.3.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.
- package/dist/cjs/assets/abi/ZKPassportVerifier.json +608 -0
- package/dist/cjs/index.d.ts +51 -4
- package/dist/cjs/index.js +1497 -679
- package/dist/esm/assets/abi/ZKPassportVerifier.json +608 -0
- package/dist/esm/index.d.ts +51 -4
- package/dist/esm/index.js +1491 -673
- package/package.json +5 -3
- package/src/assets/abi/ZKPassportVerifier.json +608 -0
- package/src/index.ts +1930 -822
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type DisclosableIDCredential, type IDCredential, type IDCredentialValue, type NumericalIDCredential, type ProofResult, type QueryResult } from "@zkpassport/utils";
|
|
1
|
+
import { type DisclosableIDCredential, type IDCredential, type IDCredentialValue, type NumericalIDCredential, type ProofResult, type QueryResult, ProofMode } from "@zkpassport/utils";
|
|
2
2
|
export type QueryResultError<T> = {
|
|
3
3
|
expected?: T;
|
|
4
4
|
received?: T;
|
|
5
5
|
message: string;
|
|
6
6
|
};
|
|
7
7
|
export type QueryResultErrors = {
|
|
8
|
-
[key in IDCredential | "sig_check_dsc" | "sig_check_id_data" | "data_check_integrity" | "disclose"]: {
|
|
8
|
+
[key in IDCredential | "sig_check_dsc" | "sig_check_id_data" | "data_check_integrity" | "outer" | "disclose"]: {
|
|
9
9
|
disclose?: QueryResultError<string | number | Date>;
|
|
10
10
|
gte?: QueryResultError<number | Date>;
|
|
11
11
|
lte?: QueryResultError<number | Date>;
|
|
@@ -17,8 +17,20 @@ export type QueryResultErrors = {
|
|
|
17
17
|
commitment?: QueryResultError<string>;
|
|
18
18
|
date?: QueryResultError<string>;
|
|
19
19
|
certificate?: QueryResultError<string>;
|
|
20
|
+
scope?: QueryResultError<string>;
|
|
20
21
|
};
|
|
21
22
|
};
|
|
23
|
+
export type SolidityVerifierParameters = {
|
|
24
|
+
vkeyHash: string;
|
|
25
|
+
proof: string;
|
|
26
|
+
publicInputs: string[];
|
|
27
|
+
committedInputs: string;
|
|
28
|
+
committedInputCounts: number[];
|
|
29
|
+
validityPeriodInDays: number;
|
|
30
|
+
scope: string;
|
|
31
|
+
subscope: string;
|
|
32
|
+
};
|
|
33
|
+
export type EVMChain = "ethereum_sepolia" | "local_anvil";
|
|
22
34
|
export type * from "@zkpassport/utils";
|
|
23
35
|
export { SANCTIONED_COUNTRIES, EU_COUNTRIES, EEA_COUNTRIES, SCHENGEN_COUNTRIES, ASEAN_COUNTRIES, MERCOSUR_COUNTRIES, } from "@zkpassport/utils";
|
|
24
36
|
export type QueryBuilderResult = {
|
|
@@ -185,11 +197,12 @@ export declare class ZKPassport {
|
|
|
185
197
|
* @param validity How many days ago should have the ID been last scanned by the user?
|
|
186
198
|
* @returns The query builder object.
|
|
187
199
|
*/
|
|
188
|
-
request({ name, logo, purpose, scope, validity, topicOverride, keyPairOverride, }: {
|
|
200
|
+
request({ name, logo, purpose, scope, mode, validity, topicOverride, keyPairOverride, }: {
|
|
189
201
|
name: string;
|
|
190
202
|
logo: string;
|
|
191
203
|
purpose: string;
|
|
192
204
|
scope?: string;
|
|
205
|
+
mode?: ProofMode;
|
|
193
206
|
validity?: number;
|
|
194
207
|
topicOverride?: string;
|
|
195
208
|
keyPairOverride?: {
|
|
@@ -197,6 +210,15 @@ export declare class ZKPassport {
|
|
|
197
210
|
publicKey: Uint8Array;
|
|
198
211
|
};
|
|
199
212
|
}): Promise<QueryBuilder>;
|
|
213
|
+
private checkDiscloseBytesPublicInputs;
|
|
214
|
+
private checkAgePublicInputs;
|
|
215
|
+
private checkBirthdatePublicInputs;
|
|
216
|
+
private checkExpiryDatePublicInputs;
|
|
217
|
+
private checkNationalityExclusionPublicInputs;
|
|
218
|
+
private checkIssuingCountryExclusionPublicInputs;
|
|
219
|
+
private checkNationalityInclusionPublicInputs;
|
|
220
|
+
private checkIssuingCountryInclusionPublicInputs;
|
|
221
|
+
private checkScopeFromDisclosureProof;
|
|
200
222
|
private checkPublicInputs;
|
|
201
223
|
/**
|
|
202
224
|
* @notice Verify the proofs received from the mobile app.
|
|
@@ -206,15 +228,40 @@ export declare class ZKPassport {
|
|
|
206
228
|
* @returns An object containing the unique identifier associated to the user
|
|
207
229
|
* and a boolean indicating whether the proofs were successfully verified.
|
|
208
230
|
*/
|
|
209
|
-
verify({ proofs, queryResult, validity, }: {
|
|
231
|
+
verify({ proofs, queryResult, validity, scope, }: {
|
|
210
232
|
proofs: Array<ProofResult>;
|
|
211
233
|
queryResult: QueryResult;
|
|
212
234
|
validity?: number;
|
|
235
|
+
scope?: string;
|
|
213
236
|
}): Promise<{
|
|
214
237
|
uniqueIdentifier: string | undefined;
|
|
215
238
|
verified: boolean;
|
|
216
239
|
queryResultErrors?: QueryResultErrors;
|
|
217
240
|
}>;
|
|
241
|
+
getSolidityVerifierDetails(network: EVMChain): {
|
|
242
|
+
address: `0x${string}`;
|
|
243
|
+
functionName: string;
|
|
244
|
+
abi: {
|
|
245
|
+
type: "function" | "event" | "constructor";
|
|
246
|
+
name: string;
|
|
247
|
+
inputs: {
|
|
248
|
+
name: string;
|
|
249
|
+
type: string;
|
|
250
|
+
internalType: string;
|
|
251
|
+
}[];
|
|
252
|
+
outputs: {
|
|
253
|
+
name: string;
|
|
254
|
+
type: string;
|
|
255
|
+
internalType: string;
|
|
256
|
+
}[];
|
|
257
|
+
}[];
|
|
258
|
+
};
|
|
259
|
+
getSolidityVerifierParameters({ proof, validityPeriodInDays, domain, scope, }: {
|
|
260
|
+
proof: ProofResult;
|
|
261
|
+
validityPeriodInDays?: number;
|
|
262
|
+
domain?: string;
|
|
263
|
+
scope?: string;
|
|
264
|
+
}): SolidityVerifierParameters;
|
|
218
265
|
/**
|
|
219
266
|
* @notice Returns the URL of the request.
|
|
220
267
|
* @param requestId The request ID.
|