@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/iframe/main.js +18 -18
- package/dist/iframe/main.js.map +1 -1
- package/dist/index.cjs +41 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -40
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1403,7 +1403,7 @@ async function deriveBackupPasswordFromPasskey(userId, credentialId) {
|
|
|
1403
1403
|
}
|
|
1404
1404
|
function getBackupStatus(userId) {
|
|
1405
1405
|
const storage = typeof window !== "undefined" ? window.localStorage : void 0;
|
|
1406
|
-
const statusData = storage?.getItem(`lumia.backup.status.${userId}`);
|
|
1406
|
+
const statusData = storage?.getItem(`lumia-passport.backup.status.${userId}`);
|
|
1407
1407
|
if (statusData) {
|
|
1408
1408
|
try {
|
|
1409
1409
|
return JSON.parse(statusData);
|
|
@@ -1417,14 +1417,14 @@ function updateBackupStatus(userId, method, status) {
|
|
|
1417
1417
|
if (!storage) return;
|
|
1418
1418
|
const current = getBackupStatus(userId);
|
|
1419
1419
|
current[method] = { ...current[method], ...status };
|
|
1420
|
-
storage.setItem(`lumia.backup.status.${userId}`, JSON.stringify(current));
|
|
1420
|
+
storage.setItem(`lumia-passport.backup.status.${userId}`, JSON.stringify(current));
|
|
1421
1421
|
if (typeof window !== "undefined") {
|
|
1422
|
-
window.dispatchEvent(new CustomEvent("lumia-backup-status-changed", { detail: { method, status, currentStatus: current } }));
|
|
1422
|
+
window.dispatchEvent(new CustomEvent("lumia-passport-backup-status-changed", { detail: { method, status, currentStatus: current } }));
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
1425
|
function clearBackupStatus(userId) {
|
|
1426
1426
|
const storage = typeof window !== "undefined" ? window.localStorage : void 0;
|
|
1427
|
-
storage?.removeItem(`lumia.backup.status.${userId}`);
|
|
1427
|
+
storage?.removeItem(`lumia-passport.backup.status.${userId}`);
|
|
1428
1428
|
}
|
|
1429
1429
|
async function checkServerBackupAvailability() {
|
|
1430
1430
|
try {
|
|
@@ -2411,7 +2411,7 @@ var init_iframe_manager = __esm({
|
|
|
2411
2411
|
const response = await this.sendMessage("SDK_AUTH", {
|
|
2412
2412
|
projectId: this.projectId
|
|
2413
2413
|
});
|
|
2414
|
-
if (response.type === "
|
|
2414
|
+
if (response.type === "LUMIA_PASSPORT_SDK_AUTH_SUCCESS") {
|
|
2415
2415
|
this.sessionToken = response.sessionToken;
|
|
2416
2416
|
this.log("[IframeManager] \u2705 SDK authenticated, session token received");
|
|
2417
2417
|
} else {
|
|
@@ -2427,20 +2427,21 @@ var init_iframe_manager = __esm({
|
|
|
2427
2427
|
return;
|
|
2428
2428
|
}
|
|
2429
2429
|
const validIframeTypes = [
|
|
2430
|
-
"
|
|
2431
|
-
"
|
|
2432
|
-
"
|
|
2433
|
-
"
|
|
2434
|
-
"
|
|
2435
|
-
"
|
|
2436
|
-
"
|
|
2437
|
-
"
|
|
2438
|
-
"
|
|
2439
|
-
"
|
|
2440
|
-
"
|
|
2441
|
-
"
|
|
2442
|
-
"
|
|
2443
|
-
"
|
|
2430
|
+
"LUMIA_PASSPORT_IFRAME_READY",
|
|
2431
|
+
"LUMIA_PASSPORT_SHOW_IFRAME",
|
|
2432
|
+
"LUMIA_PASSPORT_HIDE_IFRAME",
|
|
2433
|
+
"LUMIA_PASSPORT_SDK_AUTH_SUCCESS",
|
|
2434
|
+
"LUMIA_PASSPORT_AUTH_SUCCESS",
|
|
2435
|
+
"LUMIA_PASSPORT_DKG_SUCCESS",
|
|
2436
|
+
"LUMIA_PASSPORT_SIGNATURE",
|
|
2437
|
+
"LUMIA_PASSPORT_ADDRESS",
|
|
2438
|
+
"LUMIA_PASSPORT_KEYSHARE_STATUS",
|
|
2439
|
+
"LUMIA_PASSPORT_TRUSTED_APPS_LIST",
|
|
2440
|
+
"LUMIA_PASSPORT_TRUSTED_APP_REMOVED",
|
|
2441
|
+
"LUMIA_PASSPORT_REQUEST_NEW_TOKEN",
|
|
2442
|
+
"LUMIA_PASSPORT_TOKEN_REFRESHED",
|
|
2443
|
+
"LUMIA_PASSPORT_RESPONSE",
|
|
2444
|
+
"LUMIA_PASSPORT_ERROR"
|
|
2444
2445
|
];
|
|
2445
2446
|
if (!validIframeTypes.includes(message.type) && !message.messageId) {
|
|
2446
2447
|
return;
|
|
@@ -2450,24 +2451,24 @@ var init_iframe_manager = __esm({
|
|
|
2450
2451
|
this.log("[IframeManager] \u26A0\uFE0F Ignored message from invalid origin:", event.origin, "expected:", iframeOrigin);
|
|
2451
2452
|
return;
|
|
2452
2453
|
}
|
|
2453
|
-
if (message.type === "
|
|
2454
|
-
this.log("[IframeManager] \u{1F4E8} Received
|
|
2454
|
+
if (message.type === "LUMIA_PASSPORT_IFRAME_READY") {
|
|
2455
|
+
this.log("[IframeManager] \u{1F4E8} Received LUMIA_PASSPORT_IFRAME_READY");
|
|
2455
2456
|
this.isReady = true;
|
|
2456
2457
|
this.readyResolve();
|
|
2457
2458
|
return;
|
|
2458
2459
|
}
|
|
2459
|
-
if (message.type === "
|
|
2460
|
-
this.log("[IframeManager] \u{1F4E8} Received
|
|
2460
|
+
if (message.type === "LUMIA_PASSPORT_SHOW_IFRAME") {
|
|
2461
|
+
this.log("[IframeManager] \u{1F4E8} Received LUMIA_PASSPORT_SHOW_IFRAME");
|
|
2461
2462
|
this.showIframe();
|
|
2462
2463
|
return;
|
|
2463
2464
|
}
|
|
2464
|
-
if (message.type === "
|
|
2465
|
-
this.log("[IframeManager] \u{1F4E8} Received
|
|
2465
|
+
if (message.type === "LUMIA_PASSPORT_HIDE_IFRAME") {
|
|
2466
|
+
this.log("[IframeManager] \u{1F4E8} Received LUMIA_PASSPORT_HIDE_IFRAME");
|
|
2466
2467
|
this.hideIframe();
|
|
2467
2468
|
return;
|
|
2468
2469
|
}
|
|
2469
|
-
if (message.type === "
|
|
2470
|
-
this.log("[IframeManager] \u{1F4E8} Received
|
|
2470
|
+
if (message.type === "LUMIA_PASSPORT_REQUEST_NEW_TOKEN") {
|
|
2471
|
+
this.log("[IframeManager] \u{1F4E8} Received LUMIA_PASSPORT_REQUEST_NEW_TOKEN");
|
|
2471
2472
|
this.handleTokenRefreshRequest(message).catch((error) => {
|
|
2472
2473
|
this.log("[IframeManager] \u274C Token refresh error:", error);
|
|
2473
2474
|
});
|
|
@@ -2477,7 +2478,7 @@ var init_iframe_manager = __esm({
|
|
|
2477
2478
|
const pending = this.pendingRequests.get(message.messageId);
|
|
2478
2479
|
if (pending) {
|
|
2479
2480
|
this.pendingRequests.delete(message.messageId);
|
|
2480
|
-
if (message.type === "
|
|
2481
|
+
if (message.type === "LUMIA_PASSPORT_ERROR") {
|
|
2481
2482
|
pending.reject(new Error(message.error || "Unknown error"));
|
|
2482
2483
|
} else {
|
|
2483
2484
|
pending.resolve(message.data || message);
|
|
@@ -2500,7 +2501,7 @@ var init_iframe_manager = __esm({
|
|
|
2500
2501
|
const iframeOrigin = new URL(this.iframeUrl).origin;
|
|
2501
2502
|
this.iframe.contentWindow.postMessage(
|
|
2502
2503
|
{
|
|
2503
|
-
type: "
|
|
2504
|
+
type: "LUMIA_PASSPORT_TOKEN_REFRESHED",
|
|
2504
2505
|
messageId: message.messageId,
|
|
2505
2506
|
accessToken: newAccessToken,
|
|
2506
2507
|
timestamp: Date.now()
|
|
@@ -2515,7 +2516,7 @@ var init_iframe_manager = __esm({
|
|
|
2515
2516
|
const iframeOrigin = new URL(this.iframeUrl).origin;
|
|
2516
2517
|
this.iframe.contentWindow.postMessage(
|
|
2517
2518
|
{
|
|
2518
|
-
type: "
|
|
2519
|
+
type: "LUMIA_PASSPORT_TOKEN_REFRESHED",
|
|
2519
2520
|
messageId: message.messageId,
|
|
2520
2521
|
error: "Token refresh failed",
|
|
2521
2522
|
timestamp: Date.now()
|
|
@@ -2530,7 +2531,7 @@ var init_iframe_manager = __esm({
|
|
|
2530
2531
|
const iframeOrigin = new URL(this.iframeUrl).origin;
|
|
2531
2532
|
this.iframe.contentWindow.postMessage(
|
|
2532
2533
|
{
|
|
2533
|
-
type: "
|
|
2534
|
+
type: "LUMIA_PASSPORT_TOKEN_REFRESHED",
|
|
2534
2535
|
messageId: message.messageId,
|
|
2535
2536
|
error: error instanceof Error ? error.message : "Unknown error",
|
|
2536
2537
|
timestamp: Date.now()
|
|
@@ -2653,7 +2654,7 @@ var init_iframe_manager = __esm({
|
|
|
2653
2654
|
userId,
|
|
2654
2655
|
projectId: this.projectId
|
|
2655
2656
|
});
|
|
2656
|
-
if (response.type === "
|
|
2657
|
+
if (response.type === "LUMIA_PASSPORT_AUTH_SUCCESS") {
|
|
2657
2658
|
return {
|
|
2658
2659
|
userId: response.userId,
|
|
2659
2660
|
address: response.address
|
|
@@ -2672,7 +2673,7 @@ var init_iframe_manager = __esm({
|
|
|
2672
2673
|
accessToken
|
|
2673
2674
|
// Pass access token for TSS API authentication
|
|
2674
2675
|
});
|
|
2675
|
-
if (response.type === "
|
|
2676
|
+
if (response.type === "LUMIA_PASSPORT_DKG_SUCCESS") {
|
|
2676
2677
|
return response.ownerAddress;
|
|
2677
2678
|
}
|
|
2678
2679
|
throw new Error("DKG failed");
|
|
@@ -2689,7 +2690,7 @@ var init_iframe_manager = __esm({
|
|
|
2689
2690
|
accessToken
|
|
2690
2691
|
// Pass access token for TSS API authentication
|
|
2691
2692
|
});
|
|
2692
|
-
if (response.type === "
|
|
2693
|
+
if (response.type === "LUMIA_PASSPORT_SIGNATURE") {
|
|
2693
2694
|
return response.signature;
|
|
2694
2695
|
}
|
|
2695
2696
|
throw new Error("Transaction signing failed");
|
|
@@ -2702,7 +2703,7 @@ var init_iframe_manager = __esm({
|
|
|
2702
2703
|
const response = await this.sendMessage("GET_ADDRESS", {
|
|
2703
2704
|
userId
|
|
2704
2705
|
});
|
|
2705
|
-
if (response.type === "
|
|
2706
|
+
if (response.type === "LUMIA_PASSPORT_ADDRESS") {
|
|
2706
2707
|
return response.address;
|
|
2707
2708
|
}
|
|
2708
2709
|
return void 0;
|
|
@@ -2715,7 +2716,7 @@ var init_iframe_manager = __esm({
|
|
|
2715
2716
|
const response = await this.sendMessage("CHECK_KEYSHARE", {
|
|
2716
2717
|
userId
|
|
2717
2718
|
});
|
|
2718
|
-
if (response.type === "
|
|
2719
|
+
if (response.type === "LUMIA_PASSPORT_KEYSHARE_STATUS") {
|
|
2719
2720
|
return {
|
|
2720
2721
|
hasKeyshare: response.hasKeyshare,
|
|
2721
2722
|
address: response.address
|
|
@@ -2731,7 +2732,7 @@ var init_iframe_manager = __esm({
|
|
|
2731
2732
|
const response = await this.sendMessage("GET_TRUSTED_APPS", {
|
|
2732
2733
|
userId
|
|
2733
2734
|
});
|
|
2734
|
-
if (response.type === "
|
|
2735
|
+
if (response.type === "LUMIA_PASSPORT_TRUSTED_APPS_LIST") {
|
|
2735
2736
|
return response.apps || [];
|
|
2736
2737
|
}
|
|
2737
2738
|
return [];
|
|
@@ -2746,7 +2747,7 @@ var init_iframe_manager = __esm({
|
|
|
2746
2747
|
projectId,
|
|
2747
2748
|
appOrigin: origin
|
|
2748
2749
|
});
|
|
2749
|
-
if (response.type === "
|
|
2750
|
+
if (response.type === "LUMIA_PASSPORT_TRUSTED_APP_REMOVED") {
|
|
2750
2751
|
return response.success;
|
|
2751
2752
|
}
|
|
2752
2753
|
return false;
|
|
@@ -5967,7 +5968,7 @@ function BackupForm({ userId, onBackupSuccess }) {
|
|
|
5967
5968
|
setTimeout(() => {
|
|
5968
5969
|
if (typeof window !== "undefined") {
|
|
5969
5970
|
window.dispatchEvent(
|
|
5970
|
-
new CustomEvent("lumia-backup-status-changed", {
|
|
5971
|
+
new CustomEvent("lumia-passport-backup-status-changed", {
|
|
5971
5972
|
detail: { method, success: true }
|
|
5972
5973
|
})
|
|
5973
5974
|
);
|
|
@@ -8996,7 +8997,7 @@ function KeyshareBackup({ userId, onClose, onBackupSuccess }) {
|
|
|
8996
8997
|
setTimeout(() => {
|
|
8997
8998
|
if (typeof window !== "undefined") {
|
|
8998
8999
|
window.dispatchEvent(
|
|
8999
|
-
new CustomEvent("lumia-backup-status-changed", {
|
|
9000
|
+
new CustomEvent("lumia-passport-backup-status-changed", {
|
|
9000
9001
|
detail: { method, success: true }
|
|
9001
9002
|
})
|
|
9002
9003
|
);
|