@lumiapassport/ui-kit 1.4.9 → 1.4.13

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.
@@ -14,7 +14,7 @@
14
14
  <meta http-equiv="X-Content-Type-Options" content="nosniff" />
15
15
  <meta http-equiv="Referrer-Policy" content="strict-origin-when-cross-origin" />
16
16
 
17
- <title>Lumia Passport Secure Wallet - iframe version 1.4.9</title>
17
+ <title>Lumia Passport Secure Wallet - iframe version 1.4.13</title>
18
18
 
19
19
  <!-- Styles will be injected by build process -->
20
20
  <style>
@@ -2597,7 +2597,6 @@ var SigningManager = class extends TokenRefreshApiClient {
2597
2597
  this.wasmLoaded = false;
2598
2598
  this.storage = new StorageManager();
2599
2599
  this.trustedApps = new TrustedAppsManager();
2600
- console.log("[iframe][Sign] Initialized with TSS URL:", this.tssUrl);
2601
2600
  }
2602
2601
  /**
2603
2602
  * Initialize WASM module
@@ -2607,7 +2606,6 @@ var SigningManager = class extends TokenRefreshApiClient {
2607
2606
  try {
2608
2607
  await dkls23_wasm_default();
2609
2608
  this.wasmLoaded = true;
2610
- console.log("[iframe][Sign] \u2705 WASM module loaded");
2611
2609
  globalThis.__tss_wasm_api__ = dkls23_wasm_exports;
2612
2610
  } catch (error) {
2613
2611
  console.error("[iframe][Sign] Failed to load WASM:", error);
@@ -2621,14 +2619,10 @@ var SigningManager = class extends TokenRefreshApiClient {
2621
2619
  if (!this.wasmLoaded) {
2622
2620
  await this.initialize();
2623
2621
  }
2624
- console.log("[iframe][Sign] Signing transaction for user:", userId);
2625
- console.log("[iframe][Sign] Transaction details:", transaction);
2626
- console.log("[iframe][Sign] Loading keyshare...");
2627
2622
  const keyshareData = this.storage.loadKeyshare(userId);
2628
2623
  if (!keyshareData) {
2629
2624
  throw new Error("No keyshare found. Please complete DKG first.");
2630
2625
  }
2631
- console.log("[iframe][Sign] \u2713 Keyshare loaded");
2632
2626
  const projectInfo = {
2633
2627
  id: projectId,
2634
2628
  name: "Application",
@@ -2637,12 +2631,8 @@ var SigningManager = class extends TokenRefreshApiClient {
2637
2631
  domains: [origin]
2638
2632
  };
2639
2633
  const isTrusted = this.trustedApps.isTrusted(userId, projectId, origin);
2640
- console.log("[iframe][Sign] App trusted status:", isTrusted);
2641
2634
  if (!isTrusted) {
2642
- console.log("[iframe][Sign] Assessing risk...");
2643
2635
  const risk = await this.assessRisk(transaction);
2644
- console.log("[iframe][Sign] \u2713 Risk assessment:", risk);
2645
- console.log("[iframe][Sign] Showing confirmation dialog...");
2646
2636
  const confirmResult = await this.showConfirmationDialog(
2647
2637
  userId,
2648
2638
  projectId,
@@ -2651,21 +2641,15 @@ var SigningManager = class extends TokenRefreshApiClient {
2651
2641
  transaction,
2652
2642
  risk
2653
2643
  );
2654
- console.log("[iframe][Sign] Confirmation result:", confirmResult);
2655
2644
  if (!confirmResult.confirmed) {
2656
2645
  throw new Error("User rejected transaction");
2657
2646
  }
2658
2647
  if (confirmResult.trustApp) {
2659
2648
  this.trustedApps.addTrustedApp(userId, projectId, origin);
2660
2649
  }
2661
- } else {
2662
- console.log("[iframe][Sign] \u2705 App is trusted, skipping confirmation");
2663
2650
  }
2664
2651
  const digest32 = transaction.digest32 || this.computeTransactionHash(transaction);
2665
- console.log("[iframe][Sign] Using digest for signing:", digest32);
2666
- console.log("[iframe][Sign] Digest was pre-computed:", !!transaction.digest32);
2667
2652
  const signature = await this.performMPCSigning(userId, keyshareData, digest32, projectId, accessToken);
2668
- console.log("[iframe][Sign] \u2705 Transaction signed");
2669
2653
  return signature;
2670
2654
  }
2671
2655
  /**
@@ -2678,7 +2662,6 @@ var SigningManager = class extends TokenRefreshApiClient {
2678
2662
  const digestBytes = this.hexToBytes(digestHex);
2679
2663
  const digestB64 = btoa(String.fromCharCode(...digestBytes));
2680
2664
  const CHAIN_PATH = "m";
2681
- console.log("[iframe][Sign] Starting MPC signing protocol...");
2682
2665
  const clientSignStartResult = sign_start(keyshare, digestB64, CHAIN_PATH);
2683
2666
  if (!Array.isArray(clientSignStartResult) || clientSignStartResult.length < 2) {
2684
2667
  throw new Error("Invalid sign_start result format");
@@ -2737,54 +2720,24 @@ var SigningManager = class extends TokenRefreshApiClient {
2737
2720
  async showConfirmationDialog(userId, projectId, project, origin, transaction, risk) {
2738
2721
  this.showIframe();
2739
2722
  return new Promise((resolve) => {
2740
- console.log("[iframe][Sign] Creating modal element...");
2741
2723
  const modal = this.createConfirmationModal(userId, projectId, project, origin, transaction, risk);
2742
- console.log("[iframe][Sign] Modal created:", modal);
2743
2724
  const confirmBtn = modal.querySelector(".confirm-btn");
2744
2725
  const cancelBtn = modal.querySelector(".cancel-btn");
2745
2726
  const trustCheckbox = modal.querySelector(".trust-app-checkbox");
2746
- console.log("[iframe][Sign] Found elements:", {
2747
- confirmBtn: !!confirmBtn,
2748
- cancelBtn: !!cancelBtn,
2749
- trustCheckbox: !!trustCheckbox
2750
- });
2751
2727
  confirmBtn?.addEventListener("click", (e) => {
2752
- console.log("[iframe][Sign] Confirm button clicked, isTrusted:", e.isTrusted);
2753
2728
  if (e.isTrusted) {
2754
2729
  const trustApp = trustCheckbox?.checked || false;
2755
- console.log("[iframe][Sign] Trust app checkbox:", trustApp);
2756
2730
  modal.remove();
2757
2731
  this.hideIframe();
2758
2732
  resolve({ confirmed: true, trustApp });
2759
2733
  }
2760
2734
  });
2761
2735
  cancelBtn?.addEventListener("click", () => {
2762
- console.log("[iframe][Sign] Cancel button clicked");
2763
2736
  modal.remove();
2764
2737
  this.hideIframe();
2765
2738
  resolve({ confirmed: false, trustApp: false });
2766
2739
  });
2767
- console.log("[iframe][Sign] Appending modal to body...");
2768
2740
  document.body.appendChild(modal);
2769
- console.log("[iframe][Sign] Modal appended, children count:", document.body.children.length);
2770
- const computedStyle = window.getComputedStyle(modal);
2771
- const rect = modal.getBoundingClientRect();
2772
- console.log("[iframe][Sign] Modal computed styles:", {
2773
- display: computedStyle.display,
2774
- position: computedStyle.position,
2775
- zIndex: computedStyle.zIndex,
2776
- visibility: computedStyle.visibility,
2777
- opacity: computedStyle.opacity,
2778
- width: computedStyle.width,
2779
- height: computedStyle.height
2780
- });
2781
- console.log("[iframe][Sign] Modal position (rect):", {
2782
- top: rect.top,
2783
- left: rect.left,
2784
- width: rect.width,
2785
- height: rect.height,
2786
- inViewport: rect.top >= 0 && rect.left >= 0 && rect.bottom <= window.innerHeight && rect.right <= window.innerWidth
2787
- });
2788
2741
  });
2789
2742
  }
2790
2743
  /**
@@ -2952,7 +2905,6 @@ var SigningManager = class extends TokenRefreshApiClient {
2952
2905
  showIframe() {
2953
2906
  if (window.parent !== window) {
2954
2907
  window.parent.postMessage({ type: "LUMIA_PASSPORT_SHOW_IFRAME", timestamp: Date.now() }, "*");
2955
- console.log("[iframe][Sign] Requested parent to show iframe");
2956
2908
  }
2957
2909
  }
2958
2910
  /**
@@ -2961,7 +2913,6 @@ var SigningManager = class extends TokenRefreshApiClient {
2961
2913
  hideIframe() {
2962
2914
  if (window.parent !== window) {
2963
2915
  window.parent.postMessage({ type: "LUMIA_PASSPORT_HIDE_IFRAME", timestamp: Date.now() }, "*");
2964
- console.log("[iframe][Sign] Requested parent to hide iframe");
2965
2916
  }
2966
2917
  }
2967
2918
  };
@@ -3649,7 +3600,7 @@ var BackupManager = class {
3649
3600
  };
3650
3601
 
3651
3602
  // src/iframe/main.ts
3652
- var IFRAME_VERSION = "1.4.9";
3603
+ var IFRAME_VERSION = "1.4.13";
3653
3604
  var IframeWallet = class {
3654
3605
  constructor() {
3655
3606
  console.log("=".repeat(60));
@@ -3665,13 +3616,9 @@ var IframeWallet = class {
3665
3616
  this.backupManager = new BackupManager();
3666
3617
  }
3667
3618
  async initialize() {
3668
- console.log("[iframe] Initializing Lumia Passport Secure Wallet...");
3669
- console.log("[iframe] Origin:", window.location.origin);
3670
- console.log("[iframe] Expected: auth.lumiapassport.com");
3671
3619
  if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1" && !window.location.hostname.includes("lumiapassport.com")) {
3672
3620
  console.warn("[iframe] \u26A0\uFE0F Running on unexpected origin!");
3673
3621
  }
3674
- console.log("[iframe] Loading WASM modules...");
3675
3622
  await Promise.all([
3676
3623
  this.dkgManager.initialize(),
3677
3624
  this.signingManager.initialize()
@@ -3690,17 +3637,9 @@ var IframeWallet = class {
3690
3637
  // Initial broadcast, will validate origin in subsequent messages
3691
3638
  );
3692
3639
  }
3693
- console.log("[iframe] \u2705 Wallet ready and listening for messages");
3694
3640
  }
3695
3641
  async handleMessage(message, origin) {
3696
3642
  const { type, messageId, projectId } = message;
3697
- console.log(`[iframe] \u{1F4E8} Message received:`, {
3698
- type,
3699
- messageId: messageId.substring(0, 20),
3700
- origin: origin.substring(0, 30),
3701
- hasData: !!message.data,
3702
- dataKeys: message.data ? Object.keys(message.data) : []
3703
- });
3704
3643
  try {
3705
3644
  switch (type) {
3706
3645
  case "SDK_AUTH":
@@ -3929,9 +3868,7 @@ var IframeWallet = class {
3929
3868
  console.error("[iframe] GET_TRUSTED_APPS: Session validation failed");
3930
3869
  throw new Error("Invalid session");
3931
3870
  }
3932
- console.log("[iframe] GET_TRUSTED_APPS: Session validated, fetching apps...");
3933
3871
  const trustedApps = this.trustedApps.getTrustedAppsForUser(userId);
3934
- console.log(`[iframe] GET_TRUSTED_APPS: Found ${trustedApps.length} trusted apps`);
3935
3872
  this.messenger.sendResponse(
3936
3873
  messageId,
3937
3874
  {
@@ -3950,7 +3887,6 @@ var IframeWallet = class {
3950
3887
  console.error("[iframe] REMOVE_TRUSTED_APP: Session validation failed");
3951
3888
  throw new Error("Invalid session");
3952
3889
  }
3953
- console.log("[iframe] REMOVE_TRUSTED_APP: Session validated, removing app...");
3954
3890
  this.trustedApps.removeTrustedApp(userId, projectId, appOrigin);
3955
3891
  this.messenger.sendResponse(
3956
3892
  messageId,
@@ -3981,10 +3917,8 @@ var IframeWallet = class {
3981
3917
  this.messenger.sendError(messageId, "Invalid session", origin);
3982
3918
  return;
3983
3919
  }
3984
- console.log("[iframe] CREATE_BACKUP: Session validated, creating backup...");
3985
3920
  try {
3986
3921
  const result = await this.backupManager.createBackup(userId, backupRequest, accessToken);
3987
- console.log("[iframe] CREATE_BACKUP: Backup result:", result);
3988
3922
  this.messenger.sendResponse(
3989
3923
  messageId,
3990
3924
  {
@@ -4055,10 +3989,8 @@ var IframeWallet = class {
4055
3989
  this.messenger.sendError(messageId, "Invalid session", origin);
4056
3990
  return;
4057
3991
  }
4058
- console.log("[iframe] RESTORE_BACKUP: Session validated, restoring backup...");
4059
3992
  try {
4060
3993
  const backupData = await this.backupManager.restoreFromServer(userId, password, accessToken);
4061
- console.log("[iframe] RESTORE_BACKUP: Restore successful");
4062
3994
  this.messenger.sendResponse(
4063
3995
  messageId,
4064
3996
  {
@@ -4109,10 +4041,8 @@ var IframeWallet = class {
4109
4041
  this.messenger.sendError(messageId, "Invalid session", origin);
4110
4042
  return;
4111
4043
  }
4112
- console.log("[iframe] RESTORE_FROM_FILE: Session validated, restoring from file...");
4113
4044
  try {
4114
4045
  const backupData = await this.backupManager.restoreFromLocalFile(fileContent, userId, password);
4115
- console.log("[iframe] RESTORE_FROM_FILE: Restore successful");
4116
4046
  this.messenger.sendResponse(
4117
4047
  messageId,
4118
4048
  {
@@ -4158,10 +4088,8 @@ var IframeWallet = class {
4158
4088
  this.messenger.sendError(messageId, "Invalid session", origin);
4159
4089
  return;
4160
4090
  }
4161
- console.log("[iframe] ENCRYPT_BACKUP_DATA: Session validated, encrypting backup data...");
4162
4091
  try {
4163
4092
  const encryptedData = await this.backupManager.encryptBackupData(userId, password);
4164
- console.log("[iframe] ENCRYPT_BACKUP_DATA: Encryption successful");
4165
4093
  this.messenger.sendResponse(
4166
4094
  messageId,
4167
4095
  {
@@ -4221,7 +4149,6 @@ var IframeWallet = class {
4221
4149
  hasSession,
4222
4150
  timestamp: Date.now()
4223
4151
  };
4224
- console.log("[iframe] \u{1F4E4} Sending WALLET_READY status:", status);
4225
4152
  if (window.parent) {
4226
4153
  window.parent.postMessage(
4227
4154
  {