@zkpassport/sdk 0.8.0-beta.1 → 0.8.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/dist/cjs/index.cjs +738 -555
- package/dist/cjs/index.d.cts +11 -10
- package/dist/esm/index.d.ts +11 -10
- package/dist/esm/index.js +742 -556
- package/package.json +3 -3
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDCredential, ProofResult, QueryResult, IDCredentialValue, NumericalIDCredential, DisclosableIDCredential, BoundData, SanctionsCountries, SanctionsLists,
|
|
1
|
+
import { IDCredential, ProofResult, QueryResult, IDCredentialValue, NumericalIDCredential, DisclosableIDCredential, BoundData, SanctionsCountries, SanctionsLists, ProofMode, SupportedChain } from '@zkpassport/utils';
|
|
2
2
|
export * from '@zkpassport/utils';
|
|
3
3
|
export { ASEAN_COUNTRIES, EEA_COUNTRIES, EU_COUNTRIES, MERCOSUR_COUNTRIES, SANCTIONED_COUNTRIES, SCHENGEN_COUNTRIES } from '@zkpassport/utils';
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ type QueryResultError<T> = {
|
|
|
8
8
|
message: string;
|
|
9
9
|
};
|
|
10
10
|
type QueryResultErrors = {
|
|
11
|
-
[key in IDCredential | "sig_check_dsc" | "sig_check_id_data" | "data_check_integrity" | "outer" | "disclose" | "bind"]: {
|
|
11
|
+
[key in IDCredential | "sig_check_dsc" | "sig_check_id_data" | "data_check_integrity" | "outer" | "disclose" | "bind" | "facematch" | "sanctions"]: {
|
|
12
12
|
disclose?: QueryResultError<string | number | Date>;
|
|
13
13
|
gte?: QueryResultError<number | Date>;
|
|
14
14
|
lte?: QueryResultError<number | Date>;
|
|
@@ -81,7 +81,7 @@ type QueryBuilderResult = {
|
|
|
81
81
|
uniqueIdentifier: string | undefined;
|
|
82
82
|
verified: boolean;
|
|
83
83
|
result: QueryResult;
|
|
84
|
-
queryResultErrors?: QueryResultErrors
|
|
84
|
+
queryResultErrors?: Partial<QueryResultErrors>;
|
|
85
85
|
}) => void) => void;
|
|
86
86
|
/**
|
|
87
87
|
* Called when the user has rejected the request.
|
|
@@ -162,18 +162,17 @@ type QueryBuilder = {
|
|
|
162
162
|
* @param countries The country or list of countries whose sanction lists to check against. Defaults to "all".
|
|
163
163
|
* e.g. "US", ["US", "GB", "CH", "EU"], "all"
|
|
164
164
|
* @param lists The specific lists from a given country to check against. Defaults to "all".
|
|
165
|
-
* e.g. ["
|
|
165
|
+
* e.g. ["OFAC_SDN"], "all"
|
|
166
166
|
*/
|
|
167
167
|
sanctions: (countries?: SanctionsCountries, lists?: SanctionsLists) => QueryBuilder;
|
|
168
168
|
/**
|
|
169
169
|
* Requires that the ID holder's face matches the photo on the ID.
|
|
170
|
-
* @param mode The mode to use for the face match. Defaults to "
|
|
170
|
+
* @param mode The mode to use for the face match. Defaults to "regular".
|
|
171
171
|
* @param mode "strict" - The user will have to go through an extensive liveness check to prevent spoofing making it more secure.
|
|
172
172
|
* Best for high security requirements such as KYC.
|
|
173
|
-
* @param mode "
|
|
173
|
+
* @param mode "regular" - The user will only have to go through a basic liveness check to prevent spoofing, making it faster for the user.
|
|
174
174
|
* Best for lower security requirements that requires fast verification such as age verification.
|
|
175
175
|
*/
|
|
176
|
-
facematch: (mode?: FacematchMode) => QueryBuilder;
|
|
177
176
|
/**
|
|
178
177
|
* Builds the request.
|
|
179
178
|
*
|
|
@@ -202,6 +201,7 @@ declare class ZKPassport {
|
|
|
202
201
|
private onResultCallbacks;
|
|
203
202
|
private onRejectCallbacks;
|
|
204
203
|
private onErrorCallbacks;
|
|
204
|
+
private normalizeDomain;
|
|
205
205
|
constructor(_domain?: string);
|
|
206
206
|
private handleResult;
|
|
207
207
|
private setExpectedProofCount;
|
|
@@ -218,7 +218,7 @@ declare class ZKPassport {
|
|
|
218
218
|
* @param logo The logo of your service
|
|
219
219
|
* @param purpose To explain what you want to do with the user's data
|
|
220
220
|
* @param scope Scope this request to a specific use case
|
|
221
|
-
* @param validity How many
|
|
221
|
+
* @param validity How many seconds ago the proof checking the expiry date of the ID should have been generated
|
|
222
222
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
223
223
|
* @returns The query builder object.
|
|
224
224
|
*/
|
|
@@ -250,12 +250,13 @@ declare class ZKPassport {
|
|
|
250
250
|
private checkCertificateRegistryRoot;
|
|
251
251
|
private checkCircuitRegistryRoot;
|
|
252
252
|
private checkBindPublicInputs;
|
|
253
|
+
private checkSanctionsExclusionPublicInputs;
|
|
253
254
|
private checkPublicInputs;
|
|
254
255
|
/**
|
|
255
256
|
* @notice Verify the proofs received from the mobile app.
|
|
256
257
|
* @param proofs The proofs to verify.
|
|
257
258
|
* @param queryResult The query result to verify against
|
|
258
|
-
* @param validity How many
|
|
259
|
+
* @param validity How many seconds ago the proof checking the expiry date of the ID should have been generated
|
|
259
260
|
* @param scope Scope this request to a specific use case
|
|
260
261
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
261
262
|
* @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
|
|
@@ -273,7 +274,7 @@ declare class ZKPassport {
|
|
|
273
274
|
}): Promise<{
|
|
274
275
|
uniqueIdentifier: string | undefined;
|
|
275
276
|
verified: boolean;
|
|
276
|
-
queryResultErrors?: QueryResultErrors
|
|
277
|
+
queryResultErrors?: Partial<QueryResultErrors>;
|
|
277
278
|
}>;
|
|
278
279
|
getSolidityVerifierDetails(network: SupportedChain): {
|
|
279
280
|
address: `0x${string}`;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDCredential, ProofResult, QueryResult, IDCredentialValue, NumericalIDCredential, DisclosableIDCredential, BoundData, SanctionsCountries, SanctionsLists,
|
|
1
|
+
import { IDCredential, ProofResult, QueryResult, IDCredentialValue, NumericalIDCredential, DisclosableIDCredential, BoundData, SanctionsCountries, SanctionsLists, ProofMode, SupportedChain } from '@zkpassport/utils';
|
|
2
2
|
export * from '@zkpassport/utils';
|
|
3
3
|
export { ASEAN_COUNTRIES, EEA_COUNTRIES, EU_COUNTRIES, MERCOSUR_COUNTRIES, SANCTIONED_COUNTRIES, SCHENGEN_COUNTRIES } from '@zkpassport/utils';
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ type QueryResultError<T> = {
|
|
|
8
8
|
message: string;
|
|
9
9
|
};
|
|
10
10
|
type QueryResultErrors = {
|
|
11
|
-
[key in IDCredential | "sig_check_dsc" | "sig_check_id_data" | "data_check_integrity" | "outer" | "disclose" | "bind"]: {
|
|
11
|
+
[key in IDCredential | "sig_check_dsc" | "sig_check_id_data" | "data_check_integrity" | "outer" | "disclose" | "bind" | "facematch" | "sanctions"]: {
|
|
12
12
|
disclose?: QueryResultError<string | number | Date>;
|
|
13
13
|
gte?: QueryResultError<number | Date>;
|
|
14
14
|
lte?: QueryResultError<number | Date>;
|
|
@@ -81,7 +81,7 @@ type QueryBuilderResult = {
|
|
|
81
81
|
uniqueIdentifier: string | undefined;
|
|
82
82
|
verified: boolean;
|
|
83
83
|
result: QueryResult;
|
|
84
|
-
queryResultErrors?: QueryResultErrors
|
|
84
|
+
queryResultErrors?: Partial<QueryResultErrors>;
|
|
85
85
|
}) => void) => void;
|
|
86
86
|
/**
|
|
87
87
|
* Called when the user has rejected the request.
|
|
@@ -162,18 +162,17 @@ type QueryBuilder = {
|
|
|
162
162
|
* @param countries The country or list of countries whose sanction lists to check against. Defaults to "all".
|
|
163
163
|
* e.g. "US", ["US", "GB", "CH", "EU"], "all"
|
|
164
164
|
* @param lists The specific lists from a given country to check against. Defaults to "all".
|
|
165
|
-
* e.g. ["
|
|
165
|
+
* e.g. ["OFAC_SDN"], "all"
|
|
166
166
|
*/
|
|
167
167
|
sanctions: (countries?: SanctionsCountries, lists?: SanctionsLists) => QueryBuilder;
|
|
168
168
|
/**
|
|
169
169
|
* Requires that the ID holder's face matches the photo on the ID.
|
|
170
|
-
* @param mode The mode to use for the face match. Defaults to "
|
|
170
|
+
* @param mode The mode to use for the face match. Defaults to "regular".
|
|
171
171
|
* @param mode "strict" - The user will have to go through an extensive liveness check to prevent spoofing making it more secure.
|
|
172
172
|
* Best for high security requirements such as KYC.
|
|
173
|
-
* @param mode "
|
|
173
|
+
* @param mode "regular" - The user will only have to go through a basic liveness check to prevent spoofing, making it faster for the user.
|
|
174
174
|
* Best for lower security requirements that requires fast verification such as age verification.
|
|
175
175
|
*/
|
|
176
|
-
facematch: (mode?: FacematchMode) => QueryBuilder;
|
|
177
176
|
/**
|
|
178
177
|
* Builds the request.
|
|
179
178
|
*
|
|
@@ -202,6 +201,7 @@ declare class ZKPassport {
|
|
|
202
201
|
private onResultCallbacks;
|
|
203
202
|
private onRejectCallbacks;
|
|
204
203
|
private onErrorCallbacks;
|
|
204
|
+
private normalizeDomain;
|
|
205
205
|
constructor(_domain?: string);
|
|
206
206
|
private handleResult;
|
|
207
207
|
private setExpectedProofCount;
|
|
@@ -218,7 +218,7 @@ declare class ZKPassport {
|
|
|
218
218
|
* @param logo The logo of your service
|
|
219
219
|
* @param purpose To explain what you want to do with the user's data
|
|
220
220
|
* @param scope Scope this request to a specific use case
|
|
221
|
-
* @param validity How many
|
|
221
|
+
* @param validity How many seconds ago the proof checking the expiry date of the ID should have been generated
|
|
222
222
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
223
223
|
* @returns The query builder object.
|
|
224
224
|
*/
|
|
@@ -250,12 +250,13 @@ declare class ZKPassport {
|
|
|
250
250
|
private checkCertificateRegistryRoot;
|
|
251
251
|
private checkCircuitRegistryRoot;
|
|
252
252
|
private checkBindPublicInputs;
|
|
253
|
+
private checkSanctionsExclusionPublicInputs;
|
|
253
254
|
private checkPublicInputs;
|
|
254
255
|
/**
|
|
255
256
|
* @notice Verify the proofs received from the mobile app.
|
|
256
257
|
* @param proofs The proofs to verify.
|
|
257
258
|
* @param queryResult The query result to verify against
|
|
258
|
-
* @param validity How many
|
|
259
|
+
* @param validity How many seconds ago the proof checking the expiry date of the ID should have been generated
|
|
259
260
|
* @param scope Scope this request to a specific use case
|
|
260
261
|
* @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
|
|
261
262
|
* @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
|
|
@@ -273,7 +274,7 @@ declare class ZKPassport {
|
|
|
273
274
|
}): Promise<{
|
|
274
275
|
uniqueIdentifier: string | undefined;
|
|
275
276
|
verified: boolean;
|
|
276
|
-
queryResultErrors?: QueryResultErrors
|
|
277
|
+
queryResultErrors?: Partial<QueryResultErrors>;
|
|
277
278
|
}>;
|
|
278
279
|
getSolidityVerifierDetails(network: SupportedChain): {
|
|
279
280
|
address: `0x${string}`;
|