@lumiapassport/ui-kit 1.9.0 → 1.9.2
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/index.html +1 -1
- package/dist/iframe/main.js +11 -19
- package/dist/iframe/main.js.map +1 -1
- package/dist/index.cjs +66 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -9
- package/dist/index.d.ts +38 -9
- package/dist/index.js +63 -27
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,7 @@ import { UserOperationV07, UserOperationV06 } from '@lumiapassport/core/bundler'
|
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as viem from 'viem';
|
|
6
6
|
import { Chain, Hash as Hash$1, TransactionReceipt } from 'viem';
|
|
7
|
+
export { JwtTokens, LoginResponse, VerifyResponse, getValidTokens, jwtTokenManager, logout } from '@lumiapassport/core/auth';
|
|
7
8
|
import * as wagmi from 'wagmi';
|
|
8
9
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
9
10
|
import { QueryClient } from '@tanstack/react-query';
|
|
@@ -545,9 +546,45 @@ interface UseUserOpStatusReturn {
|
|
|
545
546
|
}
|
|
546
547
|
declare function useUserOpStatus(options?: UseUserOpStatusOptions): UseUserOpStatusReturn;
|
|
547
548
|
|
|
549
|
+
interface UseLogoutReturn {
|
|
550
|
+
logout: () => Promise<void>;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Hook for logging out and disconnecting from Lumia Passport
|
|
554
|
+
* Clears session, tokens, and notifies callbacks
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```tsx
|
|
558
|
+
* function MyComponent() {
|
|
559
|
+
* const { logout } = useLogout();
|
|
560
|
+
*
|
|
561
|
+
* return (
|
|
562
|
+
* <button onClick={logout}>
|
|
563
|
+
* Disconnect
|
|
564
|
+
* </button>
|
|
565
|
+
* );
|
|
566
|
+
* }
|
|
567
|
+
* ```
|
|
568
|
+
*/
|
|
569
|
+
declare function useLogout(): UseLogoutReturn;
|
|
570
|
+
|
|
548
571
|
declare const LUMIA_EXPLORER_URL: string;
|
|
549
572
|
declare const lumiaBeam: Chain;
|
|
550
573
|
|
|
574
|
+
declare global {
|
|
575
|
+
interface Window {
|
|
576
|
+
__LUMIA_CONDITIONAL_UI_ACTIVE__?: boolean;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
interface AuthProvider {
|
|
581
|
+
provider: 'passkey' | 'email' | 'telegram' | 'google' | 'discord' | 'twitter' | 'wallet';
|
|
582
|
+
verified: boolean;
|
|
583
|
+
linkedAt: string;
|
|
584
|
+
lastUsedAt?: string;
|
|
585
|
+
externalId: string;
|
|
586
|
+
}
|
|
587
|
+
|
|
551
588
|
/**
|
|
552
589
|
* Provider information in user profile
|
|
553
590
|
* Matches the structure returned by backend /api/auth/profile
|
|
@@ -956,14 +993,6 @@ declare function useSmartAccountTransactions(): {
|
|
|
956
993
|
}>;
|
|
957
994
|
};
|
|
958
995
|
|
|
959
|
-
interface AuthProvider {
|
|
960
|
-
provider: 'passkey' | 'email' | 'telegram' | 'google' | 'discord' | 'twitter' | 'wallet';
|
|
961
|
-
verified: boolean;
|
|
962
|
-
linkedAt: string;
|
|
963
|
-
lastUsedAt?: string;
|
|
964
|
-
externalId: string;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
996
|
interface LinkedProfileDisplay extends AuthProvider {
|
|
968
997
|
displayName: string;
|
|
969
998
|
icon?: string;
|
|
@@ -993,4 +1022,4 @@ interface WalletReadyStatus {
|
|
|
993
1022
|
timestamp: number;
|
|
994
1023
|
}
|
|
995
1024
|
|
|
996
|
-
export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type SignTypedDataParams, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type TypedDataDomain, type TypedDataField, type UpdateProfileRequest, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, deployAccount, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, signTypedData, updateUserProfile, useAssets, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
|
|
1025
|
+
export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type SignTypedDataParams, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type TypedDataDomain, type TypedDataField, type UpdateProfileRequest, type UseLogoutReturn, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, deployAccount, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, signTypedData, updateUserProfile, useAssets, useLogout, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { UserOperationV07, UserOperationV06 } from '@lumiapassport/core/bundler'
|
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as viem from 'viem';
|
|
6
6
|
import { Chain, Hash as Hash$1, TransactionReceipt } from 'viem';
|
|
7
|
+
export { JwtTokens, LoginResponse, VerifyResponse, getValidTokens, jwtTokenManager, logout } from '@lumiapassport/core/auth';
|
|
7
8
|
import * as wagmi from 'wagmi';
|
|
8
9
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
9
10
|
import { QueryClient } from '@tanstack/react-query';
|
|
@@ -545,9 +546,45 @@ interface UseUserOpStatusReturn {
|
|
|
545
546
|
}
|
|
546
547
|
declare function useUserOpStatus(options?: UseUserOpStatusOptions): UseUserOpStatusReturn;
|
|
547
548
|
|
|
549
|
+
interface UseLogoutReturn {
|
|
550
|
+
logout: () => Promise<void>;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Hook for logging out and disconnecting from Lumia Passport
|
|
554
|
+
* Clears session, tokens, and notifies callbacks
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```tsx
|
|
558
|
+
* function MyComponent() {
|
|
559
|
+
* const { logout } = useLogout();
|
|
560
|
+
*
|
|
561
|
+
* return (
|
|
562
|
+
* <button onClick={logout}>
|
|
563
|
+
* Disconnect
|
|
564
|
+
* </button>
|
|
565
|
+
* );
|
|
566
|
+
* }
|
|
567
|
+
* ```
|
|
568
|
+
*/
|
|
569
|
+
declare function useLogout(): UseLogoutReturn;
|
|
570
|
+
|
|
548
571
|
declare const LUMIA_EXPLORER_URL: string;
|
|
549
572
|
declare const lumiaBeam: Chain;
|
|
550
573
|
|
|
574
|
+
declare global {
|
|
575
|
+
interface Window {
|
|
576
|
+
__LUMIA_CONDITIONAL_UI_ACTIVE__?: boolean;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
interface AuthProvider {
|
|
581
|
+
provider: 'passkey' | 'email' | 'telegram' | 'google' | 'discord' | 'twitter' | 'wallet';
|
|
582
|
+
verified: boolean;
|
|
583
|
+
linkedAt: string;
|
|
584
|
+
lastUsedAt?: string;
|
|
585
|
+
externalId: string;
|
|
586
|
+
}
|
|
587
|
+
|
|
551
588
|
/**
|
|
552
589
|
* Provider information in user profile
|
|
553
590
|
* Matches the structure returned by backend /api/auth/profile
|
|
@@ -956,14 +993,6 @@ declare function useSmartAccountTransactions(): {
|
|
|
956
993
|
}>;
|
|
957
994
|
};
|
|
958
995
|
|
|
959
|
-
interface AuthProvider {
|
|
960
|
-
provider: 'passkey' | 'email' | 'telegram' | 'google' | 'discord' | 'twitter' | 'wallet';
|
|
961
|
-
verified: boolean;
|
|
962
|
-
linkedAt: string;
|
|
963
|
-
lastUsedAt?: string;
|
|
964
|
-
externalId: string;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
996
|
interface LinkedProfileDisplay extends AuthProvider {
|
|
968
997
|
displayName: string;
|
|
969
998
|
icon?: string;
|
|
@@ -993,4 +1022,4 @@ interface WalletReadyStatus {
|
|
|
993
1022
|
timestamp: number;
|
|
994
1023
|
}
|
|
995
1024
|
|
|
996
|
-
export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type SignTypedDataParams, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type TypedDataDomain, type TypedDataField, type UpdateProfileRequest, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, deployAccount, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, signTypedData, updateUserProfile, useAssets, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
|
|
1025
|
+
export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type SignTypedDataParams, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type TypedDataDomain, type TypedDataField, type UpdateProfileRequest, type UseLogoutReturn, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, deployAccount, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, signTypedData, updateUserProfile, useAssets, useLogout, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
|
package/dist/index.js
CHANGED
|
@@ -764,8 +764,8 @@ async function ensureDkgAndGetOwner(userId, _clientSeedHex) {
|
|
|
764
764
|
};
|
|
765
765
|
}
|
|
766
766
|
await iframeManager.authenticate(userId);
|
|
767
|
-
const { jwtTokenManager:
|
|
768
|
-
const accessToken =
|
|
767
|
+
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
768
|
+
const accessToken = jwtTokenManager4.getAccessToken();
|
|
769
769
|
if (!accessToken) {
|
|
770
770
|
throw new Error("No access token available for DKG");
|
|
771
771
|
}
|
|
@@ -791,8 +791,8 @@ async function signDigestWithMpc(userId, digest32, userOpDetails) {
|
|
|
791
791
|
};
|
|
792
792
|
try {
|
|
793
793
|
const iframeManager = getIframeManager();
|
|
794
|
-
const { jwtTokenManager:
|
|
795
|
-
const accessToken =
|
|
794
|
+
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
795
|
+
const accessToken = jwtTokenManager4.getAccessToken();
|
|
796
796
|
if (!accessToken) {
|
|
797
797
|
throw new Error("No access token available for signing");
|
|
798
798
|
}
|
|
@@ -837,8 +837,8 @@ async function signTypedDataWithMpc(userId, digest32, typedData) {
|
|
|
837
837
|
digest32
|
|
838
838
|
});
|
|
839
839
|
const iframeManager = getIframeManager();
|
|
840
|
-
const { jwtTokenManager:
|
|
841
|
-
const accessToken =
|
|
840
|
+
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
841
|
+
const accessToken = jwtTokenManager4.getAccessToken();
|
|
842
842
|
if (!accessToken) {
|
|
843
843
|
console.error("[signTypedDataWithMpc] No access token available");
|
|
844
844
|
throw new Error("No access token available for signing");
|
|
@@ -1340,7 +1340,7 @@ async function deleteShare() {
|
|
|
1340
1340
|
async function deriveKEKFromPasskey(userId, requiredCredentialId) {
|
|
1341
1341
|
const challengeString = `lumia-kek:${userId}`;
|
|
1342
1342
|
const challenge = new TextEncoder().encode(challengeString);
|
|
1343
|
-
function
|
|
1343
|
+
function base64urlToUint8Array2(base64url) {
|
|
1344
1344
|
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
|
|
1345
1345
|
const pad = base64.length % 4 ? 4 - base64.length % 4 : 0;
|
|
1346
1346
|
const padded = base64 + "=".repeat(pad);
|
|
@@ -1352,7 +1352,7 @@ async function deriveKEKFromPasskey(userId, requiredCredentialId) {
|
|
|
1352
1352
|
return bytes;
|
|
1353
1353
|
}
|
|
1354
1354
|
const targetCredentialId = requiredCredentialId || createPasskeyHelpers(userId).getCredId();
|
|
1355
|
-
const allowCredentials = targetCredentialId ? [{ id:
|
|
1355
|
+
const allowCredentials = targetCredentialId ? [{ id: base64urlToUint8Array2(targetCredentialId), type: "public-key" }] : [];
|
|
1356
1356
|
try {
|
|
1357
1357
|
const credential = await navigator.credentials.get({
|
|
1358
1358
|
publicKey: {
|
|
@@ -2065,6 +2065,7 @@ async function verifyEmailLinkCode(email, code) {
|
|
|
2065
2065
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
2066
2066
|
const response = await authenticatedFetch(`${getTssUrl3()}/api/auth/link/email/verify-code`, {
|
|
2067
2067
|
method: "POST",
|
|
2068
|
+
credentials: "include",
|
|
2068
2069
|
body: JSON.stringify({ email, code })
|
|
2069
2070
|
});
|
|
2070
2071
|
if (!response.ok) {
|
|
@@ -2100,13 +2101,13 @@ async function beginPasskeyLinking() {
|
|
|
2100
2101
|
const begin2 = await res.json();
|
|
2101
2102
|
const options2 = {
|
|
2102
2103
|
rp: begin2.rp,
|
|
2103
|
-
user: { id:
|
|
2104
|
-
challenge:
|
|
2104
|
+
user: { id: base64urlToUint8Array(begin2.user.id), name: begin2.user.name, displayName: begin2.user.displayName },
|
|
2105
|
+
challenge: base64urlToUint8Array(begin2.challenge),
|
|
2105
2106
|
pubKeyCredParams: begin2.pubKeyCredParams,
|
|
2106
2107
|
timeout: begin2.timeout,
|
|
2107
2108
|
attestation: begin2.attestation,
|
|
2108
2109
|
authenticatorSelection: { ...begin2.authenticatorSelection, residentKey: begin2.authenticatorSelection?.residentKey ?? "preferred", requireResidentKey: begin2.authenticatorSelection?.requireResidentKey ?? false, userVerification: begin2.authenticatorSelection?.userVerification ?? "preferred" },
|
|
2109
|
-
excludeCredentials: begin2.excludeCredentials?.map((cred) => ({ type: cred.type, id:
|
|
2110
|
+
excludeCredentials: begin2.excludeCredentials?.map((cred) => ({ type: cred.type, id: base64urlToUint8Array(cred.id), transports: cred.transports })) || void 0
|
|
2110
2111
|
};
|
|
2111
2112
|
return { challengeId: begin2.challengeId, options: options2 };
|
|
2112
2113
|
}
|
|
@@ -2115,13 +2116,13 @@ async function beginPasskeyLinking() {
|
|
|
2115
2116
|
const begin = await res.json();
|
|
2116
2117
|
const options = {
|
|
2117
2118
|
rp: begin.rp,
|
|
2118
|
-
user: { id:
|
|
2119
|
-
challenge:
|
|
2119
|
+
user: { id: base64urlToUint8Array(begin.user.id), name: begin.user.name, displayName: begin.user.displayName },
|
|
2120
|
+
challenge: base64urlToUint8Array(begin.challenge),
|
|
2120
2121
|
pubKeyCredParams: begin.pubKeyCredParams,
|
|
2121
2122
|
timeout: begin.timeout,
|
|
2122
2123
|
attestation: begin.attestation,
|
|
2123
2124
|
authenticatorSelection: { ...begin.authenticatorSelection, residentKey: "preferred", requireResidentKey: false, userVerification: "preferred" },
|
|
2124
|
-
excludeCredentials: begin.excludeCredentials?.map((cred) => ({ type: cred.type, id:
|
|
2125
|
+
excludeCredentials: begin.excludeCredentials?.map((cred) => ({ type: cred.type, id: base64urlToUint8Array(cred.id), transports: cred.transports })) || void 0
|
|
2125
2126
|
};
|
|
2126
2127
|
return { challengeId: begin.challengeId, options };
|
|
2127
2128
|
}
|
|
@@ -2195,18 +2196,10 @@ async function linkPasskeyWithWebAuthn(optionsOverride) {
|
|
|
2195
2196
|
const cid = challengeId || "local-" + Date.now();
|
|
2196
2197
|
await completePasskeyLinking({ challengeId: cid, credential: attestationPayload });
|
|
2197
2198
|
}
|
|
2198
|
-
function base64urlToUint8Array2(base64url) {
|
|
2199
|
-
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
|
|
2200
|
-
const pad = base64.length % 4 ? 4 - base64.length % 4 : 0;
|
|
2201
|
-
const padded = base64 + "=".repeat(pad);
|
|
2202
|
-
const binary = atob(padded);
|
|
2203
|
-
const bytes = new Uint8Array(binary.length);
|
|
2204
|
-
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
2205
|
-
return bytes;
|
|
2206
|
-
}
|
|
2207
2199
|
var init_passkey2 = __esm({
|
|
2208
2200
|
"src/internal/auth/providers/passkey.ts"() {
|
|
2209
2201
|
init_auth();
|
|
2202
|
+
init_base64url();
|
|
2210
2203
|
init_webauthn();
|
|
2211
2204
|
init_types();
|
|
2212
2205
|
}
|
|
@@ -2335,6 +2328,7 @@ __export(auth_exports, {
|
|
|
2335
2328
|
getLinkedProviders: () => getLinkedProviders,
|
|
2336
2329
|
getProviderDisplayInfo: () => getProviderDisplayInfo,
|
|
2337
2330
|
getTssUrl: () => getTssUrl3,
|
|
2331
|
+
getValidTokens: () => getValidTokens,
|
|
2338
2332
|
hasAvailablePasskeys: () => hasAvailablePasskeys,
|
|
2339
2333
|
hideTelegramWidget: () => hideTelegramWidget,
|
|
2340
2334
|
initTelegramWidget: () => initTelegramWidget,
|
|
@@ -2366,6 +2360,7 @@ import {
|
|
|
2366
2360
|
logout,
|
|
2367
2361
|
verifyToken,
|
|
2368
2362
|
ensureValidToken,
|
|
2363
|
+
getValidTokens,
|
|
2369
2364
|
authenticatedFetch,
|
|
2370
2365
|
loginWithUserId,
|
|
2371
2366
|
loginWithEmail,
|
|
@@ -2583,10 +2578,10 @@ var init_iframe_manager = __esm({
|
|
|
2583
2578
|
*/
|
|
2584
2579
|
async handleTokenRefreshRequest(message) {
|
|
2585
2580
|
try {
|
|
2586
|
-
const { jwtTokenManager:
|
|
2587
|
-
const refreshSuccess = await
|
|
2581
|
+
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
2582
|
+
const refreshSuccess = await jwtTokenManager4.refreshAccessToken();
|
|
2588
2583
|
if (refreshSuccess) {
|
|
2589
|
-
const newAccessToken =
|
|
2584
|
+
const newAccessToken = jwtTokenManager4.getAccessToken();
|
|
2590
2585
|
if (this.iframe && this.iframe.contentWindow) {
|
|
2591
2586
|
const iframeOrigin = new URL(this.iframeUrl).origin;
|
|
2592
2587
|
this.iframe.contentWindow.postMessage(
|
|
@@ -8673,7 +8668,7 @@ function useLumiaPassportLinkedProfiles() {
|
|
|
8673
8668
|
// package.json
|
|
8674
8669
|
var package_default = {
|
|
8675
8670
|
name: "@lumiapassport/ui-kit",
|
|
8676
|
-
version: "1.9.
|
|
8671
|
+
version: "1.9.2",
|
|
8677
8672
|
description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
|
|
8678
8673
|
type: "module",
|
|
8679
8674
|
main: "./dist/index.cjs",
|
|
@@ -10090,9 +10085,46 @@ function useUserOpStatus(options = {}) {
|
|
|
10090
10085
|
};
|
|
10091
10086
|
}
|
|
10092
10087
|
|
|
10088
|
+
// src/hooks/useLogout.ts
|
|
10089
|
+
import { useCallback as useCallback7 } from "react";
|
|
10090
|
+
import { logout as coreLogout, jwtTokenManager as jwtTokenManager3 } from "@lumiapassport/core/auth";
|
|
10091
|
+
init_LumiaPassportContext();
|
|
10092
|
+
function useLogout() {
|
|
10093
|
+
const { setSession, setAddress, setStatus, setError, address } = useLumiaPassportSession();
|
|
10094
|
+
const { callbacks } = useLumiaPassportConfig();
|
|
10095
|
+
const logout2 = useCallback7(async () => {
|
|
10096
|
+
const prevAddress = address;
|
|
10097
|
+
let userId = null;
|
|
10098
|
+
try {
|
|
10099
|
+
userId = jwtTokenManager3.getUserId() || null;
|
|
10100
|
+
} catch (error) {
|
|
10101
|
+
console.warn("[useLogout] Could not get userId:", error);
|
|
10102
|
+
}
|
|
10103
|
+
try {
|
|
10104
|
+
await coreLogout();
|
|
10105
|
+
} catch (error) {
|
|
10106
|
+
console.warn("[useLogout] Core logout failed:", error);
|
|
10107
|
+
}
|
|
10108
|
+
setSession(null);
|
|
10109
|
+
setAddress(null);
|
|
10110
|
+
setStatus("idle");
|
|
10111
|
+
setError(null);
|
|
10112
|
+
try {
|
|
10113
|
+
callbacks?.onLumiaPassportDisconnect?.({
|
|
10114
|
+
address: prevAddress,
|
|
10115
|
+
userId
|
|
10116
|
+
});
|
|
10117
|
+
} catch (error) {
|
|
10118
|
+
console.warn("[useLogout] Callback error:", error);
|
|
10119
|
+
}
|
|
10120
|
+
}, [address, setAddress, setError, setSession, setStatus, callbacks]);
|
|
10121
|
+
return { logout: logout2 };
|
|
10122
|
+
}
|
|
10123
|
+
|
|
10093
10124
|
// src/index.ts
|
|
10094
10125
|
init_account();
|
|
10095
10126
|
init_base();
|
|
10127
|
+
init_auth();
|
|
10096
10128
|
init_profile();
|
|
10097
10129
|
init_wagmi();
|
|
10098
10130
|
|
|
@@ -10238,6 +10270,9 @@ export {
|
|
|
10238
10270
|
UserOpStatus,
|
|
10239
10271
|
deployAccount,
|
|
10240
10272
|
getUserProfile,
|
|
10273
|
+
getValidTokens,
|
|
10274
|
+
jwtTokenManager2 as jwtTokenManager,
|
|
10275
|
+
logout,
|
|
10241
10276
|
lumiaBeam,
|
|
10242
10277
|
prepareUserOperation,
|
|
10243
10278
|
queryClient,
|
|
@@ -10245,6 +10280,7 @@ export {
|
|
|
10245
10280
|
signTypedData,
|
|
10246
10281
|
updateUserProfile,
|
|
10247
10282
|
useAssets,
|
|
10283
|
+
useLogout,
|
|
10248
10284
|
useLumiaPassportConfig,
|
|
10249
10285
|
useLumiaPassportLinkedProfiles,
|
|
10250
10286
|
useLumiaPassportSession,
|