@lumiapassport/ui-kit 1.0.1 → 1.1.0

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.cjs CHANGED
@@ -1415,7 +1415,7 @@ async function deriveBackupPasswordFromPasskey(userId, credentialId) {
1415
1415
  }
1416
1416
  function getBackupStatus(userId) {
1417
1417
  const storage = typeof window !== "undefined" ? window.localStorage : void 0;
1418
- const statusData = storage?.getItem(`lumia.backup.status.${userId}`);
1418
+ const statusData = storage?.getItem(`lumia-passport.backup.status.${userId}`);
1419
1419
  if (statusData) {
1420
1420
  try {
1421
1421
  return JSON.parse(statusData);
@@ -1429,14 +1429,14 @@ function updateBackupStatus(userId, method, status) {
1429
1429
  if (!storage) return;
1430
1430
  const current = getBackupStatus(userId);
1431
1431
  current[method] = { ...current[method], ...status };
1432
- storage.setItem(`lumia.backup.status.${userId}`, JSON.stringify(current));
1432
+ storage.setItem(`lumia-passport.backup.status.${userId}`, JSON.stringify(current));
1433
1433
  if (typeof window !== "undefined") {
1434
- window.dispatchEvent(new CustomEvent("lumia-backup-status-changed", { detail: { method, status, currentStatus: current } }));
1434
+ window.dispatchEvent(new CustomEvent("lumia-passport-backup-status-changed", { detail: { method, status, currentStatus: current } }));
1435
1435
  }
1436
1436
  }
1437
1437
  function clearBackupStatus(userId) {
1438
1438
  const storage = typeof window !== "undefined" ? window.localStorage : void 0;
1439
- storage?.removeItem(`lumia.backup.status.${userId}`);
1439
+ storage?.removeItem(`lumia-passport.backup.status.${userId}`);
1440
1440
  }
1441
1441
  async function checkServerBackupAvailability() {
1442
1442
  try {
@@ -2410,7 +2410,7 @@ var init_iframe_manager = __esm({
2410
2410
  const response = await this.sendMessage("SDK_AUTH", {
2411
2411
  projectId: this.projectId
2412
2412
  });
2413
- if (response.type === "SDK_AUTH_SUCCESS") {
2413
+ if (response.type === "LUMIA_PASSPORT_SDK_AUTH_SUCCESS") {
2414
2414
  this.sessionToken = response.sessionToken;
2415
2415
  this.log("[IframeManager] \u2705 SDK authenticated, session token received");
2416
2416
  } else {
@@ -2426,20 +2426,21 @@ var init_iframe_manager = __esm({
2426
2426
  return;
2427
2427
  }
2428
2428
  const validIframeTypes = [
2429
- "IFRAME_READY",
2430
- "SHOW_IFRAME",
2431
- "HIDE_IFRAME",
2432
- "SDK_AUTH_SUCCESS",
2433
- "AUTH_SUCCESS",
2434
- "DKG_SUCCESS",
2435
- "SIGNATURE",
2436
- "ADDRESS",
2437
- "KEYSHARE_STATUS",
2438
- "TRUSTED_APPS_LIST",
2439
- "TRUSTED_APP_REMOVED",
2440
- "REQUEST_NEW_TOKEN",
2441
- "RESPONSE",
2442
- "ERROR"
2429
+ "LUMIA_PASSPORT_IFRAME_READY",
2430
+ "LUMIA_PASSPORT_SHOW_IFRAME",
2431
+ "LUMIA_PASSPORT_HIDE_IFRAME",
2432
+ "LUMIA_PASSPORT_SDK_AUTH_SUCCESS",
2433
+ "LUMIA_PASSPORT_AUTH_SUCCESS",
2434
+ "LUMIA_PASSPORT_DKG_SUCCESS",
2435
+ "LUMIA_PASSPORT_SIGNATURE",
2436
+ "LUMIA_PASSPORT_ADDRESS",
2437
+ "LUMIA_PASSPORT_KEYSHARE_STATUS",
2438
+ "LUMIA_PASSPORT_TRUSTED_APPS_LIST",
2439
+ "LUMIA_PASSPORT_TRUSTED_APP_REMOVED",
2440
+ "LUMIA_PASSPORT_REQUEST_NEW_TOKEN",
2441
+ "LUMIA_PASSPORT_TOKEN_REFRESHED",
2442
+ "LUMIA_PASSPORT_RESPONSE",
2443
+ "LUMIA_PASSPORT_ERROR"
2443
2444
  ];
2444
2445
  if (!validIframeTypes.includes(message.type) && !message.messageId) {
2445
2446
  return;
@@ -2449,24 +2450,24 @@ var init_iframe_manager = __esm({
2449
2450
  this.log("[IframeManager] \u26A0\uFE0F Ignored message from invalid origin:", event.origin, "expected:", iframeOrigin);
2450
2451
  return;
2451
2452
  }
2452
- if (message.type === "IFRAME_READY") {
2453
- this.log("[IframeManager] \u{1F4E8} Received IFRAME_READY");
2453
+ if (message.type === "LUMIA_PASSPORT_IFRAME_READY") {
2454
+ this.log("[IframeManager] \u{1F4E8} Received LUMIA_PASSPORT_IFRAME_READY");
2454
2455
  this.isReady = true;
2455
2456
  this.readyResolve();
2456
2457
  return;
2457
2458
  }
2458
- if (message.type === "SHOW_IFRAME") {
2459
- this.log("[IframeManager] \u{1F4E8} Received SHOW_IFRAME");
2459
+ if (message.type === "LUMIA_PASSPORT_SHOW_IFRAME") {
2460
+ this.log("[IframeManager] \u{1F4E8} Received LUMIA_PASSPORT_SHOW_IFRAME");
2460
2461
  this.showIframe();
2461
2462
  return;
2462
2463
  }
2463
- if (message.type === "HIDE_IFRAME") {
2464
- this.log("[IframeManager] \u{1F4E8} Received HIDE_IFRAME");
2464
+ if (message.type === "LUMIA_PASSPORT_HIDE_IFRAME") {
2465
+ this.log("[IframeManager] \u{1F4E8} Received LUMIA_PASSPORT_HIDE_IFRAME");
2465
2466
  this.hideIframe();
2466
2467
  return;
2467
2468
  }
2468
- if (message.type === "REQUEST_NEW_TOKEN") {
2469
- this.log("[IframeManager] \u{1F4E8} Received REQUEST_NEW_TOKEN");
2469
+ if (message.type === "LUMIA_PASSPORT_REQUEST_NEW_TOKEN") {
2470
+ this.log("[IframeManager] \u{1F4E8} Received LUMIA_PASSPORT_REQUEST_NEW_TOKEN");
2470
2471
  this.handleTokenRefreshRequest(message).catch((error) => {
2471
2472
  this.log("[IframeManager] \u274C Token refresh error:", error);
2472
2473
  });
@@ -2476,7 +2477,7 @@ var init_iframe_manager = __esm({
2476
2477
  const pending = this.pendingRequests.get(message.messageId);
2477
2478
  if (pending) {
2478
2479
  this.pendingRequests.delete(message.messageId);
2479
- if (message.type === "ERROR") {
2480
+ if (message.type === "LUMIA_PASSPORT_ERROR") {
2480
2481
  pending.reject(new Error(message.error || "Unknown error"));
2481
2482
  } else {
2482
2483
  pending.resolve(message.data || message);
@@ -2499,7 +2500,7 @@ var init_iframe_manager = __esm({
2499
2500
  const iframeOrigin = new URL(this.iframeUrl).origin;
2500
2501
  this.iframe.contentWindow.postMessage(
2501
2502
  {
2502
- type: "TOKEN_REFRESHED",
2503
+ type: "LUMIA_PASSPORT_TOKEN_REFRESHED",
2503
2504
  messageId: message.messageId,
2504
2505
  accessToken: newAccessToken,
2505
2506
  timestamp: Date.now()
@@ -2514,7 +2515,7 @@ var init_iframe_manager = __esm({
2514
2515
  const iframeOrigin = new URL(this.iframeUrl).origin;
2515
2516
  this.iframe.contentWindow.postMessage(
2516
2517
  {
2517
- type: "TOKEN_REFRESHED",
2518
+ type: "LUMIA_PASSPORT_TOKEN_REFRESHED",
2518
2519
  messageId: message.messageId,
2519
2520
  error: "Token refresh failed",
2520
2521
  timestamp: Date.now()
@@ -2529,7 +2530,7 @@ var init_iframe_manager = __esm({
2529
2530
  const iframeOrigin = new URL(this.iframeUrl).origin;
2530
2531
  this.iframe.contentWindow.postMessage(
2531
2532
  {
2532
- type: "TOKEN_REFRESHED",
2533
+ type: "LUMIA_PASSPORT_TOKEN_REFRESHED",
2533
2534
  messageId: message.messageId,
2534
2535
  error: error instanceof Error ? error.message : "Unknown error",
2535
2536
  timestamp: Date.now()
@@ -2652,7 +2653,7 @@ var init_iframe_manager = __esm({
2652
2653
  userId,
2653
2654
  projectId: this.projectId
2654
2655
  });
2655
- if (response.type === "AUTH_SUCCESS") {
2656
+ if (response.type === "LUMIA_PASSPORT_AUTH_SUCCESS") {
2656
2657
  return {
2657
2658
  userId: response.userId,
2658
2659
  address: response.address
@@ -2671,7 +2672,7 @@ var init_iframe_manager = __esm({
2671
2672
  accessToken
2672
2673
  // Pass access token for TSS API authentication
2673
2674
  });
2674
- if (response.type === "DKG_SUCCESS") {
2675
+ if (response.type === "LUMIA_PASSPORT_DKG_SUCCESS") {
2675
2676
  return response.ownerAddress;
2676
2677
  }
2677
2678
  throw new Error("DKG failed");
@@ -2688,7 +2689,7 @@ var init_iframe_manager = __esm({
2688
2689
  accessToken
2689
2690
  // Pass access token for TSS API authentication
2690
2691
  });
2691
- if (response.type === "SIGNATURE") {
2692
+ if (response.type === "LUMIA_PASSPORT_SIGNATURE") {
2692
2693
  return response.signature;
2693
2694
  }
2694
2695
  throw new Error("Transaction signing failed");
@@ -2701,7 +2702,7 @@ var init_iframe_manager = __esm({
2701
2702
  const response = await this.sendMessage("GET_ADDRESS", {
2702
2703
  userId
2703
2704
  });
2704
- if (response.type === "ADDRESS") {
2705
+ if (response.type === "LUMIA_PASSPORT_ADDRESS") {
2705
2706
  return response.address;
2706
2707
  }
2707
2708
  return void 0;
@@ -2714,7 +2715,7 @@ var init_iframe_manager = __esm({
2714
2715
  const response = await this.sendMessage("CHECK_KEYSHARE", {
2715
2716
  userId
2716
2717
  });
2717
- if (response.type === "KEYSHARE_STATUS") {
2718
+ if (response.type === "LUMIA_PASSPORT_KEYSHARE_STATUS") {
2718
2719
  return {
2719
2720
  hasKeyshare: response.hasKeyshare,
2720
2721
  address: response.address
@@ -2730,7 +2731,7 @@ var init_iframe_manager = __esm({
2730
2731
  const response = await this.sendMessage("GET_TRUSTED_APPS", {
2731
2732
  userId
2732
2733
  });
2733
- if (response.type === "TRUSTED_APPS_LIST") {
2734
+ if (response.type === "LUMIA_PASSPORT_TRUSTED_APPS_LIST") {
2734
2735
  return response.apps || [];
2735
2736
  }
2736
2737
  return [];
@@ -2745,7 +2746,7 @@ var init_iframe_manager = __esm({
2745
2746
  projectId,
2746
2747
  appOrigin: origin
2747
2748
  });
2748
- if (response.type === "TRUSTED_APP_REMOVED") {
2749
+ if (response.type === "LUMIA_PASSPORT_TRUSTED_APP_REMOVED") {
2749
2750
  return response.success;
2750
2751
  }
2751
2752
  return false;
@@ -5989,7 +5990,7 @@ function BackupForm({ userId, onBackupSuccess }) {
5989
5990
  setTimeout(() => {
5990
5991
  if (typeof window !== "undefined") {
5991
5992
  window.dispatchEvent(
5992
- new CustomEvent("lumia-backup-status-changed", {
5993
+ new CustomEvent("lumia-passport-backup-status-changed", {
5993
5994
  detail: { method, success: true }
5994
5995
  })
5995
5996
  );
@@ -9018,7 +9019,7 @@ function KeyshareBackup({ userId, onClose, onBackupSuccess }) {
9018
9019
  setTimeout(() => {
9019
9020
  if (typeof window !== "undefined") {
9020
9021
  window.dispatchEvent(
9021
- new CustomEvent("lumia-backup-status-changed", {
9022
+ new CustomEvent("lumia-passport-backup-status-changed", {
9022
9023
  detail: { method, success: true }
9023
9024
  })
9024
9025
  );