@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
|
@@ -1,49 +1,61 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
createLogger
|
|
4
|
-
} from "../chunk-2DFJ6LEN.js";
|
|
5
2
|
|
|
6
3
|
// src/wallets/walletConnectors/abcWallet/kakaoAuth.ts
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var KAKAO_EXPIRES_AT_KEY = "kakao_expires_at";
|
|
4
|
+
var POPUP_TIMEOUT_MS = 3 * 60 * 1e3;
|
|
5
|
+
var REQUEST_TIMEOUT_MS = 15 * 1e3;
|
|
6
|
+
var serverEndpoint;
|
|
7
|
+
var configuredCallbackPath;
|
|
12
8
|
var isKakaoLoginInProgress = false;
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
throw new Error("
|
|
9
|
+
function configureKakaoAuth(config) {
|
|
10
|
+
const endpoint = config.serverEndpoint.replace(/\/$/, "");
|
|
11
|
+
if (!/^\/(?:[a-zA-Z0-9_-]+\/)*[a-zA-Z0-9_-]+$/.test(endpoint)) {
|
|
12
|
+
throw new Error("Kakao serverEndpoint must be a root-relative path");
|
|
17
13
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
if (config.callbackPath !== void 0 && (config.callbackPath.length > 256 || !/^\/(?:[a-zA-Z0-9_-]+\/)*[a-zA-Z0-9_-]+\/?$/.test(config.callbackPath))) {
|
|
15
|
+
throw new Error("Kakao callbackPath must be a root-relative path");
|
|
16
|
+
}
|
|
17
|
+
serverEndpoint = endpoint;
|
|
18
|
+
configuredCallbackPath = config.callbackPath;
|
|
21
19
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
35
|
-
if (!
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
41
|
-
return;
|
|
20
|
+
async function requestServer(endpoint, action, body) {
|
|
21
|
+
const controller = new AbortController();
|
|
22
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
23
|
+
try {
|
|
24
|
+
const response = await fetch(`${endpoint}/${action}/`, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
credentials: "same-origin",
|
|
27
|
+
cache: "no-store",
|
|
28
|
+
redirect: "error",
|
|
29
|
+
headers: { "Content-Type": "application/json" },
|
|
30
|
+
body: JSON.stringify(body),
|
|
31
|
+
signal: controller.signal
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok)
|
|
34
|
+
throw new Error("Kakao authentication failed. Please try again.");
|
|
35
|
+
const data = await response.json();
|
|
36
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
37
|
+
throw new Error("Invalid Kakao server response");
|
|
42
38
|
}
|
|
43
|
-
|
|
39
|
+
return data;
|
|
40
|
+
} finally {
|
|
41
|
+
clearTimeout(timeout);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function getAuthCodeViaPopup(popup, authorizationUrl, redirectUri, state, callbackPath) {
|
|
45
|
+
const redirect = new URL(redirectUri);
|
|
46
|
+
const expectedCallback = new URL(
|
|
47
|
+
callbackPath ?? redirect.pathname,
|
|
48
|
+
window.location.origin
|
|
49
|
+
);
|
|
50
|
+
const authorize = new URL(authorizationUrl);
|
|
51
|
+
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) {
|
|
52
|
+
throw new Error("Invalid Kakao authorization configuration");
|
|
53
|
+
}
|
|
54
|
+
popup.location.href = authorizationUrl;
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
44
56
|
const startTime = Date.now();
|
|
45
57
|
const timer = setInterval(() => {
|
|
46
|
-
if (Date.now() - startTime
|
|
58
|
+
if (Date.now() - startTime >= POPUP_TIMEOUT_MS) {
|
|
47
59
|
clearInterval(timer);
|
|
48
60
|
popup.close();
|
|
49
61
|
reject(new Error("KAKAO_TIMEOUT"));
|
|
@@ -54,129 +66,94 @@ function getAuthCodeViaPopup(redirectUri) {
|
|
|
54
66
|
reject(new Error("KAKAO_CANCELLED"));
|
|
55
67
|
return;
|
|
56
68
|
}
|
|
69
|
+
let callback;
|
|
57
70
|
try {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
71
|
+
callback = new URL(popup.location.href);
|
|
72
|
+
} catch {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (callback.origin !== redirect.origin || callback.pathname !== expectedCallback.pathname)
|
|
76
|
+
return;
|
|
77
|
+
clearInterval(timer);
|
|
78
|
+
popup.close();
|
|
79
|
+
if (callback.searchParams.getAll("state").length !== 1 || callback.searchParams.get("state") !== state) {
|
|
80
|
+
reject(new Error("Invalid Kakao authorization state"));
|
|
81
|
+
} else if (callback.searchParams.has("error")) {
|
|
82
|
+
reject(
|
|
83
|
+
new Error(
|
|
84
|
+
callback.searchParams.get("error") === "access_denied" ? "KAKAO_CANCELLED" : "Kakao authorization failed"
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
} else if (callback.searchParams.getAll("code").length === 1 && callback.searchParams.get("code")) {
|
|
88
|
+
resolve(callback.searchParams.get("code"));
|
|
89
|
+
} else {
|
|
90
|
+
reject(new Error("No Kakao authorization code received"));
|
|
75
91
|
}
|
|
76
92
|
}, 500);
|
|
77
93
|
});
|
|
78
94
|
}
|
|
79
|
-
async function exchangeCodeForTokens(code, redirectUri) {
|
|
80
|
-
const restApiKey = process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY;
|
|
81
|
-
if (!restApiKey) {
|
|
82
|
-
throw new Error("NEXT_PUBLIC_KAKAO_REST_API_KEY is not configured");
|
|
83
|
-
}
|
|
84
|
-
const response = await fetch("https://kauth.kakao.com/oauth/token", {
|
|
85
|
-
method: "POST",
|
|
86
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
87
|
-
body: new URLSearchParams({
|
|
88
|
-
grant_type: "authorization_code",
|
|
89
|
-
client_id: restApiKey,
|
|
90
|
-
redirect_uri: redirectUri,
|
|
91
|
-
code,
|
|
92
|
-
...process.env.NEXT_PUBLIC_KAKAO_CLIENT_SECRET ? { client_secret: process.env.NEXT_PUBLIC_KAKAO_CLIENT_SECRET } : {}
|
|
93
|
-
})
|
|
94
|
-
});
|
|
95
|
-
if (!response.ok) {
|
|
96
|
-
const err = await response.json().catch(() => ({}));
|
|
97
|
-
throw new Error(err.error_description || "Failed to get access token");
|
|
98
|
-
}
|
|
99
|
-
const data = await response.json();
|
|
100
|
-
if (!data.id_token) {
|
|
101
|
-
throw new Error("No id_token received. Ensure openid scope is enabled.");
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
accessToken: data.access_token,
|
|
105
|
-
idToken: data.id_token,
|
|
106
|
-
expiresIn: data.expires_in || 21600
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function tryExistingToken() {
|
|
110
|
-
const storedIdToken = sessionStorage.getItem(KAKAO_ID_TOKEN_KEY);
|
|
111
|
-
const storedEmail = sessionStorage.getItem(KAKAO_EMAIL_KEY);
|
|
112
|
-
const expiresAt = sessionStorage.getItem(KAKAO_EXPIRES_AT_KEY);
|
|
113
|
-
if (!storedIdToken || !storedEmail || !expiresAt) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
if (Date.now() >= Number(expiresAt)) {
|
|
117
|
-
clearStoredTokens();
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
email: storedEmail,
|
|
122
|
-
idToken: storedIdToken,
|
|
123
|
-
service: "kakao"
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function clearStoredTokens() {
|
|
127
|
-
sessionStorage.removeItem(KAKAO_TOKEN_KEY);
|
|
128
|
-
sessionStorage.removeItem(KAKAO_ID_TOKEN_KEY);
|
|
129
|
-
sessionStorage.removeItem(KAKAO_EMAIL_KEY);
|
|
130
|
-
sessionStorage.removeItem(KAKAO_EXPIRES_AT_KEY);
|
|
131
|
-
}
|
|
132
95
|
async function kakaoLogin() {
|
|
133
|
-
if (isKakaoLoginInProgress)
|
|
96
|
+
if (isKakaoLoginInProgress)
|
|
134
97
|
return null;
|
|
135
|
-
|
|
98
|
+
if (!serverEndpoint)
|
|
99
|
+
throw new Error(
|
|
100
|
+
"Configure a Kakao server authentication endpoint before login"
|
|
101
|
+
);
|
|
102
|
+
const endpoint = serverEndpoint;
|
|
103
|
+
const callbackPath = configuredCallbackPath;
|
|
136
104
|
isKakaoLoginInProgress = true;
|
|
105
|
+
let popup = null;
|
|
137
106
|
try {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const redirectUri = `${window.location.origin}/auth/kakao/callback`;
|
|
143
|
-
const code = await getAuthCodeViaPopup(redirectUri);
|
|
144
|
-
const { accessToken, idToken, expiresIn } = await exchangeCodeForTokens(
|
|
145
|
-
code,
|
|
146
|
-
redirectUri
|
|
107
|
+
popup = window.open(
|
|
108
|
+
"about:blank",
|
|
109
|
+
"kakao_login",
|
|
110
|
+
"width=500,height=700,scrollbars=yes"
|
|
147
111
|
);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
112
|
+
if (!popup)
|
|
113
|
+
throw new Error("KAKAO_POPUP_BLOCKED");
|
|
114
|
+
for (const key of [
|
|
115
|
+
"kakao_access_token",
|
|
116
|
+
"kakao_id_token",
|
|
117
|
+
"kakao_email",
|
|
118
|
+
"kakao_expires_at"
|
|
119
|
+
]) {
|
|
120
|
+
try {
|
|
121
|
+
sessionStorage.removeItem(key);
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
154
124
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
125
|
+
const start = await requestServer(endpoint, "start", {});
|
|
126
|
+
if (typeof start.authorizationUrl !== "string" || typeof start.redirectUri !== "string" || typeof start.state !== "string" || !/^[a-zA-Z0-9_-]{43}$/.test(start.state))
|
|
127
|
+
throw new Error("Invalid Kakao server response");
|
|
128
|
+
const code = await getAuthCodeViaPopup(
|
|
129
|
+
popup,
|
|
130
|
+
start.authorizationUrl,
|
|
131
|
+
start.redirectUri,
|
|
132
|
+
start.state,
|
|
133
|
+
callbackPath
|
|
161
134
|
);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
135
|
+
const result = await requestServer(endpoint, "exchange", {
|
|
136
|
+
code,
|
|
137
|
+
state: start.state
|
|
138
|
+
});
|
|
139
|
+
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)
|
|
140
|
+
throw new Error("Invalid Kakao server response");
|
|
141
|
+
return { email: result.email, idToken: result.idToken, service: "kakao" };
|
|
167
142
|
} catch (error) {
|
|
168
|
-
if (error
|
|
143
|
+
if (error instanceof Error && error.message === "KAKAO_CANCELLED")
|
|
169
144
|
return null;
|
|
170
|
-
|
|
171
|
-
if (error?.message === "KAKAO_TIMEOUT") {
|
|
145
|
+
if (error instanceof Error && error.message === "KAKAO_TIMEOUT")
|
|
172
146
|
throw new Error("Login timed out. Please try again.");
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
throw
|
|
147
|
+
if (error instanceof Error && error.message === "KAKAO_POPUP_BLOCKED")
|
|
148
|
+
throw new Error("Please allow popups and try again.");
|
|
149
|
+
throw new Error("Kakao authentication failed. Please try again.");
|
|
176
150
|
} finally {
|
|
151
|
+
if (popup && !popup.closed)
|
|
152
|
+
popup.close();
|
|
177
153
|
isKakaoLoginInProgress = false;
|
|
178
154
|
}
|
|
179
155
|
}
|
|
180
156
|
export {
|
|
157
|
+
configureKakaoAuth,
|
|
181
158
|
kakaoLogin
|
|
182
159
|
};
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
refreshAccessToken,
|
|
11
11
|
scheduleProactiveRefresh,
|
|
12
12
|
setupVisibilityRefresh
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-F6EG7H2O.js";
|
|
14
14
|
import "../chunk-2DFJ6LEN.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-ZITVWA4X.js";
|
|
16
|
+
import "../chunk-7GBAUSQJ.js";
|
|
17
17
|
export {
|
|
18
18
|
SESSION_EXPIRED_EVENT,
|
|
19
19
|
SessionExpiredError,
|
|
@@ -306,7 +306,8 @@ export interface TalkenEvmSignRequest {
|
|
|
306
306
|
gasPrice?: string;
|
|
307
307
|
maxFeePerGas?: string;
|
|
308
308
|
maxPriorityFeePerGas?: string;
|
|
309
|
-
|
|
309
|
+
/** talken-api accepts exactly these; anything else is 400 (talken-api#908). */
|
|
310
|
+
type?: 'LEGACY' | 'EIP1559';
|
|
310
311
|
pin?: string;
|
|
311
312
|
email?: string;
|
|
312
313
|
}
|
|
@@ -356,6 +357,74 @@ export interface TalkenEvmSignatureResponse {
|
|
|
356
357
|
signature: string;
|
|
357
358
|
txHash?: string;
|
|
358
359
|
}
|
|
360
|
+
/** WaaS EVM quantity: decimal or `0x` hex string, or a safe integer. */
|
|
361
|
+
type TalkenEvmQuantity = string | number;
|
|
362
|
+
/** `POST /sign/tx` */
|
|
363
|
+
export interface TalkenSignTxBody {
|
|
364
|
+
/** talken-api chainKey. A WaaS network name resolves to itself. */
|
|
365
|
+
chainKey: string;
|
|
366
|
+
/** Decimal wei. */
|
|
367
|
+
amountWei: string;
|
|
368
|
+
/** talken-api defaults an absent `to` to the sender. */
|
|
369
|
+
to?: string;
|
|
370
|
+
data?: string;
|
|
371
|
+
nonce?: TalkenEvmQuantity;
|
|
372
|
+
gasLimit?: TalkenEvmQuantity;
|
|
373
|
+
gasPrice?: TalkenEvmQuantity;
|
|
374
|
+
maxFeePerGas?: TalkenEvmQuantity;
|
|
375
|
+
maxPriorityFeePerGas?: TalkenEvmQuantity;
|
|
376
|
+
type?: 'LEGACY' | 'EIP1559';
|
|
377
|
+
pin?: string;
|
|
378
|
+
email?: string;
|
|
379
|
+
}
|
|
380
|
+
/** `POST /sign/typed-data` */
|
|
381
|
+
export interface TalkenSignTypedDataBody {
|
|
382
|
+
chainKey: string;
|
|
383
|
+
domain: Record<string, unknown>;
|
|
384
|
+
types: Record<string, unknown>;
|
|
385
|
+
primaryType: string;
|
|
386
|
+
message: Record<string, unknown>;
|
|
387
|
+
pin?: string;
|
|
388
|
+
email?: string;
|
|
389
|
+
}
|
|
390
|
+
/** `POST /sign/message` */
|
|
391
|
+
export interface TalkenSignMessageBody {
|
|
392
|
+
chainKey: string;
|
|
393
|
+
message: string;
|
|
394
|
+
address?: string;
|
|
395
|
+
signaturePrefix?: 'eip191' | 'native';
|
|
396
|
+
pin?: string;
|
|
397
|
+
email?: string;
|
|
398
|
+
}
|
|
399
|
+
/** `POST /sign/authorization` */
|
|
400
|
+
export interface TalkenSignAuthorizationBody {
|
|
401
|
+
chainKey: string;
|
|
402
|
+
/** `chainId` a JSON integer, `nonce` a decimal string. */
|
|
403
|
+
authorization: {
|
|
404
|
+
chainId: number;
|
|
405
|
+
address: string;
|
|
406
|
+
nonce: string;
|
|
407
|
+
};
|
|
408
|
+
pin?: string;
|
|
409
|
+
email?: string;
|
|
410
|
+
}
|
|
411
|
+
/** `POST /sign/solana` */
|
|
412
|
+
export interface TalkenSignSolanaBody {
|
|
413
|
+
/** Hex-encoded bytes to sign. */
|
|
414
|
+
message: string;
|
|
415
|
+
network?: 'solana' | 'solana_devnet';
|
|
416
|
+
pin?: string;
|
|
417
|
+
keyId?: string;
|
|
418
|
+
encryptedShare?: string;
|
|
419
|
+
secretStore?: string;
|
|
420
|
+
}
|
|
421
|
+
/** `POST /sign/hash` */
|
|
422
|
+
export interface TalkenSignHashBody {
|
|
423
|
+
hash: string;
|
|
424
|
+
chainKey?: string;
|
|
425
|
+
pin?: string;
|
|
426
|
+
email?: string;
|
|
427
|
+
}
|
|
359
428
|
export interface TalkenTxRawRequest {
|
|
360
429
|
chain?: 'evm' | 'svm' | 'tvm';
|
|
361
430
|
network: string;
|
|
@@ -496,3 +565,4 @@ export interface TalkenWalletscanNftsRequest {
|
|
|
496
565
|
chainKeys: string;
|
|
497
566
|
walletAddress: string;
|
|
498
567
|
}
|
|
568
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-3IYXGND5.js";
|
|
3
|
+
import "../chunk-RKQS3OQG.js";
|
|
3
4
|
import "../chunk-YTIJR6EJ.js";
|
|
4
5
|
import "../chunk-PR5O3NNO.js";
|
|
5
6
|
import {
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
AbcErrorCode,
|
|
11
12
|
TalkenApiError
|
|
12
13
|
} from "../chunk-BUAWEYGV.js";
|
|
13
|
-
import "../chunk-RKQS3OQG.js";
|
|
14
14
|
export {
|
|
15
15
|
AbcError,
|
|
16
16
|
AbcErrorCode,
|
|
@@ -15,15 +15,15 @@ import {
|
|
|
15
15
|
saveToStorage,
|
|
16
16
|
validateEmail,
|
|
17
17
|
validatePin
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-YECMDMEA.js";
|
|
19
19
|
import "../chunk-3IYXGND5.js";
|
|
20
|
+
import "../chunk-RKQS3OQG.js";
|
|
20
21
|
import "../chunk-YTIJR6EJ.js";
|
|
21
22
|
import "../chunk-PR5O3NNO.js";
|
|
22
23
|
import "../chunk-JU6AJBYS.js";
|
|
23
24
|
import "../chunk-BUAWEYGV.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-3Z5DO42M.js";
|
|
25
|
+
import "../chunk-ZITVWA4X.js";
|
|
26
|
+
import "../chunk-7GBAUSQJ.js";
|
|
27
27
|
export {
|
|
28
28
|
calculateExpiryTimestamp,
|
|
29
29
|
clearAuthState,
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
generateMpcWallets,
|
|
4
4
|
recoverMpcWallets,
|
|
5
5
|
validateMpcWallets
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-XQTK7NGN.js";
|
|
7
|
+
import "../chunk-5SHN7JNR.js";
|
|
8
8
|
import "../chunk-KXPCOVNY.js";
|
|
9
9
|
import "../chunk-2DFJ6LEN.js";
|
|
10
10
|
import "../chunk-3IYXGND5.js";
|
|
11
|
+
import "../chunk-RKQS3OQG.js";
|
|
11
12
|
import "../chunk-YTIJR6EJ.js";
|
|
12
13
|
import "../chunk-PR5O3NNO.js";
|
|
13
14
|
import "../chunk-JU6AJBYS.js";
|
|
14
15
|
import "../chunk-BUAWEYGV.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-3Z5DO42M.js";
|
|
16
|
+
import "../chunk-ZITVWA4X.js";
|
|
17
|
+
import "../chunk-7GBAUSQJ.js";
|
|
18
18
|
export {
|
|
19
19
|
generateMpcWallets,
|
|
20
20
|
recoverMpcWallets,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
toSignSolanaBody
|
|
4
|
+
} from "./chunk-ZTIRW7TR.js";
|
|
2
5
|
import {
|
|
3
6
|
TALKEN_API_ENDPOINTS
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7GBAUSQJ.js";
|
|
5
8
|
|
|
6
9
|
// src/wallets/walletConnectors/abcWallet/api/modules/solana.ts
|
|
7
10
|
var TalkenSolanaModule = class {
|
|
@@ -40,7 +43,7 @@ var TalkenSolanaModule = class {
|
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
42
45
|
* Sign Solana transaction or message (sign-only, no broadcast)
|
|
43
|
-
* POST /wallet/sign/sol
|
|
46
|
+
* POST /sign/solana (same body as the retired /wallet/sign/sol)
|
|
44
47
|
*
|
|
45
48
|
* Two modes:
|
|
46
49
|
* - PIN mode: { message, pin } — server resolves signing material
|
|
@@ -51,7 +54,7 @@ var TalkenSolanaModule = class {
|
|
|
51
54
|
async sign(params) {
|
|
52
55
|
return this.client.post(
|
|
53
56
|
TALKEN_API_ENDPOINTS.SIGN_SVM,
|
|
54
|
-
params
|
|
57
|
+
toSignSolanaBody(params)
|
|
55
58
|
);
|
|
56
59
|
}
|
|
57
60
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
WalletscanApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HXYOWG5P.js";
|
|
5
5
|
import {
|
|
6
6
|
getCredentialManager
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5SHN7JNR.js";
|
|
8
8
|
import {
|
|
9
9
|
AbstractChainProvider
|
|
10
10
|
} from "./chunk-3DHUDD4U.js";
|
|
@@ -148,15 +148,17 @@ var TALKEN_API_ENDPOINTS = {
|
|
|
148
148
|
WALLET_ADDRESS: "/wallet/address",
|
|
149
149
|
WALLET_SCAN: "/wallet/scan",
|
|
150
150
|
WALLET_BTC: "/wallet/btc",
|
|
151
|
-
// ──
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
// ── Sign (WaaS proxy, canonical /sign/*) ────────────────────────────
|
|
152
|
+
// The /wallet/sign/* aliases answer 410 Gone from 2026-11-14. These routes
|
|
153
|
+
// take different bodies; see api/modules/signBodies.ts.
|
|
154
|
+
SIGN_EVM: "/sign/tx",
|
|
155
|
+
SIGN_TYPED: "/sign/typed-data",
|
|
156
|
+
SIGN_PERSONAL: "/sign/message",
|
|
157
|
+
SIGN_AUTHORIZATION: "/sign/authorization",
|
|
156
158
|
// ── Hash Sign (secp256k1, universal: EVM/BTC/TVM) ───────────────────
|
|
157
|
-
SIGN_HASH: "/
|
|
158
|
-
// ── SOL Sign (
|
|
159
|
-
SIGN_SVM: "/
|
|
159
|
+
SIGN_HASH: "/sign/hash",
|
|
160
|
+
// ── SOL Sign (Ed25519) ──────────────────────────────────────────────
|
|
161
|
+
SIGN_SVM: "/sign/solana",
|
|
160
162
|
// ── TX ──────────────────────────────────────────────────────────────
|
|
161
163
|
TX_RAW: "/wallet/tx/raw",
|
|
162
164
|
TX_EVM: "/wallet/tx/evm",
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createAbcEvmProvider
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CIAVEXOY.js";
|
|
5
5
|
import {
|
|
6
6
|
createTalkenApiClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KX3IFHJQ.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveTalkenApiUrl
|
|
10
10
|
} from "./chunk-GFWUFYT2.js";
|
|
11
11
|
import {
|
|
12
12
|
getCredentialManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5SHN7JNR.js";
|
|
14
14
|
import {
|
|
15
15
|
setTalkenApiClient
|
|
16
16
|
} from "./chunk-R6ZE7JAZ.js";
|
|
@@ -28,15 +28,15 @@ import {
|
|
|
28
28
|
loadAuthState,
|
|
29
29
|
loadFromStorage,
|
|
30
30
|
saveAuthState
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-YECMDMEA.js";
|
|
32
32
|
import {
|
|
33
33
|
STORAGE_NS,
|
|
34
34
|
get,
|
|
35
35
|
remove
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-ZITVWA4X.js";
|
|
37
37
|
import {
|
|
38
38
|
loadTgAccessKey
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-7GBAUSQJ.js";
|
|
40
40
|
|
|
41
41
|
// src/wallets/walletConnectors/abcWallet/abcConnector.ts
|
|
42
42
|
import { getTalkenApiClient } from "@talken/talkenkit";
|