@reclaimprotocol/js-sdk 5.0.0-dev.1 → 5.0.0-dev.3

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.
@@ -182,12 +270,19 @@ type ClaimID = ProviderClaimData['identifier'];
182
270
  type ClaimInfo = Pick<ProviderClaimData, 'context' | 'provider' | 'parameters'>;
183
271
  type CompleteClaimData = Pick<ProviderClaimData, 'owner' | 'timestampS' | 'epoch'> & ClaimInfo;
184
272
  interface HttpProviderClaimParams {
185
- body: string;
273
+ body?: string | null;
186
274
  method: RequestSpec['method'];
187
275
  responseMatches: ResponseMatchSpec[];
188
276
  responseRedactions: ResponseRedactionSpec[];
189
277
  url: string;
190
278
  }
279
+ interface HashableHttpProviderClaimParams {
280
+ body: string;
281
+ method: RequestSpec['method'];
282
+ responseMatches: (Omit<ResponseMatchSpec, 'isOptional'>)[];
283
+ responseRedactions: ResponseRedactionSpec[];
284
+ url: string;
285
+ }
191
286
  type SignedClaim = {
192
287
  claim: CompleteClaimData;
193
288
  signatures: Uint8Array[];
@@ -217,7 +312,16 @@ type ProofRequestOptions = {
217
312
  useBrowserExtension?: boolean;
218
313
  extensionID?: string;
219
314
  providerVersion?: string;
315
+ /**
316
+ * @deprecated Use `portalUrl` instead.
317
+ */
220
318
  customSharePageUrl?: string;
319
+ /**
320
+ * URL of the portal/share page for the verification flow.
321
+ *
322
+ * @default 'https://portal.reclaimprotocol.org'
323
+ */
324
+ portalUrl?: string;
221
325
  customAppClipUrl?: string;
222
326
  launchOptions?: ReclaimFlowLaunchOptions;
223
327
  /**
@@ -253,6 +357,10 @@ type ProofRequestOptions = {
253
357
  * @since 4.7.0
254
358
  */
255
359
  metadata?: Record<string, string>;
360
+ /**
361
+ * If true, generates a TEE attestation nonce during session initialization and expects a TEE attestation in the proof.
362
+ */
363
+ acceptTeeAttestation?: boolean;
256
364
  };
257
365
  type ReclaimFlowLaunchOptions = {
258
366
  /**
@@ -268,7 +376,40 @@ type ReclaimFlowLaunchOptions = {
268
376
  * once fully released. See: https://blog.reclaimprotocol.org/posts/moving-beyond-google-play-instant
269
377
  */
270
378
  canUseDeferredDeepLinksFlow?: boolean;
379
+ /**
380
+ * Verification mode for the flow.
381
+ *
382
+ * - `'portal'`: Opens the portal URL in the browser (remote browser verification).
383
+ * - `'app'`: Verifier app flow via the share page. If `useAppClip` is `true`, uses App Clip on iOS.
384
+ *
385
+ * Can be set at call time via `triggerReclaimFlow({ verificationMode })` or `getRequestUrl({ verificationMode })`,
386
+ * or at init time via `launchOptions: { verificationMode }`.
387
+ *
388
+ * @default 'portal'
389
+ */
390
+ verificationMode?: 'app' | 'portal';
391
+ /**
392
+ * Target DOM element to embed the verification flow in an iframe.
393
+ * When provided, the portal opens inside the element instead of a new tab.
394
+ * Use `closeEmbeddedFlow()` to remove the iframe programmatically.
395
+ *
396
+ * Only applies to portal mode.
397
+ */
398
+ target?: HTMLElement;
399
+ };
400
+ /**
401
+ * Handle returned by `triggerReclaimFlow` to control the launched flow.
402
+ */
403
+ type FlowHandle = {
404
+ /** Closes the flow (removes iframe, closes tab, stops polling) */
405
+ close: () => void;
406
+ /** The iframe element when using embedded mode, `undefined` otherwise */
407
+ iframe?: HTMLIFrameElement;
408
+ /** The tab/window reference when using new tab mode, `undefined` otherwise */
409
+ tab?: Window | null;
271
410
  };
411
+ /** Alias for `FlowHandle` */
412
+ type EmbeddedFlowHandle = FlowHandle;
272
413
  type ModalOptions = {
273
414
  title?: string;
274
415
  description?: string;
@@ -338,6 +479,7 @@ type ProofPropertiesJSON = {
338
479
  jsonProofResponse?: boolean;
339
480
  resolvedProviderVersion: string;
340
481
  modalOptions?: SerializableModalOptions;
482
+ teeAttestation?: TeeAttestation | string;
341
483
  };
342
484
  type HttpFormEntry = {
343
485
  name: string;
@@ -347,7 +489,7 @@ type HttpRedirectionMethod = 'GET' | 'POST';
347
489
  /**
348
490
  * Options for HTTP redirection.
349
491
  *
350
- * Only supported by In-Browser SDK.
492
+ * Only supported by Portal flow.
351
493
  * On other SDKs, this will be ignored and a GET redirection will be performed with the URL.
352
494
  *
353
495
  * @since 4.11.0
@@ -400,6 +542,16 @@ type TemplateData = {
400
542
  metadata?: Record<string, string>;
401
543
  preferredLocale?: ProofRequestOptions['preferredLocale'];
402
544
  };
545
+ type TrustedData = {
546
+ context: Record<string, unknown>;
547
+ extractedParameters: Record<string, string>;
548
+ };
549
+ type VerifyProofResult = {
550
+ isVerified: boolean;
551
+ isTeeVerified?: boolean;
552
+ data: TrustedData[];
553
+ error?: Error;
554
+ };
403
555
  type ProviderVersionConfig = {
404
556
  major?: number;
405
557
  minor?: number;
@@ -418,12 +570,16 @@ type StatusUrlResponse = {
418
570
  sessionId: string;
419
571
  proofs?: Proof[];
420
572
  statusV2: string;
573
+ error?: {
574
+ type: string;
575
+ message: string;
576
+ };
421
577
  };
422
578
  providerId?: string;
423
579
  };
424
580
  type ProviderConfigResponse = {
425
581
  message: string;
426
- providers?: ReclaimProviderConfig;
582
+ providers?: ReclaimProviderConfig[];
427
583
  providerId?: string;
428
584
  providerVersionString?: string;
429
585
  };
@@ -437,6 +593,12 @@ interface ReclaimProviderConfig {
437
593
  requestData: InterceptorRequestSpec[];
438
594
  allowedInjectedRequestData: InjectedRequestSpec[];
439
595
  }
596
+ type ProviderHashRequirementsResponse = {
597
+ message?: string;
598
+ hashRequirements?: ProviderHashRequirementsConfig;
599
+ providerId?: string;
600
+ providerVersionString?: string;
601
+ };
440
602
 
441
603
  /**
442
604
  * Content validation configuration specifying essential required hashes and optional extra proofs.
@@ -451,6 +613,40 @@ type ValidationConfigWithHash = {
451
613
  */
452
614
  hashes: (string | HashRequirement)[];
453
615
  };
616
+ /**
617
+ * Content validation configuration specifying the provider id and version used in the verification session that generated the proofs.
618
+ * Used to explicitly validate that a generated proof matches the exact request structure expected.
619
+ *
620
+ * See also:
621
+ *
622
+ * * `ReclaimProofRequest.getProviderVersion()` - With a ReclaimProofRequest object, you can get the provider id & exact version of provider used in verification session.
623
+ */
624
+ interface ValidationConfigWithProviderInformation {
625
+ /**
626
+ * The identifier of provider used in verifications that resulted in a proof
627
+ *
628
+ * See also:
629
+ *
630
+ * * `ReclaimProofRequest.getProviderVersion()` - With a ReclaimProofRequest object, you can get the provider id & exact version of provider used in verification session.
631
+ **/
632
+ providerId: string;
633
+ /**
634
+ * The exact version of provider used in verifications that resulted in a proof.
635
+ *
636
+ * 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.
637
+ * Patches for the next provider version are also fetched and hashes from that spec is also be used to compare the hashes from proof.
638
+ *
639
+ * See also:
640
+ *
641
+ * * `ReclaimProofRequest.getProviderVersion()` - With a ReclaimProofRequest object, you can get the provider id & exact version of provider used in verification session.
642
+ **/
643
+ providerVersion?: string;
644
+ /**
645
+ * List of allowed pre-release tags.
646
+ * For example, if you are using AI, provide `['ai']` to allow AI patch versions of the provider.
647
+ */
648
+ allowedTags?: string[];
649
+ }
454
650
  /**
455
651
  * Legacy configuration to completely bypass content validation during verification.
456
652
  * Warning: Using this poses a risk as it avoids strictly matching proof parameters to expected hashes.
@@ -462,12 +658,19 @@ interface ValidationConfigWithDisabledValidation {
462
658
  * Represents the configuration options applied when validating proof contents, allowing
463
659
  * strict hash checking or intentionally skipping validation if flagged.
464
660
  */
465
- type ValidationConfig = ValidationConfigWithHash | ValidationConfigWithDisabledValidation;
661
+ type ValidationConfig = ValidationConfigWithHash | ValidationConfigWithProviderInformation | ValidationConfigWithDisabledValidation;
466
662
  /**
467
663
  * Describes the comprehensive configuration required to initialize the proof verification process.
468
664
  * Aligns with `ValidationConfig` options for verifying signatures alongside proof contents.
469
665
  */
470
- type VerificationConfig = ValidationConfig;
666
+ type VerificationConfig = ValidationConfig & {
667
+ /**
668
+ * If true, verifies TEE (Trusted Execution Environment) attestation included in the proof.
669
+ * When enabled, the result will include `isTeeVerified` and `isVerified` will be false
670
+ * if TEE data is missing or TEE verification fails.
671
+ */
672
+ verifyTEE?: boolean;
673
+ };
471
674
  declare function assertValidProofsByHash(proofs: Proof[], config: ProviderHashRequirementsConfig): void;
472
675
  declare function isHttpProviderClaimParams(claimParams: unknown): claimParams is HttpProviderClaimParams;
473
676
  declare function getHttpProviderClaimParamsFromProof(proof: Proof): HttpProviderClaimParams;
@@ -477,7 +680,7 @@ declare function getHttpProviderClaimParamsFromProof(proof: Proof): HttpProvider
477
680
  * @param config - The validation config
478
681
  * @throws {ProofNotValidatedError} When the proof is not validated
479
682
  */
480
- declare function assertValidateProof(proofs: Proof[], config: VerificationConfig): void;
683
+ declare function assertValidateProof(proofs: Proof[], config: VerificationConfig): Promise<void>;
481
684
 
482
685
  /**
483
686
  * Verifies one or more Reclaim proofs by validating signatures, verifying witness information,
@@ -491,28 +694,54 @@ declare function assertValidateProof(proofs: Proof[], config: VerificationConfig
491
694
  * * All 3 functions above are alternatives of each other and result from these functions can be directly used as `config` parameter in this function for proof validation.
492
695
  *
493
696
  * @param proofOrProofs - A single proof object or an array of proof objects to be verified.
494
- * @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.
697
+ * @param config - Verification configuration that specifies required hashes, allowed extra hashes, or disables content validation. Optionally includes `verifyTEE` to require TEE attestation verification.
698
+ * @returns Verification result with `isVerified`, extracted `data` from each proof, optional `error` on failure, and `isTeeVerified` when `verifyTEE` is enabled.
498
699
  *
499
700
  * @example
500
701
  * ```typescript
702
+ * // Fast and simple automatically fetched verification
703
+ * const { isVerified, data } = await verifyProof(proof, request.getProviderVersion());
704
+ *
705
+ * // With TEE attestation verification (fails if TEE data is missing or invalid)
706
+ * const { isVerified, isTeeVerified, data } = await verifyProof(proof, { ...request.getProviderVersion(), verifyTEE: true });
707
+ *
708
+ * // Or, by manually providing the details:
709
+ *
710
+ * const { isVerified, data } = await verifyProof(proof, {
711
+ * providerId: "YOUR_PROVIDER_ID",
712
+ * // The exact provider version used in the session.
713
+ * providerVersion: "1.0.0",
714
+ * // Optionally provide tags. For example, this can be `['ai']` when you want to allow patches from ai.
715
+ * allowedTags: ["ai"]
716
+ * });
717
+ *
501
718
  * // Validate a single proof against expected hash
502
- * const isValid = await verifyProof(proof, { hashes: ['0xAbC...'] });
719
+ * const { isVerified, data } = await verifyProof(proof, { hashes: ['0xAbC...'] });
720
+ * if (isVerified) {
721
+ * console.log(data[0].context);
722
+ * console.log(data[0].extractedParameters);
723
+ * }
503
724
  *
504
725
  * // Validate multiple proofs
505
- * const areAllValid = await verifyProof([proof1, proof2], {
726
+ * const { isVerified, data } = await verifyProof([proof1, proof2], {
506
727
  * hashes: ['0xAbC...', '0xF22..'],
507
728
  * });
508
729
  *
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 }],
730
+ * // Validate multiple proofs and handle optional matches or repeated proofs
731
+ * const { isVerified, data } = await verifyProof([proof1, proof2, sameAsProof2], {
732
+ * hashes: [
733
+ * // A string hash is perfectly equivalent to { value: '...', required: true, multiple: true }
734
+ * '0xStrict1...',
735
+ * // An array 'value' means 1 proof can have any 1 matching hash from this list.
736
+ * // 'multiple: true' (the default) means any proof matching this hash is allowed to appear multiple times in the list of proofs.
737
+ * { value: ['0xOpt1..', '0xOpt2..'], multiple: true },
738
+ * // 'required: false' means there can be 0 proofs matching this hash. Such proofs may be optionally present. (Defaults to true).
739
+ * { value: '0xE33..', required: false }
740
+ * ],
512
741
  * });
513
742
  * ```
514
743
  */
515
- declare function verifyProof(proofOrProofs: Proof | Proof[], config: VerificationConfig): Promise<boolean>;
744
+ declare function verifyProof(proofOrProofs: Proof | Proof[], config: VerificationConfig): Promise<VerifyProofResult>;
516
745
  /**
517
746
  * Transforms a Reclaim proof into a format suitable for on-chain verification
518
747
  *
@@ -536,6 +765,8 @@ declare class ReclaimProofRequest {
536
765
  private sessionId;
537
766
  private options?;
538
767
  private context;
768
+ private attestationNonce?;
769
+ private attestationNonceData?;
539
770
  private claimCreationType?;
540
771
  private providerId;
541
772
  private resolvedProviderVersion?;
@@ -553,19 +784,22 @@ declare class ReclaimProofRequest {
553
784
  private templateData;
554
785
  private extensionID;
555
786
  private customSharePageUrl?;
787
+ private appSharePageUrl;
556
788
  private customAppClipUrl?;
789
+ private portalTab?;
790
+ private portalIframe?;
557
791
  private modalOptions?;
558
792
  private modal?;
559
793
  private readonly FAILURE_TIMEOUT;
560
794
  private constructor();
561
795
  /**
562
- * Initializes a new Reclaim proof request instance with automatic signature generation and session creation
796
+ * Initializes a new Reclaim proof request instance with automatic signature generation and session creation.
563
797
  *
564
798
  * @param applicationId - Your Reclaim application ID
565
799
  * @param appSecret - Your application secret key for signing requests
566
800
  * @param providerId - The ID of the provider to use for proof generation
567
801
  * @param options - Optional configuration options for the proof request
568
- * @returns Promise<ReclaimProofRequest> - A fully initialized proof request instance
802
+ * @returns A fully initialized proof request instance
569
803
  * @throws {InitError} When initialization fails due to invalid parameters or session creation errors
570
804
  *
571
805
  * @example
@@ -574,7 +808,7 @@ declare class ReclaimProofRequest {
574
808
  * 'your-app-id',
575
809
  * 'your-app-secret',
576
810
  * 'provider-id',
577
- * { log: true, acceptAiProviders: true }
811
+ * { portalUrl: 'https://portal.reclaimprotocol.org', log: true }
578
812
  * );
579
813
  * ```
580
814
  */
@@ -629,11 +863,11 @@ declare class ReclaimProofRequest {
629
863
  *
630
864
  * @param url - The URL where users should be redirected after successful proof generation
631
865
  * @param method - The redirection method that should be used for redirection. Allowed options: `GET`, and `POST`.
632
- * `POST` form redirection is only supported in In-Browser SDK.
866
+ * `POST` form redirection is only supported in Portal flow.
633
867
  * @param body - List of name-value pairs to be sent as the body of the form request.
634
868
  * `When `method` is set to `POST`, `body` will be sent with 'application/x-www-form-urlencoded' content type.
635
869
  * When `method` is set to `GET`, if `body` is set then `body` will be sent as query parameters.
636
- * Sending `body` on redirection is only supported in In-Browser SDK.
870
+ * Sending `body` on redirection is only supported in Portal flow.
637
871
  *
638
872
  * @throws {InvalidParamError} When URL is invalid
639
873
  *
@@ -686,11 +920,11 @@ declare class ReclaimProofRequest {
686
920
  *
687
921
  * @param url - The URL where users should be redirected after an error which aborts the verification process
688
922
  * @param method - The redirection method that should be used for redirection. Allowed options: `GET`, and `POST`.
689
- * `POST` form redirection is only supported in In-Browser SDK.
923
+ * `POST` form redirection is only supported in Portal flow.
690
924
  * @param body - List of name-value pairs to be sent as the body of the form request.
691
925
  * When `method` is set to `POST`, `body` will be sent with 'application/x-www-form-urlencoded' content type.
692
926
  * When `method` is set to `GET`, if `body` is set then `body` will be sent as query parameters.
693
- * Sending `body` on redirection is only supported in In-Browser SDK.
927
+ * Sending `body` on redirection is only supported in Portal flow.
694
928
  * @throws {InvalidParamError} When URL is invalid
695
929
  *
696
930
  * @example
@@ -861,7 +1095,26 @@ declare class ReclaimProofRequest {
861
1095
  private setSignature;
862
1096
  private generateSignature;
863
1097
  private clearInterval;
1098
+ private setAttestationContext;
1099
+ private applyAttestationContext;
1100
+ private encodeTemplateData;
864
1101
  private buildSharePageUrl;
1102
+ private openPortalTab;
1103
+ private closePortalTab;
1104
+ private embedPortalIframe;
1105
+ /**
1106
+ * Closes the embedded portal iframe and stops the session polling.
1107
+ *
1108
+ * Call this to programmatically cancel the embedded verification flow
1109
+ * that was started with `triggerReclaimFlow({ target: element })`.
1110
+ * Also called automatically when verification succeeds or fails.
1111
+ *
1112
+ * @example
1113
+ * ```typescript
1114
+ * proofRequest.closeEmbeddedFlow();
1115
+ * ```
1116
+ */
1117
+ closeEmbeddedFlow(): void;
865
1118
  /**
866
1119
  * Exports the Reclaim proof verification request as a JSON string
867
1120
  *
@@ -885,13 +1138,15 @@ declare class ReclaimProofRequest {
885
1138
  */
886
1139
  private getTemplateData;
887
1140
  /**
888
- * Generates and returns the request URL for proof verification
1141
+ * Generates and returns the request URL for proof verification.
1142
+ *
1143
+ * Defaults to portal mode. Pass `{ verificationMode: 'app' }` for native app flow URLs.
889
1144
  *
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
1145
+ * - Portal mode (default): returns portal URL on all platforms
1146
+ * - App mode: returns share page URL on all platforms
1147
+ * - App mode + `useAppClip: true` on iOS: returns App Clip URL instead
1148
+ *
1149
+ * Falls back to `launchOptions` set at init time if not passed at call time.
895
1150
  *
896
1151
  * @param launchOptions - Optional launch configuration to override default behavior
897
1152
  * @returns Promise<string> - The generated request URL
@@ -899,31 +1154,58 @@ declare class ReclaimProofRequest {
899
1154
  *
900
1155
  * @example
901
1156
  * ```typescript
902
- * const requestUrl = await proofRequest.getRequestUrl();
903
- * // Share this URL with users or display as QR code
1157
+ * // Portal URL (default)
1158
+ * const url = await proofRequest.getRequestUrl();
1159
+ *
1160
+ * // Verifier app flow URL
1161
+ * const url = await proofRequest.getRequestUrl({ verificationMode: 'app' });
904
1162
  * ```
905
1163
  */
906
1164
  getRequestUrl(launchOptions?: ReclaimFlowLaunchOptions): Promise<string>;
907
1165
  /**
908
- * Triggers the appropriate Reclaim verification flow based on device type and configuration
1166
+ * Triggers the appropriate Reclaim verification flow based on device type and configuration.
909
1167
  *
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
1168
+ * Defaults to portal mode (remote browser verification). Pass `{ verificationMode: 'app' }`
1169
+ * for verifier app flow via the share page.
1170
+ *
1171
+ * - **Embedded iframe**: Pass `{ target: element }` to embed the portal inside a DOM element instead of a new tab
1172
+ * - Desktop: browser extension takes priority in both modes
1173
+ * - Desktop portal mode (no extension): opens portal in new tab
1174
+ * - Desktop app mode (no extension): shows QR code modal with share page URL
1175
+ * - Mobile portal mode: opens portal in new tab
1176
+ * - Mobile app mode: opens share page (or App Clip on iOS if `useAppClip` is `true`)
915
1177
  *
916
1178
  * @param launchOptions - Optional launch configuration to override default behavior
917
- * @returns Promise<void>
1179
+ * @returns Promise<FlowHandle> - Handle to control the flow (close, access iframe)
918
1180
  * @throws {SignatureNotFoundError} When signature is not set
919
1181
  *
920
1182
  * @example
921
1183
  * ```typescript
922
- * await proofRequest.triggerReclaimFlow();
923
- * // The appropriate verification method will be triggered automatically
1184
+ * // Portal flow (default) — opens in new tab
1185
+ * const handle = await proofRequest.triggerReclaimFlow();
1186
+ * handle.tab; // Window reference to the opened tab
1187
+ * handle.close(); // close tab and stop polling
1188
+ *
1189
+ * // Embed portal in an iframe inside a DOM element
1190
+ * const handle = await proofRequest.triggerReclaimFlow({ target: document.getElementById('reclaim-container') });
1191
+ * handle.iframe; // HTMLIFrameElement reference
1192
+ * handle.close(); // remove iframe and stop polling
1193
+ *
1194
+ * // Verifier app flow
1195
+ * await proofRequest.triggerReclaimFlow({ verificationMode: 'app' });
1196
+ *
1197
+ * // App Clip on iOS (requires useAppClip: true at init)
1198
+ * const request = await ReclaimProofRequest.init(APP_ID, SECRET, PROVIDER, { useAppClip: true });
1199
+ * await request.triggerReclaimFlow({ verificationMode: 'app' });
1200
+ *
1201
+ * // Can also set verificationMode at init time via launchOptions
1202
+ * const request = await ReclaimProofRequest.init(APP_ID, SECRET, PROVIDER, {
1203
+ * launchOptions: { verificationMode: 'app' }
1204
+ * });
1205
+ * await request.triggerReclaimFlow(); // uses 'app' mode from init
924
1206
  * ```
925
1207
  */
926
- triggerReclaimFlow(launchOptions?: ReclaimFlowLaunchOptions): Promise<void>;
1208
+ triggerReclaimFlow(launchOptions?: ReclaimFlowLaunchOptions): Promise<FlowHandle>;
927
1209
  /**
928
1210
  * Checks if the Reclaim browser extension is installed and available
929
1211
  *
@@ -946,16 +1228,28 @@ declare class ReclaimProofRequest {
946
1228
  private showQRCodeModal;
947
1229
  private redirectToInstantApp;
948
1230
  private redirectToAppClip;
1231
+ /**
1232
+ * Returns the provider id and exact version of the provider that was used in the verification session of this request.
1233
+ *
1234
+ * This can be provided as a config parameter to the `verifyProof` function to verify the proof.
1235
+ *
1236
+ * See also:
1237
+ * * `verifyProof()` - Verifies a proof against the expected provider configuration.
1238
+ * * `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.
1239
+ * * `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.
1240
+ */
1241
+ getProviderVersion(): ProviderVersionInfo;
949
1242
  /**
950
1243
  * Fetches the provider config that was used for this session and returns the hash requirements
951
1244
  *
952
1245
  * See also:
1246
+ * * `verifyProof()` - Verifies a proof against the expected provider configuration.
953
1247
  * * `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
1248
  * * `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
1249
  *
956
- * @returns A promise that resolves to a ProviderHashRequirementsConfig
1250
+ * @returns A promise that resolves to a `ProviderHashRequirementsConfig` or `ProviderHashRequirementsConfig[]`
957
1251
  */
958
- getProviderHashRequirements(): Promise<ProviderHashRequirementsConfig>;
1252
+ getProviderHashRequirements(proofs: Proof[], allowedTags: string[] | null | undefined): Promise<ProviderHashRequirementsConfig[]>;
959
1253
  /**
960
1254
  * Starts the proof request session and monitors for proof submission
961
1255
  *
@@ -1080,21 +1374,27 @@ declare function updateSession(sessionId: string, status: SessionStatus): Promis
1080
1374
  * @throws StatusUrlError if the status URL fetch fails
1081
1375
  */
1082
1376
  declare function fetchStatusUrl(sessionId: string): Promise<StatusUrlResponse>;
1083
- declare function fetchProviderConfig(providerId: string, exactProviderVersionString: string): Promise<ProviderConfigResponse>;
1377
+ declare function fetchProviderConfigs(providerId: string, exactProviderVersionString: string | null | undefined, allowedTags: string[] | null | undefined): Promise<ProviderConfigResponse>;
1378
+
1084
1379
  /**
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.
1380
+ * Validates the hardware TEE attestation included in the proof.
1381
+ * Throws an error if the attestation is invalid or compromised.
1096
1382
  */
1097
- declare function fetchProviderHashRequirementsBy(providerId: string, exactProviderVersion: string): Promise<ProviderHashRequirementsConfig>;
1383
+ declare function verifyTeeAttestation(proof: Proof, expectedApplicationId?: string): Promise<boolean>;
1384
+
1385
+ declare const TeeVerificationError: {
1386
+ new (message?: string, innerError?: unknown | undefined): {
1387
+ innerError?: unknown | undefined;
1388
+ name: string;
1389
+ message: string;
1390
+ stack?: string;
1391
+ cause?: unknown;
1392
+ };
1393
+ isError(error: unknown): error is Error;
1394
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1395
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
1396
+ stackTraceLimit: number;
1397
+ };
1098
1398
 
1099
1399
  /**
1100
1400
  * Highly accurate device type detection - returns only 'desktop' or 'mobile'
@@ -1123,4 +1423,4 @@ declare function isDesktopDevice(): boolean;
1123
1423
  */
1124
1424
  declare function clearDeviceCache(): void;
1125
1425
 
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 };
1426
+ export { type Beacon, type BeaconState, type BodySniff, ClaimCreationType, type ClaimID, type ClaimInfo, type CompleteClaimData, type Context, type CreateVerificationRequest, DeviceType, type EmbeddedFlowHandle, type ExtensionMessage, type FlowHandle, 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, TeeVerificationError, type TemplateData, type TrustedData, 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 };