@reclaimprotocol/js-sdk 5.0.0-dev.2 → 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.js CHANGED
@@ -84,7 +84,7 @@ var require_package = __commonJS({
84
84
  "package.json"(exports2, module2) {
85
85
  module2.exports = {
86
86
  name: "@reclaimprotocol/js-sdk",
87
- version: "5.0.0-dev.2",
87
+ version: "5.0.0-dev.3",
88
88
  description: "Designed to request proofs from the Reclaim protocol and manage the flow of claims and witness interactions.",
89
89
  main: "dist/index.js",
90
90
  types: "dist/index.d.ts",
@@ -193,6 +193,7 @@ var require_package = __commonJS({
193
193
  var index_exports = {};
194
194
  __export(index_exports, {
195
195
  ReclaimProofRequest: () => ReclaimProofRequest,
196
+ TeeVerificationError: () => TeeVerificationError,
196
197
  assertValidProofsByHash: () => assertValidProofsByHash,
197
198
  assertValidateProof: () => assertValidateProof,
198
199
  assertVerifiedProof: () => assertVerifiedProof,
@@ -279,6 +280,7 @@ var InavlidParametersError = createErrorClass("InavlidParametersError");
279
280
  var ProofSubmissionFailedError = createErrorClass("ProofSubmissionFailedError");
280
281
  var ErrorDuringVerificationError = createErrorClass("ErrorDuringVerificationError");
281
282
  var CallbackUrlRequiredError = createErrorClass("CallbackUrlRequiredError");
283
+ var TeeVerificationError = createErrorClass("TeeVerificationError");
282
284
 
283
285
  // src/utils/logger.ts
284
286
  var SimpleLogger = class {
@@ -855,7 +857,7 @@ function getShortenedUrl(url) {
855
857
  });
856
858
  const res = yield response.json();
857
859
  if (!response.ok) {
858
- logger5.info(`Failed to shorten URL: ${url}, Response: ${JSON.stringify(res)}`);
860
+ logger5.info(`Failed to shorten URL: status=${response.status}`);
859
861
  return url;
860
862
  }
861
863
  const shortenedVerificationUrl = res.result.shortUrl;
@@ -2320,7 +2322,7 @@ Got: ${report.reportData}`);
2320
2322
  // src/Reclaim.ts
2321
2323
  var logger10 = logger_default.logger;
2322
2324
  var sdkVersion = require_package().version;
2323
- function verifyProof(proofOrProofs, config, verifyTEE) {
2325
+ function verifyProof(proofOrProofs, config) {
2324
2326
  return __async(this, null, function* () {
2325
2327
  const proofs = Array.isArray(proofOrProofs) ? proofOrProofs : [proofOrProofs];
2326
2328
  try {
@@ -2339,25 +2341,31 @@ function verifyProof(proofOrProofs, config, verifyTEE) {
2339
2341
  isVerified: true,
2340
2342
  data: proofs.map(extractProofData)
2341
2343
  };
2342
- if (verifyTEE) {
2344
+ if (config.verifyTEE) {
2343
2345
  const hasTeeData = proofs.every((proof) => proof.teeAttestation || JSON.parse(proof.claimData.context).attestationNonce);
2344
2346
  if (!hasTeeData) {
2345
- logger10.error("TEE verification requested but one or more proofs are missing TEE attestation data");
2347
+ const teeError = new TeeVerificationError("TEE verification requested but one or more proofs are missing TEE attestation data");
2348
+ logger10.error(teeError.message);
2346
2349
  result.isTeeVerified = false;
2347
2350
  result.isVerified = false;
2351
+ result.error = teeError;
2348
2352
  return result;
2349
2353
  }
2350
2354
  try {
2351
2355
  const teeResults = yield Promise.all(proofs.map((proof) => verifyTeeAttestation(proof)));
2352
2356
  result.isTeeVerified = teeResults.every((r) => r === true);
2353
2357
  if (!result.isTeeVerified) {
2354
- logger10.error("TEE attestation verification failed for one or more proofs");
2358
+ const teeError = new TeeVerificationError("TEE attestation verification failed for one or more proofs");
2359
+ logger10.error(teeError.message);
2360
+ result.isVerified = false;
2361
+ result.error = teeError;
2355
2362
  }
2356
- result.isVerified = result.isVerified && result.isTeeVerified;
2357
2363
  } catch (error) {
2358
- logger10.error("Error verifying TEE attestation:", error);
2364
+ const teeError = new TeeVerificationError("Error verifying TEE attestation", error);
2365
+ logger10.error(teeError.message);
2359
2366
  result.isTeeVerified = false;
2360
2367
  result.isVerified = false;
2368
+ result.error = teeError;
2361
2369
  }
2362
2370
  }
2363
2371
  return result;
@@ -2365,7 +2373,8 @@ function verifyProof(proofOrProofs, config, verifyTEE) {
2365
2373
  logger10.error("Error in validating proof:", error);
2366
2374
  return {
2367
2375
  isVerified: false,
2368
- data: []
2376
+ data: [],
2377
+ error: error instanceof Error ? error : new Error(String(error))
2369
2378
  };
2370
2379
  }
2371
2380
  });
@@ -2433,6 +2442,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
2433
2442
  this.intervals = /* @__PURE__ */ new Map();
2434
2443
  this.jsonProofResponse = false;
2435
2444
  this.extensionID = "reclaim-extension";
2445
+ this.appSharePageUrl = "https://share.reclaimprotocol.org/verify";
2436
2446
  this.FAILURE_TIMEOUT = 30 * 1e3;
2437
2447
  /**
2438
2448
  * Validates signature and returns template data
@@ -2483,7 +2493,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
2483
2493
  };
2484
2494
  return templateData;
2485
2495
  };
2486
- var _a, _b, _c;
2496
+ var _a, _b;
2487
2497
  this.providerId = providerId;
2488
2498
  this.timeStamp = Date.now().toString();
2489
2499
  this.applicationId = applicationId;
@@ -2502,7 +2512,11 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
2502
2512
  if (options.useAppClip === void 0) {
2503
2513
  options.useAppClip = false;
2504
2514
  }
2505
- this.customSharePageUrl = (_c = (_b = options.portalUrl) != null ? _b : options.customSharePageUrl) != null ? _c : "https://portal.reclaimprotocol.org";
2515
+ const customUrl = (_b = options.portalUrl) != null ? _b : options.customSharePageUrl;
2516
+ this.customSharePageUrl = customUrl != null ? customUrl : "https://portal.reclaimprotocol.org";
2517
+ if (customUrl) {
2518
+ this.appSharePageUrl = customUrl;
2519
+ }
2506
2520
  options.customSharePageUrl = this.customSharePageUrl;
2507
2521
  if (options == null ? void 0 : options.envUrl) {
2508
2522
  setBackendBaseUrl(options.envUrl);
@@ -2831,11 +2845,11 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
2831
2845
  *
2832
2846
  * @param url - The URL where users should be redirected after successful proof generation
2833
2847
  * @param method - The redirection method that should be used for redirection. Allowed options: `GET`, and `POST`.
2834
- * `POST` form redirection is only supported in In-Browser SDK.
2848
+ * `POST` form redirection is only supported in Portal flow.
2835
2849
  * @param body - List of name-value pairs to be sent as the body of the form request.
2836
2850
  * `When `method` is set to `POST`, `body` will be sent with 'application/x-www-form-urlencoded' content type.
2837
2851
  * When `method` is set to `GET`, if `body` is set then `body` will be sent as query parameters.
2838
- * Sending `body` on redirection is only supported in In-Browser SDK.
2852
+ * Sending `body` on redirection is only supported in Portal flow.
2839
2853
  *
2840
2854
  * @throws {InvalidParamError} When URL is invalid
2841
2855
  *
@@ -2897,11 +2911,11 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
2897
2911
  *
2898
2912
  * @param url - The URL where users should be redirected after an error which aborts the verification process
2899
2913
  * @param method - The redirection method that should be used for redirection. Allowed options: `GET`, and `POST`.
2900
- * `POST` form redirection is only supported in In-Browser SDK.
2914
+ * `POST` form redirection is only supported in Portal flow.
2901
2915
  * @param body - List of name-value pairs to be sent as the body of the form request.
2902
2916
  * When `method` is set to `POST`, `body` will be sent with 'application/x-www-form-urlencoded' content type.
2903
2917
  * When `method` is set to `GET`, if `body` is set then `body` will be sent as query parameters.
2904
- * Sending `body` on redirection is only supported in In-Browser SDK.
2918
+ * Sending `body` on redirection is only supported in Portal flow.
2905
2919
  * @throws {InvalidParamError} When URL is invalid
2906
2920
  *
2907
2921
  * @example
@@ -3196,8 +3210,80 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3196
3210
  attestationNonceData: this.attestationNonceData
3197
3211
  });
3198
3212
  }
3213
+ encodeTemplateData(templateData) {
3214
+ let template = encodeURIComponent(JSON.stringify(templateData));
3215
+ template = replaceAll(template, "(", "%28");
3216
+ template = replaceAll(template, ")", "%29");
3217
+ return template;
3218
+ }
3199
3219
  buildSharePageUrl(template) {
3200
- return `https://share.reclaimprotocol.org/verify/?template=${template}`;
3220
+ return `${this.appSharePageUrl}/?template=${template}`;
3221
+ }
3222
+ openPortalTab(templateData, preOpenedTab) {
3223
+ return __async(this, null, function* () {
3224
+ const newTab = preOpenedTab != null ? preOpenedTab : window.open("about:blank", "_blank");
3225
+ const link = yield createLinkWithTemplateData(templateData, this.customSharePageUrl);
3226
+ logger10.info("Opening portal in new tab: " + link);
3227
+ if (newTab) {
3228
+ this.portalTab = newTab;
3229
+ newTab.location = link;
3230
+ setTimeout(() => {
3231
+ try {
3232
+ if (newTab.location.href === "about:blank") {
3233
+ newTab.close();
3234
+ this.portalTab = void 0;
3235
+ window.open(link, "_blank");
3236
+ }
3237
+ } catch (_) {
3238
+ }
3239
+ }, 500);
3240
+ }
3241
+ });
3242
+ }
3243
+ closePortalTab() {
3244
+ var _a;
3245
+ try {
3246
+ (_a = this.portalTab) == null ? void 0 : _a.close();
3247
+ } catch (_) {
3248
+ }
3249
+ this.portalTab = void 0;
3250
+ }
3251
+ embedPortalIframe(templateData, target) {
3252
+ return __async(this, null, function* () {
3253
+ let link = yield createLinkWithTemplateData(templateData, this.customSharePageUrl);
3254
+ const separator = link.includes("?") ? "&" : "?";
3255
+ link = `${link}${separator}embedded=true`;
3256
+ logger10.info("Embedding portal in iframe: " + link);
3257
+ this.closeEmbeddedFlow();
3258
+ const iframe = document.createElement("iframe");
3259
+ iframe.src = link;
3260
+ iframe.style.width = "100%";
3261
+ iframe.style.height = "100%";
3262
+ iframe.style.border = "none";
3263
+ iframe.setAttribute("allow", "clipboard-write");
3264
+ iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
3265
+ target.appendChild(iframe);
3266
+ this.portalIframe = iframe;
3267
+ });
3268
+ }
3269
+ /**
3270
+ * Closes the embedded portal iframe and stops the session polling.
3271
+ *
3272
+ * Call this to programmatically cancel the embedded verification flow
3273
+ * that was started with `triggerReclaimFlow({ target: element })`.
3274
+ * Also called automatically when verification succeeds or fails.
3275
+ *
3276
+ * @example
3277
+ * ```typescript
3278
+ * proofRequest.closeEmbeddedFlow();
3279
+ * ```
3280
+ */
3281
+ closeEmbeddedFlow() {
3282
+ if (this.portalIframe) {
3283
+ this.portalIframe.remove();
3284
+ this.portalIframe = void 0;
3285
+ }
3286
+ this.clearInterval();
3201
3287
  }
3202
3288
  /**
3203
3289
  * Exports the Reclaim proof verification request as a JSON string
@@ -3270,7 +3356,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3270
3356
  * // Portal URL (default)
3271
3357
  * const url = await proofRequest.getRequestUrl();
3272
3358
  *
3273
- * // Native app flow URL
3359
+ * // Verifier app flow URL
3274
3360
  * const url = await proofRequest.getRequestUrl({ verificationMode: 'app' });
3275
3361
  * ```
3276
3362
  */
@@ -3287,15 +3373,13 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3287
3373
  const templateData = this.getTemplateData();
3288
3374
  yield updateSession(this.sessionId, "SESSION_STARTED" /* SESSION_STARTED */);
3289
3375
  if (mode === "app") {
3290
- let template = encodeURIComponent(JSON.stringify(templateData));
3291
- template = replaceAll(template, "(", "%28");
3292
- template = replaceAll(template, ")", "%29");
3376
+ const template = this.encodeTemplateData(templateData);
3293
3377
  if (((_c = this.options) == null ? void 0 : _c.useAppClip) && getDeviceType() === "mobile" /* MOBILE */ && getMobileDeviceType() === "ios" /* IOS */) {
3294
3378
  const appClipUrl = this.customAppClipUrl ? `${this.customAppClipUrl}&template=${template}` : `https://appclip.apple.com/id?p=org.reclaimprotocol.app.clip&template=${template}`;
3295
3379
  logger10.info("App Clip Url created successfully: " + appClipUrl);
3296
3380
  return appClipUrl;
3297
3381
  }
3298
- const sharePageUrl = yield createLinkWithTemplateData(templateData, "https://share.reclaimprotocol.org/verify");
3382
+ const sharePageUrl = yield createLinkWithTemplateData(templateData, this.appSharePageUrl);
3299
3383
  logger10.info("Share page Url created successfully: " + sharePageUrl);
3300
3384
  return sharePageUrl;
3301
3385
  }
@@ -3312,8 +3396,9 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3312
3396
  * Triggers the appropriate Reclaim verification flow based on device type and configuration.
3313
3397
  *
3314
3398
  * Defaults to portal mode (remote browser verification). Pass `{ verificationMode: 'app' }`
3315
- * for native app flow via the share page.
3399
+ * for verifier app flow via the share page.
3316
3400
  *
3401
+ * - **Embedded iframe**: Pass `{ target: element }` to embed the portal inside a DOM element instead of a new tab
3317
3402
  * - Desktop: browser extension takes priority in both modes
3318
3403
  * - Desktop portal mode (no extension): opens portal in new tab
3319
3404
  * - Desktop app mode (no extension): shows QR code modal with share page URL
@@ -3321,15 +3406,22 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3321
3406
  * - Mobile app mode: opens share page (or App Clip on iOS if `useAppClip` is `true`)
3322
3407
  *
3323
3408
  * @param launchOptions - Optional launch configuration to override default behavior
3324
- * @returns Promise<void>
3409
+ * @returns Promise<FlowHandle> - Handle to control the flow (close, access iframe)
3325
3410
  * @throws {SignatureNotFoundError} When signature is not set
3326
3411
  *
3327
3412
  * @example
3328
3413
  * ```typescript
3329
- * // Portal flow (default)
3330
- * await proofRequest.triggerReclaimFlow();
3414
+ * // Portal flow (default) — opens in new tab
3415
+ * const handle = await proofRequest.triggerReclaimFlow();
3416
+ * handle.tab; // Window reference to the opened tab
3417
+ * handle.close(); // close tab and stop polling
3418
+ *
3419
+ * // Embed portal in an iframe inside a DOM element
3420
+ * const handle = await proofRequest.triggerReclaimFlow({ target: document.getElementById('reclaim-container') });
3421
+ * handle.iframe; // HTMLIFrameElement reference
3422
+ * handle.close(); // remove iframe and stop polling
3331
3423
  *
3332
- * // Native app flow
3424
+ * // Verifier app flow
3333
3425
  * await proofRequest.triggerReclaimFlow({ verificationMode: 'app' });
3334
3426
  *
3335
3427
  * // App Clip on iOS (requires useAppClip: true at init)
@@ -3345,7 +3437,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3345
3437
  */
3346
3438
  triggerReclaimFlow(launchOptions) {
3347
3439
  return __async(this, null, function* () {
3348
- var _a, _b, _c, _d, _e, _f;
3440
+ var _a, _b, _c, _d, _e;
3349
3441
  const options = launchOptions || ((_a = this.options) == null ? void 0 : _a.launchOptions) || {};
3350
3442
  const mode = (_b = options.verificationMode) != null ? _b : "portal";
3351
3443
  if (!this.signature) {
@@ -3357,37 +3449,38 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3357
3449
  logger10.info(`Triggering Reclaim flow (mode: ${mode})`);
3358
3450
  const deviceType = getDeviceType();
3359
3451
  updateSession(this.sessionId, "SESSION_STARTED" /* SESSION_STARTED */);
3452
+ if ("target" in options && !options.target) {
3453
+ logger10.warn("triggerReclaimFlow: target was provided but is null/undefined \u2014 falling back to default flow. Ensure the element exists in the DOM.");
3454
+ }
3455
+ if (options.target && mode === "portal") {
3456
+ yield this.embedPortalIframe(templateData, options.target);
3457
+ return {
3458
+ close: () => this.closeEmbeddedFlow(),
3459
+ iframe: this.portalIframe
3460
+ };
3461
+ }
3360
3462
  if (deviceType === "desktop" /* DESKTOP */) {
3361
- const extensionAvailable = yield this.isBrowserExtensionAvailable();
3362
- if (((_c = this.options) == null ? void 0 : _c.useBrowserExtension) && extensionAvailable) {
3363
- logger10.info("Triggering browser extension flow");
3364
- this.triggerBrowserExtensionFlow();
3365
- return;
3366
- }
3367
- if (mode === "portal") {
3368
- const portalUrl = (_d = this.customSharePageUrl) != null ? _d : "https://portal.reclaimprotocol.org";
3369
- const newTab = window.open("about:blank", "_blank");
3370
- const link = yield createLinkWithTemplateData(templateData, portalUrl);
3371
- logger10.info("Opening portal in new tab: " + link);
3372
- if (newTab) {
3373
- newTab.location = link;
3374
- setTimeout(() => {
3375
- try {
3376
- if (newTab.location.href === "about:blank") {
3377
- newTab.close();
3378
- window.open(link, "_blank");
3379
- }
3380
- } catch (_) {
3463
+ if ((_c = this.options) == null ? void 0 : _c.useBrowserExtension) {
3464
+ const extensionAvailable = yield this.isBrowserExtensionAvailable();
3465
+ if (extensionAvailable) {
3466
+ logger10.info("Triggering browser extension flow");
3467
+ this.triggerBrowserExtensionFlow();
3468
+ return {
3469
+ close: () => {
3470
+ this.clearInterval();
3381
3471
  }
3382
- }, 500);
3472
+ };
3383
3473
  }
3474
+ }
3475
+ if (mode === "portal") {
3476
+ yield this.openPortalTab(templateData);
3384
3477
  } else {
3385
3478
  logger10.info("Showing QR code modal with share page URL");
3386
- yield this.showQRCodeModal("app");
3479
+ yield this.showQRCodeModal();
3387
3480
  }
3388
3481
  } else if (deviceType === "mobile" /* MOBILE */) {
3389
3482
  if (mode === "app") {
3390
- if (((_e = this.options) == null ? void 0 : _e.useAppClip) && getMobileDeviceType() === "ios" /* IOS */) {
3483
+ if (((_d = this.options) == null ? void 0 : _d.useAppClip) && getMobileDeviceType() === "ios" /* IOS */) {
3391
3484
  logger10.info("Redirecting to iOS app clip");
3392
3485
  this.redirectToAppClip();
3393
3486
  } else {
@@ -3395,24 +3488,18 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3395
3488
  yield this.redirectToInstantApp(options);
3396
3489
  }
3397
3490
  } else {
3398
- const portalUrl = (_f = this.customSharePageUrl) != null ? _f : "https://portal.reclaimprotocol.org";
3399
- const newTab = window.open("about:blank", "_blank");
3400
- const link = yield createLinkWithTemplateData(templateData, portalUrl);
3401
- logger10.info("Opening portal on mobile: " + link);
3402
- if (newTab) {
3403
- newTab.location = link;
3404
- setTimeout(() => {
3405
- try {
3406
- if (newTab.location.href === "about:blank") {
3407
- newTab.close();
3408
- window.open(link, "_blank");
3409
- }
3410
- } catch (_) {
3411
- }
3412
- }, 500);
3413
- }
3491
+ yield this.openPortalTab(templateData);
3414
3492
  }
3415
3493
  }
3494
+ return {
3495
+ close: () => {
3496
+ var _a2;
3497
+ this.closePortalTab();
3498
+ this.closeEmbeddedFlow();
3499
+ (_a2 = this.modal) == null ? void 0 : _a2.close();
3500
+ },
3501
+ tab: (_e = this.portalTab) != null ? _e : void 0
3502
+ };
3416
3503
  } catch (error) {
3417
3504
  logger10.info("Error triggering Reclaim flow:", error);
3418
3505
  throw error;
@@ -3477,11 +3564,10 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3477
3564
  window.postMessage(message, "*");
3478
3565
  logger10.info("Browser extension flow triggered");
3479
3566
  }
3480
- showQRCodeModal(mode = "portal") {
3567
+ showQRCodeModal() {
3481
3568
  return __async(this, null, function* () {
3482
3569
  try {
3483
- const url = mode === "app" ? "https://share.reclaimprotocol.org/verify" : this.customSharePageUrl;
3484
- const requestUrl = yield createLinkWithTemplateData(this.templateData, url);
3570
+ const requestUrl = yield createLinkWithTemplateData(this.templateData, this.appSharePageUrl);
3485
3571
  this.modal = new QRCodeModal(this.modalOptions);
3486
3572
  yield this.modal.show(requestUrl);
3487
3573
  } catch (error) {
@@ -3494,9 +3580,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3494
3580
  return __async(this, null, function* () {
3495
3581
  var _a;
3496
3582
  try {
3497
- let template = encodeURIComponent(JSON.stringify(this.templateData));
3498
- template = replaceAll(template, "(", "%28");
3499
- template = replaceAll(template, ")", "%29");
3583
+ const template = this.encodeTemplateData(this.templateData);
3500
3584
  let instantAppUrl = this.buildSharePageUrl(template);
3501
3585
  logger10.info("Redirecting to Android instant app: " + instantAppUrl);
3502
3586
  const isDeferredDeeplinksFlowEnabled = (_a = options.canUseDeferredDeepLinksFlow) != null ? _a : false;
@@ -3555,12 +3639,10 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3555
3639
  }
3556
3640
  redirectToAppClip() {
3557
3641
  try {
3558
- let template = encodeURIComponent(JSON.stringify(this.templateData));
3559
- template = replaceAll(template, "(", "%28");
3560
- template = replaceAll(template, ")", "%29");
3642
+ const template = this.encodeTemplateData(this.templateData);
3561
3643
  const appClipUrl = this.customAppClipUrl ? `${this.customAppClipUrl}&template=${template}` : `https://appclip.apple.com/id?p=org.reclaimprotocol.app.clip&template=${template}`;
3562
3644
  logger10.info("Redirecting to iOS app clip: " + appClipUrl);
3563
- const verifierUrl = `https://share.reclaimprotocol.org/verifier/?template=${template}`;
3645
+ const verifierUrl = `${this.appSharePageUrl}/?template=${template}`;
3564
3646
  window.location.href = appClipUrl;
3565
3647
  setTimeout(() => {
3566
3648
  window.location.href = verifierUrl;
@@ -3643,7 +3725,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3643
3725
  * ```
3644
3726
  */
3645
3727
  startSession(_0) {
3646
- return __async(this, arguments, function* ({ onSuccess, onError, verificationConfig }) {
3728
+ return __async(this, arguments, function* ({ onSuccess, onError }) {
3647
3729
  if (!this.sessionId) {
3648
3730
  const message = "Session can't be started due to undefined value of sessionId";
3649
3731
  logger10.info(message);
@@ -3690,6 +3772,8 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3690
3772
  }
3691
3773
  this.clearInterval();
3692
3774
  (_b = this.modal) == null ? void 0 : _b.close();
3775
+ this.closePortalTab();
3776
+ this.closeEmbeddedFlow();
3693
3777
  }
3694
3778
  } else {
3695
3779
  if (statusUrlResponse.session.statusV2 === "PROOF_SUBMISSION_FAILED" /* PROOF_SUBMISSION_FAILED */) {
@@ -3702,6 +3786,8 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3702
3786
  }
3703
3787
  this.clearInterval();
3704
3788
  (_d = this.modal) == null ? void 0 : _d.close();
3789
+ this.closePortalTab();
3790
+ this.closeEmbeddedFlow();
3705
3791
  }
3706
3792
  }
3707
3793
  } catch (e) {
@@ -3710,6 +3796,8 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3710
3796
  }
3711
3797
  this.clearInterval();
3712
3798
  (_e = this.modal) == null ? void 0 : _e.close();
3799
+ this.closePortalTab();
3800
+ this.closeEmbeddedFlow();
3713
3801
  }
3714
3802
  }), sessionUpdatePollingInterval);
3715
3803
  this.intervals.set(this.sessionId, interval);
@@ -3752,6 +3840,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
3752
3840
  // Annotate the CommonJS export names for ESM import in node:
3753
3841
  0 && (module.exports = {
3754
3842
  ReclaimProofRequest,
3843
+ TeeVerificationError,
3755
3844
  assertValidProofsByHash,
3756
3845
  assertValidateProof,
3757
3846
  assertVerifiedProof,