@reclaimprotocol/js-sdk 5.0.0-dev.1 → 5.0.0-dev.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/index.d.ts CHANGED
@@ -1,3 +1,11 @@
1
+ interface TeeAttestation {
2
+ workload_digest: string;
3
+ verifier_digest: string;
4
+ nonce: string;
5
+ snp_report: string;
6
+ vlek_cert: string;
7
+ timestamp: string;
8
+ }
1
9
  interface Proof {
2
10
  identifier: string;
3
11
  claimData: ProviderClaimData;
@@ -8,6 +16,7 @@ interface Proof {
8
16
  [key: string]: string;
9
17
  };
10
18
  taskId?: number;
19
+ teeAttestation?: TeeAttestation;
11
20
  }
12
21
  declare const RECLAIM_EXTENSION_ACTIONS: {
13
22
  CHECK_EXTENSION: string;
@@ -38,6 +47,14 @@ interface Context {
38
47
  contextAddress: string;
39
48
  contextMessage: string;
40
49
  reclaimSessionId: string;
50
+ extractedParameters?: Record<string, string>;
51
+ providerHash?: string;
52
+ attestationNonce?: string;
53
+ attestationNonceData?: {
54
+ applicationId: string;
55
+ sessionId: string;
56
+ timestamp: string;
57
+ };
41
58
  }
42
59
  interface Beacon {
43
60
  getState(epoch?: number): Promise<BeaconState>;
@@ -49,7 +66,73 @@ type BeaconState = {
49
66
  witnessesRequiredForClaim: number;
50
67
  nextEpochTimestampS: number;
51
68
  };
69
+ /**
70
+ * Information of the exact provider and its version used in the verification session.
71
+ *
72
+ * See also:
73
+ *
74
+ * * `ReclaimProofRequest.getProviderVersion()` - With a ReclaimProofRequest object, you can get the provider id & exact version of provider used in verification session.
75
+ */
76
+ interface ProviderVersionInfo {
77
+ /**
78
+ * The identifier of provider used in verifications that resulted in a proof
79
+ *
80
+ * See also:
81
+ *
82
+ * * `ReclaimProofRequest.getProviderVersion()` - With a ReclaimProofRequest object, you can get the provider id & exact version of provider used in verification session.
83
+ */
84
+ providerId: string;
85
+ /**
86
+ * The exact version of provider used in verifications that resulted in a proof.
87
+ *
88
+ * This cannot be a version constaint or version expression.
89
+ *
90
+ * See also:
91
+ *
92
+ * * `ReclaimProofRequest.getProviderVersion()` - With a ReclaimProofRequest object, you can get the provider id & exact version of provider used in verification session.
93
+ */
94
+ providerVersion: string;
95
+ /**
96
+ * List of allowed pre-release tags.
97
+ * For example, if you are using AI, provide `['ai']` to allow AI patch versions of the provider.
98
+ */
99
+ allowedTags: string[];
100
+ }
52
101
 
102
+ /**
103
+ * Fetches the provider configuration by the providerId and its version; and constructs the robust hash requirements needed for proof validation.
104
+ * It resolves both explicitly required HTTP requests and allowed injected requests based on the provider version.
105
+ *
106
+ * See also:
107
+ *
108
+ * * `ReclaimProofRequest.getProviderHashRequirements()` - An alternative of this function to get the expected hashes for a proof request. The result can be provided in verifyProof function's `config` parameter for proof validation.
109
+ * * `getProviderHashRequirementsFromSpec()` - An alternative of this function to get the expected hashes from a provider spec. The result can be provided in verifyProof function's `config` parameter for proof validation.
110
+ *
111
+ * @param providerId - The unique identifier of the selected provider.
112
+ * @param exactProviderVersionString - The specific version string of the provider configuration to ensure deterministic validation.
113
+ * @returns A promise that resolves to `ProviderHashRequirementsConfig` representing the expected hashes for proof validation.
114
+ */
115
+ declare function fetchProviderHashRequirementsBy(providerId: string, exactProviderVersionString: string | null | undefined, allowedTags: string[] | null | undefined, proofs?: Proof[]): Promise<ProviderHashRequirementsConfig[]>;
116
+ /**
117
+ * Generates an array of `RequestSpec` objects by replacing template parameters with their corresponding values.
118
+ *
119
+ * If the input template includes `templateParams` (e.g., `['param1', 'param2']`), this function will
120
+ * cartesian-map (or pairwise-map) the provided `templateParameters` record (e.g., `{ param1: ['v1', 'v2'], param2: ['a1', 'a2'] }`)
121
+ * to generate multiple unique `RequestSpec` configurations.
122
+ *
123
+ * The function ensures that:
124
+ * 1. Parameters strictly specified in `template.templateParams` are found.
125
+ * 2. All specified template parameters arrays have the exact same length (pairwise mapping).
126
+ * 3. String replacements are fully applied (all occurrences) to `responseMatches` (value) and `responseRedactions` (jsonPath, xPath, regex).
127
+ *
128
+ * @param requestSpecTemplates - The base template `RequestSpec` containing parameter placeholders.
129
+ * @param templateParameters - A record mapping parameter names to arrays of strings representing the extracted values.
130
+ * @returns An array of fully constructed `RequestSpec` objects with templates replaced.
131
+ * @throws {InvalidRequestSpecError} If required parameters are missing or parameter value arrays have mismatched lengths.
132
+ */
133
+ declare function generateSpecsFromRequestSpecTemplate(requestSpecTemplates: RequestSpec[], templateParameters: Record<string, string[]>): RequestSpec[];
134
+ declare function takeTemplateParametersFromProofs(proofs?: Proof[]): Record<string, string[]>;
135
+ declare function takePairsWhereValueIsArray(o: Record<string, string> | undefined): Record<string, string[]>;
53
136
  /**
54
137
  * Transforms a raw provider hash requirement specification into a structured configuration for proof validation.
55
138
  * It computes the proof hashes for both required and allowed extra requests to correctly match uploaded proofs.
@@ -91,9 +174,9 @@ type ProviderHashRequirementsConfig = {
91
174
  */
92
175
  type HashRequirement = {
93
176
  /**
94
- * The hash value to match
177
+ * The hash value(s) to match. An array represents multiple valid hashes for optional configurations.
95
178
  */
96
- value: string;
179
+ value: string | string[];
97
180
  /**
98
181
  * Whether the hash is required to be present in the proof.
99
182
  * Defaults to true
@@ -138,9 +221,14 @@ interface RequestSpec {
138
221
  required?: boolean;
139
222
  /**
140
223
  * Whether request matching this spec is allowed to appear multiple times in list of proofs.
141
- * Defaults to false.
224
+ * Defaults to true.
142
225
  */
143
226
  multiple?: boolean;
227
+ /**
228
+ * Template parameter variables for the request spec that should be replaced with real values
229
+ * during dynamic request spec construction.
230
+ */
231
+ templateParams?: string[];
144
232
  }
145
233
  /**
146
234
  * Defines the configuration for identifying/sniffing the request body.
@@ -178,16 +266,98 @@ interface ResponseRedactionSpec {
178
266
  xPath: string;
179
267
  }
180
268
 
269
+ /**
270
+ * Content validation configuration specifying essential required hashes and optional extra proofs.
271
+ * Used to explicitly validate that a generated proof matches the exact request structure expected.
272
+ */
273
+ type ValidationConfigWithHash = {
274
+ /**
275
+ * Array of computed hashes that must be satisfied by the proofs.
276
+ *
277
+ * An element can be a `HashRequirement` object or a string that is equivalent to
278
+ * a `{ value: '<hash>', required: true, multiple: false }` as `HashRequirement`.
279
+ */
280
+ hashes: (string | HashRequirement)[];
281
+ };
282
+ /**
283
+ * Content validation configuration specifying the provider id and version used in the verification session that generated the proofs.
284
+ * Used to explicitly validate that a generated proof matches the exact request structure expected.
285
+ *
286
+ * See also:
287
+ *
288
+ * * `ReclaimProofRequest.getProviderVersion()` - With a ReclaimProofRequest object, you can get the provider id & exact version of provider used in verification session.
289
+ */
290
+ interface ValidationConfigWithProviderInformation {
291
+ /**
292
+ * The identifier of provider used in verifications that resulted in a proof
293
+ *
294
+ * See also:
295
+ *
296
+ * * `ReclaimProofRequest.getProviderVersion()` - With a ReclaimProofRequest object, you can get the provider id & exact version of provider used in verification session.
297
+ **/
298
+ providerId: string;
299
+ /**
300
+ * The exact version of provider used in verifications that resulted in a proof.
301
+ *
302
+ * This cannot be a version constaint or version expression. It can be undefined or left blank if proof must be validated with latest version of provider.
303
+ * Patches for the next provider version are also fetched and hashes from that spec is also be used to compare the hashes from proof.
304
+ *
305
+ * See also:
306
+ *
307
+ * * `ReclaimProofRequest.getProviderVersion()` - With a ReclaimProofRequest object, you can get the provider id & exact version of provider used in verification session.
308
+ **/
309
+ providerVersion?: string;
310
+ /**
311
+ * List of allowed pre-release tags.
312
+ * For example, if you are using AI, provide `['ai']` to allow AI patch versions of the provider.
313
+ */
314
+ allowedTags?: string[];
315
+ }
316
+ /**
317
+ * Legacy configuration to completely bypass content validation during verification.
318
+ * Warning: Using this poses a risk as it avoids strictly matching proof parameters to expected hashes.
319
+ */
320
+ interface ValidationConfigWithDisabledValidation {
321
+ dangerouslyDisableContentValidation: true;
322
+ }
323
+ /**
324
+ * Represents the configuration options applied when validating proof contents, allowing
325
+ * strict hash checking or intentionally skipping validation if flagged.
326
+ */
327
+ type ValidationConfig = ValidationConfigWithHash | ValidationConfigWithProviderInformation | ValidationConfigWithDisabledValidation;
328
+ /**
329
+ * Describes the comprehensive configuration required to initialize the proof verification process.
330
+ * Aligns with `ValidationConfig` options for verifying signatures alongside proof contents.
331
+ */
332
+ type VerificationConfig = ValidationConfig;
333
+ declare function assertValidProofsByHash(proofs: Proof[], config: ProviderHashRequirementsConfig): void;
334
+ declare function isHttpProviderClaimParams(claimParams: unknown): claimParams is HttpProviderClaimParams;
335
+ declare function getHttpProviderClaimParamsFromProof(proof: Proof): HttpProviderClaimParams;
336
+ /**
337
+ * Asserts that the proof is validated by checking the content of proof with with expectations from provider config or hash based on [options]
338
+ * @param proofs - The proofs to validate
339
+ * @param config - The validation config
340
+ * @throws {ProofNotValidatedError} When the proof is not validated
341
+ */
342
+ declare function assertValidateProof(proofs: Proof[], config: VerificationConfig): Promise<void>;
343
+
181
344
  type ClaimID = ProviderClaimData['identifier'];
182
345
  type ClaimInfo = Pick<ProviderClaimData, 'context' | 'provider' | 'parameters'>;
183
346
  type CompleteClaimData = Pick<ProviderClaimData, 'owner' | 'timestampS' | 'epoch'> & ClaimInfo;
184
347
  interface HttpProviderClaimParams {
185
- body: string;
348
+ body?: string | null;
186
349
  method: RequestSpec['method'];
187
350
  responseMatches: ResponseMatchSpec[];
188
351
  responseRedactions: ResponseRedactionSpec[];
189
352
  url: string;
190
353
  }
354
+ interface HashableHttpProviderClaimParams {
355
+ body: string;
356
+ method: RequestSpec['method'];
357
+ responseMatches: (Omit<ResponseMatchSpec, 'isOptional'>)[];
358
+ responseRedactions: ResponseRedactionSpec[];
359
+ url: string;
360
+ }
191
361
  type SignedClaim = {
192
362
  claim: CompleteClaimData;
193
363
  signatures: Uint8Array[];
@@ -199,6 +369,7 @@ type CreateVerificationRequest = {
199
369
  type StartSessionParams = {
200
370
  onSuccess: OnSuccess;
201
371
  onError: OnError;
372
+ verificationConfig?: VerificationConfig;
202
373
  };
203
374
  type OnSuccess = (proof?: Proof | Proof[]) => void;
204
375
  type OnError = (error: Error) => void;
@@ -217,7 +388,16 @@ type ProofRequestOptions = {
217
388
  useBrowserExtension?: boolean;
218
389
  extensionID?: string;
219
390
  providerVersion?: string;
391
+ /**
392
+ * @deprecated Use `portalUrl` instead.
393
+ */
220
394
  customSharePageUrl?: string;
395
+ /**
396
+ * URL of the portal/share page for the verification flow.
397
+ *
398
+ * @default 'https://portal.reclaimprotocol.org'
399
+ */
400
+ portalUrl?: string;
221
401
  customAppClipUrl?: string;
222
402
  launchOptions?: ReclaimFlowLaunchOptions;
223
403
  /**
@@ -253,6 +433,10 @@ type ProofRequestOptions = {
253
433
  * @since 4.7.0
254
434
  */
255
435
  metadata?: Record<string, string>;
436
+ /**
437
+ * If true, generates a TEE attestation nonce during session initialization and expects a TEE attestation in the proof.
438
+ */
439
+ acceptTeeAttestation?: boolean;
256
440
  };
257
441
  type ReclaimFlowLaunchOptions = {
258
442
  /**
@@ -268,6 +452,18 @@ type ReclaimFlowLaunchOptions = {
268
452
  * once fully released. See: https://blog.reclaimprotocol.org/posts/moving-beyond-google-play-instant
269
453
  */
270
454
  canUseDeferredDeepLinksFlow?: boolean;
455
+ /**
456
+ * Verification mode for the flow.
457
+ *
458
+ * - `'portal'`: Opens the portal URL in the browser (remote browser verification).
459
+ * - `'app'`: Native app flow via the share page. If `useAppClip` is `true`, uses App Clip on iOS.
460
+ *
461
+ * Can be set at call time via `triggerReclaimFlow({ verificationMode })` or `getRequestUrl({ verificationMode })`,
462
+ * or at init time via `launchOptions: { verificationMode }`.
463
+ *
464
+ * @default 'portal'
465
+ */
466
+ verificationMode?: 'app' | 'portal';
271
467
  };
272
468
  type ModalOptions = {
273
469
  title?: string;
@@ -338,6 +534,7 @@ type ProofPropertiesJSON = {
338
534
  jsonProofResponse?: boolean;
339
535
  resolvedProviderVersion: string;
340
536
  modalOptions?: SerializableModalOptions;
537
+ teeAttestation?: TeeAttestation | string;
341
538
  };
342
539
  type HttpFormEntry = {
343
540
  name: string;
@@ -400,6 +597,14 @@ type TemplateData = {
400
597
  metadata?: Record<string, string>;
401
598
  preferredLocale?: ProofRequestOptions['preferredLocale'];
402
599
  };
600
+ type VerifyProofResult = {
601
+ isVerified: boolean;
602
+ isTeeVerified?: boolean;
603
+ data: {
604
+ context: Record<string, unknown>;
605
+ extractedParameters: Record<string, string>;
606
+ }[];
607
+ };
403
608
  type ProviderVersionConfig = {
404
609
  major?: number;
405
610
  minor?: number;
@@ -418,12 +623,16 @@ type StatusUrlResponse = {
418
623
  sessionId: string;
419
624
  proofs?: Proof[];
420
625
  statusV2: string;
626
+ error?: {
627
+ type: string;
628
+ message: string;
629
+ };
421
630
  };
422
631
  providerId?: string;
423
632
  };
424
633
  type ProviderConfigResponse = {
425
634
  message: string;
426
- providers?: ReclaimProviderConfig;
635
+ providers?: ReclaimProviderConfig[];
427
636
  providerId?: string;
428
637
  providerVersionString?: string;
429
638
  };
@@ -437,47 +646,12 @@ interface ReclaimProviderConfig {
437
646
  requestData: InterceptorRequestSpec[];
438
647
  allowedInjectedRequestData: InjectedRequestSpec[];
439
648
  }
440
-
441
- /**
442
- * Content validation configuration specifying essential required hashes and optional extra proofs.
443
- * Used to explicitly validate that a generated proof matches the exact request structure expected.
444
- */
445
- type ValidationConfigWithHash = {
446
- /**
447
- * Array of computed hashes that must be satisfied by the proofs.
448
- *
449
- * An element can be a `HashRequirement` object or a string that is equivalent to
450
- * a `{ value: '<hash>', required: true, multiple: false }` as `HashRequirement`.
451
- */
452
- hashes: (string | HashRequirement)[];
649
+ type ProviderHashRequirementsResponse = {
650
+ message?: string;
651
+ hashRequirements?: ProviderHashRequirementsConfig;
652
+ providerId?: string;
653
+ providerVersionString?: string;
453
654
  };
454
- /**
455
- * Legacy configuration to completely bypass content validation during verification.
456
- * Warning: Using this poses a risk as it avoids strictly matching proof parameters to expected hashes.
457
- */
458
- interface ValidationConfigWithDisabledValidation {
459
- dangerouslyDisableContentValidation: true;
460
- }
461
- /**
462
- * Represents the configuration options applied when validating proof contents, allowing
463
- * strict hash checking or intentionally skipping validation if flagged.
464
- */
465
- type ValidationConfig = ValidationConfigWithHash | ValidationConfigWithDisabledValidation;
466
- /**
467
- * Describes the comprehensive configuration required to initialize the proof verification process.
468
- * Aligns with `ValidationConfig` options for verifying signatures alongside proof contents.
469
- */
470
- type VerificationConfig = ValidationConfig;
471
- declare function assertValidProofsByHash(proofs: Proof[], config: ProviderHashRequirementsConfig): void;
472
- declare function isHttpProviderClaimParams(claimParams: unknown): claimParams is HttpProviderClaimParams;
473
- declare function getHttpProviderClaimParamsFromProof(proof: Proof): HttpProviderClaimParams;
474
- /**
475
- * Asserts that the proof is validated by checking the content of proof with with expectations from provider config or hash based on [options]
476
- * @param proofs - The proofs to validate
477
- * @param config - The validation config
478
- * @throws {ProofNotValidatedError} When the proof is not validated
479
- */
480
- declare function assertValidateProof(proofs: Proof[], config: VerificationConfig): void;
481
655
 
482
656
  /**
483
657
  * Verifies one or more Reclaim proofs by validating signatures, verifying witness information,
@@ -492,27 +666,54 @@ declare function assertValidateProof(proofs: Proof[], config: VerificationConfig
492
666
  *
493
667
  * @param proofOrProofs - A single proof object or an array of proof objects to be verified.
494
668
  * @param config - Verification configuration that specifies required hashes, allowed extra hashes, or disables content validation.
495
- * @returns Promise<boolean> - Returns `true` if all proofs are successfully verified and validated, `false` otherwise.
496
- * @throws {ProofNotVerifiedError} When signature validation or identifier mismatch occurs.
497
- * @throws {ProofNotValidatedError} When no proofs are provided, when the configuration is missing, or when proof content does not match the expectations set in the config.
669
+ * @param verifyTEE - If `true`, requires and verifies TEE attestation on the proofs. Verification fails if TEE data is missing or invalid.
670
+ * @returns Verification result with `isVerified`, extracted `data` from each proof, and `isTeeVerified` when `verifyTEE` is `true`
498
671
  *
499
672
  * @example
500
673
  * ```typescript
674
+ * // Fast and simple automatically fetched verification
675
+ * const { isVerified, data } = await verifyProof(proof, request.getProviderVersion());
676
+ *
677
+ * // With TEE attestation verification (fails if TEE data is missing or invalid)
678
+ * const { isVerified, isTeeVerified, data } = await verifyProof(proof, request.getProviderVersion(), true);
679
+ *
680
+ * // Or, by manually providing the details:
681
+ *
682
+ * const { isVerified, data } = await verifyProof(proof, {
683
+ * providerId: "YOUR_PROVIDER_ID",
684
+ * // The exact provider version used in the session.
685
+ * providerVersion: "1.0.0",
686
+ * // Optionally provide tags. For example, this can be `['ai']` when you want to allow patches from ai.
687
+ * allowedTags: ["ai"]
688
+ * });
689
+ *
501
690
  * // Validate a single proof against expected hash
502
- * const isValid = await verifyProof(proof, { hashes: ['0xAbC...'] });
691
+ * const { isVerified, data } = await verifyProof(proof, { hashes: ['0xAbC...'] });
692
+ * if (isVerified) {
693
+ * console.log(data[0].context);
694
+ * console.log(data[0].extractedParameters);
695
+ * }
503
696
  *
504
697
  * // Validate multiple proofs
505
- * const areAllValid = await verifyProof([proof1, proof2], {
698
+ * const { isVerified, data } = await verifyProof([proof1, proof2], {
506
699
  * hashes: ['0xAbC...', '0xF22..'],
507
700
  * });
508
701
  *
509
- * // Validate 1 required proofs, any number of multiple with same hash, and one optional
510
- * const areAllValid = await verifyProof([proof1, proof2, sameAsProof2], {
511
- * hashes: ['0xAbC...', { value: '0xF22..', multiple: true }, { value: '0xE33..', required: false }],
702
+ * // Validate multiple proofs and handle optional matches or repeated proofs
703
+ * const { isVerified, data } = await verifyProof([proof1, proof2, sameAsProof2], {
704
+ * hashes: [
705
+ * // A string hash is perfectly equivalent to { value: '...', required: true, multiple: true }
706
+ * '0xStrict1...',
707
+ * // An array 'value' means 1 proof can have any 1 matching hash from this list.
708
+ * // 'multiple: true' (the default) means any proof matching this hash is allowed to appear multiple times in the list of proofs.
709
+ * { value: ['0xOpt1..', '0xOpt2..'], multiple: true },
710
+ * // 'required: false' means there can be 0 proofs matching this hash. Such proofs may be optionally present. (Defaults to true).
711
+ * { value: '0xE33..', required: false }
712
+ * ],
512
713
  * });
513
714
  * ```
514
715
  */
515
- declare function verifyProof(proofOrProofs: Proof | Proof[], config: VerificationConfig): Promise<boolean>;
716
+ declare function verifyProof(proofOrProofs: Proof | Proof[], config: VerificationConfig, verifyTEE?: boolean): Promise<VerifyProofResult>;
516
717
  /**
517
718
  * Transforms a Reclaim proof into a format suitable for on-chain verification
518
719
  *
@@ -536,6 +737,8 @@ declare class ReclaimProofRequest {
536
737
  private sessionId;
537
738
  private options?;
538
739
  private context;
740
+ private attestationNonce?;
741
+ private attestationNonceData?;
539
742
  private claimCreationType?;
540
743
  private providerId;
541
744
  private resolvedProviderVersion?;
@@ -559,13 +762,13 @@ declare class ReclaimProofRequest {
559
762
  private readonly FAILURE_TIMEOUT;
560
763
  private constructor();
561
764
  /**
562
- * Initializes a new Reclaim proof request instance with automatic signature generation and session creation
765
+ * Initializes a new Reclaim proof request instance with automatic signature generation and session creation.
563
766
  *
564
767
  * @param applicationId - Your Reclaim application ID
565
768
  * @param appSecret - Your application secret key for signing requests
566
769
  * @param providerId - The ID of the provider to use for proof generation
567
770
  * @param options - Optional configuration options for the proof request
568
- * @returns Promise<ReclaimProofRequest> - A fully initialized proof request instance
771
+ * @returns A fully initialized proof request instance
569
772
  * @throws {InitError} When initialization fails due to invalid parameters or session creation errors
570
773
  *
571
774
  * @example
@@ -574,7 +777,7 @@ declare class ReclaimProofRequest {
574
777
  * 'your-app-id',
575
778
  * 'your-app-secret',
576
779
  * 'provider-id',
577
- * { log: true, acceptAiProviders: true }
780
+ * { portalUrl: 'https://portal.reclaimprotocol.org', log: true }
578
781
  * );
579
782
  * ```
580
783
  */
@@ -861,6 +1064,8 @@ declare class ReclaimProofRequest {
861
1064
  private setSignature;
862
1065
  private generateSignature;
863
1066
  private clearInterval;
1067
+ private setAttestationContext;
1068
+ private applyAttestationContext;
864
1069
  private buildSharePageUrl;
865
1070
  /**
866
1071
  * Exports the Reclaim proof verification request as a JSON string
@@ -885,13 +1090,15 @@ declare class ReclaimProofRequest {
885
1090
  */
886
1091
  private getTemplateData;
887
1092
  /**
888
- * Generates and returns the request URL for proof verification
1093
+ * Generates and returns the request URL for proof verification.
1094
+ *
1095
+ * Defaults to portal mode. Pass `{ verificationMode: 'app' }` for native app flow URLs.
889
1096
  *
890
- * This URL can be shared with users to initiate the proof generation process.
891
- * The URL format varies based on device type:
892
- * - Mobile iOS: Returns App Clip URL (if useAppClip is enabled)
893
- * - Mobile Android: Returns Instant App URL (if useAppClip is enabled)
894
- * - Desktop/Other: Returns standard verification URL
1097
+ * - Portal mode (default): returns portal URL on all platforms
1098
+ * - App mode: returns share page URL on all platforms
1099
+ * - App mode + `useAppClip: true` on iOS: returns App Clip URL instead
1100
+ *
1101
+ * Falls back to `launchOptions` set at init time if not passed at call time.
895
1102
  *
896
1103
  * @param launchOptions - Optional launch configuration to override default behavior
897
1104
  * @returns Promise<string> - The generated request URL
@@ -899,19 +1106,25 @@ declare class ReclaimProofRequest {
899
1106
  *
900
1107
  * @example
901
1108
  * ```typescript
902
- * const requestUrl = await proofRequest.getRequestUrl();
903
- * // Share this URL with users or display as QR code
1109
+ * // Portal URL (default)
1110
+ * const url = await proofRequest.getRequestUrl();
1111
+ *
1112
+ * // Native app flow URL
1113
+ * const url = await proofRequest.getRequestUrl({ verificationMode: 'app' });
904
1114
  * ```
905
1115
  */
906
1116
  getRequestUrl(launchOptions?: ReclaimFlowLaunchOptions): Promise<string>;
907
1117
  /**
908
- * Triggers the appropriate Reclaim verification flow based on device type and configuration
1118
+ * Triggers the appropriate Reclaim verification flow based on device type and configuration.
1119
+ *
1120
+ * Defaults to portal mode (remote browser verification). Pass `{ verificationMode: 'app' }`
1121
+ * for native app flow via the share page.
909
1122
  *
910
- * This method automatically detects the device type and initiates the optimal verification flow:
911
- * - Desktop with browser extension: Triggers extension flow
912
- * - Desktop without extension: Shows QR code modal
913
- * - Mobile Android: Redirects to Instant App
914
- * - Mobile iOS: Redirects to App Clip
1123
+ * - Desktop: browser extension takes priority in both modes
1124
+ * - Desktop portal mode (no extension): opens portal in new tab
1125
+ * - Desktop app mode (no extension): shows QR code modal with share page URL
1126
+ * - Mobile portal mode: opens portal in new tab
1127
+ * - Mobile app mode: opens share page (or App Clip on iOS if `useAppClip` is `true`)
915
1128
  *
916
1129
  * @param launchOptions - Optional launch configuration to override default behavior
917
1130
  * @returns Promise<void>
@@ -919,8 +1132,21 @@ declare class ReclaimProofRequest {
919
1132
  *
920
1133
  * @example
921
1134
  * ```typescript
1135
+ * // Portal flow (default)
922
1136
  * await proofRequest.triggerReclaimFlow();
923
- * // The appropriate verification method will be triggered automatically
1137
+ *
1138
+ * // Native app flow
1139
+ * await proofRequest.triggerReclaimFlow({ verificationMode: 'app' });
1140
+ *
1141
+ * // App Clip on iOS (requires useAppClip: true at init)
1142
+ * const request = await ReclaimProofRequest.init(APP_ID, SECRET, PROVIDER, { useAppClip: true });
1143
+ * await request.triggerReclaimFlow({ verificationMode: 'app' });
1144
+ *
1145
+ * // Can also set verificationMode at init time via launchOptions
1146
+ * const request = await ReclaimProofRequest.init(APP_ID, SECRET, PROVIDER, {
1147
+ * launchOptions: { verificationMode: 'app' }
1148
+ * });
1149
+ * await request.triggerReclaimFlow(); // uses 'app' mode from init
924
1150
  * ```
925
1151
  */
926
1152
  triggerReclaimFlow(launchOptions?: ReclaimFlowLaunchOptions): Promise<void>;
@@ -946,16 +1172,28 @@ declare class ReclaimProofRequest {
946
1172
  private showQRCodeModal;
947
1173
  private redirectToInstantApp;
948
1174
  private redirectToAppClip;
1175
+ /**
1176
+ * Returns the provider id and exact version of the provider that was used in the verification session of this request.
1177
+ *
1178
+ * This can be provided as a config parameter to the `verifyProof` function to verify the proof.
1179
+ *
1180
+ * See also:
1181
+ * * `verifyProof()` - Verifies a proof against the expected provider configuration.
1182
+ * * `getProviderHashRequirements()` - An alternative of this function to get the expected hashes for a provider version by providing providerId and exactProviderVersionString. The result can be provided in verifyProof function's `config` parameter for proof validation.
1183
+ * * `getProviderHashRequirementsFromSpec()` - An alternative of this function to get the expected hashes from a provider spec. The result can be provided in verifyProof function's `config` parameter for proof validation.
1184
+ */
1185
+ getProviderVersion(): ProviderVersionInfo;
949
1186
  /**
950
1187
  * Fetches the provider config that was used for this session and returns the hash requirements
951
1188
  *
952
1189
  * See also:
1190
+ * * `verifyProof()` - Verifies a proof against the expected provider configuration.
953
1191
  * * `fetchProviderHashRequirementsBy()` - An alternative of this function to get the expected hashes for a provider version by providing providerId and exactProviderVersionString. The result can be provided in verifyProof function's `config` parameter for proof validation.
954
1192
  * * `getProviderHashRequirementsFromSpec()` - An alternative of this function to get the expected hashes from a provider spec. The result can be provided in verifyProof function's `config` parameter for proof validation.
955
1193
  *
956
- * @returns A promise that resolves to a ProviderHashRequirementsConfig
1194
+ * @returns A promise that resolves to a `ProviderHashRequirementsConfig` or `ProviderHashRequirementsConfig[]`
957
1195
  */
958
- getProviderHashRequirements(): Promise<ProviderHashRequirementsConfig>;
1196
+ getProviderHashRequirements(proofs: Proof[], allowedTags: string[] | null | undefined): Promise<ProviderHashRequirementsConfig[]>;
959
1197
  /**
960
1198
  * Starts the proof request session and monitors for proof submission
961
1199
  *
@@ -995,7 +1233,7 @@ declare class ReclaimProofRequest {
995
1233
  * });
996
1234
  * ```
997
1235
  */
998
- startSession({ onSuccess, onError }: StartSessionParams): Promise<void>;
1236
+ startSession({ onSuccess, onError, verificationConfig }: StartSessionParams): Promise<void>;
999
1237
  /**
1000
1238
  * Closes the QR code modal if it is currently open
1001
1239
  *
@@ -1080,21 +1318,13 @@ declare function updateSession(sessionId: string, status: SessionStatus): Promis
1080
1318
  * @throws StatusUrlError if the status URL fetch fails
1081
1319
  */
1082
1320
  declare function fetchStatusUrl(sessionId: string): Promise<StatusUrlResponse>;
1083
- declare function fetchProviderConfig(providerId: string, exactProviderVersionString: string): Promise<ProviderConfigResponse>;
1321
+ declare function fetchProviderConfigs(providerId: string, exactProviderVersionString: string | null | undefined, allowedTags: string[] | null | undefined): Promise<ProviderConfigResponse>;
1322
+
1084
1323
  /**
1085
- * Fetches the provider configuration by the providerId and its version; and constructs the robust hash requirements needed for proof validation.
1086
- * It resolves both explicitly required HTTP requests and allowed injected requests based on the provider version.
1087
- *
1088
- * See also:
1089
- *
1090
- * * `ReclaimProofRequest.getProviderHashRequirements()` - An alternative of this function to get the expected hashes for a proof request. The result can be provided in verifyProof function's `config` parameter for proof validation.
1091
- * * `getProviderHashRequirementsFromSpec()` - An alternative of this function to get the expected hashes from a provider spec. The result can be provided in verifyProof function's `config` parameter for proof validation.
1092
- *
1093
- * @param providerId - The unique identifier of the selected provider.
1094
- * @param exactProviderVersion - The specific version string of the provider configuration to ensure deterministic validation.
1095
- * @returns A promise that resolves to `ProviderHashRequirementsConfig` representing the expected hashes for proof validation.
1324
+ * Validates the hardware TEE attestation included in the proof.
1325
+ * Throws an error if the attestation is invalid or compromised.
1096
1326
  */
1097
- declare function fetchProviderHashRequirementsBy(providerId: string, exactProviderVersion: string): Promise<ProviderHashRequirementsConfig>;
1327
+ declare function verifyTeeAttestation(proof: Proof, expectedApplicationId?: string): Promise<boolean>;
1098
1328
 
1099
1329
  /**
1100
1330
  * Highly accurate device type detection - returns only 'desktop' or 'mobile'
@@ -1123,4 +1353,4 @@ declare function isDesktopDevice(): boolean;
1123
1353
  */
1124
1354
  declare function clearDeviceCache(): void;
1125
1355
 
1126
- export { type Beacon, type BeaconState, type BodySniff, ClaimCreationType, type ClaimID, type ClaimInfo, type CompleteClaimData, type Context, type CreateVerificationRequest, DeviceType, type ExtensionMessage, type HashRequirement, type HttpFormEntry, type HttpProviderClaimParams, type HttpRedirectionMethod, type HttpRedirectionOptions, type InitSessionResponse, type InjectedRequestSpec, type InterceptorRequestSpec, type ModalOptions, type OnError, type OnSuccess, type Proof, type ProofPropertiesJSON, type ProofRequestOptions, type ProviderClaimData, type ProviderConfigResponse, type ProviderHashRequirementSpec, type ProviderHashRequirementsConfig, type ProviderVersionConfig, RECLAIM_EXTENSION_ACTIONS, type ReclaimFlowLaunchOptions, ReclaimProofRequest, type ReclaimProviderConfig, type RequestSpec, type ResponseMatchSpec, type ResponseRedactionSpec, type SerializableModalOptions, SessionStatus, type SignedClaim, type StartSessionParams, type StatusUrlResponse, type TemplateData, type UpdateSessionResponse, type ValidationConfig, type ValidationConfigWithDisabledValidation, type ValidationConfigWithHash, type VerificationConfig, type WitnessData, assertValidProofsByHash, assertValidateProof, assertVerifiedProof, clearDeviceCache, createLinkWithTemplateData, fetchProviderConfig, fetchProviderHashRequirementsBy, fetchStatusUrl, getAttestors, getDeviceType, getHttpProviderClaimParamsFromProof, getMobileDeviceType, getProviderHashRequirementsFromSpec, getShortenedUrl, hashRequestSpec, initSession, isDesktopDevice, isHttpProviderClaimParams, isMobileDevice, recoverSignersOfSignedClaim, transformForOnchain, updateSession, verifyProof };
1356
+ export { type Beacon, type BeaconState, type BodySniff, ClaimCreationType, type ClaimID, type ClaimInfo, type CompleteClaimData, type Context, type CreateVerificationRequest, DeviceType, type ExtensionMessage, type HashRequirement, type HashableHttpProviderClaimParams, type HttpFormEntry, type HttpProviderClaimParams, type HttpRedirectionMethod, type HttpRedirectionOptions, type InitSessionResponse, type InjectedRequestSpec, type InterceptorRequestSpec, type ModalOptions, type OnError, type OnSuccess, type Proof, type ProofPropertiesJSON, type ProofRequestOptions, type ProviderClaimData, type ProviderConfigResponse, type ProviderHashRequirementSpec, type ProviderHashRequirementsConfig, type ProviderHashRequirementsResponse, type ProviderVersionConfig, type ProviderVersionInfo, RECLAIM_EXTENSION_ACTIONS, type ReclaimFlowLaunchOptions, ReclaimProofRequest, type ReclaimProviderConfig, type RequestSpec, type ResponseMatchSpec, type ResponseRedactionSpec, type SerializableModalOptions, SessionStatus, type SignedClaim, type StartSessionParams, type StatusUrlResponse, type TeeAttestation, type TemplateData, type UpdateSessionResponse, type ValidationConfig, type ValidationConfigWithDisabledValidation, type ValidationConfigWithHash, type ValidationConfigWithProviderInformation, type VerificationConfig, type VerifyProofResult, type WitnessData, assertValidProofsByHash, assertValidateProof, assertVerifiedProof, clearDeviceCache, createLinkWithTemplateData, fetchProviderConfigs, fetchProviderHashRequirementsBy, fetchStatusUrl, generateSpecsFromRequestSpecTemplate, getAttestors, getDeviceType, getHttpProviderClaimParamsFromProof, getMobileDeviceType, getProviderHashRequirementsFromSpec, getShortenedUrl, hashRequestSpec, initSession, isDesktopDevice, isHttpProviderClaimParams, isMobileDevice, recoverSignersOfSignedClaim, takePairsWhereValueIsArray, takeTemplateParametersFromProofs, transformForOnchain, updateSession, verifyProof, verifyTeeAttestation };