@zkpassport/sdk 0.18.0 → 0.18.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 CHANGED
@@ -126,6 +126,17 @@ return { registered: true }
126
126
 
127
127
  `verify()` checks the proofs locally and defers to the ZKPassport verifier API when the local result is not verified. Set `verifierMode` to `"local"` or `"api"` to force one.
128
128
 
129
+ Local verification reads the registry roots on-chain. To use your own Ethereum RPC for those reads instead of the built-in endpoint, pass `config.rpcUrl` to `verify()`, or to `request()` so it is used when verifying the proofs that request receives. The URL must serve the chain the query binds to: Sepolia in dev mode and Ethereum otherwise when unbound.
130
+
131
+ ```typescript
132
+ const { verified } = await zkPassport.verify({
133
+ proofs,
134
+ originalQuery: query,
135
+ queryResult: result,
136
+ config: { rpcUrl: "https://your-rpc.example" },
137
+ })
138
+ ```
139
+
129
140
  ### Using with Next.js
130
141
 
131
142
  Request the proofs in the browser (with the "How to use" example above, or the drop-in card/button from `@zkpassport/ui`), then send them from `onSuccess` to an API route that verifies them:
@@ -24,6 +24,14 @@ type QueryResultErrors = {
24
24
  };
25
25
  };
26
26
  type VerifierMode = "auto" | "local" | "api";
27
+ type VerificationConfig = {
28
+ /**
29
+ * Ethereum RPC used for the on-chain reads during local verification: the registry root checks
30
+ * and the Solidity verifier. It must serve the chain the query binds to, or Sepolia in dev mode
31
+ * and Ethereum otherwise. Defaults to the built-in endpoint for that chain.
32
+ */
33
+ rpcUrl?: string;
34
+ };
27
35
  type RequestedNullifierType = NullifierType.NON_SALTED | NullifierType.SALTED | NullifierType.NONE;
28
36
  type VerificationResult = {
29
37
  uniqueIdentifier: string | undefined;
@@ -336,9 +344,10 @@ declare class ZKPassport {
336
344
  * @param mode The proof mode (e.g. "fast" / "compressed").
337
345
  * @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
338
346
  * @param verifierMode How the received proofs are verified: "local", "api" or "auto" (default).
347
+ * @param config Settings for verifying the received proofs, see {@link VerificationConfig}.
339
348
  * @returns The query builder object.
340
349
  */
341
- request({ name, logo, purpose, scope, projectID, mode, validity, devMode, uniqueIdentifierType, oprfKeyId, topicOverride, keyPairOverride, cloudProverUrl, bridgeUrl, returnDeepLink, verifierMode, }: {
350
+ request({ name, logo, purpose, scope, projectID, mode, validity, devMode, uniqueIdentifierType, oprfKeyId, topicOverride, keyPairOverride, cloudProverUrl, bridgeUrl, returnDeepLink, verifierMode, config, }: {
342
351
  name?: string;
343
352
  logo?: string;
344
353
  purpose?: string;
@@ -358,6 +367,7 @@ declare class ZKPassport {
358
367
  bridgeUrl?: string;
359
368
  returnDeepLink?: string;
360
369
  verifierMode?: VerifierMode;
370
+ config?: VerificationConfig;
361
371
  }): Promise<QueryBuilder>;
362
372
  /**
363
373
  * @notice Create a new offline query
@@ -384,10 +394,11 @@ declare class ZKPassport {
384
394
  * @param verifierMode "local" verifies with the verifier bundled in this SDK, "api" with the
385
395
  * ZKPassport verifier API, and "auto" (default) verifies locally but defers to the API when
386
396
  * the local result is not verified — e.g. proofs from a newer bb version than this SDK supports.
397
+ * @param config Verification settings such as the RPC URL, see {@link VerificationConfig}.
387
398
  * @returns An object containing the unique identifier associated to the user
388
399
  * and a boolean indicating whether the proofs were successfully verified.
389
400
  */
390
- verify({ proofs, originalQuery, queryResult, validity, scope, devMode, writingDirectory, oprfKeyId, uniqueIdentifierType, verifierMode, }: {
401
+ verify({ proofs, originalQuery, queryResult, validity, scope, devMode, writingDirectory, oprfKeyId, uniqueIdentifierType, verifierMode, config, }: {
391
402
  proofs: Array<ProofResult>;
392
403
  originalQuery: Query;
393
404
  queryResult: QueryResult;
@@ -398,6 +409,7 @@ declare class ZKPassport {
398
409
  oprfKeyId?: string;
399
410
  uniqueIdentifierType?: RequestedNullifierType;
400
411
  verifierMode?: VerifierMode;
412
+ config?: VerificationConfig;
401
413
  }): Promise<VerificationResult>;
402
414
  private verifyLocally;
403
415
  getSolidityVerifierDetails(): {
@@ -449,4 +461,4 @@ declare class ZKPassport {
449
461
  clearAllRequests(): void;
450
462
  }
451
463
 
452
- export { type DashboardConfig as D, type OnSuccessVerdict as O, type Policy as P, type QueryBuilder as Q, type RequestedNullifierType as R, type SolidityProofVerificationData as S, VERSION 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 RequestSuccess as h, type SolidityServiceConfig as i, type SolidityVerifierParameters as j, type VerificationResult as k, type VerifierMode as l, normalizeCountry as n, rangeCompare as r };
464
+ export { type DashboardConfig as D, type OnSuccessVerdict as O, type Policy as P, type QueryBuilder as Q, type RequestedNullifierType as R, type SolidityProofVerificationData as S, VERSION 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 RequestSuccess as h, type SolidityServiceConfig as i, type SolidityVerifierParameters as j, type VerificationConfig as k, type VerificationResult as l, type VerifierMode as m, normalizeCountry as n, rangeCompare as r };