@zkpassport/sdk 0.17.0-beta.1 → 0.17.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.
@@ -24,6 +24,7 @@ type QueryResultErrors = {
24
24
  };
25
25
  };
26
26
  type VerifierMode = "auto" | "local" | "api";
27
+ type RequestedNullifierType = NullifierType.NON_SALTED | NullifierType.SALTED | NullifierType.NONE;
27
28
  type VerificationResult = {
28
29
  uniqueIdentifier: string | undefined;
29
30
  uniqueIdentifierType: NullifierType | undefined;
@@ -251,9 +252,9 @@ type QueryBuilder<T extends "online" | "offline" = "online"> = {
251
252
  facematch: (mode?: FacematchMode) => QueryBuilder;
252
253
  raw: (query: Query) => QueryBuilder<T>;
253
254
  /**
254
- * Applies an immutable policy fetched from the dashboard. The policy's query,
255
- * purpose and scope are locked; combining with builder methods (except
256
- * `.bind()`, which may follow it) or calling twice throws.
255
+ * Applies a policy fetched from the dashboard. The policy's query is locked, and its
256
+ * purpose and scope are used unless the request sets its own. Combining with builder
257
+ * methods (except `.bind()`, which may follow it) or calling twice throws.
257
258
  * @param id The policy id (e.g. `'pol_xyz'`).
258
259
  */
259
260
  policy: (id: string) => QueryBuilder<T>;
@@ -317,11 +318,11 @@ declare class ZKPassport {
317
318
  private assertCanApplyPolicy;
318
319
  /**
319
320
  * @notice Create a new request. To apply a policy, chain `.policy('<id>')` on
320
- * the returned builder; a policy locks the query and scope.
321
+ * the returned builder; a policy locks the query.
321
322
  * @param name Your service name. Defaults to the dashboard branding, then the domain.
322
323
  * @param logo Your service logo. Defaults to the dashboard branding.
323
324
  * @param purpose Explanation shown to the user. Defaults to the policy's purpose (if any), then a generic message.
324
- * @param scope Use-case scope (drives the nullifier). Defaults to the domain. Locked by `.policy()` (to the policy id).
325
+ * @param scope Use-case scope (drives the nullifier). Defaults to the policy id (if any), then the domain.
325
326
  * @param projectID The project ID of your service
326
327
  * @param validity How many seconds ago the proof checking the expiry date of the ID should have been generated
327
328
  * @param mode The proof mode (e.g. "fast" / "compressed").
@@ -338,7 +339,7 @@ declare class ZKPassport {
338
339
  projectID?: string;
339
340
  validity?: number;
340
341
  devMode?: boolean;
341
- uniqueIdentifierType?: NullifierType.NON_SALTED | NullifierType.SALTED | NullifierType.NONE;
342
+ uniqueIdentifierType?: RequestedNullifierType;
342
343
  oprfKeyId?: string;
343
344
  topicOverride?: string;
344
345
  keyPairOverride?: {
@@ -370,13 +371,15 @@ declare class ZKPassport {
370
371
  * @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
371
372
  * It should only be needed when running the `verify` function on a server with restricted write access (e.g. Vercel)
372
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.
373
376
  * @param verifierMode "local" verifies with the verifier bundled in this SDK, "api" with the
374
377
  * ZKPassport verifier API, and "auto" (default) verifies locally but defers to the API when
375
378
  * the local result is not verified — e.g. proofs from a newer bb version than this SDK supports.
376
379
  * @returns An object containing the unique identifier associated to the user
377
380
  * and a boolean indicating whether the proofs were successfully verified.
378
381
  */
379
- verify({ proofs, originalQuery, queryResult, validity, scope, devMode, writingDirectory, oprfKeyId, verifierMode, }: {
382
+ verify({ proofs, originalQuery, queryResult, validity, scope, devMode, writingDirectory, oprfKeyId, uniqueIdentifierType, verifierMode, }: {
380
383
  proofs: Array<ProofResult>;
381
384
  originalQuery: Query;
382
385
  queryResult: QueryResult;
@@ -385,6 +388,7 @@ declare class ZKPassport {
385
388
  devMode?: boolean;
386
389
  writingDirectory?: string;
387
390
  oprfKeyId?: string;
391
+ uniqueIdentifierType?: RequestedNullifierType;
388
392
  verifierMode?: VerifierMode;
389
393
  }): Promise<VerificationResult>;
390
394
  private verifyLocally;
@@ -437,4 +441,4 @@ declare class ZKPassport {
437
441
  clearAllRequests(): void;
438
442
  }
439
443
 
440
- 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 SolidityServiceConfig as h, type SolidityVerifierParameters as i, type VerifierMode as j, normalizeCountry as n, rangeCompare as r };
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 };