@lumiapassport/ui-kit 1.9.1 → 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 +1 -1
- package/dist/index.cjs +65 -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 +62 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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: {
|
|
@@ -2101,13 +2101,13 @@ async function beginPasskeyLinking() {
|
|
|
2101
2101
|
const begin2 = await res.json();
|
|
2102
2102
|
const options2 = {
|
|
2103
2103
|
rp: begin2.rp,
|
|
2104
|
-
user: { id:
|
|
2105
|
-
challenge:
|
|
2104
|
+
user: { id: base64urlToUint8Array(begin2.user.id), name: begin2.user.name, displayName: begin2.user.displayName },
|
|
2105
|
+
challenge: base64urlToUint8Array(begin2.challenge),
|
|
2106
2106
|
pubKeyCredParams: begin2.pubKeyCredParams,
|
|
2107
2107
|
timeout: begin2.timeout,
|
|
2108
2108
|
attestation: begin2.attestation,
|
|
2109
2109
|
authenticatorSelection: { ...begin2.authenticatorSelection, residentKey: begin2.authenticatorSelection?.residentKey ?? "preferred", requireResidentKey: begin2.authenticatorSelection?.requireResidentKey ?? false, userVerification: begin2.authenticatorSelection?.userVerification ?? "preferred" },
|
|
2110
|
-
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
|
|
2111
2111
|
};
|
|
2112
2112
|
return { challengeId: begin2.challengeId, options: options2 };
|
|
2113
2113
|
}
|
|
@@ -2116,13 +2116,13 @@ async function beginPasskeyLinking() {
|
|
|
2116
2116
|
const begin = await res.json();
|
|
2117
2117
|
const options = {
|
|
2118
2118
|
rp: begin.rp,
|
|
2119
|
-
user: { id:
|
|
2120
|
-
challenge:
|
|
2119
|
+
user: { id: base64urlToUint8Array(begin.user.id), name: begin.user.name, displayName: begin.user.displayName },
|
|
2120
|
+
challenge: base64urlToUint8Array(begin.challenge),
|
|
2121
2121
|
pubKeyCredParams: begin.pubKeyCredParams,
|
|
2122
2122
|
timeout: begin.timeout,
|
|
2123
2123
|
attestation: begin.attestation,
|
|
2124
2124
|
authenticatorSelection: { ...begin.authenticatorSelection, residentKey: "preferred", requireResidentKey: false, userVerification: "preferred" },
|
|
2125
|
-
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
|
|
2126
2126
|
};
|
|
2127
2127
|
return { challengeId: begin.challengeId, options };
|
|
2128
2128
|
}
|
|
@@ -2196,18 +2196,10 @@ async function linkPasskeyWithWebAuthn(optionsOverride) {
|
|
|
2196
2196
|
const cid = challengeId || "local-" + Date.now();
|
|
2197
2197
|
await completePasskeyLinking({ challengeId: cid, credential: attestationPayload });
|
|
2198
2198
|
}
|
|
2199
|
-
function base64urlToUint8Array2(base64url) {
|
|
2200
|
-
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
|
|
2201
|
-
const pad = base64.length % 4 ? 4 - base64.length % 4 : 0;
|
|
2202
|
-
const padded = base64 + "=".repeat(pad);
|
|
2203
|
-
const binary = atob(padded);
|
|
2204
|
-
const bytes = new Uint8Array(binary.length);
|
|
2205
|
-
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
2206
|
-
return bytes;
|
|
2207
|
-
}
|
|
2208
2199
|
var init_passkey2 = __esm({
|
|
2209
2200
|
"src/internal/auth/providers/passkey.ts"() {
|
|
2210
2201
|
init_auth();
|
|
2202
|
+
init_base64url();
|
|
2211
2203
|
init_webauthn();
|
|
2212
2204
|
init_types();
|
|
2213
2205
|
}
|
|
@@ -2336,6 +2328,7 @@ __export(auth_exports, {
|
|
|
2336
2328
|
getLinkedProviders: () => getLinkedProviders,
|
|
2337
2329
|
getProviderDisplayInfo: () => getProviderDisplayInfo,
|
|
2338
2330
|
getTssUrl: () => getTssUrl3,
|
|
2331
|
+
getValidTokens: () => getValidTokens,
|
|
2339
2332
|
hasAvailablePasskeys: () => hasAvailablePasskeys,
|
|
2340
2333
|
hideTelegramWidget: () => hideTelegramWidget,
|
|
2341
2334
|
initTelegramWidget: () => initTelegramWidget,
|
|
@@ -2367,6 +2360,7 @@ import {
|
|
|
2367
2360
|
logout,
|
|
2368
2361
|
verifyToken,
|
|
2369
2362
|
ensureValidToken,
|
|
2363
|
+
getValidTokens,
|
|
2370
2364
|
authenticatedFetch,
|
|
2371
2365
|
loginWithUserId,
|
|
2372
2366
|
loginWithEmail,
|
|
@@ -2584,10 +2578,10 @@ var init_iframe_manager = __esm({
|
|
|
2584
2578
|
*/
|
|
2585
2579
|
async handleTokenRefreshRequest(message) {
|
|
2586
2580
|
try {
|
|
2587
|
-
const { jwtTokenManager:
|
|
2588
|
-
const refreshSuccess = await
|
|
2581
|
+
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
2582
|
+
const refreshSuccess = await jwtTokenManager4.refreshAccessToken();
|
|
2589
2583
|
if (refreshSuccess) {
|
|
2590
|
-
const newAccessToken =
|
|
2584
|
+
const newAccessToken = jwtTokenManager4.getAccessToken();
|
|
2591
2585
|
if (this.iframe && this.iframe.contentWindow) {
|
|
2592
2586
|
const iframeOrigin = new URL(this.iframeUrl).origin;
|
|
2593
2587
|
this.iframe.contentWindow.postMessage(
|
|
@@ -8674,7 +8668,7 @@ function useLumiaPassportLinkedProfiles() {
|
|
|
8674
8668
|
// package.json
|
|
8675
8669
|
var package_default = {
|
|
8676
8670
|
name: "@lumiapassport/ui-kit",
|
|
8677
|
-
version: "1.9.
|
|
8671
|
+
version: "1.9.2",
|
|
8678
8672
|
description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
|
|
8679
8673
|
type: "module",
|
|
8680
8674
|
main: "./dist/index.cjs",
|
|
@@ -10091,9 +10085,46 @@ function useUserOpStatus(options = {}) {
|
|
|
10091
10085
|
};
|
|
10092
10086
|
}
|
|
10093
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
|
+
|
|
10094
10124
|
// src/index.ts
|
|
10095
10125
|
init_account();
|
|
10096
10126
|
init_base();
|
|
10127
|
+
init_auth();
|
|
10097
10128
|
init_profile();
|
|
10098
10129
|
init_wagmi();
|
|
10099
10130
|
|
|
@@ -10239,6 +10270,9 @@ export {
|
|
|
10239
10270
|
UserOpStatus,
|
|
10240
10271
|
deployAccount,
|
|
10241
10272
|
getUserProfile,
|
|
10273
|
+
getValidTokens,
|
|
10274
|
+
jwtTokenManager2 as jwtTokenManager,
|
|
10275
|
+
logout,
|
|
10242
10276
|
lumiaBeam,
|
|
10243
10277
|
prepareUserOperation,
|
|
10244
10278
|
queryClient,
|
|
@@ -10246,6 +10280,7 @@ export {
|
|
|
10246
10280
|
signTypedData,
|
|
10247
10281
|
updateUserProfile,
|
|
10248
10282
|
useAssets,
|
|
10283
|
+
useLogout,
|
|
10249
10284
|
useLumiaPassportConfig,
|
|
10250
10285
|
useLumiaPassportLinkedProfiles,
|
|
10251
10286
|
useLumiaPassportSession,
|