@talken/talkenkit 2.8.2 → 2.8.4
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/{AbcCredentialManager-6FBGTSSM.js → AbcCredentialManager-QM2BNLSR.js} +1 -1
- package/dist/{abcWallet-7ZZXHG7O.js → abcWallet-4PXYWHYM.js} +2 -2
- package/dist/{chunk-SUYKWM5G.js → chunk-PS5CBMY5.js} +10 -8
- package/dist/{chunk-HX6JUKSS.js → chunk-ZISAJ7BZ.js} +253 -25
- package/dist/index.d.ts +2 -0
- package/dist/index.js +192 -212
- package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.js +4 -4
- package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/StorageService.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +5 -5
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +6 -6
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +21 -18
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +9 -8
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +21 -19
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +6 -6
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +22 -19
- package/dist/wallets/walletConnectors/abcWallet/abcXrplProvider.js +6 -6
- package/dist/wallets/walletConnectors/abcWallet/api/ConfigApi.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +15 -13
- package/dist/wallets/walletConnectors/abcWallet/api/TokenApi.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/api/index.js +18 -16
- package/dist/wallets/walletConnectors/abcWallet/api/modules/auth.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/api/modules/bitcoin.d.ts +1 -1
- package/dist/wallets/walletConnectors/abcWallet/api/modules/bitcoin.js +13 -5
- package/dist/wallets/walletConnectors/abcWallet/api/modules/evm.d.ts +8 -5
- package/dist/wallets/walletConnectors/abcWallet/api/modules/evm.js +12 -4
- package/dist/wallets/walletConnectors/abcWallet/api/modules/signBodies.d.ts +34 -0
- package/dist/wallets/walletConnectors/abcWallet/api/modules/signBodies.js +25 -0
- package/dist/wallets/walletConnectors/abcWallet/api/modules/signingRefresh.d.ts +17 -0
- package/dist/wallets/walletConnectors/abcWallet/api/modules/signingRefresh.js +18 -0
- package/dist/wallets/walletConnectors/abcWallet/api/modules/solana.d.ts +1 -1
- package/dist/wallets/walletConnectors/abcWallet/api/modules/solana.js +9 -2
- package/dist/wallets/walletConnectors/abcWallet/api/modules/tron.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/modules/wallet.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/modules/walletscan.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/modules/xrp.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/constants.d.ts +6 -6
- package/dist/wallets/walletConnectors/abcWallet/constants.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/evmTxType.d.ts +20 -0
- package/dist/wallets/walletConnectors/abcWallet/evmTxType.js +8 -0
- package/dist/wallets/walletConnectors/abcWallet/index.js +36 -33
- package/dist/wallets/walletConnectors/abcWallet/kakaoAuth.d.ts +10 -21
- package/dist/wallets/walletConnectors/abcWallet/kakaoAuth.js +118 -141
- package/dist/wallets/walletConnectors/abcWallet/sessionUtils.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/types/api.types.d.ts +71 -1
- package/dist/wallets/walletConnectors/abcWallet/types.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/utils.js +4 -4
- package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +5 -5
- package/dist/wallets/walletConnectors/{chunk-3NWM24MH.js → chunk-5E7TNMON.js} +6 -3
- package/dist/wallets/walletConnectors/{chunk-YNE2UX2Z.js → chunk-5SHN7JNR.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-TYJR3KGY.js → chunk-6BHMNR5X.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-2LOET2LX.js → chunk-6HR6CEOY.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-ANBOP6A6.js → chunk-6LPMWYFM.js} +2 -2
- package/dist/wallets/walletConnectors/{chunk-L3EPZ4NZ.js → chunk-75H6DQT6.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-3Z5DO42M.js → chunk-7GBAUSQJ.js} +10 -8
- package/dist/wallets/walletConnectors/{chunk-KCB4MMIZ.js → chunk-CCUNTMLD.js} +6 -6
- package/dist/wallets/walletConnectors/{chunk-HM73RD2O.js → chunk-CIAVEXOY.js} +10 -4
- package/dist/wallets/walletConnectors/{chunk-URTS7ZIZ.js → chunk-DPYQH3WE.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-2LH53QET.js → chunk-F6AHT6K4.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-ZXG3X6PV.js → chunk-F6EG7H2O.js} +2 -2
- package/dist/wallets/walletConnectors/chunk-FLBJ7T4Q.js +44 -0
- package/dist/wallets/walletConnectors/{chunk-4DGLNUHL.js → chunk-FWKMNVWU.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-ZOBSRU6L.js → chunk-HFW2XV2R.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-M4YGDOD5.js → chunk-HMMEOZDT.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-S6XEM7RM.js → chunk-HXYOWG5P.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-BF4HTXWH.js → chunk-KX3IFHJQ.js} +16 -16
- package/dist/wallets/walletConnectors/chunk-OESFVVLA.js +38 -0
- package/dist/wallets/walletConnectors/{chunk-XDNFWX2X.js → chunk-OEZE4GBQ.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-YFNVHCMA.js → chunk-QTBJ6WNZ.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-FWX2HD26.js → chunk-RQYBKCWA.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-4BG6V5TZ.js → chunk-TXB6KXPR.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-4Y7YP4IR.js → chunk-UNLWNVSN.js} +16 -6
- package/dist/wallets/walletConnectors/{chunk-6FPKKAFI.js → chunk-XQTK7NGN.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-VVXSRRXI.js → chunk-YECMDMEA.js} +2 -2
- package/dist/wallets/walletConnectors/{chunk-ICGK5DGY.js → chunk-YUBS7MJ6.js} +44 -19
- package/dist/wallets/walletConnectors/{chunk-NEMEHJ72.js → chunk-ZITVWA4X.js} +1 -1
- package/dist/wallets/walletConnectors/chunk-ZTIRW7TR.js +161 -0
- package/dist/wallets/walletConnectors/index.js +61 -58
- package/package.json +12 -11
- package/LICENSE +0 -9
- package/dist/wallets/walletConnectors/chunk-2KHTFKPP.js +0 -186
- package/dist/wallets/walletConnectors/chunk-3LAMBKQL.js +0 -345
- package/dist/wallets/walletConnectors/chunk-3QC567QK.js +0 -94
- package/dist/wallets/walletConnectors/chunk-4V3HRM2R.js +0 -95
- package/dist/wallets/walletConnectors/chunk-55MPPI65.js +0 -492
- package/dist/wallets/walletConnectors/chunk-5QYCHHVB.js +0 -98
- package/dist/wallets/walletConnectors/chunk-63H3LXPW.js +0 -58
- package/dist/wallets/walletConnectors/chunk-6BDKSA22.js +0 -341
- package/dist/wallets/walletConnectors/chunk-7DLZKN46.js +0 -341
- package/dist/wallets/walletConnectors/chunk-7IBMHOYD.js +0 -102
- package/dist/wallets/walletConnectors/chunk-A2DZALFI.js +0 -108
- package/dist/wallets/walletConnectors/chunk-BZPKBSWY.js +0 -66
- package/dist/wallets/walletConnectors/chunk-CEOJSQAI.js +0 -66
- package/dist/wallets/walletConnectors/chunk-CXWASK7L.js +0 -370
- package/dist/wallets/walletConnectors/chunk-DHWJ3552.js +0 -93
- package/dist/wallets/walletConnectors/chunk-EJALZNAR.js +0 -101
- package/dist/wallets/walletConnectors/chunk-EQ4EX5IN.js +0 -340
- package/dist/wallets/walletConnectors/chunk-EULIVR7N.js +0 -370
- package/dist/wallets/walletConnectors/chunk-FGYJTUYV.js +0 -94
- package/dist/wallets/walletConnectors/chunk-FVA6H2VF.js +0 -95
- package/dist/wallets/walletConnectors/chunk-HALTGRQW.js +0 -87
- package/dist/wallets/walletConnectors/chunk-IONL6LMJ.js +0 -71
- package/dist/wallets/walletConnectors/chunk-KQDFRZT4.js +0 -65
- package/dist/wallets/walletConnectors/chunk-LIN3ZO63.js +0 -378
- package/dist/wallets/walletConnectors/chunk-OUVRAKVV.js +0 -3050
- package/dist/wallets/walletConnectors/chunk-PXL5G2PM.js +0 -96
- package/dist/wallets/walletConnectors/chunk-QB3QLNSL.js +0 -76
- package/dist/wallets/walletConnectors/chunk-QRU6XFHH.js +0 -110
- package/dist/wallets/walletConnectors/chunk-SKVKZ5FY.js +0 -132
- package/dist/wallets/walletConnectors/chunk-T6RB3SM7.js +0 -73
- package/dist/wallets/walletConnectors/chunk-TA4DDCKN.js +0 -96
- package/dist/wallets/walletConnectors/chunk-TWVKSPTP.js +0 -91
- package/dist/wallets/walletConnectors/chunk-V5LGED4F.js +0 -103
- package/dist/wallets/walletConnectors/chunk-VEJS7JOC.js +0 -58
- package/dist/wallets/walletConnectors/chunk-XS6GJRRA.js +0 -98
- package/dist/wallets/walletConnectors/chunk-XSX5EECZ.js +0 -96
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
scheduleProactiveRefresh,
|
|
67
67
|
setGaslessConfig,
|
|
68
68
|
setupVisibilityRefresh
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-ZISAJ7BZ.js";
|
|
70
70
|
import {
|
|
71
71
|
en_US_default
|
|
72
72
|
} from "./chunk-X4GSACNW.js";
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
remove,
|
|
96
96
|
set,
|
|
97
97
|
setJSON
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-PS5CBMY5.js";
|
|
99
99
|
|
|
100
100
|
// src/components/ConnectButton/ConnectButton.tsx
|
|
101
101
|
import React105, { useContext as useContext32, useEffect as useEffect38, useState as useState45 } from "react";
|
|
@@ -197,7 +197,7 @@ function useBitcoinWallet() {
|
|
|
197
197
|
wallet: bitcoinWallet,
|
|
198
198
|
emptyState: emptyWalletState2,
|
|
199
199
|
requestInterceptor,
|
|
200
|
-
importProvider: async () => (await import("./abcWallet-
|
|
200
|
+
importProvider: async () => (await import("./abcWallet-4PXYWHYM.js")).AbcBitcoinProvider,
|
|
201
201
|
mapState: (nextWallet, provider) => ({
|
|
202
202
|
address: nextWallet.address,
|
|
203
203
|
publicKey: nextWallet.publicKey,
|
|
@@ -1370,7 +1370,7 @@ function useAbcSolanaState(evmConnected, connector, requestInterceptor) {
|
|
|
1370
1370
|
wallet: solanaWallet,
|
|
1371
1371
|
emptyState: emptyWalletState,
|
|
1372
1372
|
requestInterceptor,
|
|
1373
|
-
importProvider: async () => (await import("./abcWallet-
|
|
1373
|
+
importProvider: async () => (await import("./abcWallet-4PXYWHYM.js")).AbcSolanaProvider,
|
|
1374
1374
|
mapState: (nextWallet, provider) => ({
|
|
1375
1375
|
address: nextWallet.address,
|
|
1376
1376
|
publicKey: nextWallet.publicKey,
|
|
@@ -2462,7 +2462,7 @@ function useTronWallet() {
|
|
|
2462
2462
|
wallet: tronWallet,
|
|
2463
2463
|
emptyState: emptyWalletState2,
|
|
2464
2464
|
requestInterceptor,
|
|
2465
|
-
importProvider: async () => (await import("./abcWallet-
|
|
2465
|
+
importProvider: async () => (await import("./abcWallet-4PXYWHYM.js")).AbcTronProvider,
|
|
2466
2466
|
mapState: (nextWallet, provider) => ({
|
|
2467
2467
|
address: nextWallet.address,
|
|
2468
2468
|
publicKey: nextWallet.publicKey,
|
|
@@ -2539,7 +2539,7 @@ function useXrplWallet() {
|
|
|
2539
2539
|
wallet: xrplWallet,
|
|
2540
2540
|
emptyState: emptyWalletState2,
|
|
2541
2541
|
requestInterceptor,
|
|
2542
|
-
importProvider: async () => (await import("./abcWallet-
|
|
2542
|
+
importProvider: async () => (await import("./abcWallet-4PXYWHYM.js")).AbcXrplProvider,
|
|
2543
2543
|
mapState: (nextWallet, provider) => ({
|
|
2544
2544
|
address: nextWallet.address,
|
|
2545
2545
|
publicKey: nextWallet.publicKey,
|
|
@@ -9241,7 +9241,7 @@ function setRainbowKitVersion({ version }) {
|
|
|
9241
9241
|
}
|
|
9242
9242
|
function useFingerprint() {
|
|
9243
9243
|
const fingerprint = useCallback16(() => {
|
|
9244
|
-
setRainbowKitVersion({ version: "2.8.
|
|
9244
|
+
setRainbowKitVersion({ version: "2.8.4" });
|
|
9245
9245
|
}, []);
|
|
9246
9246
|
useEffect25(() => {
|
|
9247
9247
|
fingerprint();
|
|
@@ -11583,7 +11583,7 @@ function AbcWaasAuthSections(props) {
|
|
|
11583
11583
|
const isTelegramMiniApp = typeof window !== "undefined" && (!!window.Telegram?.WebApp && window.Telegram.WebApp.platform !== "unknown" || window.location.hash.includes("tgWebAppData"));
|
|
11584
11584
|
const isGoogleEnabled = !isTelegramMiniApp && typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_GOOGLE_OAUTH_ENABLED === "true" && !!process.env.NEXT_PUBLIC_FIREBASE_API_KEY;
|
|
11585
11585
|
const isAppleEnabled = !isTelegramMiniApp && typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_APPLE_OAUTH_ENABLED === "true" && !!process.env.NEXT_PUBLIC_APPLE_OAUTH_CLIENT_ID;
|
|
11586
|
-
const isKakaoEnabled = !isTelegramMiniApp && typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_KAKAO_OAUTH_ENABLED === "true"
|
|
11586
|
+
const isKakaoEnabled = !isTelegramMiniApp && typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_KAKAO_OAUTH_ENABLED === "true";
|
|
11587
11587
|
const hasSocialLogin = isGoogleEnabled || isAppleEnabled || isKakaoEnabled;
|
|
11588
11588
|
const handleEmailFormSubmit = (e) => {
|
|
11589
11589
|
e.preventDefault();
|
|
@@ -12030,46 +12030,61 @@ async function appleLogin() {
|
|
|
12030
12030
|
}
|
|
12031
12031
|
|
|
12032
12032
|
// src/wallets/walletConnectors/abcWallet/kakaoAuth.ts
|
|
12033
|
-
var
|
|
12034
|
-
var
|
|
12035
|
-
var
|
|
12036
|
-
var
|
|
12037
|
-
var KAKAO_EXPIRES_AT_KEY = "kakao_expires_at";
|
|
12033
|
+
var POPUP_TIMEOUT_MS = 3 * 60 * 1e3;
|
|
12034
|
+
var REQUEST_TIMEOUT_MS = 15 * 1e3;
|
|
12035
|
+
var serverEndpoint;
|
|
12036
|
+
var configuredCallbackPath;
|
|
12038
12037
|
var isKakaoLoginInProgress = false;
|
|
12039
|
-
function
|
|
12040
|
-
const
|
|
12041
|
-
if (
|
|
12042
|
-
throw new Error("
|
|
12038
|
+
function configureKakaoAuth(config) {
|
|
12039
|
+
const endpoint = config.serverEndpoint.replace(/\/$/, "");
|
|
12040
|
+
if (!/^\/(?:[a-zA-Z0-9_-]+\/)*[a-zA-Z0-9_-]+$/.test(endpoint)) {
|
|
12041
|
+
throw new Error("Kakao serverEndpoint must be a root-relative path");
|
|
12043
12042
|
}
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12043
|
+
if (config.callbackPath !== void 0 && (config.callbackPath.length > 256 || !/^\/(?:[a-zA-Z0-9_-]+\/)*[a-zA-Z0-9_-]+\/?$/.test(config.callbackPath))) {
|
|
12044
|
+
throw new Error("Kakao callbackPath must be a root-relative path");
|
|
12045
|
+
}
|
|
12046
|
+
serverEndpoint = endpoint;
|
|
12047
|
+
configuredCallbackPath = config.callbackPath;
|
|
12047
12048
|
}
|
|
12048
|
-
function
|
|
12049
|
-
|
|
12050
|
-
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
);
|
|
12061
|
-
if (!
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
);
|
|
12067
|
-
return;
|
|
12049
|
+
async function requestServer(endpoint, action, body) {
|
|
12050
|
+
const controller = new AbortController();
|
|
12051
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
12052
|
+
try {
|
|
12053
|
+
const response = await fetch(`${endpoint}/${action}/`, {
|
|
12054
|
+
method: "POST",
|
|
12055
|
+
credentials: "same-origin",
|
|
12056
|
+
cache: "no-store",
|
|
12057
|
+
redirect: "error",
|
|
12058
|
+
headers: { "Content-Type": "application/json" },
|
|
12059
|
+
body: JSON.stringify(body),
|
|
12060
|
+
signal: controller.signal
|
|
12061
|
+
});
|
|
12062
|
+
if (!response.ok)
|
|
12063
|
+
throw new Error("Kakao authentication failed. Please try again.");
|
|
12064
|
+
const data = await response.json();
|
|
12065
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
12066
|
+
throw new Error("Invalid Kakao server response");
|
|
12068
12067
|
}
|
|
12069
|
-
|
|
12068
|
+
return data;
|
|
12069
|
+
} finally {
|
|
12070
|
+
clearTimeout(timeout);
|
|
12071
|
+
}
|
|
12072
|
+
}
|
|
12073
|
+
function getAuthCodeViaPopup(popup, authorizationUrl, redirectUri, state, callbackPath) {
|
|
12074
|
+
const redirect = new URL(redirectUri);
|
|
12075
|
+
const expectedCallback = new URL(
|
|
12076
|
+
callbackPath ?? redirect.pathname,
|
|
12077
|
+
window.location.origin
|
|
12078
|
+
);
|
|
12079
|
+
const authorize = new URL(authorizationUrl);
|
|
12080
|
+
if (redirect.protocol !== "https:" || redirect.origin !== window.location.origin || redirect.username || redirect.password || redirect.search || redirect.hash || authorize.origin !== "https://kauth.kakao.com" || authorize.pathname !== "/oauth/authorize" || authorize.searchParams.get("state") !== state || authorize.searchParams.get("redirect_uri") !== redirectUri) {
|
|
12081
|
+
throw new Error("Invalid Kakao authorization configuration");
|
|
12082
|
+
}
|
|
12083
|
+
popup.location.href = authorizationUrl;
|
|
12084
|
+
return new Promise((resolve, reject) => {
|
|
12070
12085
|
const startTime = Date.now();
|
|
12071
12086
|
const timer = setInterval(() => {
|
|
12072
|
-
if (Date.now() - startTime
|
|
12087
|
+
if (Date.now() - startTime >= POPUP_TIMEOUT_MS) {
|
|
12073
12088
|
clearInterval(timer);
|
|
12074
12089
|
popup.close();
|
|
12075
12090
|
reject(new Error("KAKAO_TIMEOUT"));
|
|
@@ -12080,126 +12095,90 @@ function getAuthCodeViaPopup(redirectUri) {
|
|
|
12080
12095
|
reject(new Error("KAKAO_CANCELLED"));
|
|
12081
12096
|
return;
|
|
12082
12097
|
}
|
|
12098
|
+
let callback;
|
|
12083
12099
|
try {
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12091
|
-
|
|
12092
|
-
|
|
12093
|
-
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
}
|
|
12100
|
+
callback = new URL(popup.location.href);
|
|
12101
|
+
} catch {
|
|
12102
|
+
return;
|
|
12103
|
+
}
|
|
12104
|
+
if (callback.origin !== redirect.origin || callback.pathname !== expectedCallback.pathname)
|
|
12105
|
+
return;
|
|
12106
|
+
clearInterval(timer);
|
|
12107
|
+
popup.close();
|
|
12108
|
+
if (callback.searchParams.getAll("state").length !== 1 || callback.searchParams.get("state") !== state) {
|
|
12109
|
+
reject(new Error("Invalid Kakao authorization state"));
|
|
12110
|
+
} else if (callback.searchParams.has("error")) {
|
|
12111
|
+
reject(
|
|
12112
|
+
new Error(
|
|
12113
|
+
callback.searchParams.get("error") === "access_denied" ? "KAKAO_CANCELLED" : "Kakao authorization failed"
|
|
12114
|
+
)
|
|
12115
|
+
);
|
|
12116
|
+
} else if (callback.searchParams.getAll("code").length === 1 && callback.searchParams.get("code")) {
|
|
12117
|
+
resolve(callback.searchParams.get("code"));
|
|
12118
|
+
} else {
|
|
12119
|
+
reject(new Error("No Kakao authorization code received"));
|
|
12101
12120
|
}
|
|
12102
12121
|
}, 500);
|
|
12103
12122
|
});
|
|
12104
12123
|
}
|
|
12105
|
-
async function exchangeCodeForTokens(code, redirectUri) {
|
|
12106
|
-
const restApiKey = process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY;
|
|
12107
|
-
if (!restApiKey) {
|
|
12108
|
-
throw new Error("NEXT_PUBLIC_KAKAO_REST_API_KEY is not configured");
|
|
12109
|
-
}
|
|
12110
|
-
const response = await fetch("https://kauth.kakao.com/oauth/token", {
|
|
12111
|
-
method: "POST",
|
|
12112
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
12113
|
-
body: new URLSearchParams({
|
|
12114
|
-
grant_type: "authorization_code",
|
|
12115
|
-
client_id: restApiKey,
|
|
12116
|
-
redirect_uri: redirectUri,
|
|
12117
|
-
code,
|
|
12118
|
-
...process.env.NEXT_PUBLIC_KAKAO_CLIENT_SECRET ? { client_secret: process.env.NEXT_PUBLIC_KAKAO_CLIENT_SECRET } : {}
|
|
12119
|
-
})
|
|
12120
|
-
});
|
|
12121
|
-
if (!response.ok) {
|
|
12122
|
-
const err = await response.json().catch(() => ({}));
|
|
12123
|
-
throw new Error(err.error_description || "Failed to get access token");
|
|
12124
|
-
}
|
|
12125
|
-
const data = await response.json();
|
|
12126
|
-
if (!data.id_token) {
|
|
12127
|
-
throw new Error("No id_token received. Ensure openid scope is enabled.");
|
|
12128
|
-
}
|
|
12129
|
-
return {
|
|
12130
|
-
accessToken: data.access_token,
|
|
12131
|
-
idToken: data.id_token,
|
|
12132
|
-
expiresIn: data.expires_in || 21600
|
|
12133
|
-
};
|
|
12134
|
-
}
|
|
12135
|
-
function tryExistingToken() {
|
|
12136
|
-
const storedIdToken = sessionStorage.getItem(KAKAO_ID_TOKEN_KEY);
|
|
12137
|
-
const storedEmail = sessionStorage.getItem(KAKAO_EMAIL_KEY);
|
|
12138
|
-
const expiresAt = sessionStorage.getItem(KAKAO_EXPIRES_AT_KEY);
|
|
12139
|
-
if (!storedIdToken || !storedEmail || !expiresAt) {
|
|
12140
|
-
return null;
|
|
12141
|
-
}
|
|
12142
|
-
if (Date.now() >= Number(expiresAt)) {
|
|
12143
|
-
clearStoredTokens();
|
|
12144
|
-
return null;
|
|
12145
|
-
}
|
|
12146
|
-
return {
|
|
12147
|
-
email: storedEmail,
|
|
12148
|
-
idToken: storedIdToken,
|
|
12149
|
-
service: "kakao"
|
|
12150
|
-
};
|
|
12151
|
-
}
|
|
12152
|
-
function clearStoredTokens() {
|
|
12153
|
-
sessionStorage.removeItem(KAKAO_TOKEN_KEY);
|
|
12154
|
-
sessionStorage.removeItem(KAKAO_ID_TOKEN_KEY);
|
|
12155
|
-
sessionStorage.removeItem(KAKAO_EMAIL_KEY);
|
|
12156
|
-
sessionStorage.removeItem(KAKAO_EXPIRES_AT_KEY);
|
|
12157
|
-
}
|
|
12158
12124
|
async function kakaoLogin() {
|
|
12159
|
-
if (isKakaoLoginInProgress)
|
|
12125
|
+
if (isKakaoLoginInProgress)
|
|
12160
12126
|
return null;
|
|
12161
|
-
|
|
12127
|
+
if (!serverEndpoint)
|
|
12128
|
+
throw new Error(
|
|
12129
|
+
"Configure a Kakao server authentication endpoint before login"
|
|
12130
|
+
);
|
|
12131
|
+
const endpoint = serverEndpoint;
|
|
12132
|
+
const callbackPath = configuredCallbackPath;
|
|
12162
12133
|
isKakaoLoginInProgress = true;
|
|
12134
|
+
let popup = null;
|
|
12163
12135
|
try {
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
const redirectUri = `${window.location.origin}/auth/kakao/callback`;
|
|
12169
|
-
const code = await getAuthCodeViaPopup(redirectUri);
|
|
12170
|
-
const { accessToken, idToken, expiresIn } = await exchangeCodeForTokens(
|
|
12171
|
-
code,
|
|
12172
|
-
redirectUri
|
|
12136
|
+
popup = window.open(
|
|
12137
|
+
"about:blank",
|
|
12138
|
+
"kakao_login",
|
|
12139
|
+
"width=500,height=700,scrollbars=yes"
|
|
12173
12140
|
);
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12141
|
+
if (!popup)
|
|
12142
|
+
throw new Error("KAKAO_POPUP_BLOCKED");
|
|
12143
|
+
for (const key of [
|
|
12144
|
+
"kakao_access_token",
|
|
12145
|
+
"kakao_id_token",
|
|
12146
|
+
"kakao_email",
|
|
12147
|
+
"kakao_expires_at"
|
|
12148
|
+
]) {
|
|
12149
|
+
try {
|
|
12150
|
+
sessionStorage.removeItem(key);
|
|
12151
|
+
} catch {
|
|
12152
|
+
}
|
|
12180
12153
|
}
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12154
|
+
const start = await requestServer(endpoint, "start", {});
|
|
12155
|
+
if (typeof start.authorizationUrl !== "string" || typeof start.redirectUri !== "string" || typeof start.state !== "string" || !/^[a-zA-Z0-9_-]{43}$/.test(start.state))
|
|
12156
|
+
throw new Error("Invalid Kakao server response");
|
|
12157
|
+
const code = await getAuthCodeViaPopup(
|
|
12158
|
+
popup,
|
|
12159
|
+
start.authorizationUrl,
|
|
12160
|
+
start.redirectUri,
|
|
12161
|
+
start.state,
|
|
12162
|
+
callbackPath
|
|
12187
12163
|
);
|
|
12188
|
-
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
12192
|
-
|
|
12164
|
+
const result = await requestServer(endpoint, "exchange", {
|
|
12165
|
+
code,
|
|
12166
|
+
state: start.state
|
|
12167
|
+
});
|
|
12168
|
+
if (typeof result.email !== "string" || !result.email || result.email.length > 320 || typeof result.idToken !== "string" || result.idToken.length > 16 * 1024 || result.idToken.split(".").length !== 3)
|
|
12169
|
+
throw new Error("Invalid Kakao server response");
|
|
12170
|
+
return { email: result.email, idToken: result.idToken, service: "kakao" };
|
|
12193
12171
|
} catch (error2) {
|
|
12194
|
-
if (error2
|
|
12172
|
+
if (error2 instanceof Error && error2.message === "KAKAO_CANCELLED")
|
|
12195
12173
|
return null;
|
|
12196
|
-
|
|
12197
|
-
if (error2?.message === "KAKAO_TIMEOUT") {
|
|
12174
|
+
if (error2 instanceof Error && error2.message === "KAKAO_TIMEOUT")
|
|
12198
12175
|
throw new Error("Login timed out. Please try again.");
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
throw
|
|
12176
|
+
if (error2 instanceof Error && error2.message === "KAKAO_POPUP_BLOCKED")
|
|
12177
|
+
throw new Error("Please allow popups and try again.");
|
|
12178
|
+
throw new Error("Kakao authentication failed. Please try again.");
|
|
12202
12179
|
} finally {
|
|
12180
|
+
if (popup && !popup.closed)
|
|
12181
|
+
popup.close();
|
|
12203
12182
|
isKakaoLoginInProgress = false;
|
|
12204
12183
|
}
|
|
12205
12184
|
}
|
|
@@ -12431,7 +12410,7 @@ function useAbcWaasSocial(props) {
|
|
|
12431
12410
|
}
|
|
12432
12411
|
|
|
12433
12412
|
// src/components/ConnectOptions/AbcWaasAuth/AbcWaasAuthFlow.tsx
|
|
12434
|
-
var
|
|
12413
|
+
var logger17 = createLogger("AbcWaasAuthFlow");
|
|
12435
12414
|
function AbcWaasAuthFlow({
|
|
12436
12415
|
onPinCreateRequired,
|
|
12437
12416
|
onPinVerifyRequired,
|
|
@@ -12445,23 +12424,23 @@ function AbcWaasAuthFlow({
|
|
|
12445
12424
|
});
|
|
12446
12425
|
const socialAuth = useAbcWaasSocial({
|
|
12447
12426
|
onPinRequired: (loginData, email, canVerifyPin) => {
|
|
12448
|
-
|
|
12427
|
+
logger17.info("PIN required for social login");
|
|
12449
12428
|
abcAuth.setEmail(email);
|
|
12450
12429
|
if (canVerifyPin) {
|
|
12451
|
-
|
|
12430
|
+
logger17.info("Social login - routing to verify modal");
|
|
12452
12431
|
onPinVerifyRequired(loginData);
|
|
12453
12432
|
} else {
|
|
12454
|
-
|
|
12433
|
+
logger17.warn("Social login - routing to create modal");
|
|
12455
12434
|
onPinCreateRequired(loginData);
|
|
12456
12435
|
}
|
|
12457
12436
|
},
|
|
12458
12437
|
onEmailSet: (email) => {
|
|
12459
|
-
|
|
12438
|
+
logger17.info("Email set from social login");
|
|
12460
12439
|
abcAuth.setEmail(email);
|
|
12461
12440
|
}
|
|
12462
12441
|
});
|
|
12463
12442
|
const handleSocialLogin = async (provider) => {
|
|
12464
|
-
|
|
12443
|
+
logger17.info("Social login initiated:", provider);
|
|
12465
12444
|
if (provider === "google") {
|
|
12466
12445
|
await socialAuth.handleGoogleLogin();
|
|
12467
12446
|
} else if (provider === "apple") {
|
|
@@ -12971,7 +12950,7 @@ function clearLatestWalletId() {
|
|
|
12971
12950
|
}
|
|
12972
12951
|
|
|
12973
12952
|
// src/components/ConnectOptions/ExternalWallets/hooks/useWalletConnection.ts
|
|
12974
|
-
var
|
|
12953
|
+
var logger18 = createLogger("useWalletConnection");
|
|
12975
12954
|
function useWalletConnection({
|
|
12976
12955
|
onSuccess,
|
|
12977
12956
|
initialWallet
|
|
@@ -13059,7 +13038,7 @@ function useWalletConnection({
|
|
|
13059
13038
|
callOnSuccess();
|
|
13060
13039
|
return;
|
|
13061
13040
|
}
|
|
13062
|
-
|
|
13041
|
+
logger18.error("Connection failed:", error2);
|
|
13063
13042
|
setConnectionError(true);
|
|
13064
13043
|
}
|
|
13065
13044
|
};
|
|
@@ -13365,7 +13344,7 @@ function PinInputModal({
|
|
|
13365
13344
|
|
|
13366
13345
|
// src/components/ConnectOptions/PinAuth/hooks/usePinCreation.ts
|
|
13367
13346
|
import { useState as useState34 } from "react";
|
|
13368
|
-
var
|
|
13347
|
+
var logger19 = createLogger("PinCreation");
|
|
13369
13348
|
function usePinCreation(props) {
|
|
13370
13349
|
const { onPinConfirmed, onShowConfirmModal } = props;
|
|
13371
13350
|
const [pin, setPin] = useState34("");
|
|
@@ -13373,29 +13352,29 @@ function usePinCreation(props) {
|
|
|
13373
13352
|
const [error2, setError] = useState34("");
|
|
13374
13353
|
const [isCreating, setIsCreating] = useState34(false);
|
|
13375
13354
|
const handlePinCreate = async (createdPin) => {
|
|
13376
|
-
|
|
13355
|
+
logger19.info("Creating PIN");
|
|
13377
13356
|
setPin(createdPin);
|
|
13378
13357
|
setError("");
|
|
13379
13358
|
onShowConfirmModal?.();
|
|
13380
13359
|
};
|
|
13381
13360
|
const handlePinConfirm = async (confirmedPin) => {
|
|
13382
|
-
|
|
13361
|
+
logger19.info("Confirming PIN");
|
|
13383
13362
|
if (confirmedPin !== pin) {
|
|
13384
|
-
|
|
13363
|
+
logger19.error("PINs do not match");
|
|
13385
13364
|
setError("PINs do not match. Please try again.");
|
|
13386
13365
|
return;
|
|
13387
13366
|
}
|
|
13388
13367
|
setIsCreating(true);
|
|
13389
13368
|
setError("");
|
|
13390
13369
|
try {
|
|
13391
|
-
|
|
13370
|
+
logger19.debug("Hashing PIN...");
|
|
13392
13371
|
const hashedPin = await hashPin(pin);
|
|
13393
|
-
|
|
13372
|
+
logger19.info("PIN hashed successfully");
|
|
13394
13373
|
await onPinConfirmed(hashedPin);
|
|
13395
13374
|
setPin("");
|
|
13396
13375
|
setConfirmPin("");
|
|
13397
13376
|
} catch (error3) {
|
|
13398
|
-
|
|
13377
|
+
logger19.error("PIN confirmation failed:", error3);
|
|
13399
13378
|
setError(error3.message || "Failed to confirm PIN");
|
|
13400
13379
|
throw error3;
|
|
13401
13380
|
} finally {
|
|
@@ -13403,7 +13382,7 @@ function usePinCreation(props) {
|
|
|
13403
13382
|
}
|
|
13404
13383
|
};
|
|
13405
13384
|
const resetPin = () => {
|
|
13406
|
-
|
|
13385
|
+
logger19.debug("Resetting PIN state");
|
|
13407
13386
|
setPin("");
|
|
13408
13387
|
setConfirmPin("");
|
|
13409
13388
|
setError("");
|
|
@@ -13421,14 +13400,14 @@ function usePinCreation(props) {
|
|
|
13421
13400
|
|
|
13422
13401
|
// src/components/ConnectOptions/PinAuth/hooks/usePinVerification.ts
|
|
13423
13402
|
import { useState as useState35 } from "react";
|
|
13424
|
-
var
|
|
13403
|
+
var logger20 = createLogger("PinVerification");
|
|
13425
13404
|
function usePinVerification(props) {
|
|
13426
13405
|
const { email, onVerified, onSessionExpired } = props;
|
|
13427
13406
|
const [isVerifying, setIsVerifying] = useState35(false);
|
|
13428
13407
|
const [error2, setError] = useState35("");
|
|
13429
13408
|
const [progress, setProgress] = useState35([]);
|
|
13430
13409
|
const handlePinVerify = async (pin) => {
|
|
13431
|
-
|
|
13410
|
+
logger20.info("Verifying PIN");
|
|
13432
13411
|
setProgress([
|
|
13433
13412
|
{ label: "Verifying PIN...", status: "active" },
|
|
13434
13413
|
{ label: "Restoring wallet data...", status: "pending" }
|
|
@@ -13437,15 +13416,15 @@ function usePinVerification(props) {
|
|
|
13437
13416
|
setError("");
|
|
13438
13417
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
13439
13418
|
try {
|
|
13440
|
-
|
|
13419
|
+
logger20.debug("Hashing PIN...");
|
|
13441
13420
|
const hashedPin = await hashPin(pin);
|
|
13442
|
-
|
|
13421
|
+
logger20.debug("Decrypting stored data...");
|
|
13443
13422
|
const saltHex = get(STORAGE_NS.ABC, "enc_salt");
|
|
13444
13423
|
const encryptedData = get(STORAGE_NS.ABC, "enc_tokens");
|
|
13445
13424
|
let sensitiveData;
|
|
13446
13425
|
let isExpired = false;
|
|
13447
13426
|
if (!saltHex || !encryptedData) {
|
|
13448
|
-
|
|
13427
|
+
logger20.info("Using fresh tokens from auth_state");
|
|
13449
13428
|
const authStateStr2 = get(STORAGE_NS.ABC, "auth_state");
|
|
13450
13429
|
if (!authStateStr2) {
|
|
13451
13430
|
throw new Error("No auth state found. Please login again.");
|
|
@@ -13461,7 +13440,7 @@ function usePinVerification(props) {
|
|
|
13461
13440
|
};
|
|
13462
13441
|
isExpired = false;
|
|
13463
13442
|
} else {
|
|
13464
|
-
|
|
13443
|
+
logger20.debug("Decrypting stored tokens");
|
|
13465
13444
|
try {
|
|
13466
13445
|
const decrypted = await decryptWithPin(
|
|
13467
13446
|
encryptedData,
|
|
@@ -13469,7 +13448,7 @@ function usePinVerification(props) {
|
|
|
13469
13448
|
saltHex
|
|
13470
13449
|
);
|
|
13471
13450
|
sensitiveData = JSON.parse(decrypted);
|
|
13472
|
-
|
|
13451
|
+
logger20.info("PIN verified successfully");
|
|
13473
13452
|
} catch (_decryptError) {
|
|
13474
13453
|
throw new Error("Incorrect PIN. Please try again.");
|
|
13475
13454
|
}
|
|
@@ -13479,7 +13458,7 @@ function usePinVerification(props) {
|
|
|
13479
13458
|
{ label: "Verifying PIN...", status: "completed" },
|
|
13480
13459
|
{ label: "Restoring wallet data...", status: "active" }
|
|
13481
13460
|
]);
|
|
13482
|
-
|
|
13461
|
+
logger20.info("Restoring wallet data...");
|
|
13483
13462
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
13484
13463
|
const authStateStr = get(STORAGE_NS.ABC, "auth_state");
|
|
13485
13464
|
if (!authStateStr) {
|
|
@@ -13490,7 +13469,7 @@ function usePinVerification(props) {
|
|
|
13490
13469
|
authState.refreshToken = sensitiveData.refreshToken;
|
|
13491
13470
|
authState.expiresAt = sensitiveData.expiresAt;
|
|
13492
13471
|
if (isExpired) {
|
|
13493
|
-
|
|
13472
|
+
logger20.info("Access token expired, attempting refresh...");
|
|
13494
13473
|
try {
|
|
13495
13474
|
const refreshToken = sensitiveData.refreshToken;
|
|
13496
13475
|
if (!refreshToken) {
|
|
@@ -13509,7 +13488,7 @@ function usePinVerification(props) {
|
|
|
13509
13488
|
if (!res.accessToken) {
|
|
13510
13489
|
throw new Error("Your session has expired. Please login again.");
|
|
13511
13490
|
}
|
|
13512
|
-
|
|
13491
|
+
logger20.info("Token refreshed successfully");
|
|
13513
13492
|
const newAccessToken = res.accessToken;
|
|
13514
13493
|
const newRefreshToken = res.refreshToken || refreshToken;
|
|
13515
13494
|
const expiresIn = res.expiresIn || 600;
|
|
@@ -13536,9 +13515,9 @@ function usePinVerification(props) {
|
|
|
13536
13515
|
);
|
|
13537
13516
|
set(STORAGE_NS.ABC, "enc_tokens", encryptedTokens);
|
|
13538
13517
|
setJSON(STORAGE_NS.ABC, "auth_state", authState);
|
|
13539
|
-
|
|
13518
|
+
logger20.info("Encrypted tokens updated");
|
|
13540
13519
|
} catch (refreshError) {
|
|
13541
|
-
|
|
13520
|
+
logger20.error("Token refresh failed:", refreshError);
|
|
13542
13521
|
const freshAuthState = getJSON(STORAGE_NS.ABC, "auth_state");
|
|
13543
13522
|
const hasFreshTokens = freshAuthState && (() => {
|
|
13544
13523
|
try {
|
|
@@ -13549,7 +13528,7 @@ function usePinVerification(props) {
|
|
|
13549
13528
|
}
|
|
13550
13529
|
})();
|
|
13551
13530
|
if (!hasFreshTokens) {
|
|
13552
|
-
|
|
13531
|
+
logger20.info("Clearing all auth data");
|
|
13553
13532
|
remove(STORAGE_NS.ABC, "auth_state");
|
|
13554
13533
|
remove(STORAGE_NS.ABC, "enc_tokens");
|
|
13555
13534
|
remove(STORAGE_NS.ABC, "enc_salt");
|
|
@@ -13560,7 +13539,7 @@ function usePinVerification(props) {
|
|
|
13560
13539
|
onSessionExpired?.();
|
|
13561
13540
|
throw new Error("Your session has expired. Please login again.");
|
|
13562
13541
|
}
|
|
13563
|
-
|
|
13542
|
+
logger20.info("Using fresh tokens from login, skipping refresh");
|
|
13564
13543
|
}
|
|
13565
13544
|
}
|
|
13566
13545
|
const user = getJSON(STORAGE_NS.ABC, "user");
|
|
@@ -13585,11 +13564,11 @@ function usePinVerification(props) {
|
|
|
13585
13564
|
{ label: "Verifying PIN...", status: "completed" },
|
|
13586
13565
|
{ label: "Restoring wallet data...", status: "completed" }
|
|
13587
13566
|
]);
|
|
13588
|
-
|
|
13567
|
+
logger20.info("Wallet data restored successfully");
|
|
13589
13568
|
window.dispatchEvent(new Event("talkenkit_storage_update"));
|
|
13590
13569
|
onVerified();
|
|
13591
13570
|
} catch (err) {
|
|
13592
|
-
|
|
13571
|
+
logger20.error("PIN verification failed:", err);
|
|
13593
13572
|
setError(err.message || "Failed to verify PIN");
|
|
13594
13573
|
throw err;
|
|
13595
13574
|
} finally {
|
|
@@ -13597,7 +13576,7 @@ function usePinVerification(props) {
|
|
|
13597
13576
|
}
|
|
13598
13577
|
};
|
|
13599
13578
|
const resetVerification = () => {
|
|
13600
|
-
|
|
13579
|
+
logger20.debug("Resetting verification state");
|
|
13601
13580
|
setError("");
|
|
13602
13581
|
setProgress([]);
|
|
13603
13582
|
};
|
|
@@ -13612,7 +13591,7 @@ function usePinVerification(props) {
|
|
|
13612
13591
|
|
|
13613
13592
|
// src/components/ConnectOptions/PinAuth/hooks/useWalletGeneration.ts
|
|
13614
13593
|
import { useState as useState36 } from "react";
|
|
13615
|
-
var
|
|
13594
|
+
var logger21 = createLogger("useWalletGeneration");
|
|
13616
13595
|
function useWalletGeneration(props) {
|
|
13617
13596
|
const { connectors, connect, onSuccess } = props;
|
|
13618
13597
|
const [isGenerating, setIsGenerating] = useState36(false);
|
|
@@ -13685,7 +13664,7 @@ function useWalletGeneration(props) {
|
|
|
13685
13664
|
if (!xrpAddress)
|
|
13686
13665
|
xrpAddress = addrResponse?.xrp || addrResponse?.xrpAddress || "";
|
|
13687
13666
|
} catch (err) {
|
|
13688
|
-
|
|
13667
|
+
logger21.warn("Failed to derive BTC/TRX/XRP addresses:", err);
|
|
13689
13668
|
}
|
|
13690
13669
|
}
|
|
13691
13670
|
const solMaterial = genResponse.solana;
|
|
@@ -13843,7 +13822,7 @@ function useWalletGeneration(props) {
|
|
|
13843
13822
|
}
|
|
13844
13823
|
|
|
13845
13824
|
// src/components/ConnectOptions/PinAuth/PinAuthFlow.tsx
|
|
13846
|
-
var
|
|
13825
|
+
var logger22 = createLogger("PinAuthFlow");
|
|
13847
13826
|
var PinAuthFlow = forwardRef(
|
|
13848
13827
|
(props, ref) => {
|
|
13849
13828
|
const {
|
|
@@ -13891,7 +13870,7 @@ var PinAuthFlow = forwardRef(
|
|
|
13891
13870
|
const authState = authStateStr ? JSON.parse(authStateStr) : null;
|
|
13892
13871
|
const needsWalletGeneration = authState && (!authState.wallet || !authState.solanaWallet || !authState.bitcoinWallet || !authState.tronWallet || !authState.xrplWallet);
|
|
13893
13872
|
if (needsWalletGeneration) {
|
|
13894
|
-
const { getCredentialManager: getCredentialManager2 } = await import("./AbcCredentialManager-
|
|
13873
|
+
const { getCredentialManager: getCredentialManager2 } = await import("./AbcCredentialManager-QM2BNLSR.js");
|
|
13895
13874
|
const pinHash = getCredentialManager2().getPinHash();
|
|
13896
13875
|
if (pinHash) {
|
|
13897
13876
|
await walletGeneration.generateWallets({
|
|
@@ -13908,7 +13887,7 @@ var PinAuthFlow = forwardRef(
|
|
|
13908
13887
|
if (abcConnector) {
|
|
13909
13888
|
connect({ connector: abcConnector });
|
|
13910
13889
|
} else {
|
|
13911
|
-
|
|
13890
|
+
logger22.error("ABC Wallet connector not found");
|
|
13912
13891
|
}
|
|
13913
13892
|
onComplete();
|
|
13914
13893
|
},
|
|
@@ -15419,7 +15398,7 @@ function useWalletStepMachine({
|
|
|
15419
15398
|
}
|
|
15420
15399
|
|
|
15421
15400
|
// src/components/ConnectOptions/ConnectOptionsModal.tsx
|
|
15422
|
-
var
|
|
15401
|
+
var logger23 = createLogger("ConnectOptionsModal");
|
|
15423
15402
|
function ConnectOptionsModal({
|
|
15424
15403
|
onClose,
|
|
15425
15404
|
solanaWallets,
|
|
@@ -15447,14 +15426,14 @@ function ConnectOptionsModal({
|
|
|
15447
15426
|
(c) => c.id === "abc" || c.id === "abcWallet"
|
|
15448
15427
|
);
|
|
15449
15428
|
if (!abcConnector) {
|
|
15450
|
-
|
|
15429
|
+
logger23.error("ABC connector not found");
|
|
15451
15430
|
return;
|
|
15452
15431
|
}
|
|
15453
15432
|
try {
|
|
15454
15433
|
await connectAsync({ connector: abcConnector });
|
|
15455
15434
|
onClose();
|
|
15456
15435
|
} catch (err) {
|
|
15457
|
-
|
|
15436
|
+
logger23.error("Connect failed after ensure-user:", err);
|
|
15458
15437
|
}
|
|
15459
15438
|
};
|
|
15460
15439
|
const walletConnection = useWalletConnection({
|
|
@@ -16242,7 +16221,7 @@ var MobileStatus = ({ onClose }) => {
|
|
|
16242
16221
|
};
|
|
16243
16222
|
|
|
16244
16223
|
// src/components/ConnectOptions/ConnectOptions.tsx
|
|
16245
|
-
var
|
|
16224
|
+
var logger24 = createLogger("ConnectOptions");
|
|
16246
16225
|
function ConnectOptions({ onClose }) {
|
|
16247
16226
|
const { connector } = useContext27(WalletButtonContext);
|
|
16248
16227
|
const multiChainContext = useContext27(MultiChainContext);
|
|
@@ -16312,7 +16291,7 @@ function ConnectOptions({ onClose }) {
|
|
|
16312
16291
|
setShouldCloseOnConnect(true);
|
|
16313
16292
|
}
|
|
16314
16293
|
} catch (err) {
|
|
16315
|
-
|
|
16294
|
+
logger24.error("Solana connection error:", err);
|
|
16316
16295
|
const isUserRejection2 = err?.name === "WalletConnectionError" || err?.name === "WalletNotReadyError" || err?.message?.includes("User rejected") || err?.message?.includes("User canceled");
|
|
16317
16296
|
if (!isUserRejection2) {
|
|
16318
16297
|
alert(
|
|
@@ -16458,7 +16437,7 @@ var walletName = "lkxkyz8 kwh1ip1a kwh1ip1g";
|
|
|
16458
16437
|
var walletStatus = "lkxkyza kwh1ip19";
|
|
16459
16438
|
|
|
16460
16439
|
// src/components/SolanaWalletList/SolanaWalletList.tsx
|
|
16461
|
-
var
|
|
16440
|
+
var logger25 = createLogger("SolanaWalletList");
|
|
16462
16441
|
function SolanaWalletList2({
|
|
16463
16442
|
onConnect,
|
|
16464
16443
|
onError
|
|
@@ -16477,7 +16456,7 @@ function SolanaWalletList2({
|
|
|
16477
16456
|
await connect();
|
|
16478
16457
|
onConnect?.();
|
|
16479
16458
|
} catch (err) {
|
|
16480
|
-
|
|
16459
|
+
logger25.error("Connection error:", err);
|
|
16481
16460
|
onError?.(err);
|
|
16482
16461
|
} finally {
|
|
16483
16462
|
setConnectingWallet(null);
|
|
@@ -16532,7 +16511,7 @@ function SolanaWalletList2({
|
|
|
16532
16511
|
}
|
|
16533
16512
|
|
|
16534
16513
|
// src/components/ConnectOptions/MultiChainConnectOptions.tsx
|
|
16535
|
-
var
|
|
16514
|
+
var logger26 = createLogger("MultiChainConnectOptions");
|
|
16536
16515
|
function MultiChainConnectOptions({
|
|
16537
16516
|
onClose,
|
|
16538
16517
|
showChainSelector = true
|
|
@@ -16593,7 +16572,7 @@ function UnifiedWalletList({ onClose }) {
|
|
|
16593
16572
|
addRecentSolanaWalletId(walletName2);
|
|
16594
16573
|
}
|
|
16595
16574
|
} catch (err) {
|
|
16596
|
-
|
|
16575
|
+
logger26.error("Solana connection error:", err);
|
|
16597
16576
|
const isUserRejection2 = err?.name === "WalletConnectionError" || err?.name === "WalletNotReadyError" || err?.message?.includes("User rejected") || err?.message?.includes("User canceled");
|
|
16598
16577
|
if (!isUserRejection2) {
|
|
16599
16578
|
alert(
|
|
@@ -17226,7 +17205,7 @@ import React106, {
|
|
|
17226
17205
|
useState as useState46
|
|
17227
17206
|
} from "react";
|
|
17228
17207
|
import { useAccount as useAccount22, useAccountEffect as useAccountEffect4 } from "wagmi";
|
|
17229
|
-
var
|
|
17208
|
+
var logger27 = createLogger("WalletButton");
|
|
17230
17209
|
function WalletButtonRenderer({
|
|
17231
17210
|
// Wallet is the same as `connector.id` which is injected into
|
|
17232
17211
|
// wagmi connectors
|
|
@@ -17268,14 +17247,14 @@ function WalletButtonRenderer({
|
|
|
17268
17247
|
}, [isConnected, firstConnector]);
|
|
17269
17248
|
const connectWallet = async () => {
|
|
17270
17249
|
try {
|
|
17271
|
-
|
|
17250
|
+
logger27.info("Connecting wallet:", firstConnector?.id);
|
|
17272
17251
|
setLoading(true);
|
|
17273
17252
|
if (isError)
|
|
17274
17253
|
setIsError(false);
|
|
17275
17254
|
await firstConnector?.connect?.();
|
|
17276
|
-
|
|
17255
|
+
logger27.info("Wallet connected successfully");
|
|
17277
17256
|
} catch (error2) {
|
|
17278
|
-
|
|
17257
|
+
logger27.error("Connection failed:", error2);
|
|
17279
17258
|
setIsError(true);
|
|
17280
17259
|
} finally {
|
|
17281
17260
|
setLoading(false);
|
|
@@ -18570,7 +18549,7 @@ import React110, {
|
|
|
18570
18549
|
useEffect as useEffect43,
|
|
18571
18550
|
useCallback as useCallback31
|
|
18572
18551
|
} from "react";
|
|
18573
|
-
var
|
|
18552
|
+
var logger28 = createLogger("AbcAuthProvider");
|
|
18574
18553
|
var AbcAuthContext = createContext22(null);
|
|
18575
18554
|
function useAbcAuth() {
|
|
18576
18555
|
const context = useContext36(AbcAuthContext);
|
|
@@ -18617,13 +18596,13 @@ function AbcAuthProvider({ children }) {
|
|
|
18617
18596
|
}, [state.tokens.expiresAt]);
|
|
18618
18597
|
const refreshToken = useCallback31(async () => {
|
|
18619
18598
|
if (!state.tokens.refreshToken) {
|
|
18620
|
-
|
|
18599
|
+
logger28.debug("No refresh token available");
|
|
18621
18600
|
return false;
|
|
18622
18601
|
}
|
|
18623
18602
|
try {
|
|
18624
18603
|
const api = getTalkenApiClient();
|
|
18625
18604
|
if (!api) {
|
|
18626
|
-
|
|
18605
|
+
logger28.error("TalkenApiClient not initialized");
|
|
18627
18606
|
return false;
|
|
18628
18607
|
}
|
|
18629
18608
|
api.setTokens(
|
|
@@ -18647,10 +18626,10 @@ function AbcAuthProvider({ children }) {
|
|
|
18647
18626
|
}
|
|
18648
18627
|
set(STORAGE_NS.ABC, "expires_at", String(expiresAt));
|
|
18649
18628
|
scheduleProactiveRefresh(expiresAt);
|
|
18650
|
-
|
|
18629
|
+
logger28.info("Token refreshed");
|
|
18651
18630
|
return true;
|
|
18652
18631
|
} catch (error2) {
|
|
18653
|
-
|
|
18632
|
+
logger28.error("Token refresh error:", error2);
|
|
18654
18633
|
return false;
|
|
18655
18634
|
}
|
|
18656
18635
|
}, [
|
|
@@ -18662,7 +18641,7 @@ function AbcAuthProvider({ children }) {
|
|
|
18662
18641
|
try {
|
|
18663
18642
|
const encryptedTokens = get(STORAGE_NS.ABC, "enc_tokens");
|
|
18664
18643
|
const saltHex = get(STORAGE_NS.ABC, "enc_salt");
|
|
18665
|
-
const { getCredentialManager: getCredentialManager2 } = await import("./AbcCredentialManager-
|
|
18644
|
+
const { getCredentialManager: getCredentialManager2 } = await import("./AbcCredentialManager-QM2BNLSR.js");
|
|
18666
18645
|
const storedPinHash = getCredentialManager2().getPinHash();
|
|
18667
18646
|
if (!encryptedTokens || !saltHex || !storedPinHash) {
|
|
18668
18647
|
throw new Error("No encrypted data found");
|
|
@@ -18697,10 +18676,10 @@ function AbcAuthProvider({ children }) {
|
|
|
18697
18676
|
},
|
|
18698
18677
|
pinHash: hashedPin
|
|
18699
18678
|
}));
|
|
18700
|
-
|
|
18679
|
+
logger28.info("Unlocked with PIN");
|
|
18701
18680
|
return true;
|
|
18702
18681
|
} catch (error2) {
|
|
18703
|
-
|
|
18682
|
+
logger28.error("Unlock failed:", error2);
|
|
18704
18683
|
return false;
|
|
18705
18684
|
}
|
|
18706
18685
|
}, []);
|
|
@@ -18726,7 +18705,7 @@ function AbcAuthProvider({ children }) {
|
|
|
18726
18705
|
getTalkenApiClient4()?.clearSession();
|
|
18727
18706
|
} catch {
|
|
18728
18707
|
}
|
|
18729
|
-
|
|
18708
|
+
logger28.info("Logged out");
|
|
18730
18709
|
}, []);
|
|
18731
18710
|
const setAuthState = useCallback31((partial) => {
|
|
18732
18711
|
setState((prev) => ({ ...prev, ...partial }));
|
|
@@ -18760,7 +18739,7 @@ function AbcAuthProvider({ children }) {
|
|
|
18760
18739
|
},
|
|
18761
18740
|
pinHash: null
|
|
18762
18741
|
});
|
|
18763
|
-
|
|
18742
|
+
logger28.info("Session restored (Access Key mode)");
|
|
18764
18743
|
return;
|
|
18765
18744
|
}
|
|
18766
18745
|
if (accessToken) {
|
|
@@ -18785,19 +18764,19 @@ function AbcAuthProvider({ children }) {
|
|
|
18785
18764
|
},
|
|
18786
18765
|
pinHash: null
|
|
18787
18766
|
});
|
|
18788
|
-
|
|
18767
|
+
logger28.info("Session restored (Bearer mode)", {
|
|
18789
18768
|
hasEvm: !!authState.evmWallet || !!authState.wallet,
|
|
18790
18769
|
hasSolana: !!authState.solanaWallet
|
|
18791
18770
|
});
|
|
18792
18771
|
}
|
|
18793
18772
|
}
|
|
18794
18773
|
} catch (error2) {
|
|
18795
|
-
|
|
18774
|
+
logger28.error("Failed to restore session:", error2);
|
|
18796
18775
|
}
|
|
18797
18776
|
};
|
|
18798
18777
|
restoreSession();
|
|
18799
18778
|
const handleStorageUpdate = () => {
|
|
18800
|
-
|
|
18779
|
+
logger28.debug("Storage updated, restoring session");
|
|
18801
18780
|
restoreSession();
|
|
18802
18781
|
};
|
|
18803
18782
|
window.addEventListener("talkenkit_storage_update", handleStorageUpdate);
|
|
@@ -18810,7 +18789,7 @@ function AbcAuthProvider({ children }) {
|
|
|
18810
18789
|
}, []);
|
|
18811
18790
|
useEffect43(() => {
|
|
18812
18791
|
const handleExpired = () => {
|
|
18813
|
-
|
|
18792
|
+
logger28.info("Access key expired \u2014 logging out");
|
|
18814
18793
|
logout();
|
|
18815
18794
|
};
|
|
18816
18795
|
window.addEventListener("talkenkit:access_key_expired", handleExpired);
|
|
@@ -18858,7 +18837,7 @@ function PinProvider({ children }) {
|
|
|
18858
18837
|
if (!pinResolver) {
|
|
18859
18838
|
return;
|
|
18860
18839
|
}
|
|
18861
|
-
const { getCredentialManager: getCredentialManager2 } = await import("./AbcCredentialManager-
|
|
18840
|
+
const { getCredentialManager: getCredentialManager2 } = await import("./AbcCredentialManager-QM2BNLSR.js");
|
|
18862
18841
|
const storedPinHash = getCredentialManager2().getPinHash();
|
|
18863
18842
|
if (!storedPinHash) {
|
|
18864
18843
|
throw new Error("PIN not set. Please login again.");
|
|
@@ -19586,6 +19565,7 @@ export {
|
|
|
19586
19565
|
chainIdToNetwork,
|
|
19587
19566
|
checkDelegation,
|
|
19588
19567
|
clearSession,
|
|
19568
|
+
configureKakaoAuth,
|
|
19589
19569
|
configureLogger,
|
|
19590
19570
|
connectorsForWallets,
|
|
19591
19571
|
createAbcSolanaAdapter,
|