@reclaimprotocol/js-sdk 5.0.0-dev.0 → 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,100 @@ 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[]>;
136
+ /**
137
+ * Transforms a raw provider hash requirement specification into a structured configuration for proof validation.
138
+ * It computes the proof hashes for both required and allowed extra requests to correctly match uploaded proofs.
139
+ *
140
+ * See also:
141
+ *
142
+ * * `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.
143
+ * * `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.
144
+ *
145
+ * @param spec - The raw provider specifications including required and allowed requests.
146
+ * @returns A structured configuration containing computed required and allowed hashes for validation.
147
+ */
148
+ declare function getProviderHashRequirementsFromSpec(spec: ProviderHashRequirementSpec): ProviderHashRequirementsConfig;
149
+ /**
150
+ * Computes the claim hash for a specific request specification based on its properties.
151
+ *
152
+ * @param request - The HTTP request specification (e.g., URL, method, sniffs).
153
+ * @returns A string representing the hashed proof claim parameters.
154
+ */
155
+ declare function hashRequestSpec(request: RequestSpec): HashRequirement;
156
+ /**
157
+ * Represents the raw specification of hash requirements provided by a provider's configuration.
158
+ */
159
+ interface ProviderHashRequirementSpec {
160
+ /** List of request specs that can match with HTTP requests to create a proof using Reclaim Protocol */
161
+ requests: RequestSpec[] | undefined;
162
+ }
53
163
  /**
54
164
  * The structured hash requirements configuration used during proof verification and content validation.
55
165
  */
@@ -64,9 +174,9 @@ type ProviderHashRequirementsConfig = {
64
174
  */
65
175
  type HashRequirement = {
66
176
  /**
67
- * The hash value to match
177
+ * The hash value(s) to match. An array represents multiple valid hashes for optional configurations.
68
178
  */
69
- value: string;
179
+ value: string | string[];
70
180
  /**
71
181
  * Whether the hash is required to be present in the proof.
72
182
  * Defaults to true
@@ -111,9 +221,14 @@ interface RequestSpec {
111
221
  required?: boolean;
112
222
  /**
113
223
  * Whether request matching this spec is allowed to appear multiple times in list of proofs.
114
- * Defaults to false.
224
+ * Defaults to true.
115
225
  */
116
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[];
117
232
  }
118
233
  /**
119
234
  * Defines the configuration for identifying/sniffing the request body.
@@ -151,16 +266,98 @@ interface ResponseRedactionSpec {
151
266
  xPath: string;
152
267
  }
153
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
+
154
344
  type ClaimID = ProviderClaimData['identifier'];
155
345
  type ClaimInfo = Pick<ProviderClaimData, 'context' | 'provider' | 'parameters'>;
156
346
  type CompleteClaimData = Pick<ProviderClaimData, 'owner' | 'timestampS' | 'epoch'> & ClaimInfo;
157
347
  interface HttpProviderClaimParams {
158
- body: string;
348
+ body?: string | null;
159
349
  method: RequestSpec['method'];
160
350
  responseMatches: ResponseMatchSpec[];
161
351
  responseRedactions: ResponseRedactionSpec[];
162
352
  url: string;
163
353
  }
354
+ interface HashableHttpProviderClaimParams {
355
+ body: string;
356
+ method: RequestSpec['method'];
357
+ responseMatches: (Omit<ResponseMatchSpec, 'isOptional'>)[];
358
+ responseRedactions: ResponseRedactionSpec[];
359
+ url: string;
360
+ }
164
361
  type SignedClaim = {
165
362
  claim: CompleteClaimData;
166
363
  signatures: Uint8Array[];
@@ -172,6 +369,7 @@ type CreateVerificationRequest = {
172
369
  type StartSessionParams = {
173
370
  onSuccess: OnSuccess;
174
371
  onError: OnError;
372
+ verificationConfig?: VerificationConfig;
175
373
  };
176
374
  type OnSuccess = (proof?: Proof | Proof[]) => void;
177
375
  type OnError = (error: Error) => void;
@@ -190,7 +388,16 @@ type ProofRequestOptions = {
190
388
  useBrowserExtension?: boolean;
191
389
  extensionID?: string;
192
390
  providerVersion?: string;
391
+ /**
392
+ * @deprecated Use `portalUrl` instead.
393
+ */
193
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;
194
401
  customAppClipUrl?: string;
195
402
  launchOptions?: ReclaimFlowLaunchOptions;
196
403
  /**
@@ -226,6 +433,10 @@ type ProofRequestOptions = {
226
433
  * @since 4.7.0
227
434
  */
228
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;
229
440
  };
230
441
  type ReclaimFlowLaunchOptions = {
231
442
  /**
@@ -241,6 +452,18 @@ type ReclaimFlowLaunchOptions = {
241
452
  * once fully released. See: https://blog.reclaimprotocol.org/posts/moving-beyond-google-play-instant
242
453
  */
243
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';
244
467
  };
245
468
  type ModalOptions = {
246
469
  title?: string;
@@ -311,6 +534,7 @@ type ProofPropertiesJSON = {
311
534
  jsonProofResponse?: boolean;
312
535
  resolvedProviderVersion: string;
313
536
  modalOptions?: SerializableModalOptions;
537
+ teeAttestation?: TeeAttestation | string;
314
538
  };
315
539
  type HttpFormEntry = {
316
540
  name: string;
@@ -373,6 +597,14 @@ type TemplateData = {
373
597
  metadata?: Record<string, string>;
374
598
  preferredLocale?: ProofRequestOptions['preferredLocale'];
375
599
  };
600
+ type VerifyProofResult = {
601
+ isVerified: boolean;
602
+ isTeeVerified?: boolean;
603
+ data: {
604
+ context: Record<string, unknown>;
605
+ extractedParameters: Record<string, string>;
606
+ }[];
607
+ };
376
608
  type ProviderVersionConfig = {
377
609
  major?: number;
378
610
  minor?: number;
@@ -391,12 +623,16 @@ type StatusUrlResponse = {
391
623
  sessionId: string;
392
624
  proofs?: Proof[];
393
625
  statusV2: string;
626
+ error?: {
627
+ type: string;
628
+ message: string;
629
+ };
394
630
  };
395
631
  providerId?: string;
396
632
  };
397
633
  type ProviderConfigResponse = {
398
634
  message: string;
399
- providers?: ReclaimProviderConfig;
635
+ providers?: ReclaimProviderConfig[];
400
636
  providerId?: string;
401
637
  providerVersionString?: string;
402
638
  };
@@ -410,37 +646,12 @@ interface ReclaimProviderConfig {
410
646
  requestData: InterceptorRequestSpec[];
411
647
  allowedInjectedRequestData: InjectedRequestSpec[];
412
648
  }
413
-
414
- /**
415
- * Content validation configuration specifying essential required hashes and optional extra proofs.
416
- * Used to explicitly validate that a generated proof matches the exact request structure expected.
417
- */
418
- type ValidationConfigWithHash = {
419
- /**
420
- * Array of computed hashes that must be satisfied by the proofs.
421
- *
422
- * An element can be a `HashRequirement` object or a string that is equivalent to
423
- * a `{ value: '<hash>', required: true, multiple: false }` as `HashRequirement`.
424
- */
425
- hashes: (string | HashRequirement)[];
649
+ type ProviderHashRequirementsResponse = {
650
+ message?: string;
651
+ hashRequirements?: ProviderHashRequirementsConfig;
652
+ providerId?: string;
653
+ providerVersionString?: string;
426
654
  };
427
- /**
428
- * Legacy configuration to completely bypass content validation during verification.
429
- * Warning: Using this poses a risk as it avoids strictly matching proof parameters to expected hashes.
430
- */
431
- interface ValidationConfigWithDisabledValidation {
432
- dangerouslyDisableContentValidation: true;
433
- }
434
- /**
435
- * Represents the configuration options applied when validating proof contents, allowing
436
- * strict hash checking or intentionally skipping validation if flagged.
437
- */
438
- type ValidationConfig = ValidationConfigWithHash | ValidationConfigWithDisabledValidation;
439
- /**
440
- * Describes the comprehensive configuration required to initialize the proof verification process.
441
- * Aligns with `ValidationConfig` options for verifying signatures alongside proof contents.
442
- */
443
- type VerificationConfig = ValidationConfig;
444
655
 
445
656
  /**
446
657
  * Verifies one or more Reclaim proofs by validating signatures, verifying witness information,
@@ -455,27 +666,54 @@ type VerificationConfig = ValidationConfig;
455
666
  *
456
667
  * @param proofOrProofs - A single proof object or an array of proof objects to be verified.
457
668
  * @param config - Verification configuration that specifies required hashes, allowed extra hashes, or disables content validation.
458
- * @returns Promise<boolean> - Returns `true` if all proofs are successfully verified and validated, `false` otherwise.
459
- * @throws {ProofNotVerifiedError} When signature validation or identifier mismatch occurs.
460
- * @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`
461
671
  *
462
672
  * @example
463
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
+ *
464
690
  * // Validate a single proof against expected hash
465
- * 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
+ * }
466
696
  *
467
697
  * // Validate multiple proofs
468
- * const areAllValid = await verifyProof([proof1, proof2], {
698
+ * const { isVerified, data } = await verifyProof([proof1, proof2], {
469
699
  * hashes: ['0xAbC...', '0xF22..'],
470
700
  * });
471
701
  *
472
- * // Validate 1 required proofs, any number of multiple with same hash, and one optional
473
- * const areAllValid = await verifyProof([proof1, proof2, sameAsProof2], {
474
- * 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
+ * ],
475
713
  * });
476
714
  * ```
477
715
  */
478
- declare function verifyProof(proofOrProofs: Proof | Proof[], config: VerificationConfig): Promise<boolean>;
716
+ declare function verifyProof(proofOrProofs: Proof | Proof[], config: VerificationConfig, verifyTEE?: boolean): Promise<VerifyProofResult>;
479
717
  /**
480
718
  * Transforms a Reclaim proof into a format suitable for on-chain verification
481
719
  *
@@ -499,6 +737,8 @@ declare class ReclaimProofRequest {
499
737
  private sessionId;
500
738
  private options?;
501
739
  private context;
740
+ private attestationNonce?;
741
+ private attestationNonceData?;
502
742
  private claimCreationType?;
503
743
  private providerId;
504
744
  private resolvedProviderVersion?;
@@ -522,13 +762,13 @@ declare class ReclaimProofRequest {
522
762
  private readonly FAILURE_TIMEOUT;
523
763
  private constructor();
524
764
  /**
525
- * 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.
526
766
  *
527
767
  * @param applicationId - Your Reclaim application ID
528
768
  * @param appSecret - Your application secret key for signing requests
529
769
  * @param providerId - The ID of the provider to use for proof generation
530
770
  * @param options - Optional configuration options for the proof request
531
- * @returns Promise<ReclaimProofRequest> - A fully initialized proof request instance
771
+ * @returns A fully initialized proof request instance
532
772
  * @throws {InitError} When initialization fails due to invalid parameters or session creation errors
533
773
  *
534
774
  * @example
@@ -537,7 +777,7 @@ declare class ReclaimProofRequest {
537
777
  * 'your-app-id',
538
778
  * 'your-app-secret',
539
779
  * 'provider-id',
540
- * { log: true, acceptAiProviders: true }
780
+ * { portalUrl: 'https://portal.reclaimprotocol.org', log: true }
541
781
  * );
542
782
  * ```
543
783
  */
@@ -824,6 +1064,8 @@ declare class ReclaimProofRequest {
824
1064
  private setSignature;
825
1065
  private generateSignature;
826
1066
  private clearInterval;
1067
+ private setAttestationContext;
1068
+ private applyAttestationContext;
827
1069
  private buildSharePageUrl;
828
1070
  /**
829
1071
  * Exports the Reclaim proof verification request as a JSON string
@@ -848,13 +1090,15 @@ declare class ReclaimProofRequest {
848
1090
  */
849
1091
  private getTemplateData;
850
1092
  /**
851
- * 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.
1096
+ *
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
852
1100
  *
853
- * This URL can be shared with users to initiate the proof generation process.
854
- * The URL format varies based on device type:
855
- * - Mobile iOS: Returns App Clip URL (if useAppClip is enabled)
856
- * - Mobile Android: Returns Instant App URL (if useAppClip is enabled)
857
- * - Desktop/Other: Returns standard verification URL
1101
+ * Falls back to `launchOptions` set at init time if not passed at call time.
858
1102
  *
859
1103
  * @param launchOptions - Optional launch configuration to override default behavior
860
1104
  * @returns Promise<string> - The generated request URL
@@ -862,19 +1106,25 @@ declare class ReclaimProofRequest {
862
1106
  *
863
1107
  * @example
864
1108
  * ```typescript
865
- * const requestUrl = await proofRequest.getRequestUrl();
866
- * // 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' });
867
1114
  * ```
868
1115
  */
869
1116
  getRequestUrl(launchOptions?: ReclaimFlowLaunchOptions): Promise<string>;
870
1117
  /**
871
- * 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.
872
1122
  *
873
- * This method automatically detects the device type and initiates the optimal verification flow:
874
- * - Desktop with browser extension: Triggers extension flow
875
- * - Desktop without extension: Shows QR code modal
876
- * - Mobile Android: Redirects to Instant App
877
- * - 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`)
878
1128
  *
879
1129
  * @param launchOptions - Optional launch configuration to override default behavior
880
1130
  * @returns Promise<void>
@@ -882,8 +1132,21 @@ declare class ReclaimProofRequest {
882
1132
  *
883
1133
  * @example
884
1134
  * ```typescript
1135
+ * // Portal flow (default)
885
1136
  * await proofRequest.triggerReclaimFlow();
886
- * // 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
887
1150
  * ```
888
1151
  */
889
1152
  triggerReclaimFlow(launchOptions?: ReclaimFlowLaunchOptions): Promise<void>;
@@ -909,16 +1172,28 @@ declare class ReclaimProofRequest {
909
1172
  private showQRCodeModal;
910
1173
  private redirectToInstantApp;
911
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;
912
1186
  /**
913
1187
  * Fetches the provider config that was used for this session and returns the hash requirements
914
1188
  *
915
1189
  * See also:
1190
+ * * `verifyProof()` - Verifies a proof against the expected provider configuration.
916
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.
917
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.
918
1193
  *
919
- * @returns A promise that resolves to a ProviderHashRequirementsConfig
1194
+ * @returns A promise that resolves to a `ProviderHashRequirementsConfig` or `ProviderHashRequirementsConfig[]`
920
1195
  */
921
- getProviderHashRequirements(): Promise<ProviderHashRequirementsConfig>;
1196
+ getProviderHashRequirements(proofs: Proof[], allowedTags: string[] | null | undefined): Promise<ProviderHashRequirementsConfig[]>;
922
1197
  /**
923
1198
  * Starts the proof request session and monitors for proof submission
924
1199
  *
@@ -958,7 +1233,7 @@ declare class ReclaimProofRequest {
958
1233
  * });
959
1234
  * ```
960
1235
  */
961
- startSession({ onSuccess, onError }: StartSessionParams): Promise<void>;
1236
+ startSession({ onSuccess, onError, verificationConfig }: StartSessionParams): Promise<void>;
962
1237
  /**
963
1238
  * Closes the QR code modal if it is currently open
964
1239
  *
@@ -986,6 +1261,71 @@ declare class ReclaimProofRequest {
986
1261
  getJsonProofResponse(): boolean;
987
1262
  }
988
1263
 
1264
+ /**
1265
+ * Retrieves a shortened URL for the given URL
1266
+ * @param url - The URL to be shortened
1267
+ * @returns A promise that resolves to the shortened URL, or the original URL if shortening fails
1268
+ */
1269
+ declare function getShortenedUrl(url: string): Promise<string>;
1270
+ /**
1271
+ * Creates a link with embedded template data
1272
+ * @param templateData - The data to be embedded in the link
1273
+ * @param sharePagePath - The path to the share page (optional)
1274
+ * @returns A promise that resolves to the created link (shortened if possible)
1275
+ */
1276
+ declare function createLinkWithTemplateData(templateData: TemplateData, sharePagePath?: string): Promise<string>;
1277
+ /**
1278
+ * Retrieves the list of witnesses for a given claim
1279
+ */
1280
+ declare function getAttestors(): Promise<WitnessData[]>;
1281
+ /**
1282
+ * Recovers the signers' addresses from a signed claim
1283
+ * @param claim - The signed claim object
1284
+ * @param signatures - The signatures associated with the claim
1285
+ * @returns An array of recovered signer addresses
1286
+ */
1287
+ declare function recoverSignersOfSignedClaim({ claim, signatures }: SignedClaim): string[];
1288
+ /**
1289
+ * Asserts that the proof is verified by checking the signatures and witness information
1290
+ * @param proof - The proof to verify
1291
+ * @param attestors - The attestors to check against
1292
+ * @throws {ProofNotVerifiedError} When the proof is not verified
1293
+ */
1294
+ declare function assertVerifiedProof(proof: Proof, attestors: WitnessData[]): Promise<void>;
1295
+
1296
+ /**
1297
+ * Initializes a session with the provided parameters
1298
+ * @param providerId - The ID of the provider
1299
+ * @param appId - The ID of the application
1300
+ * @param timestamp - The timestamp of the request
1301
+ * @param signature - The signature for authentication
1302
+ * @returns A promise that resolves to an InitSessionResponse
1303
+ * @throws InitSessionError if the session initialization fails
1304
+ */
1305
+ declare function initSession(providerId: string, appId: string, timestamp: string, signature: string, versionNumber?: string): Promise<InitSessionResponse>;
1306
+ /**
1307
+ * Updates the status of an existing session
1308
+ * @param sessionId - The ID of the session to update
1309
+ * @param status - The new status of the session
1310
+ * @returns A promise that resolves to the update response
1311
+ * @throws UpdateSessionError if the session update fails
1312
+ */
1313
+ declare function updateSession(sessionId: string, status: SessionStatus): Promise<any>;
1314
+ /**
1315
+ * Fetches the status URL for a given session ID
1316
+ * @param sessionId - The ID of the session to fetch the status URL for
1317
+ * @returns A promise that resolves to a StatusUrlResponse
1318
+ * @throws StatusUrlError if the status URL fetch fails
1319
+ */
1320
+ declare function fetchStatusUrl(sessionId: string): Promise<StatusUrlResponse>;
1321
+ declare function fetchProviderConfigs(providerId: string, exactProviderVersionString: string | null | undefined, allowedTags: string[] | null | undefined): Promise<ProviderConfigResponse>;
1322
+
1323
+ /**
1324
+ * Validates the hardware TEE attestation included in the proof.
1325
+ * Throws an error if the attestation is invalid or compromised.
1326
+ */
1327
+ declare function verifyTeeAttestation(proof: Proof, expectedApplicationId?: string): Promise<boolean>;
1328
+
989
1329
  /**
990
1330
  * Highly accurate device type detection - returns only 'desktop' or 'mobile'
991
1331
  * Uses multiple detection methods and scoring system for maximum accuracy
@@ -1013,4 +1353,4 @@ declare function isDesktopDevice(): boolean;
1013
1353
  */
1014
1354
  declare function clearDeviceCache(): void;
1015
1355
 
1016
- export { type Beacon, type BeaconState, ClaimCreationType, type ClaimID, type ClaimInfo, type CompleteClaimData, type Context, type CreateVerificationRequest, DeviceType, type ExtensionMessage, type HttpFormEntry, type HttpProviderClaimParams, type HttpRedirectionMethod, type HttpRedirectionOptions, type InitSessionResponse, type ModalOptions, type OnError, type OnSuccess, type Proof, type ProofPropertiesJSON, type ProofRequestOptions, type ProviderClaimData, type ProviderConfigResponse, type ProviderVersionConfig, RECLAIM_EXTENSION_ACTIONS, type ReclaimFlowLaunchOptions, ReclaimProofRequest, type ReclaimProviderConfig, type SerializableModalOptions, SessionStatus, type SignedClaim, type StartSessionParams, type StatusUrlResponse, type TemplateData, type UpdateSessionResponse, type WitnessData, clearDeviceCache, getDeviceType, getMobileDeviceType, isDesktopDevice, isMobileDevice, transformForOnchain, 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 };