@nexus-cross/crossx-sdk-core 3.0.0-beta.8 → 3.0.0-beta.9
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/adapters/confirmation/BridgeConfirmationAdapter.d.ts +2 -0
- package/dist/adapters/onewallet/OneWalletApiAdapter.d.ts +7 -0
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/i18n/types.d.ts +3 -0
- package/dist/core/ports/ConfirmationPort.d.ts +2 -0
- package/dist/core/ports/WalletProviderPort.d.ts +11 -0
- package/dist/crossx.global +6 -6
- package/dist/{factory-BB9pGBTN.js → factory-BqRrKXcb.js} +676 -560
- package/dist/factory-DTwJVS8U.cjs +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +1 -1
- package/dist/sdk/CROSSxSDK.d.ts +9 -0
- package/dist/sdk/services/PinOrchestrator.d.ts +25 -1
- package/package.json +1 -1
- package/dist/factory-CrwqZ9NB.cjs +0 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createRemoteJWKSet as
|
|
2
|
-
import { secp256k1 as
|
|
3
|
-
import { keccak_256 as
|
|
4
|
-
import { bytesToHex as
|
|
1
|
+
import { createRemoteJWKSet as Yt, jwtVerify as qt, decodeJwt as jt } from "jose";
|
|
2
|
+
import { secp256k1 as zt } from "@noble/curves/secp256k1.js";
|
|
3
|
+
import { keccak_256 as ze } from "@noble/hashes/sha3.js";
|
|
4
|
+
import { bytesToHex as Jt } from "@noble/hashes/utils.js";
|
|
5
5
|
var o = /* @__PURE__ */ ((i) => (i.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", i.AUTH_FAILED = "AUTH_FAILED", i.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", i.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", i.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", i.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", i.SESSION_EXPIRED = "SESSION_EXPIRED", i.OAUTH_POPUP_BLOCKED = "OAUTH_POPUP_BLOCKED", i.ONEID_TERMS_NOT_AGREED = "ONEID_TERMS_NOT_AGREED", i.ONEID_ACCOUNT_NOT_FOUND = "ONEID_ACCOUNT_NOT_FOUND", i.ONEID_SERVICE_NOT_LINKED = "ONEID_SERVICE_NOT_LINKED", i.ONEID_AUTHORIZATION_FAILED = "ONEID_AUTHORIZATION_FAILED", i.ONEID_STATE_MISMATCH = "ONEID_STATE_MISMATCH", i.ONEID_ISSUER_MISMATCH = "ONEID_ISSUER_MISMATCH", i.ONEID_TIMEOUT = "ONEID_TIMEOUT", i.ONEID_SESSION_EVICTED = "ONEID_SESSION_EVICTED", i.ONEID_SESSION_REVOKED = "ONEID_SESSION_REVOKED", i.ONEID_SESSION_EXPIRED = "ONEID_SESSION_EXPIRED", i.ONEID_SESSION_INVALID = "ONEID_SESSION_INVALID", i.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", i.WALLET_NAME_INVALID = "WALLET_NAME_INVALID", i.WALLET_OPERATION_UNSUPPORTED = "WALLET_OPERATION_UNSUPPORTED", i.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", i.WALLET_ALREADY_EXISTS = "WALLET_ALREADY_EXISTS", i.ADDRESS_LIMIT_EXCEEDED = "ADDRESS_LIMIT_EXCEEDED", i.SIGN_FAILED = "SIGN_FAILED", i.SIGN_REJECTED = "SIGN_REJECTED", i.TX_FAILED = "TX_FAILED", i.TX_REJECTED = "TX_REJECTED", i.BROADCAST_FAILED = "BROADCAST_FAILED", i.USER_REJECTED = "USER_REJECTED", i.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", i.NETWORK_ERROR = "NETWORK_ERROR", i.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", i.INVALID_CHAIN = "INVALID_CHAIN", i.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", i.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", i.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", i.SIGNATURE_FAILED = "SIGNATURE_FAILED", i.TRANSACTION_FAILED = "TRANSACTION_FAILED", i.PREPARE_FAILED = "PREPARE_FAILED", i.PREPARE_EXPIRED = "PREPARE_EXPIRED", i.PREPARE_MISMATCH = "PREPARE_MISMATCH", i.MIGRATION_FAILED = "MIGRATION_FAILED", i.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", i.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", i.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", i.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", i.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", i.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", i.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", i.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", i.INVALID_APP_TYPE = "INVALID_APP_TYPE", i.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", i.SDK_VERSION_UNSUPPORTED = "SDK_VERSION_UNSUPPORTED", i.UI_NOT_PROVIDED = "UI_NOT_PROVIDED", i.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", i.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", i.EXECUTION_REVERTED = "EXECUTION_REVERTED", i.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", i.PIN_NOT_SET = "PIN_NOT_SET", i.PIN_WRONG = "PIN_WRONG", i.PIN_INVALID = "PIN_INVALID", i.PIN_REPEATED_PATTERN = "PIN_REPEATED_PATTERN", i.PIN_CANCELLED = "PIN_CANCELLED", i.EXTERNAL_WALLET_REQUESTED = "EXTERNAL_WALLET_REQUESTED", i.PIN_LOCKED = "PIN_LOCKED", i.PIN_ENCRYPTION_INVALID = "PIN_ENCRYPTION_INVALID", i.PIN_POLICY_VIOLATION = "PIN_POLICY_VIOLATION", i.PIN_ENCRYPTION_FAILED = "PIN_ENCRYPTION_FAILED", i.HMAC_REQUIRED = "HMAC_REQUIRED", i.HMAC_VERIFICATION_FAILED = "HMAC_VERIFICATION_FAILED", i.WITHDRAW_FAILED = "WITHDRAW_FAILED", i.USER_NOT_FOUND = "USER_NOT_FOUND", i.RN_BRIDGE_NOT_AVAILABLE = "RN_BRIDGE_NOT_AVAILABLE", i.RN_BRIDGE_HANDSHAKE_FAILED = "RN_BRIDGE_HANDSHAKE_FAILED", i.RN_NATIVE_SESSION_EXPIRED = "RN_NATIVE_SESSION_EXPIRED", i.INVALID_CONFIG = "INVALID_CONFIG", i.UNKNOWN_ERROR = "UNKNOWN_ERROR", i))(o || {});
|
|
6
6
|
class h extends Error {
|
|
7
7
|
constructor(e, t, s) {
|
|
@@ -16,44 +16,44 @@ class h extends Error {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
var
|
|
21
|
-
const
|
|
19
|
+
const Xt = 2e3, Je = 6e4, Zt = 1e3, Qt = 1e4, es = "0x77359400", Xe = "0x3B9ACA00", Ze = 130, Tt = 6, Qe = 18, et = 3e4, ts = 300 * 1e3, ss = 30 * 1e3, tt = 100, rs = 300 * 1e3, st = 60 * 1e3, fe = "crossx-sdk-js/3.0.0-beta.9", is = "X-SDK-Version", ns = !1, as = "x-sdk-deprecation", we = -10050, yt = "ONEpocket";
|
|
20
|
+
var os = /* @__PURE__ */ ((i) => (i.MetaMask = "io.metamask", i.Binance = "com.binance.wallet", i.CROSSx = "crossx", i))(os || {});
|
|
21
|
+
const cs = {
|
|
22
22
|
"io.metamask": "MetaMask",
|
|
23
23
|
"com.binance.wallet": "Binance Wallet",
|
|
24
|
-
crossx:
|
|
25
|
-
},
|
|
24
|
+
crossx: yt
|
|
25
|
+
}, ls = [
|
|
26
26
|
"crossx",
|
|
27
27
|
"io.metamask",
|
|
28
28
|
"com.binance.wallet"
|
|
29
29
|
/* Binance */
|
|
30
30
|
];
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function Xi(i) {
|
|
32
|
+
return cs[i] ?? i;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return Array.isArray(i.connectOtherWallets) && i.connectOtherWallets.length > 0 ? [...i.connectOtherWallets] : i.showConnectOtherWallets === !0 ? [...
|
|
34
|
+
function hs(i) {
|
|
35
|
+
return Array.isArray(i.connectOtherWallets) && i.connectOtherWallets.length > 0 ? [...i.connectOtherWallets] : i.showConnectOtherWallets === !0 ? [...ls] : [];
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function Nt(i) {
|
|
38
38
|
const e = i instanceof Error ? i.message : String(i);
|
|
39
39
|
return e.includes("BRIDGE_NOT_AUTHORIZED") || e.includes("Bridge session not authenticated");
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const ds = /* @__PURE__ */ new Set(["ERR_USER_REJECTED", "USER_REJECTED", "USER_REJECT"]), us = /user rejected|rejected the request|request (?:was )?cancell?ed|entry was cancell?ed|거부했습니다|취소되었습니다/i;
|
|
42
42
|
function Rt(i) {
|
|
43
43
|
if (!i || typeof i != "object") return;
|
|
44
44
|
const e = i.code;
|
|
45
45
|
return typeof e == "string" && e.length > 0 ? e : void 0;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function gs(i) {
|
|
48
48
|
const e = Rt(i);
|
|
49
|
-
if (e) return
|
|
49
|
+
if (e) return ds.has(e);
|
|
50
50
|
const t = i instanceof Error ? i.message : String(i);
|
|
51
|
-
return
|
|
51
|
+
return us.test(t);
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function z(i, e) {
|
|
54
54
|
if (i instanceof h) return i;
|
|
55
55
|
const t = Rt(i), s = i instanceof Error ? i.message : String(i), r = { nativeCode: t, cause: i };
|
|
56
|
-
if (
|
|
56
|
+
if (gs(i))
|
|
57
57
|
return new h(o.USER_REJECTED, s, r);
|
|
58
58
|
const n = t && !s.includes(t) ? `${s} (${t})` : s;
|
|
59
59
|
return new h(e, n, r);
|
|
@@ -107,20 +107,20 @@ const Ie = {
|
|
|
107
107
|
rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
|
|
108
108
|
testnet: !0
|
|
109
109
|
}
|
|
110
|
-
},
|
|
110
|
+
}, Zi = Object.fromEntries(
|
|
111
111
|
Object.entries(Ie).map(([i, e]) => [i, e.caipId])
|
|
112
|
-
),
|
|
112
|
+
), _s = new Map(
|
|
113
113
|
Object.values(Ie).map((i) => [i.caipId, i])
|
|
114
114
|
);
|
|
115
115
|
new Map(
|
|
116
116
|
Object.values(Ie).map((i) => [i.chainId, i])
|
|
117
117
|
);
|
|
118
|
-
const
|
|
119
|
-
function
|
|
118
|
+
const fs = { symbol: "", decimals: 18 };
|
|
119
|
+
function ps(i, e) {
|
|
120
120
|
var t;
|
|
121
|
-
return (e == null ? void 0 : e[i]) ?? ((t =
|
|
121
|
+
return (e == null ? void 0 : e[i]) ?? ((t = _s.get(i)) == null ? void 0 : t.nativeCurrency);
|
|
122
122
|
}
|
|
123
|
-
class
|
|
123
|
+
class ws {
|
|
124
124
|
constructor(e, t) {
|
|
125
125
|
this.sdk = e, this.chainId = t, this._listeners = /* @__PURE__ */ new Map();
|
|
126
126
|
}
|
|
@@ -217,38 +217,38 @@ class ps {
|
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
let
|
|
221
|
-
function
|
|
222
|
-
|
|
220
|
+
let M = null;
|
|
221
|
+
function rt(i) {
|
|
222
|
+
M = i;
|
|
223
223
|
}
|
|
224
224
|
const l = {
|
|
225
225
|
/** 빌드 모드와 무관하게 항상 출력되는 정보성 로그 (SDK 수명주기 등) */
|
|
226
226
|
info(...i) {
|
|
227
|
-
if (
|
|
228
|
-
|
|
227
|
+
if (M) {
|
|
228
|
+
M.log(...i);
|
|
229
229
|
return;
|
|
230
230
|
}
|
|
231
231
|
console.log(...i);
|
|
232
232
|
},
|
|
233
233
|
log(...i) {
|
|
234
|
-
if (
|
|
235
|
-
|
|
234
|
+
if (M) {
|
|
235
|
+
M.log(...i);
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
238
|
},
|
|
239
239
|
warn(...i) {
|
|
240
|
-
if (
|
|
241
|
-
|
|
240
|
+
if (M) {
|
|
241
|
+
M.warn(...i);
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
},
|
|
245
245
|
error(...i) {
|
|
246
|
-
if (
|
|
247
|
-
|
|
246
|
+
if (M) {
|
|
247
|
+
M.error(...i);
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
},
|
|
251
|
+
}, Ss = {
|
|
252
252
|
// ── 공통 버튼 ────────────────────────────────────────────────
|
|
253
253
|
confirm: "확인",
|
|
254
254
|
cancel: "취소",
|
|
@@ -343,6 +343,10 @@ const l = {
|
|
|
343
343
|
pin_setup_confirm_title: "PIN 확인",
|
|
344
344
|
pin_setup_confirm_subtitle: "6자리 PIN을 다시 입력하세요.",
|
|
345
345
|
pin_setup_mismatch_error: "PIN이 일치하지 않습니다. 다시 시도해 주세요.",
|
|
346
|
+
// ── PIN 변경 — 새 PIN 설정 (GASPQA-6804) ─────────────────────
|
|
347
|
+
pin_change_title: "새 PIN 설정",
|
|
348
|
+
pin_change_confirm_title: "PIN 확인",
|
|
349
|
+
pin_change_same_error: "지금 PIN 과 다른 PIN 을 입력해 주세요.",
|
|
346
350
|
// ── PIN 복잡도 검증 오류 ─────────────────────────────────────
|
|
347
351
|
pin_validation_too_short: "6자리 PIN을 입력해 주세요.",
|
|
348
352
|
pin_validation_numbers_only: "숫자(0-9)만 입력할 수 있습니다.",
|
|
@@ -376,7 +380,7 @@ const l = {
|
|
|
376
380
|
session_alert_apple_account: "Apple 계정",
|
|
377
381
|
session_alert_sign_out_button: "로그아웃",
|
|
378
382
|
session_alert_sign_in_again_button: "다시 로그인"
|
|
379
|
-
},
|
|
383
|
+
}, Ot = {
|
|
380
384
|
// ── Common buttons ───────────────────────────────────────────
|
|
381
385
|
confirm: "Confirm",
|
|
382
386
|
cancel: "Cancel",
|
|
@@ -421,7 +425,7 @@ const l = {
|
|
|
421
425
|
label_including_fees: "(including fees)",
|
|
422
426
|
label_primary_type: "Primary Type",
|
|
423
427
|
// ── Login selector modal ─────────────────────────────────────
|
|
424
|
-
login_selector_title:
|
|
428
|
+
login_selector_title: yt,
|
|
425
429
|
login_selector_subtitle: "Sign in instantly with your social account",
|
|
426
430
|
login_selector_google: "Sign in with Google",
|
|
427
431
|
login_selector_apple: "Sign in with Apple",
|
|
@@ -470,6 +474,10 @@ const l = {
|
|
|
470
474
|
pin_setup_confirm_title: "Confirm PIN",
|
|
471
475
|
pin_setup_confirm_subtitle: "Confirm your 6-digit PIN",
|
|
472
476
|
pin_setup_mismatch_error: "PINs do not match. Please try again.",
|
|
477
|
+
// ── Change PIN — set a new PIN (GASPQA-6804) ─────────────────
|
|
478
|
+
pin_change_title: "Set PIN",
|
|
479
|
+
pin_change_confirm_title: "Confirm PIN",
|
|
480
|
+
pin_change_same_error: "Your new PIN must be different from your current PIN.",
|
|
473
481
|
// ── PIN validation errors ─────────────────────────────────
|
|
474
482
|
pin_validation_too_short: "Please enter a 6-digit PIN.",
|
|
475
483
|
pin_validation_numbers_only: "Only numbers (0-9) are allowed.",
|
|
@@ -503,17 +511,17 @@ For security, you must continue with the same account.`,
|
|
|
503
511
|
session_alert_apple_account: "Apple account",
|
|
504
512
|
session_alert_sign_out_button: "Sign out",
|
|
505
513
|
session_alert_sign_in_again_button: "Sign in again"
|
|
506
|
-
},
|
|
507
|
-
ko:
|
|
508
|
-
en:
|
|
514
|
+
}, Es = {
|
|
515
|
+
ko: Ss,
|
|
516
|
+
en: Ot
|
|
509
517
|
};
|
|
510
|
-
function
|
|
511
|
-
return
|
|
518
|
+
function W(i = "en", e) {
|
|
519
|
+
return Es[i] ?? Ot;
|
|
512
520
|
}
|
|
513
|
-
function
|
|
521
|
+
function As(i) {
|
|
514
522
|
return i === "ko" || i === "en" ? i : typeof navigator < "u" && (navigator.language ?? "").toLowerCase().startsWith("ko") ? "ko" : "en";
|
|
515
523
|
}
|
|
516
|
-
const
|
|
524
|
+
const it = "crossx_access_token", nt = "crossx_refresh_token", at = "crossx_user_info", Ae = class Ae {
|
|
517
525
|
constructor(e, t, s, r, n, a, c, d, g = () => {
|
|
518
526
|
}) {
|
|
519
527
|
this.config = e, this.storage = t, this.crypto = s, this.oauth = r, this.transport = n, this.walletProvider = a, this.tokenStore = c, this.requestFreshTokenFromBridge = d, this.getLocale = g, this._refreshPromise = null, this._migrated = !1;
|
|
@@ -612,7 +620,7 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
|
|
|
612
620
|
const r = e == null ? void 0 : e.provider;
|
|
613
621
|
let n = "/login";
|
|
614
622
|
r === "google" ? n = "/google" : r === "apple" && (n = "/apple");
|
|
615
|
-
const { oauthServiceUrl: a, legacyOauthServiceUrl: c } = this.config, d =
|
|
623
|
+
const { oauthServiceUrl: a, legacyOauthServiceUrl: c } = this.config, d = As(this.getLocale()), g = (A) => {
|
|
616
624
|
const S = `${A}${n}`, w = S.includes("?") ? "&" : "?";
|
|
617
625
|
return `${S}${w}locale=${d}`;
|
|
618
626
|
}, u = g(a), _ = c ? g(c) : void 0;
|
|
@@ -1058,13 +1066,13 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
|
|
|
1058
1066
|
if (!this._migrated) {
|
|
1059
1067
|
this._migrated = !0;
|
|
1060
1068
|
try {
|
|
1061
|
-
const e = await this.storage.get(
|
|
1069
|
+
const e = await this.storage.get(at);
|
|
1062
1070
|
if (!e || await this.storage.get(this.STORAGE_KEY_USER)) return;
|
|
1063
1071
|
await this.storage.set(this.STORAGE_KEY_USER, e);
|
|
1064
|
-
const s = await this.storage.get(
|
|
1072
|
+
const s = await this.storage.get(it);
|
|
1065
1073
|
s && await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, s);
|
|
1066
|
-
const r = await this.storage.get(
|
|
1067
|
-
r && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, r), await this.storage.remove(
|
|
1074
|
+
const r = await this.storage.get(nt);
|
|
1075
|
+
r && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, r), await this.storage.remove(at), await this.storage.remove(it), await this.storage.remove(nt), l.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
|
|
1068
1076
|
} catch (e) {
|
|
1069
1077
|
l.warn("[CROSSx] 스토리지 키 마이그레이션 실패:", e);
|
|
1070
1078
|
}
|
|
@@ -1100,8 +1108,8 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
|
|
|
1100
1108
|
}
|
|
1101
1109
|
};
|
|
1102
1110
|
Ae.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
|
|
1103
|
-
let
|
|
1104
|
-
class
|
|
1111
|
+
let Ue = Ae;
|
|
1112
|
+
class Is {
|
|
1105
1113
|
/**
|
|
1106
1114
|
* @param preservedKeys 로그아웃 뒤에도 남길 저장소 키. 지금은 선호 지갑(`wallet_preference`)만
|
|
1107
1115
|
* 쓴다 — 다시 로그인할 때 같은 지갑을 모달 없이 고르기 위해서다 (DEV2TF-2368).
|
|
@@ -1133,7 +1141,7 @@ class As {
|
|
|
1133
1141
|
});
|
|
1134
1142
|
}
|
|
1135
1143
|
}
|
|
1136
|
-
class
|
|
1144
|
+
class ms {
|
|
1137
1145
|
constructor(e, t) {
|
|
1138
1146
|
this.storage = e, this.walletProvider = t;
|
|
1139
1147
|
}
|
|
@@ -1150,7 +1158,7 @@ class Is {
|
|
|
1150
1158
|
};
|
|
1151
1159
|
}
|
|
1152
1160
|
}
|
|
1153
|
-
class
|
|
1161
|
+
class Pt {
|
|
1154
1162
|
/**
|
|
1155
1163
|
* @param options.ttlMs 주면 PIN 을 넣은 뒤 이 시간이 지나면 다음 서명을 기다리지 않고 메모리에서 지운다.
|
|
1156
1164
|
* 재사용 정책(PinReusePolicy memory)이 더는 쓰지 않을 PIN 을 들고 있지 않게 한다 (DEV2TF-2912 AC-7).
|
|
@@ -1219,36 +1227,36 @@ class Ot {
|
|
|
1219
1227
|
return this.encryptedBytes !== null;
|
|
1220
1228
|
}
|
|
1221
1229
|
}
|
|
1222
|
-
const
|
|
1223
|
-
function
|
|
1230
|
+
const Ts = "/authorize/result", ys = "one-oauth:authorization_response", Ct = "one-oauth:authorization_error", Ns = "one-oauth:authorization_ack", Rs = "openid profile offline_access";
|
|
1231
|
+
function He(i) {
|
|
1224
1232
|
let e = "";
|
|
1225
1233
|
for (const t of i) e += String.fromCharCode(t);
|
|
1226
1234
|
return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1227
1235
|
}
|
|
1228
|
-
function
|
|
1236
|
+
function Ne(i = 32) {
|
|
1229
1237
|
const e = new Uint8Array(i);
|
|
1230
|
-
return crypto.getRandomValues(e),
|
|
1238
|
+
return crypto.getRandomValues(e), He(e);
|
|
1231
1239
|
}
|
|
1232
|
-
async function
|
|
1240
|
+
async function Re(i) {
|
|
1233
1241
|
const e = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(i));
|
|
1234
|
-
return
|
|
1242
|
+
return He(new Uint8Array(e));
|
|
1235
1243
|
}
|
|
1236
|
-
function
|
|
1244
|
+
function q(i = 16) {
|
|
1237
1245
|
const e = new Uint8Array(i);
|
|
1238
|
-
return crypto.getRandomValues(e),
|
|
1246
|
+
return crypto.getRandomValues(e), He(e);
|
|
1239
1247
|
}
|
|
1240
|
-
const
|
|
1248
|
+
const Os = "onepocketSecureFrame", Ge = 1;
|
|
1241
1249
|
function oe() {
|
|
1242
1250
|
return new h(o.USER_REJECTED, "앱 요청을 중단했습니다");
|
|
1243
1251
|
}
|
|
1244
|
-
let
|
|
1252
|
+
let ot = 0;
|
|
1245
1253
|
function Se() {
|
|
1246
|
-
return
|
|
1254
|
+
return ot += 1, `${typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : String(Math.random())}-${ot}`;
|
|
1247
1255
|
}
|
|
1248
|
-
function
|
|
1256
|
+
function Ps(i) {
|
|
1249
1257
|
return i === "cancelled" ? o.USER_REJECTED : o.ONEID_AUTHORIZATION_FAILED;
|
|
1250
1258
|
}
|
|
1251
|
-
function
|
|
1259
|
+
function Dt(i, e) {
|
|
1252
1260
|
var r, n;
|
|
1253
1261
|
let t = e;
|
|
1254
1262
|
if (typeof e == "string")
|
|
@@ -1258,17 +1266,17 @@ function Ct(i, e) {
|
|
|
1258
1266
|
t = null;
|
|
1259
1267
|
}
|
|
1260
1268
|
const s = typeof t == "object" && t !== null ? t : {};
|
|
1261
|
-
if (s.v !== void 0 && s.v !==
|
|
1269
|
+
if (s.v !== void 0 && s.v !== Ge)
|
|
1262
1270
|
throw new h(o.ONEID_AUTHORIZATION_FAILED, "앱 채널 버전이 다릅니다", { appError: "unsupported" });
|
|
1263
1271
|
if (s.id !== i)
|
|
1264
1272
|
throw new h(o.ONEID_AUTHORIZATION_FAILED, "앱 응답의 요청 id 가 다릅니다");
|
|
1265
1273
|
if (s.ok !== !0) {
|
|
1266
1274
|
const a = (r = s.error) == null ? void 0 : r.code, c = typeof ((n = s.error) == null ? void 0 : n.message) == "string" && s.error.message ? s.error.message : "앱이 요청을 처리하지 못했습니다";
|
|
1267
|
-
throw new h(
|
|
1275
|
+
throw new h(Ps(a), c, { appError: typeof a == "string" ? a : "unknown" });
|
|
1268
1276
|
}
|
|
1269
1277
|
return typeof s.payload == "object" && s.payload !== null ? s.payload : {};
|
|
1270
1278
|
}
|
|
1271
|
-
function
|
|
1279
|
+
function Cs(i, e) {
|
|
1272
1280
|
return new Promise((t, s) => {
|
|
1273
1281
|
const r = () => s(oe());
|
|
1274
1282
|
e.addEventListener("abort", r, { once: !0 }), Promise.resolve(i).then(
|
|
@@ -1281,21 +1289,21 @@ function Ps(i, e) {
|
|
|
1281
1289
|
);
|
|
1282
1290
|
});
|
|
1283
1291
|
}
|
|
1284
|
-
function
|
|
1285
|
-
const e = (t, s, r) => i.postMessage({ v:
|
|
1292
|
+
function Ds(i) {
|
|
1293
|
+
const e = (t, s, r) => i.postMessage({ v: Ge, id: r, type: t, payload: s });
|
|
1286
1294
|
return {
|
|
1287
1295
|
async request(t, s, r) {
|
|
1288
1296
|
if (r != null && r.aborted) throw oe();
|
|
1289
1297
|
const n = Se();
|
|
1290
1298
|
let a;
|
|
1291
1299
|
try {
|
|
1292
|
-
a = await (r ?
|
|
1300
|
+
a = await (r ? Cs(e(t, s, n), r) : e(t, s, n));
|
|
1293
1301
|
} catch (c) {
|
|
1294
1302
|
throw r != null && r.aborted ? oe() : new h(o.ONEID_AUTHORIZATION_FAILED, "앱이 요청을 거부했습니다", c);
|
|
1295
1303
|
}
|
|
1296
1304
|
if (a === void 0)
|
|
1297
1305
|
throw new h(o.ONEID_AUTHORIZATION_FAILED, "앱이 이 요청을 지원하지 않습니다", { appError: "unsupported" });
|
|
1298
|
-
return
|
|
1306
|
+
return Dt(n, a);
|
|
1299
1307
|
},
|
|
1300
1308
|
notify(t, s) {
|
|
1301
1309
|
Promise.resolve(e(t, s, Se())).catch(() => {
|
|
@@ -1303,7 +1311,7 @@ function Cs(i) {
|
|
|
1303
1311
|
}
|
|
1304
1312
|
};
|
|
1305
1313
|
}
|
|
1306
|
-
function
|
|
1314
|
+
function xs(i) {
|
|
1307
1315
|
const e = /* @__PURE__ */ new Map();
|
|
1308
1316
|
i.onmessage = (s) => {
|
|
1309
1317
|
var a;
|
|
@@ -1317,7 +1325,7 @@ function Ds(i) {
|
|
|
1317
1325
|
const n = e.get(r);
|
|
1318
1326
|
n && (e.delete(r), n(s.data));
|
|
1319
1327
|
};
|
|
1320
|
-
const t = (s, r, n) => i.postMessage(JSON.stringify({ v:
|
|
1328
|
+
const t = (s, r, n) => i.postMessage(JSON.stringify({ v: Ge, id: n, type: s, payload: r }));
|
|
1321
1329
|
return {
|
|
1322
1330
|
request(s, r, n) {
|
|
1323
1331
|
const a = Se();
|
|
@@ -1332,7 +1340,7 @@ function Ds(i) {
|
|
|
1332
1340
|
n == null || n.addEventListener("abort", g, { once: !0 }), e.set(a, (u) => {
|
|
1333
1341
|
n == null || n.removeEventListener("abort", g);
|
|
1334
1342
|
try {
|
|
1335
|
-
c(
|
|
1343
|
+
c(Dt(a, u));
|
|
1336
1344
|
} catch (_) {
|
|
1337
1345
|
d(_);
|
|
1338
1346
|
}
|
|
@@ -1352,23 +1360,23 @@ function Ds(i) {
|
|
|
1352
1360
|
}
|
|
1353
1361
|
};
|
|
1354
1362
|
}
|
|
1355
|
-
function
|
|
1363
|
+
function vs(i = typeof window < "u" ? window : void 0) {
|
|
1356
1364
|
var r, n;
|
|
1357
1365
|
if (!i) return null;
|
|
1358
1366
|
const e = i;
|
|
1359
1367
|
if (e.self === e.top) return null;
|
|
1360
|
-
const t = (n = (r = e.webkit) == null ? void 0 : r.messageHandlers) == null ? void 0 : n[
|
|
1361
|
-
if (t && typeof t.postMessage == "function") return
|
|
1368
|
+
const t = (n = (r = e.webkit) == null ? void 0 : r.messageHandlers) == null ? void 0 : n[Os];
|
|
1369
|
+
if (t && typeof t.postMessage == "function") return lt(t, () => Ds(t));
|
|
1362
1370
|
const s = e.onepocketSecureFrame;
|
|
1363
|
-
return s && typeof s.postMessage == "function" ?
|
|
1371
|
+
return s && typeof s.postMessage == "function" ? lt(s, () => xs(s)) : null;
|
|
1364
1372
|
}
|
|
1365
|
-
const
|
|
1366
|
-
function
|
|
1367
|
-
let t =
|
|
1368
|
-
return t || (t = e(),
|
|
1373
|
+
const ct = /* @__PURE__ */ new WeakMap();
|
|
1374
|
+
function lt(i, e) {
|
|
1375
|
+
let t = ct.get(i);
|
|
1376
|
+
return t || (t = e(), ct.set(i, t)), t;
|
|
1369
1377
|
}
|
|
1370
|
-
const
|
|
1371
|
-
function
|
|
1378
|
+
const ht = 300 * 1e3, ks = 600 * 1e3, Oe = "crossx.oneid.pending", Ls = "/auth/app-callback", Us = 1e3;
|
|
1379
|
+
function xt(i) {
|
|
1372
1380
|
switch (i) {
|
|
1373
1381
|
case "access_denied":
|
|
1374
1382
|
return o.USER_REJECTED;
|
|
@@ -1382,7 +1390,7 @@ function Dt(i) {
|
|
|
1382
1390
|
return o.ONEID_AUTHORIZATION_FAILED;
|
|
1383
1391
|
}
|
|
1384
1392
|
}
|
|
1385
|
-
function
|
|
1393
|
+
function bs(i) {
|
|
1386
1394
|
switch (i) {
|
|
1387
1395
|
case "session_evicted":
|
|
1388
1396
|
return o.ONEID_SESSION_EVICTED;
|
|
@@ -1394,11 +1402,11 @@ function Us(i) {
|
|
|
1394
1402
|
return o.ONEID_SESSION_INVALID;
|
|
1395
1403
|
}
|
|
1396
1404
|
}
|
|
1397
|
-
const
|
|
1398
|
-
function
|
|
1405
|
+
const Ws = 15 * 1e3;
|
|
1406
|
+
function Ms(i) {
|
|
1399
1407
|
return typeof AbortSignal < "u" && typeof AbortSignal.timeout == "function" ? AbortSignal.timeout(i) : void 0;
|
|
1400
1408
|
}
|
|
1401
|
-
const
|
|
1409
|
+
const Fs = 300 * 1e3, le = "https://return-to.invalid";
|
|
1402
1410
|
function he(i) {
|
|
1403
1411
|
if (typeof i != "string" || !i.startsWith("/") || /[\u0000-\u001f\u007f\\]/.test(i)) return;
|
|
1404
1412
|
let e;
|
|
@@ -1412,7 +1420,7 @@ function he(i) {
|
|
|
1412
1420
|
if (!(t.startsWith("//") || new URL(t, le).origin !== le))
|
|
1413
1421
|
return t;
|
|
1414
1422
|
}
|
|
1415
|
-
function
|
|
1423
|
+
function J(i) {
|
|
1416
1424
|
let e;
|
|
1417
1425
|
try {
|
|
1418
1426
|
e = new URL(i);
|
|
@@ -1421,7 +1429,7 @@ function z(i) {
|
|
|
1421
1429
|
}
|
|
1422
1430
|
return e.toString().replace(/\/+$/, "");
|
|
1423
1431
|
}
|
|
1424
|
-
function
|
|
1432
|
+
function be(i) {
|
|
1425
1433
|
const e = i.split(".")[1];
|
|
1426
1434
|
if (!e) return null;
|
|
1427
1435
|
try {
|
|
@@ -1433,10 +1441,10 @@ function Ue(i) {
|
|
|
1433
1441
|
return null;
|
|
1434
1442
|
}
|
|
1435
1443
|
}
|
|
1436
|
-
function
|
|
1444
|
+
function Bs(i) {
|
|
1437
1445
|
return { get: (e) => typeof i[e] == "string" ? i[e] : null };
|
|
1438
1446
|
}
|
|
1439
|
-
function
|
|
1447
|
+
function dt(i, e, t) {
|
|
1440
1448
|
const s = i.get("state");
|
|
1441
1449
|
if (!s || s !== e)
|
|
1442
1450
|
throw new h(o.ONEID_STATE_MISMATCH, "ONE ID 로그인 결과의 state가 다릅니다");
|
|
@@ -1445,7 +1453,7 @@ function ht(i, e, t) {
|
|
|
1445
1453
|
const r = i.get("error");
|
|
1446
1454
|
if (r) {
|
|
1447
1455
|
const a = i.get("error_description") ?? void 0;
|
|
1448
|
-
throw new h(
|
|
1456
|
+
throw new h(xt(r), a || `ONE ID 인가 오류: ${r}`, {
|
|
1449
1457
|
error: r,
|
|
1450
1458
|
error_description: a
|
|
1451
1459
|
});
|
|
@@ -1455,12 +1463,12 @@ function ht(i, e, t) {
|
|
|
1455
1463
|
throw new h(o.ONEID_AUTHORIZATION_FAILED, "ONE ID 로그인 결과에 code가 없습니다");
|
|
1456
1464
|
return n;
|
|
1457
1465
|
}
|
|
1458
|
-
function
|
|
1466
|
+
function Hs(i) {
|
|
1459
1467
|
if (typeof i != "object" || i === null) return !1;
|
|
1460
1468
|
const e = i.type;
|
|
1461
|
-
return e ===
|
|
1469
|
+
return e === ys || e === Ct;
|
|
1462
1470
|
}
|
|
1463
|
-
function
|
|
1471
|
+
function ut(i, e) {
|
|
1464
1472
|
if (typeof i.access_token != "string" || i.access_token === "")
|
|
1465
1473
|
throw new h(o.ONEID_AUTHORIZATION_FAILED, "토큰 응답에 access_token이 없습니다");
|
|
1466
1474
|
const t = typeof i.expires_in == "number" ? i.expires_in : 0;
|
|
@@ -1473,7 +1481,7 @@ function dt(i, e) {
|
|
|
1473
1481
|
scope: typeof i.scope == "string" ? i.scope : void 0
|
|
1474
1482
|
};
|
|
1475
1483
|
}
|
|
1476
|
-
class
|
|
1484
|
+
class Gs {
|
|
1477
1485
|
constructor() {
|
|
1478
1486
|
this.reason = null, this.onAbort = null;
|
|
1479
1487
|
}
|
|
@@ -1486,7 +1494,7 @@ class Hs {
|
|
|
1486
1494
|
throw new h(o.USER_REJECTED, this.reason);
|
|
1487
1495
|
}
|
|
1488
1496
|
}
|
|
1489
|
-
class
|
|
1497
|
+
class Ks {
|
|
1490
1498
|
constructor(e = {}) {
|
|
1491
1499
|
this.abortPending = null, this.popupSeq = 0, this.options = e;
|
|
1492
1500
|
}
|
|
@@ -1513,11 +1521,11 @@ class Gs {
|
|
|
1513
1521
|
"팝업 창을 열 수 없습니다. 팝업 차단을 해제해 주세요."
|
|
1514
1522
|
);
|
|
1515
1523
|
try {
|
|
1516
|
-
const r =
|
|
1524
|
+
const r = J(e.issuer);
|
|
1517
1525
|
if (!e.clientId)
|
|
1518
1526
|
throw new h(o.INVALID_CONFIG, "ONE ID clientId가 비어 있습니다");
|
|
1519
1527
|
this.cancelPending("새 ONE ID 로그인 요청으로 이전 대기를 중단했습니다");
|
|
1520
|
-
const n = new
|
|
1528
|
+
const n = new Gs(), a = (c) => n.abort(c);
|
|
1521
1529
|
this.abortPending = a;
|
|
1522
1530
|
try {
|
|
1523
1531
|
return t ? await this.authorizeWithApp(t, { ...e, issuer: r }, n) : s ? await this.authorizeWithPopup(s, { ...e, issuer: r }, n) : await this.authorizeWithRedirect({ ...e, issuer: r }, n);
|
|
@@ -1533,15 +1541,15 @@ class Gs {
|
|
|
1533
1541
|
}
|
|
1534
1542
|
}
|
|
1535
1543
|
async completeRedirect(e, t) {
|
|
1536
|
-
const s =
|
|
1544
|
+
const s = J(e.issuer), r = this.takePending(), n = new URL(t).searchParams;
|
|
1537
1545
|
if (!r || r.issuer !== s || r.clientId !== e.clientId)
|
|
1538
1546
|
throw new h(
|
|
1539
1547
|
o.ONEID_STATE_MISMATCH,
|
|
1540
1548
|
"진행 중인 ONE ID 로그인이 없습니다. 다시 로그인해 주세요."
|
|
1541
1549
|
);
|
|
1542
|
-
if (this.now() - r.createdAt >
|
|
1550
|
+
if (this.now() - r.createdAt > ks)
|
|
1543
1551
|
throw new h(o.ONEID_TIMEOUT, "ONE ID 로그인 시간이 지났습니다");
|
|
1544
|
-
const a =
|
|
1552
|
+
const a = dt(n, r.state, s);
|
|
1545
1553
|
return { tokens: await this.exchangeCode(
|
|
1546
1554
|
{ ...e, issuer: s },
|
|
1547
1555
|
a,
|
|
@@ -1551,7 +1559,7 @@ class Gs {
|
|
|
1551
1559
|
), returnTo: he(r.returnTo) };
|
|
1552
1560
|
}
|
|
1553
1561
|
async refresh(e, t) {
|
|
1554
|
-
const s =
|
|
1562
|
+
const s = J(e.issuer), r = new URLSearchParams({
|
|
1555
1563
|
grant_type: "refresh_token",
|
|
1556
1564
|
client_id: e.clientId,
|
|
1557
1565
|
refresh_token: t
|
|
@@ -1563,7 +1571,7 @@ class Gs {
|
|
|
1563
1571
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
1564
1572
|
body: r,
|
|
1565
1573
|
// refresh 는 탭 사이 잠금을 쥔 채 기다린다 — 응답이 안 오면 다른 탭까지 멈추므로 끊는다 (DEV2TF-2912)
|
|
1566
|
-
signal: Ws
|
|
1574
|
+
signal: Ms(Ws)
|
|
1567
1575
|
});
|
|
1568
1576
|
} catch (d) {
|
|
1569
1577
|
throw new h(o.NETWORK_ERROR, "ONE ID 세션을 갱신하지 못했습니다", d);
|
|
@@ -1572,7 +1580,7 @@ class Gs {
|
|
|
1572
1580
|
if (!n.ok) {
|
|
1573
1581
|
if (n.status === 400 && a.error === "invalid_grant") {
|
|
1574
1582
|
const d = typeof a.error_reason == "string" ? a.error_reason : void 0;
|
|
1575
|
-
throw new h(
|
|
1583
|
+
throw new h(bs(d), "ONE ID 세션이 끝났습니다. 다시 로그인해 주세요.", {
|
|
1576
1584
|
error: "invalid_grant",
|
|
1577
1585
|
error_reason: d
|
|
1578
1586
|
});
|
|
@@ -1585,11 +1593,11 @@ class Gs {
|
|
|
1585
1593
|
error: a.error
|
|
1586
1594
|
});
|
|
1587
1595
|
}
|
|
1588
|
-
const c =
|
|
1596
|
+
const c = ut(a, this.now());
|
|
1589
1597
|
return { ...c, refreshToken: c.refreshToken ?? t };
|
|
1590
1598
|
}
|
|
1591
1599
|
async logout(e, t) {
|
|
1592
|
-
const s =
|
|
1600
|
+
const s = J(e.issuer);
|
|
1593
1601
|
let r;
|
|
1594
1602
|
try {
|
|
1595
1603
|
r = await this.fetchImpl(`${s}/logout`, {
|
|
@@ -1606,33 +1614,33 @@ class Gs {
|
|
|
1606
1614
|
}
|
|
1607
1615
|
// ─── 내부 ───────────────────────────────────────────────
|
|
1608
1616
|
findAppChannel() {
|
|
1609
|
-
return this.options.appChannel !== void 0 ? this.options.appChannel :
|
|
1617
|
+
return this.options.appChannel !== void 0 ? this.options.appChannel : vs();
|
|
1610
1618
|
}
|
|
1611
1619
|
/**
|
|
1612
1620
|
* 원포켓 앱에 인증을 맡긴다 (docs/30 §5). PAR · 토큰 교환은 이 페이지(보안 화면 origin)에서 하고,
|
|
1613
1621
|
* 앱은 인증 화면을 열어 결과만 돌려준다. PKCE verifier 는 이 함수 밖으로 나가지 않는다.
|
|
1614
1622
|
*/
|
|
1615
1623
|
async authorizeWithApp(e, t, s) {
|
|
1616
|
-
const r = `${window.location.origin}${
|
|
1624
|
+
const r = `${window.location.origin}${Ls}`, n = q(), a = q(), c = Ne(), d = await Re(c), g = await this.pushAuthorizationRequest(t, r, n, a, d);
|
|
1617
1625
|
s.throwIfAborted(), l.log("[CROSSx] ONE ID 로그인 — 원포켓 앱 인증 화면", { issuer: t.issuer, clientId: t.clientId });
|
|
1618
1626
|
const u = this.authorizeUrl(t, g), _ = await new Promise((S, w) => {
|
|
1619
1627
|
let m = !1;
|
|
1620
|
-
const f = new AbortController(), E = (
|
|
1621
|
-
m || (m = !0, s.onAbort = null, clearTimeout(y), f.abort(),
|
|
1628
|
+
const f = new AbortController(), E = (N) => {
|
|
1629
|
+
m || (m = !0, s.onAbort = null, clearTimeout(y), f.abort(), N());
|
|
1622
1630
|
}, T = () => e.notify("oneid.cancel", {}), y = setTimeout(() => {
|
|
1623
1631
|
E(() => {
|
|
1624
1632
|
T(), w(new h(o.ONEID_TIMEOUT, "ONE ID 로그인 응답 시간이 지났습니다"));
|
|
1625
1633
|
});
|
|
1626
|
-
},
|
|
1627
|
-
s.onAbort = (
|
|
1634
|
+
}, ht);
|
|
1635
|
+
s.onAbort = (N) => {
|
|
1628
1636
|
E(() => {
|
|
1629
|
-
T(), w(new h(o.USER_REJECTED,
|
|
1637
|
+
T(), w(new h(o.USER_REJECTED, N));
|
|
1630
1638
|
});
|
|
1631
1639
|
}, e.request("oneid.authorize", { authorizeUrl: u, state: n }, f.signal).then(
|
|
1632
|
-
(
|
|
1633
|
-
(
|
|
1640
|
+
(N) => E(() => S(N)),
|
|
1641
|
+
(N) => E(() => w(N))
|
|
1634
1642
|
);
|
|
1635
|
-
}), p =
|
|
1643
|
+
}), p = dt(Bs(_), n, t.issuer), A = await this.exchangeCode(t, p, c, r, a);
|
|
1636
1644
|
return l.log("[CROSSx] ONE ID 로그인 완료 (원포켓 앱)"), { status: "completed", tokens: A, returnTo: he(t.returnTo) };
|
|
1637
1645
|
}
|
|
1638
1646
|
openBlankPopup(e = 500, t = 700) {
|
|
@@ -1701,62 +1709,62 @@ class Gs {
|
|
|
1701
1709
|
status: c.status,
|
|
1702
1710
|
error: d.error
|
|
1703
1711
|
});
|
|
1704
|
-
const g =
|
|
1712
|
+
const g = ut(d, this.now());
|
|
1705
1713
|
if (g.idToken) {
|
|
1706
|
-
const u =
|
|
1714
|
+
const u = be(g.idToken);
|
|
1707
1715
|
if (!u || u.iss !== e.issuer || u.nonce !== n)
|
|
1708
1716
|
throw new h(o.ONEID_ISSUER_MISMATCH, "ONE ID id_token의 발급자나 nonce가 요청과 다릅니다");
|
|
1709
1717
|
const _ = u.aud, p = _ === e.clientId || Array.isArray(_) && _.includes(e.clientId), A = typeof u.exp == "number" ? u.exp * 1e3 : Number.NaN;
|
|
1710
|
-
if (!p || !(A +
|
|
1718
|
+
if (!p || !(A + Fs > this.now()))
|
|
1711
1719
|
throw new h(o.ONEID_ISSUER_MISMATCH, "ONE ID id_token의 대상이 이 앱이 아니거나 만료되었습니다");
|
|
1712
1720
|
}
|
|
1713
1721
|
return g;
|
|
1714
1722
|
}
|
|
1715
1723
|
async authorizeWithPopup(e, t, s) {
|
|
1716
|
-
const r = new URL(t.issuer).origin, n = `${t.issuer}${
|
|
1724
|
+
const r = new URL(t.issuer).origin, n = `${t.issuer}${Ts}`, a = q(), c = q(), d = Ne(), g = await Re(d), u = await this.pushAuthorizationRequest(t, n, a, c, g);
|
|
1717
1725
|
s.throwIfAborted(), l.log("[CROSSx] ONE ID 로그인 팝업 이동", { issuer: t.issuer, clientId: t.clientId }), e.location.href = this.authorizeUrl(t, u);
|
|
1718
1726
|
const _ = await new Promise((A, S) => {
|
|
1719
1727
|
let w = 0, m = 0;
|
|
1720
1728
|
const f = () => {
|
|
1721
|
-
s.onAbort = null, clearTimeout(T), clearInterval(y), window.removeEventListener("message",
|
|
1722
|
-
}, E = (
|
|
1723
|
-
f(), S(
|
|
1729
|
+
s.onAbort = null, clearTimeout(T), clearInterval(y), window.removeEventListener("message", N);
|
|
1730
|
+
}, E = (R) => {
|
|
1731
|
+
f(), S(R);
|
|
1724
1732
|
}, T = setTimeout(() => {
|
|
1725
1733
|
E(new h(o.ONEID_TIMEOUT, "ONE ID 로그인 응답 시간이 지났습니다"));
|
|
1726
|
-
},
|
|
1734
|
+
}, ht), y = setInterval(() => {
|
|
1727
1735
|
m++;
|
|
1728
|
-
let
|
|
1736
|
+
let R;
|
|
1729
1737
|
try {
|
|
1730
|
-
|
|
1738
|
+
R = e.closed;
|
|
1731
1739
|
} catch {
|
|
1732
1740
|
return;
|
|
1733
1741
|
}
|
|
1734
|
-
if (
|
|
1742
|
+
if (R) {
|
|
1735
1743
|
if (w === 0) {
|
|
1736
1744
|
w = m;
|
|
1737
1745
|
return;
|
|
1738
1746
|
}
|
|
1739
1747
|
l.warn("[CROSSx] ONE ID 팝업이 닫혔거나 연결이 끊겼습니다(COOP) — 로그인을 취소합니다"), E(new h(o.USER_REJECTED, "ONE ID 로그인이 취소되었습니다", { reason: "popup_closed_or_detached" }));
|
|
1740
1748
|
}
|
|
1741
|
-
},
|
|
1742
|
-
if (
|
|
1743
|
-
const O =
|
|
1749
|
+
}, Us), N = (R) => {
|
|
1750
|
+
if (R.origin !== r || R.source !== e || !Hs(R.data)) return;
|
|
1751
|
+
const O = R.data;
|
|
1744
1752
|
if (O.state !== a) {
|
|
1745
1753
|
l.warn("[CROSSx] ONE ID 결과 state가 현재 요청과 달라 무시합니다");
|
|
1746
1754
|
return;
|
|
1747
1755
|
}
|
|
1748
1756
|
try {
|
|
1749
|
-
e.postMessage({ type:
|
|
1757
|
+
e.postMessage({ type: Ns, state: a }, r);
|
|
1750
1758
|
} catch {
|
|
1751
1759
|
}
|
|
1752
1760
|
if (O.iss !== t.issuer) {
|
|
1753
1761
|
E(new h(o.ONEID_ISSUER_MISMATCH, "ONE ID 로그인 결과의 발급자가 다릅니다"));
|
|
1754
1762
|
return;
|
|
1755
1763
|
}
|
|
1756
|
-
if (O.type ===
|
|
1764
|
+
if (O.type === Ct || O.error) {
|
|
1757
1765
|
const P = O.error ?? "unknown_error";
|
|
1758
1766
|
l.warn("[CROSSx] ONE ID 인가 오류:", P), E(
|
|
1759
|
-
new h(
|
|
1767
|
+
new h(xt(P), O.error_description || `ONE ID 인가 오류: ${P}`, {
|
|
1760
1768
|
error: P,
|
|
1761
1769
|
error_description: O.error_description
|
|
1762
1770
|
})
|
|
@@ -1769,9 +1777,9 @@ class Gs {
|
|
|
1769
1777
|
}
|
|
1770
1778
|
f(), A(O.code);
|
|
1771
1779
|
};
|
|
1772
|
-
s.onAbort = (
|
|
1773
|
-
E(new h(o.USER_REJECTED,
|
|
1774
|
-
}, window.addEventListener("message",
|
|
1780
|
+
s.onAbort = (R) => {
|
|
1781
|
+
E(new h(o.USER_REJECTED, R));
|
|
1782
|
+
}, window.addEventListener("message", N);
|
|
1775
1783
|
}), p = await this.exchangeCode(t, _, d, n, c);
|
|
1776
1784
|
return l.log("[CROSSx] ONE ID 로그인 완료 (팝업)"), { status: "completed", tokens: p, returnTo: he(t.returnTo) };
|
|
1777
1785
|
}
|
|
@@ -1779,7 +1787,7 @@ class Gs {
|
|
|
1779
1787
|
const s = e.redirectUri ?? `${window.location.origin}/auth/callback`;
|
|
1780
1788
|
if (new URL(s).origin !== window.location.origin)
|
|
1781
1789
|
throw new h(o.INVALID_CONFIG, "ONE ID redirectUri는 지금 페이지와 같은 origin이어야 합니다");
|
|
1782
|
-
const r =
|
|
1790
|
+
const r = q(), n = q(), a = Ne(), c = await Re(a), d = await this.pushAuthorizationRequest(e, s, r, n, c);
|
|
1783
1791
|
t.throwIfAborted();
|
|
1784
1792
|
const g = {
|
|
1785
1793
|
issuer: e.issuer,
|
|
@@ -1815,21 +1823,21 @@ async function Pe(i) {
|
|
|
1815
1823
|
return {};
|
|
1816
1824
|
}
|
|
1817
1825
|
}
|
|
1818
|
-
const de = "crossx.oneid.session", Ce = 60 * 1e3,
|
|
1826
|
+
const de = "crossx.oneid.session", Ce = 60 * 1e3, We = /* @__PURE__ */ new Set([
|
|
1819
1827
|
o.ONEID_SESSION_EVICTED,
|
|
1820
1828
|
o.ONEID_SESSION_REVOKED,
|
|
1821
1829
|
o.ONEID_SESSION_EXPIRED,
|
|
1822
1830
|
o.ONEID_SESSION_INVALID
|
|
1823
1831
|
]);
|
|
1824
1832
|
function te(i) {
|
|
1825
|
-
return i instanceof h &&
|
|
1833
|
+
return i instanceof h && We.has(i.code);
|
|
1826
1834
|
}
|
|
1827
|
-
const
|
|
1828
|
-
function
|
|
1835
|
+
const Vs = "crossx.oneid.refresh";
|
|
1836
|
+
function $s(i) {
|
|
1829
1837
|
const e = typeof navigator < "u" ? navigator.locks : void 0;
|
|
1830
|
-
return e ? e.request(
|
|
1838
|
+
return e ? e.request(Vs, i) : i();
|
|
1831
1839
|
}
|
|
1832
|
-
class
|
|
1840
|
+
class Ys {
|
|
1833
1841
|
constructor(e, t, s, r = () => Date.now()) {
|
|
1834
1842
|
this.port = e, this.config = t, this.storage = s, this.now = r, this.refreshing = null, this.generation = 0;
|
|
1835
1843
|
}
|
|
@@ -1837,11 +1845,11 @@ class $s {
|
|
|
1837
1845
|
save(e) {
|
|
1838
1846
|
this.generation += 1;
|
|
1839
1847
|
const t = {
|
|
1840
|
-
issuer:
|
|
1848
|
+
issuer: J(this.config.issuer),
|
|
1841
1849
|
clientId: this.config.clientId,
|
|
1842
1850
|
tokens: e
|
|
1843
1851
|
};
|
|
1844
|
-
return this.storage.setItem(de, JSON.stringify(t)),
|
|
1852
|
+
return this.storage.setItem(de, JSON.stringify(t)), gt(t);
|
|
1845
1853
|
}
|
|
1846
1854
|
/**
|
|
1847
1855
|
* 보관한 세션을 돌려준다. access token이 끝나 가면 갱신한다. 없으면 null.
|
|
@@ -1849,7 +1857,7 @@ class $s {
|
|
|
1849
1857
|
*/
|
|
1850
1858
|
async get() {
|
|
1851
1859
|
const e = await this.ensureFresh();
|
|
1852
|
-
return e ?
|
|
1860
|
+
return e ? gt(e) : null;
|
|
1853
1861
|
}
|
|
1854
1862
|
/** 유효한 access token. 로그인하지 않았으면 `AUTH_NOT_AUTHENTICATED` */
|
|
1855
1863
|
async getAccessToken() {
|
|
@@ -1873,7 +1881,7 @@ class $s {
|
|
|
1873
1881
|
try {
|
|
1874
1882
|
t = (await this.port.refresh(this.config, e.tokens.refreshToken)).accessToken;
|
|
1875
1883
|
} catch (s) {
|
|
1876
|
-
if (s instanceof h &&
|
|
1884
|
+
if (s instanceof h && We.has(s.code)) return;
|
|
1877
1885
|
}
|
|
1878
1886
|
await this.port.logout(this.config, t);
|
|
1879
1887
|
}
|
|
@@ -1886,7 +1894,7 @@ class $s {
|
|
|
1886
1894
|
if (!e) return null;
|
|
1887
1895
|
try {
|
|
1888
1896
|
const s = JSON.parse(e);
|
|
1889
|
-
return typeof ((t = s == null ? void 0 : s.tokens) == null ? void 0 : t.accessToken) == "string" && typeof s.tokens.expiresAt == "number" && s.issuer ===
|
|
1897
|
+
return typeof ((t = s == null ? void 0 : s.tokens) == null ? void 0 : t.accessToken) == "string" && typeof s.tokens.expiresAt == "number" && s.issuer === J(this.config.issuer) && s.clientId === this.config.clientId ? s : (this.clear(), null);
|
|
1890
1898
|
} catch {
|
|
1891
1899
|
return this.clear(), null;
|
|
1892
1900
|
}
|
|
@@ -1900,7 +1908,7 @@ class $s {
|
|
|
1900
1908
|
if (e.tokens.expiresAt > this.now()) return e;
|
|
1901
1909
|
throw this.clear(), new h(o.ONEID_SESSION_EXPIRED, "ONE ID 로그인이 만료되었습니다. 다시 로그인해 주세요.");
|
|
1902
1910
|
}
|
|
1903
|
-
return this.refreshing ?? (this.refreshing =
|
|
1911
|
+
return this.refreshing ?? (this.refreshing = $s(() => this.refresh(e.tokens.refreshToken)).finally(() => {
|
|
1904
1912
|
this.refreshing = null;
|
|
1905
1913
|
})), this.refreshing;
|
|
1906
1914
|
}
|
|
@@ -1926,15 +1934,15 @@ class $s {
|
|
|
1926
1934
|
return this.storage.setItem(de, JSON.stringify(a)), a;
|
|
1927
1935
|
} catch (r) {
|
|
1928
1936
|
if (s !== this.generation) throw r;
|
|
1929
|
-
if (r instanceof h &&
|
|
1937
|
+
if (r instanceof h && We.has(r.code))
|
|
1930
1938
|
throw this.clear(), r;
|
|
1931
1939
|
if (t.tokens.expiresAt > this.now()) return t;
|
|
1932
1940
|
throw r;
|
|
1933
1941
|
}
|
|
1934
1942
|
}
|
|
1935
1943
|
}
|
|
1936
|
-
function
|
|
1937
|
-
const e = i.tokens.idToken ?
|
|
1944
|
+
function gt(i) {
|
|
1945
|
+
const e = i.tokens.idToken ? be(i.tokens.idToken) : null, t = typeof (e == null ? void 0 : e.sub) == "string" && e.sub ? e : be(i.tokens.accessToken);
|
|
1938
1946
|
return {
|
|
1939
1947
|
subject: typeof (t == null ? void 0 : t.sub) == "string" ? t.sub : "",
|
|
1940
1948
|
clientId: i.clientId,
|
|
@@ -1943,12 +1951,12 @@ function ut(i) {
|
|
|
1943
1951
|
expiresAt: i.tokens.expiresAt
|
|
1944
1952
|
};
|
|
1945
1953
|
}
|
|
1946
|
-
function
|
|
1954
|
+
function qs(i) {
|
|
1947
1955
|
return i === "local" ? window.localStorage : window.sessionStorage;
|
|
1948
1956
|
}
|
|
1949
|
-
const
|
|
1957
|
+
const js = new TextEncoder();
|
|
1950
1958
|
function C(i) {
|
|
1951
|
-
return
|
|
1959
|
+
return js.encode(i);
|
|
1952
1960
|
}
|
|
1953
1961
|
function F(...i) {
|
|
1954
1962
|
const e = new Uint8Array(i.reduce((s, r) => s + r.length, 0));
|
|
@@ -1957,7 +1965,7 @@ function F(...i) {
|
|
|
1957
1965
|
e.set(s, t), t += s.length;
|
|
1958
1966
|
return e;
|
|
1959
1967
|
}
|
|
1960
|
-
function
|
|
1968
|
+
function zs(i) {
|
|
1961
1969
|
return new Uint8Array([i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, i & 255]);
|
|
1962
1970
|
}
|
|
1963
1971
|
function k(i) {
|
|
@@ -1973,74 +1981,74 @@ function Z(i) {
|
|
|
1973
1981
|
function De(i) {
|
|
1974
1982
|
return k(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1975
1983
|
}
|
|
1976
|
-
function
|
|
1984
|
+
function Js(i) {
|
|
1977
1985
|
let e = i.replace(/-/g, "+").replace(/_/g, "/");
|
|
1978
1986
|
for (; e.length % 4; ) e += "=";
|
|
1979
1987
|
return Z(e);
|
|
1980
1988
|
}
|
|
1981
|
-
function
|
|
1989
|
+
function Xs(i) {
|
|
1982
1990
|
return globalThis.crypto.getRandomValues(new Uint8Array(i));
|
|
1983
1991
|
}
|
|
1984
|
-
async function
|
|
1992
|
+
async function vt(i) {
|
|
1985
1993
|
return new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", i));
|
|
1986
1994
|
}
|
|
1987
|
-
const x = globalThis.crypto.subtle,
|
|
1995
|
+
const x = globalThis.crypto.subtle, Ke = { name: "ECDH", namedCurve: "P-256" }, Zs = 32, Qs = 12, er = 32;
|
|
1988
1996
|
function ne(i) {
|
|
1989
1997
|
return new Uint8Array([i >>> 8 & 255, i & 255]);
|
|
1990
1998
|
}
|
|
1991
|
-
const se = F(C("HPKE"), ne(16), ne(1), ne(2)),
|
|
1992
|
-
async function
|
|
1999
|
+
const se = F(C("HPKE"), ne(16), ne(1), ne(2)), _t = F(C("KEM"), ne(16)), K = new Uint8Array(0);
|
|
2000
|
+
async function kt(i, e) {
|
|
1993
2001
|
const t = i.length === 0 ? new Uint8Array(32) : i, s = await x.importKey("raw", t, { name: "HMAC", hash: "SHA-256" }, !1, ["sign"]);
|
|
1994
2002
|
return new Uint8Array(await x.sign("HMAC", s, e));
|
|
1995
2003
|
}
|
|
1996
|
-
async function
|
|
2004
|
+
async function tr(i, e, t) {
|
|
1997
2005
|
const s = new Uint8Array(t);
|
|
1998
|
-
let r =
|
|
2006
|
+
let r = K;
|
|
1999
2007
|
for (let n = 1, a = 0; a < t; n++)
|
|
2000
|
-
r = await
|
|
2008
|
+
r = await kt(i, F(r, e, new Uint8Array([n]))), s.set(r.subarray(0, Math.min(32, t - a)), a), a += 32;
|
|
2001
2009
|
return s;
|
|
2002
2010
|
}
|
|
2003
2011
|
function pe(i, e, t, s) {
|
|
2004
|
-
return
|
|
2012
|
+
return kt(i, F(C("HPKE-v1"), s, C(e), t));
|
|
2005
2013
|
}
|
|
2006
|
-
function
|
|
2007
|
-
return
|
|
2014
|
+
function Me(i, e, t, s, r) {
|
|
2015
|
+
return tr(i, F(ne(s), C("HPKE-v1"), r, C(e), t), s);
|
|
2008
2016
|
}
|
|
2009
|
-
async function
|
|
2010
|
-
const t = await x.importKey("raw", e,
|
|
2017
|
+
async function Lt(i, e) {
|
|
2018
|
+
const t = await x.importKey("raw", e, Ke, !1, []);
|
|
2011
2019
|
return new Uint8Array(await x.deriveBits({ name: "ECDH", public: t }, i, 256));
|
|
2012
2020
|
}
|
|
2013
|
-
async function
|
|
2014
|
-
const s = await pe(
|
|
2015
|
-
return
|
|
2021
|
+
async function Ut(i, e, t) {
|
|
2022
|
+
const s = await pe(K, "eae_prk", i, _t);
|
|
2023
|
+
return Me(s, "shared_secret", F(e, t), er, _t);
|
|
2016
2024
|
}
|
|
2017
|
-
async function
|
|
2018
|
-
const e = await pe(
|
|
2025
|
+
async function bt(i) {
|
|
2026
|
+
const e = await pe(K, "psk_id_hash", K, se), t = await pe(K, "info_hash", K, se), s = F(new Uint8Array([0]), e, t), r = await pe(i, "secret", K, se), n = await Me(r, "key", s, Zs, se), a = await Me(r, "base_nonce", s, Qs, se);
|
|
2019
2027
|
return { key: n, baseNonce: a };
|
|
2020
2028
|
}
|
|
2021
2029
|
function me(i, e) {
|
|
2022
2030
|
if (i.length !== 65 || i[0] !== 4)
|
|
2023
2031
|
throw new Error(`${e} must be SEC1 uncompressed P-256 (65B)`);
|
|
2024
2032
|
}
|
|
2025
|
-
async function
|
|
2026
|
-
const i = await x.generateKey(
|
|
2033
|
+
async function Wt() {
|
|
2034
|
+
const i = await x.generateKey(Ke, !1, ["deriveBits"]), e = new Uint8Array(await x.exportKey("raw", i.publicKey));
|
|
2027
2035
|
return { privateKey: i.privateKey, publicKey: e };
|
|
2028
2036
|
}
|
|
2029
|
-
async function
|
|
2037
|
+
async function sr(i, e, t) {
|
|
2030
2038
|
me(i, "recipient public key");
|
|
2031
|
-
const s = await x.generateKey(
|
|
2039
|
+
const s = await x.generateKey(Ke, !1, ["deriveBits"]), r = new Uint8Array(await x.exportKey("raw", s.publicKey)), n = await Ut(await Lt(s.privateKey, i), r, i), { key: a, baseNonce: c } = await bt(n), d = await x.importKey("raw", a, "AES-GCM", !1, ["encrypt"]), g = new Uint8Array(
|
|
2032
2040
|
await x.encrypt({ name: "AES-GCM", iv: c, additionalData: t }, d, e)
|
|
2033
2041
|
);
|
|
2034
2042
|
return { enc: r, ciphertext: g };
|
|
2035
2043
|
}
|
|
2036
|
-
async function
|
|
2044
|
+
async function rr(i, e, t, s) {
|
|
2037
2045
|
me(e, "enc");
|
|
2038
|
-
const r = await
|
|
2046
|
+
const r = await Ut(await Lt(i.privateKey, e), e, i.publicKey), { key: n, baseNonce: a } = await bt(r), c = await x.importKey("raw", n, "AES-GCM", !1, ["decrypt"]);
|
|
2039
2047
|
return new Uint8Array(
|
|
2040
2048
|
await x.decrypt({ name: "AES-GCM", iv: a, additionalData: s }, c, t)
|
|
2041
2049
|
);
|
|
2042
2050
|
}
|
|
2043
|
-
const
|
|
2051
|
+
const Mt = globalThis.crypto.subtle, ir = { name: "ECDSA", namedCurve: "P-256" }, nr = "one-wallet/authz-sig/v1", ar = "one-wallet/seal-aad/v1", or = 60, cr = 32, lr = {
|
|
2044
2052
|
generate: 1,
|
|
2045
2053
|
recover: 3,
|
|
2046
2054
|
verify_pin: 4,
|
|
@@ -2054,35 +2062,35 @@ const Wt = globalThis.crypto.subtle, rr = { name: "ECDSA", namedCurve: "P-256" }
|
|
|
2054
2062
|
sign_typed_data: 21,
|
|
2055
2063
|
sign_message: 22
|
|
2056
2064
|
};
|
|
2057
|
-
function
|
|
2058
|
-
return F(
|
|
2065
|
+
function hr(i) {
|
|
2066
|
+
return F(zs(i.length), i);
|
|
2059
2067
|
}
|
|
2060
|
-
function
|
|
2061
|
-
return F(C(i), ...e.map(
|
|
2068
|
+
function Ft(i, e, t) {
|
|
2069
|
+
return F(C(i), ...e.map(hr), new Uint8Array([t]));
|
|
2062
2070
|
}
|
|
2063
|
-
function
|
|
2064
|
-
return
|
|
2065
|
-
|
|
2071
|
+
function dr(i, e, t) {
|
|
2072
|
+
return Ft(
|
|
2073
|
+
ar,
|
|
2066
2074
|
[i.nonce, C(i.expiresAt), i.intentHash, C(e), C(i.authzKeyId)],
|
|
2067
2075
|
t
|
|
2068
2076
|
);
|
|
2069
2077
|
}
|
|
2070
|
-
function
|
|
2071
|
-
return
|
|
2072
|
-
|
|
2078
|
+
function ur(i, e, t) {
|
|
2079
|
+
return Ft(
|
|
2080
|
+
nr,
|
|
2073
2081
|
[i.enc, i.ciphertext, i.nonce, C(i.expiresAt), i.intentHash, C(e), C(i.authzKeyId)],
|
|
2074
2082
|
t
|
|
2075
2083
|
);
|
|
2076
2084
|
}
|
|
2077
|
-
function
|
|
2078
|
-
return
|
|
2085
|
+
function gr(i, e, t) {
|
|
2086
|
+
return vt(dr(i, e, t));
|
|
2079
2087
|
}
|
|
2080
|
-
function
|
|
2088
|
+
function _r(i) {
|
|
2081
2089
|
return i.toISOString().replace(/\.\d+Z$/, "Z");
|
|
2082
2090
|
}
|
|
2083
|
-
async function
|
|
2091
|
+
async function fr(i, e) {
|
|
2084
2092
|
if (i.length !== 32) throw new Error("authz private key must be a 32B P-256 scalar");
|
|
2085
|
-
return me(e, "authz public key"),
|
|
2093
|
+
return me(e, "authz public key"), Mt.importKey(
|
|
2086
2094
|
"jwk",
|
|
2087
2095
|
{
|
|
2088
2096
|
kty: "EC",
|
|
@@ -2092,22 +2100,22 @@ async function _r(i, e) {
|
|
|
2092
2100
|
d: De(i),
|
|
2093
2101
|
ext: !1
|
|
2094
2102
|
},
|
|
2095
|
-
|
|
2103
|
+
ir,
|
|
2096
2104
|
!1,
|
|
2097
2105
|
["sign"]
|
|
2098
2106
|
);
|
|
2099
2107
|
}
|
|
2100
|
-
async function
|
|
2108
|
+
async function pr(i) {
|
|
2101
2109
|
if (i.intent.command !== i.command) throw new Error("intent.command must match command");
|
|
2102
|
-
const e =
|
|
2103
|
-
nonce:
|
|
2104
|
-
expiresAt:
|
|
2105
|
-
intentHash: await
|
|
2110
|
+
const e = lr[i.command], t = C(JSON.stringify(i.intent)), s = {
|
|
2111
|
+
nonce: Xs(cr),
|
|
2112
|
+
expiresAt: _r(new Date((i.now ?? /* @__PURE__ */ new Date()).getTime() + (i.ttlSec ?? or) * 1e3)),
|
|
2113
|
+
intentHash: await vt(t),
|
|
2106
2114
|
authzKeyId: i.authz.keyId
|
|
2107
|
-
}, r = await
|
|
2115
|
+
}, r = await gr(s, i.bindingId, e), n = { pin: i.plaintext.pin };
|
|
2108
2116
|
i.plaintext.new_pin != null && (n.new_pin = i.plaintext.new_pin), i.plaintext.share_c && (n.share_c = k(i.plaintext.share_c)), i.plaintext.response_key && (n.response_key = k(i.plaintext.response_key));
|
|
2109
|
-
const { enc: a, ciphertext: c } = await
|
|
2110
|
-
await
|
|
2117
|
+
const { enc: a, ciphertext: c } = await sr(i.recipientPub, C(JSON.stringify(n)), r), d = new Uint8Array(
|
|
2118
|
+
await Mt.sign({ name: "ECDSA", hash: "SHA-256" }, i.authz.signingKey, ur({ ...s, enc: a, ciphertext: c }, i.bindingId, e))
|
|
2111
2119
|
);
|
|
2112
2120
|
return {
|
|
2113
2121
|
envelope: {
|
|
@@ -2124,18 +2132,18 @@ async function fr(i) {
|
|
|
2124
2132
|
aad: r
|
|
2125
2133
|
};
|
|
2126
2134
|
}
|
|
2127
|
-
function
|
|
2128
|
-
return
|
|
2135
|
+
function Bt(i, e, t) {
|
|
2136
|
+
return rr(i, Z(e.enc), Z(e.ciphertext), t);
|
|
2129
2137
|
}
|
|
2130
|
-
const
|
|
2131
|
-
class
|
|
2138
|
+
const wr = 90 * 1e3;
|
|
2139
|
+
class Sr {
|
|
2132
2140
|
constructor(e) {
|
|
2133
2141
|
this.opts = e, this.current = null, this.pending = null, this.generation = 0, this.now = e.now ?? Date.now;
|
|
2134
2142
|
}
|
|
2135
2143
|
/** 쓸 수 있는 B 키. 없거나 만료가 가까우면 발급한다 */
|
|
2136
2144
|
async get() {
|
|
2137
2145
|
const e = this.current;
|
|
2138
|
-
if (e && e.expiresAtMs - this.now() >
|
|
2146
|
+
if (e && e.expiresAtMs - this.now() > wr) return e;
|
|
2139
2147
|
if (!this.pending) {
|
|
2140
2148
|
const t = this.issue().finally(() => {
|
|
2141
2149
|
this.pending === t && (this.pending = null);
|
|
@@ -2166,7 +2174,7 @@ class wr {
|
|
|
2166
2174
|
}
|
|
2167
2175
|
async issue() {
|
|
2168
2176
|
var g;
|
|
2169
|
-
const e = this.generation, t = await
|
|
2177
|
+
const e = this.generation, t = await Wt(), s = await this.opts.getIssuanceJwt(), r = await this.opts.client.call("POST", "/authz-keys", {
|
|
2170
2178
|
jwt: s,
|
|
2171
2179
|
response_key: k(t.publicKey)
|
|
2172
2180
|
});
|
|
@@ -2174,11 +2182,11 @@ class wr {
|
|
|
2174
2182
|
throw new h(o.AUTH_FAILED, "authz-keys response is incomplete");
|
|
2175
2183
|
let n;
|
|
2176
2184
|
try {
|
|
2177
|
-
n = await
|
|
2185
|
+
n = await Bt(t, r.sealed_private_key, Z(r.cert_sig));
|
|
2178
2186
|
} catch (u) {
|
|
2179
2187
|
throw new h(o.AUTH_FAILED, "failed to open sealed authz key", { cause: u });
|
|
2180
2188
|
}
|
|
2181
|
-
const a = await
|
|
2189
|
+
const a = await fr(n, Z(r.key_cert.pubkey));
|
|
2182
2190
|
n.fill(0);
|
|
2183
2191
|
const c = Date.parse(r.key_cert.expires_at);
|
|
2184
2192
|
if (Number.isNaN(c))
|
|
@@ -2194,7 +2202,7 @@ class wr {
|
|
|
2194
2202
|
return this.current = d, d;
|
|
2195
2203
|
}
|
|
2196
2204
|
}
|
|
2197
|
-
const
|
|
2205
|
+
const Er = 600 * 1e3, Ar = {
|
|
2198
2206
|
UNAUTHORIZED: o.AUTH_TOKEN_INVALID,
|
|
2199
2207
|
AUTHZ_TOKEN_INVALID: o.AUTH_TOKEN_INVALID,
|
|
2200
2208
|
FORBIDDEN: o.AUTH_FAILED,
|
|
@@ -2231,16 +2239,16 @@ const Sr = 600 * 1e3, Er = {
|
|
|
2231
2239
|
ENVELOPE_INVALID: o.SIGNATURE_FAILED,
|
|
2232
2240
|
REPLAY: o.SIGNATURE_FAILED
|
|
2233
2241
|
};
|
|
2234
|
-
function
|
|
2235
|
-
const t = (e == null ? void 0 : e.code) ?? "", s =
|
|
2242
|
+
function Ir(i, e) {
|
|
2243
|
+
const t = (e == null ? void 0 : e.code) ?? "", s = Ar[t] ?? (i === 401 ? o.AUTH_TOKEN_INVALID : i >= 500 ? o.GATEWAY_INTERNAL_ERROR : o.UNKNOWN_ERROR), r = { status: i, serverCode: t };
|
|
2236
2244
|
return (e == null ? void 0 : e.remaining_attempts) != null && (r.remainingAttempts = e.remaining_attempts), (e == null ? void 0 : e.lock_expires_at) != null && (r.lockExpiresAt = e.lock_expires_at > 1e10 ? e.lock_expires_at : e.lock_expires_at * 1e3), (e == null ? void 0 : e.permanent) != null && (r.permanent = e.permanent), e != null && e.tx_hash && (r.txHash = e.tx_hash), new h(s, (e == null ? void 0 : e.message) || `one-wallet-api ${i}${t ? ` ${t}` : ""}`, r);
|
|
2237
2245
|
}
|
|
2238
|
-
function
|
|
2246
|
+
function mr(i) {
|
|
2239
2247
|
if (!(i instanceof h)) return !1;
|
|
2240
2248
|
const e = i.details;
|
|
2241
2249
|
return (e == null ? void 0 : e.status) === 401 && (!e.serverCode || e.serverCode === "UNAUTHORIZED");
|
|
2242
2250
|
}
|
|
2243
|
-
class
|
|
2251
|
+
class Tr {
|
|
2244
2252
|
constructor(e) {
|
|
2245
2253
|
this.opts = e, this.recipient = null, this.now = e.now ?? Date.now;
|
|
2246
2254
|
}
|
|
@@ -2250,7 +2258,7 @@ class mr {
|
|
|
2250
2258
|
try {
|
|
2251
2259
|
return await this.send(e, r, s, a);
|
|
2252
2260
|
} catch (c) {
|
|
2253
|
-
if (!n || !a.DPoP || !
|
|
2261
|
+
if (!n || !a.DPoP || !mr(c)) throw c;
|
|
2254
2262
|
return this.send(e, r, s, await n({ method: e, url: r, retry: !0 }));
|
|
2255
2263
|
}
|
|
2256
2264
|
}
|
|
@@ -2260,7 +2268,7 @@ class mr {
|
|
|
2260
2268
|
}
|
|
2261
2269
|
/** enclave 수신 공개키(SEC1 65B) */
|
|
2262
2270
|
async getRecipientKey() {
|
|
2263
|
-
if (this.recipient && this.now() - this.recipient.fetchedAt <
|
|
2271
|
+
if (this.recipient && this.now() - this.recipient.fetchedAt < Er)
|
|
2264
2272
|
return this.recipient.key;
|
|
2265
2273
|
const e = await this.callPublic("GET", "/attestation");
|
|
2266
2274
|
if (!(e != null && e.recipient_public_key))
|
|
@@ -2292,28 +2300,28 @@ class mr {
|
|
|
2292
2300
|
throw new h(o.NETWORK_ERROR, "one-wallet-api request failed", { cause: a });
|
|
2293
2301
|
}
|
|
2294
2302
|
if (n.status < 200 || n.status >= 300)
|
|
2295
|
-
throw
|
|
2303
|
+
throw Ir(n.status, n.data);
|
|
2296
2304
|
return n.data;
|
|
2297
2305
|
}
|
|
2298
2306
|
}
|
|
2299
|
-
const xe = (i) => `m/44'/60'/0'/0/${i}`,
|
|
2300
|
-
function
|
|
2307
|
+
const xe = (i) => `m/44'/60'/0'/0/${i}`, yr = /^0x(?:[0-9a-fA-F]{2})*$/;
|
|
2308
|
+
function Nr(i) {
|
|
2301
2309
|
try {
|
|
2302
|
-
const e = JSON.parse(new TextDecoder().decode(
|
|
2310
|
+
const e = JSON.parse(new TextDecoder().decode(Js(i.split(".")[1] ?? "")));
|
|
2303
2311
|
if (typeof (e == null ? void 0 : e.sub) == "string" && e.sub) return e.sub;
|
|
2304
2312
|
} catch {
|
|
2305
2313
|
}
|
|
2306
2314
|
throw new h(o.AUTH_TOKEN_INVALID, "access token has no sub");
|
|
2307
2315
|
}
|
|
2308
2316
|
function Rr(i) {
|
|
2309
|
-
if (
|
|
2317
|
+
if (yr.test(i)) {
|
|
2310
2318
|
const e = i.slice(2);
|
|
2311
2319
|
return Uint8Array.from({ length: e.length / 2 }, (t, s) => parseInt(e.slice(s * 2, s * 2 + 2), 16));
|
|
2312
2320
|
}
|
|
2313
2321
|
return C(i);
|
|
2314
2322
|
}
|
|
2315
|
-
const
|
|
2316
|
-
function
|
|
2323
|
+
const ft = (i) => `0x${i.toString(16)}`;
|
|
2324
|
+
function pt(i, e) {
|
|
2317
2325
|
const t = i.chainId ?? Number(e.split(":")[1]);
|
|
2318
2326
|
if (!Number.isSafeInteger(t))
|
|
2319
2327
|
throw new h(o.TX_INVALID_PARAMS, `invalid chain id: ${e}`);
|
|
@@ -2327,20 +2335,20 @@ function ft(i, e) {
|
|
|
2327
2335
|
gas_price: i.gasPrice,
|
|
2328
2336
|
max_fee_per_gas: i.maxFeePerGas,
|
|
2329
2337
|
max_priority_fee_per_gas: i.maxPriorityFeePerGas,
|
|
2330
|
-
nonce:
|
|
2331
|
-
chain_id:
|
|
2338
|
+
nonce: ft(i.nonce),
|
|
2339
|
+
chain_id: ft(t)
|
|
2332
2340
|
};
|
|
2333
2341
|
return Object.fromEntries(Object.entries(s).filter(([, r]) => r !== void 0));
|
|
2334
2342
|
}
|
|
2335
|
-
class
|
|
2343
|
+
class Fe {
|
|
2336
2344
|
constructor(e) {
|
|
2337
|
-
this.opts = e, this.walletAddress = null, this.client = new
|
|
2345
|
+
this.opts = e, this.walletAddress = null, this.client = new Tr({
|
|
2338
2346
|
baseUrl: e.baseUrl,
|
|
2339
2347
|
transport: e.transport,
|
|
2340
2348
|
getAccessToken: e.getAccessToken,
|
|
2341
2349
|
getAuthorizationHeaders: e.getAuthorizationHeaders,
|
|
2342
2350
|
now: e.now
|
|
2343
|
-
}), this.authzKeys = new
|
|
2351
|
+
}), this.authzKeys = new Sr({ client: this.client, getIssuanceJwt: e.getAccessToken, now: e.now });
|
|
2344
2352
|
}
|
|
2345
2353
|
async checkWallet() {
|
|
2346
2354
|
return await this.findWallet() ? "exists" : "not_found";
|
|
@@ -2349,7 +2357,7 @@ class Me {
|
|
|
2349
2357
|
if (this.walletAddress) return this.walletData(this.walletAddress);
|
|
2350
2358
|
const t = await this.findWallet();
|
|
2351
2359
|
if (t) return this.walletData(t.address);
|
|
2352
|
-
const s = this.requirePin(), r =
|
|
2360
|
+
const s = this.requirePin(), r = Nr(await this.opts.getAccessToken()), n = await Wt(), { result: a, aad: c } = await this.withEnvelope(
|
|
2353
2361
|
"generate",
|
|
2354
2362
|
r,
|
|
2355
2363
|
{ command: "generate" },
|
|
@@ -2361,7 +2369,7 @@ class Me {
|
|
|
2361
2369
|
})
|
|
2362
2370
|
);
|
|
2363
2371
|
if (this.walletAddress = a.address, a.sealed_share_c && this.opts.onShareC) {
|
|
2364
|
-
const d = await
|
|
2372
|
+
const d = await Bt(n, a.sealed_share_c, c);
|
|
2365
2373
|
await this.opts.onShareC(d, a.address);
|
|
2366
2374
|
}
|
|
2367
2375
|
return this.walletData(a.address);
|
|
@@ -2373,6 +2381,34 @@ class Me {
|
|
|
2373
2381
|
);
|
|
2374
2382
|
return ((s == null ? void 0 : s.addresses) ?? []).map((r) => ({ address: r.address, index: r.index, name: r.name || void 0 }));
|
|
2375
2383
|
}
|
|
2384
|
+
/**
|
|
2385
|
+
* `POST /wallets/{지갑}/pin/verify` — verify_pin 봉투 (docs/26 §5.1, GASPQA-6804).
|
|
2386
|
+
* 틀리면 서버가 200 `{valid:false, remaining_attempts}` 를 주므로 `PIN_WRONG` 으로 바꿔 던진다. 잠금은 423 `PIN_LOCKED`.
|
|
2387
|
+
*/
|
|
2388
|
+
async checkPinForChange(e) {
|
|
2389
|
+
const t = await this.requireWalletAddress(), { result: s } = await this.withEnvelope(
|
|
2390
|
+
"verify_pin",
|
|
2391
|
+
t,
|
|
2392
|
+
{ command: "verify_pin" },
|
|
2393
|
+
{ pin: e },
|
|
2394
|
+
(r, n) => this.client.call("POST", `/wallets/${t}/pin/verify`, { envelope: r, intent: n })
|
|
2395
|
+
);
|
|
2396
|
+
if (!(s != null && s.valid))
|
|
2397
|
+
throw new h(o.PIN_WRONG, "Incorrect PIN.", {
|
|
2398
|
+
...(s == null ? void 0 : s.remaining_attempts) != null ? { remainingAttempts: s.remaining_attempts } : {}
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
/** `PUT /wallets/{지갑}/pin` — change_pin 봉투, 평문 `{pin, new_pin}` → 204 (docs/26 §5.1, GASPQA-6804) */
|
|
2402
|
+
async changePin(e, t) {
|
|
2403
|
+
const s = await this.requireWalletAddress();
|
|
2404
|
+
await this.withEnvelope(
|
|
2405
|
+
"change_pin",
|
|
2406
|
+
s,
|
|
2407
|
+
{ command: "change_pin" },
|
|
2408
|
+
{ pin: e, new_pin: t },
|
|
2409
|
+
(r, n) => this.client.call("PUT", `/wallets/${s}/pin`, { envelope: r, intent: n })
|
|
2410
|
+
);
|
|
2411
|
+
}
|
|
2376
2412
|
/** `PATCH /wallets/{addr}/addresses` — 봉투 없음, 한 번에 1~10개 (docs/26 §5.1, GASPQA-6803) */
|
|
2377
2413
|
async setAddressNames(e, t) {
|
|
2378
2414
|
const s = await this.requireWalletAddress();
|
|
@@ -2419,7 +2455,7 @@ class Me {
|
|
|
2419
2455
|
const n = await this.resolveTarget(r, s.from), { result: a } = await this.withEnvelope(
|
|
2420
2456
|
"sign",
|
|
2421
2457
|
n.address,
|
|
2422
|
-
{ command: "sign", index: n.index, unsigned_tx:
|
|
2458
|
+
{ command: "sign", index: n.index, unsigned_tx: pt(s, t) },
|
|
2423
2459
|
{ pin: this.requirePin() },
|
|
2424
2460
|
(c, d) => this.client.call("POST", `/wallets/${n.address}/signatures`, {
|
|
2425
2461
|
type: "transaction",
|
|
@@ -2434,7 +2470,7 @@ class Me {
|
|
|
2434
2470
|
const r = await this.resolveTarget(void 0, s.from), { result: n } = await this.withEnvelope(
|
|
2435
2471
|
"sign",
|
|
2436
2472
|
r.address,
|
|
2437
|
-
{ command: "sign", index: r.index, unsigned_tx:
|
|
2473
|
+
{ command: "sign", index: r.index, unsigned_tx: pt(s, t) },
|
|
2438
2474
|
{ pin: this.requirePin() },
|
|
2439
2475
|
(a, c) => this.client.call("POST", `/wallets/${r.address}/transactions`, { chain_id: t, envelope: a, intent: c })
|
|
2440
2476
|
);
|
|
@@ -2491,7 +2527,7 @@ class Me {
|
|
|
2491
2527
|
async withEnvelope(e, t, s, r, n) {
|
|
2492
2528
|
var a;
|
|
2493
2529
|
for (let c = 0; ; c++) {
|
|
2494
|
-
const d = await
|
|
2530
|
+
const d = await pr({
|
|
2495
2531
|
recipientPub: await this.client.getRecipientKey(),
|
|
2496
2532
|
bindingId: t,
|
|
2497
2533
|
command: e,
|
|
@@ -2512,11 +2548,11 @@ class Me {
|
|
|
2512
2548
|
}
|
|
2513
2549
|
}
|
|
2514
2550
|
}
|
|
2515
|
-
const
|
|
2516
|
-
function
|
|
2517
|
-
return i.code ===
|
|
2551
|
+
const Or = 3, Pr = /^0x(?:[0-9a-fA-F]{2}){4,}$/;
|
|
2552
|
+
function Cr(i) {
|
|
2553
|
+
return i.code === Or || /execution reverted/i.test(i.message ?? "");
|
|
2518
2554
|
}
|
|
2519
|
-
class
|
|
2555
|
+
class Dr {
|
|
2520
2556
|
constructor(e, t) {
|
|
2521
2557
|
this.chainRegistry = e, this.transport = t, this._nextId = 1;
|
|
2522
2558
|
}
|
|
@@ -2541,8 +2577,8 @@ class Cr {
|
|
|
2541
2577
|
body: n
|
|
2542
2578
|
})).data;
|
|
2543
2579
|
if (c != null && c.error) {
|
|
2544
|
-
const { code: d, message: g } = c.error, u = { method: e, chainId: s, code: d, message: g, data: c.error.data }, _ =
|
|
2545
|
-
throw _ && typeof u.data == "string" &&
|
|
2580
|
+
const { code: d, message: g } = c.error, u = { method: e, chainId: s, code: d, message: g, data: c.error.data }, _ = Cr(c.error);
|
|
2581
|
+
throw _ && typeof u.data == "string" && Pr.test(u.data) && (u.revertData = u.data, u.selector = u.data.slice(0, 10).toLowerCase()), new h(
|
|
2546
2582
|
_ ? o.EXECUTION_REVERTED : o.UNKNOWN_ERROR,
|
|
2547
2583
|
`RPC 오류 [${e}] (${s}): ${g} (코드: ${d})`,
|
|
2548
2584
|
u
|
|
@@ -2551,7 +2587,7 @@ class Cr {
|
|
|
2551
2587
|
return c == null ? void 0 : c.result;
|
|
2552
2588
|
}
|
|
2553
2589
|
}
|
|
2554
|
-
class
|
|
2590
|
+
class xr {
|
|
2555
2591
|
constructor() {
|
|
2556
2592
|
this.listeners = /* @__PURE__ */ new Map();
|
|
2557
2593
|
}
|
|
@@ -2574,7 +2610,7 @@ class Dr {
|
|
|
2574
2610
|
this.listeners.clear();
|
|
2575
2611
|
}
|
|
2576
2612
|
}
|
|
2577
|
-
function
|
|
2613
|
+
function vr() {
|
|
2578
2614
|
var e;
|
|
2579
2615
|
if (typeof globalThis < "u" && ((e = globalThis.crypto) != null && e.getRandomValues)) {
|
|
2580
2616
|
const t = new Uint8Array(16);
|
|
@@ -2644,7 +2680,7 @@ class b {
|
|
|
2644
2680
|
async handshake() {
|
|
2645
2681
|
if (!this.bridge)
|
|
2646
2682
|
throw new h(o.AUTH_NOT_INITIALIZED, "Bridge not initialized");
|
|
2647
|
-
const e =
|
|
2683
|
+
const e = vr(), t = Date.now(), s = {
|
|
2648
2684
|
version: 1,
|
|
2649
2685
|
appId: this.config.appId,
|
|
2650
2686
|
appVersion: this.config.appVersion,
|
|
@@ -2841,7 +2877,7 @@ const X = {
|
|
|
2841
2877
|
oneWalletApiUrl: "https://dev-one-pocket-api.onechain.nexus/embed/v1"
|
|
2842
2878
|
}
|
|
2843
2879
|
};
|
|
2844
|
-
function
|
|
2880
|
+
function kr(i) {
|
|
2845
2881
|
const e = i.environment, t = e && e in X ? X[e] : null;
|
|
2846
2882
|
if (!t)
|
|
2847
2883
|
return null;
|
|
@@ -2856,7 +2892,7 @@ function vr(i) {
|
|
|
2856
2892
|
function ce() {
|
|
2857
2893
|
try {
|
|
2858
2894
|
if (typeof __CROSSX_CONFIG__ < "u") {
|
|
2859
|
-
const i = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e =
|
|
2895
|
+
const i = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = kr(i);
|
|
2860
2896
|
if (e) return e;
|
|
2861
2897
|
}
|
|
2862
2898
|
} catch {
|
|
@@ -2869,47 +2905,47 @@ function ce() {
|
|
|
2869
2905
|
}
|
|
2870
2906
|
return X.production;
|
|
2871
2907
|
}
|
|
2872
|
-
function
|
|
2908
|
+
function Ht(i) {
|
|
2873
2909
|
let e = i.length;
|
|
2874
2910
|
for (; e > 0 && i.charCodeAt(e - 1) === 48; ) e--;
|
|
2875
2911
|
return i.slice(0, e);
|
|
2876
2912
|
}
|
|
2877
|
-
function
|
|
2913
|
+
function Lr(i, e = Tt) {
|
|
2878
2914
|
if (!i || i === "0x0" || i === "0x") return "0";
|
|
2879
2915
|
try {
|
|
2880
2916
|
const t = BigInt(i);
|
|
2881
2917
|
if (t === 0n) return "0";
|
|
2882
|
-
const s = 10n ** BigInt(
|
|
2918
|
+
const s = 10n ** BigInt(Qe), r = t / s, a = (t % s).toString().padStart(Qe, "0"), c = Ht(a).slice(0, e);
|
|
2883
2919
|
return c ? `${r}.${c}` : `${r}`;
|
|
2884
2920
|
} catch {
|
|
2885
2921
|
return "?";
|
|
2886
2922
|
}
|
|
2887
2923
|
}
|
|
2888
|
-
function ue(i, e, t, s =
|
|
2924
|
+
function ue(i, e, t, s = Tt) {
|
|
2889
2925
|
if (!(!i || i === "0x" || i === "0x0"))
|
|
2890
2926
|
try {
|
|
2891
2927
|
const r = BigInt(i);
|
|
2892
2928
|
if (r === 0n) return;
|
|
2893
|
-
const n = 10n ** BigInt(t), a = r / n, d = (r % n).toString().padStart(t, "0"), g =
|
|
2929
|
+
const n = 10n ** BigInt(t), a = r / n, d = (r % n).toString().padStart(t, "0"), g = Ht(d.slice(0, s)), u = g ? `${a}.${g}` : `${a}`;
|
|
2894
2930
|
return e ? `${u} ${e}` : u;
|
|
2895
2931
|
} catch {
|
|
2896
2932
|
return;
|
|
2897
2933
|
}
|
|
2898
2934
|
}
|
|
2899
|
-
function
|
|
2935
|
+
function Ur(i) {
|
|
2900
2936
|
const e = i.startsWith("0x") ? i.slice(2) : i;
|
|
2901
2937
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
2902
2938
|
throw new h(
|
|
2903
2939
|
o.SIGNATURE_FAILED,
|
|
2904
2940
|
"유효하지 않은 서명: 올바른 hex 문자열이 아닙니다"
|
|
2905
2941
|
);
|
|
2906
|
-
if (e.length !==
|
|
2942
|
+
if (e.length !== Ze)
|
|
2907
2943
|
throw new h(
|
|
2908
2944
|
o.SIGNATURE_FAILED,
|
|
2909
|
-
`서명 길이가 유효하지 않습니다: ${
|
|
2945
|
+
`서명 길이가 유효하지 않습니다: ${Ze} hex 문자(65 바이트) 예상, 현재 ${e.length}`
|
|
2910
2946
|
);
|
|
2911
2947
|
}
|
|
2912
|
-
function
|
|
2948
|
+
function br(i) {
|
|
2913
2949
|
const e = i.startsWith("0x") ? i.slice(2) : i;
|
|
2914
2950
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
2915
2951
|
throw new h(
|
|
@@ -2922,8 +2958,8 @@ function Ur(i) {
|
|
|
2922
2958
|
"유효하지 않은 서명된 트랜잭션: 너무 짧습니다"
|
|
2923
2959
|
);
|
|
2924
2960
|
}
|
|
2925
|
-
function
|
|
2926
|
-
const t =
|
|
2961
|
+
function Wr(i, e) {
|
|
2962
|
+
const t = Mr(e);
|
|
2927
2963
|
if (i === "0") {
|
|
2928
2964
|
if (t !== void 0 && t !== 0)
|
|
2929
2965
|
throw new h(
|
|
@@ -2947,7 +2983,7 @@ function br(i, e) {
|
|
|
2947
2983
|
);
|
|
2948
2984
|
}
|
|
2949
2985
|
}
|
|
2950
|
-
function
|
|
2986
|
+
function Mr(i) {
|
|
2951
2987
|
if (i == null || typeof i != "object") return;
|
|
2952
2988
|
const e = i.domain;
|
|
2953
2989
|
if (e == null || typeof e != "object") return;
|
|
@@ -2956,13 +2992,13 @@ function Wr(i) {
|
|
|
2956
2992
|
const s = Number(t);
|
|
2957
2993
|
return Number.isFinite(s) ? s : void 0;
|
|
2958
2994
|
}
|
|
2959
|
-
const
|
|
2960
|
-
function
|
|
2995
|
+
const Fr = 4, Br = 24, Hr = /^[\p{L}\p{N} _\-.,()[\]@#%^*~/:+=!?]+$/u;
|
|
2996
|
+
function Gr(i) {
|
|
2961
2997
|
if (typeof i != "string") return null;
|
|
2962
2998
|
const e = i.trim(), t = [...e].length;
|
|
2963
|
-
return t <
|
|
2999
|
+
return t < Fr || t > Br ? null : Hr.test(e) ? e : null;
|
|
2964
3000
|
}
|
|
2965
|
-
const
|
|
3001
|
+
const Qi = 900 * 1e3, Kr = /* @__PURE__ */ new Set([
|
|
2966
3002
|
"095ea7b3",
|
|
2967
3003
|
// approve(address,uint256)
|
|
2968
3004
|
"a22cb465",
|
|
@@ -2973,7 +3009,7 @@ const Zi = 900 * 1e3, Gr = /* @__PURE__ */ new Set([
|
|
|
2973
3009
|
// increaseApproval(address,uint256) — 예전 OpenZeppelin
|
|
2974
3010
|
"87517c45"
|
|
2975
3011
|
// Permit2 approve(address,address,uint160,uint48)
|
|
2976
|
-
]),
|
|
3012
|
+
]), Vr = /* @__PURE__ */ new Set([
|
|
2977
3013
|
"Permit",
|
|
2978
3014
|
"PermitSingle",
|
|
2979
3015
|
"PermitBatch",
|
|
@@ -2982,22 +3018,22 @@ const Zi = 900 * 1e3, Gr = /* @__PURE__ */ new Set([
|
|
|
2982
3018
|
"PermitWitnessTransferFrom",
|
|
2983
3019
|
"PermitBatchWitnessTransferFrom"
|
|
2984
3020
|
]);
|
|
2985
|
-
function
|
|
3021
|
+
function $r(i) {
|
|
2986
3022
|
var s;
|
|
2987
3023
|
const { action: e, context: t } = i;
|
|
2988
3024
|
if (e === "sign" || e === "send") {
|
|
2989
3025
|
const r = (s = t.tx) == null ? void 0 : s.data;
|
|
2990
3026
|
if (typeof r != "string") return !1;
|
|
2991
3027
|
const n = r.trim().toLowerCase().replace(/^0x/, "");
|
|
2992
|
-
return n.length >= 8 &&
|
|
3028
|
+
return n.length >= 8 && Kr.has(n.slice(0, 8));
|
|
2993
3029
|
}
|
|
2994
3030
|
if (e === "sign-typed-data") {
|
|
2995
|
-
const r =
|
|
2996
|
-
return r === null ||
|
|
3031
|
+
const r = Yr(t.typedData);
|
|
3032
|
+
return r === null || Vr.has(r);
|
|
2997
3033
|
}
|
|
2998
3034
|
return !1;
|
|
2999
3035
|
}
|
|
3000
|
-
function
|
|
3036
|
+
function Yr(i) {
|
|
3001
3037
|
let e = i;
|
|
3002
3038
|
if (typeof e == "string")
|
|
3003
3039
|
try {
|
|
@@ -3011,16 +3047,17 @@ function $r(i) {
|
|
|
3011
3047
|
}
|
|
3012
3048
|
return null;
|
|
3013
3049
|
}
|
|
3014
|
-
function
|
|
3050
|
+
function qr(i, e, t, s) {
|
|
3015
3051
|
if (!i) return !0;
|
|
3016
3052
|
if (i.mode === "off" || e === null) return !1;
|
|
3017
3053
|
const r = t - e;
|
|
3018
|
-
return r < 0 || r >= i.ttlMs ? !1 :
|
|
3054
|
+
return r < 0 || r >= i.ttlMs ? !1 : !$r(s);
|
|
3019
3055
|
}
|
|
3020
|
-
function
|
|
3056
|
+
function jr(i) {
|
|
3021
3057
|
return (i == null ? void 0 : i.mode) === "off";
|
|
3022
3058
|
}
|
|
3023
|
-
|
|
3059
|
+
const ve = 5;
|
|
3060
|
+
class H {
|
|
3024
3061
|
constructor(e) {
|
|
3025
3062
|
this.deps = e, this.verifyPinMutex = null;
|
|
3026
3063
|
}
|
|
@@ -3032,12 +3069,12 @@ class J {
|
|
|
3032
3069
|
var s, r;
|
|
3033
3070
|
if (this.deps.pinStore.hold(), !this.deps.pinStore.has()) return;
|
|
3034
3071
|
const t = (r = (s = this.deps).getPinReusePolicy) == null ? void 0 : r.call(s);
|
|
3035
|
-
|
|
3072
|
+
qr(t, this.deps.pinStore.getSetAt(), Date.now(), e) || this.deps.pinStore.clear();
|
|
3036
3073
|
}
|
|
3037
3074
|
/** 서명이 끝난 뒤 — 서명마다 PIN 을 받는 정책이면 PIN 을 메모리에 남기지 않는다. */
|
|
3038
3075
|
finishSigning() {
|
|
3039
3076
|
var e, t;
|
|
3040
|
-
|
|
3077
|
+
jr((t = (e = this.deps).getPinReusePolicy) == null ? void 0 : t.call(e)) && this.deps.pinStore.clear(), this.deps.pinStore.release();
|
|
3041
3078
|
}
|
|
3042
3079
|
/** PIN 재사용 정책이 있으면 true — 서명을 하나씩 처리해야 한다 (SigningOrchestrator). */
|
|
3043
3080
|
hasReusePolicy() {
|
|
@@ -3066,6 +3103,72 @@ class J {
|
|
|
3066
3103
|
);
|
|
3067
3104
|
this.deps.pinStore.set(t), l.log("[CROSSx] PIN 입력 완료 (메모리 캐시)");
|
|
3068
3105
|
}
|
|
3106
|
+
/**
|
|
3107
|
+
* PIN 변경 화면 흐름 (GASPQA-6804) — PIN 은 이 SDK(보안 화면) 밖으로 나가지 않는다.
|
|
3108
|
+
* 1) 현재 PIN 입력: 지갑 서버로 확인하며, 틀리면 같은 화면에 오류 · 연속 오입력 횟수, 잠금이면 잠금 안내
|
|
3109
|
+
* 2) 새 PIN 설정 · 재입력 (안내 동의 단계 없음). 지금 PIN 과 같으면 다시 받는다
|
|
3110
|
+
* 3) 지갑 서버에 변경. 메모리에 둔 PIN 은 결과와 상관없이 지운다 — 다음 서명 때 PIN 을 한 번 묻는다
|
|
3111
|
+
* @throws `WALLET_OPERATION_UNSUPPORTED` 지원하지 않는 지갑 서버 · RN 브리지 · `PIN_CANCELLED` 사용자가 닫음 ·
|
|
3112
|
+
* `PIN_LOCKED` 영구 잠금(현재 PIN 확인 때) 또는 변경 단계 잠금 · 그 밖의 지갑 서버 오류
|
|
3113
|
+
*/
|
|
3114
|
+
async changePinWithPrompt() {
|
|
3115
|
+
var c, d;
|
|
3116
|
+
const e = this.deps.walletProvider;
|
|
3117
|
+
if ((d = (c = this.deps).isRNBridgeMode) != null && d.call(c) || typeof e.checkPinForChange != "function" || typeof e.changePin != "function")
|
|
3118
|
+
throw new h(o.WALLET_OPERATION_UNSUPPORTED, "이 지갑 서버는 PIN 변경을 지원하지 않습니다");
|
|
3119
|
+
const t = W(this.deps.getLocale() ?? "en");
|
|
3120
|
+
let s = null;
|
|
3121
|
+
if (!await this.deps.confirmation.showPinInputPrompt({
|
|
3122
|
+
onSubmit: async (g) => {
|
|
3123
|
+
try {
|
|
3124
|
+
return await e.checkPinForChange(g), s = g, { ok: !0 };
|
|
3125
|
+
} catch (u) {
|
|
3126
|
+
if (u instanceof h) {
|
|
3127
|
+
const _ = H.pinChangeErrorResult(u, t);
|
|
3128
|
+
if (_) return _;
|
|
3129
|
+
}
|
|
3130
|
+
throw u;
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
}) || s === null)
|
|
3134
|
+
throw new h(o.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
|
|
3135
|
+
const n = s;
|
|
3136
|
+
let a;
|
|
3137
|
+
for (; ; ) {
|
|
3138
|
+
const g = await this.deps.confirmation.showPinSetupPrompt({ mode: "change", errorMessage: a });
|
|
3139
|
+
if (!g)
|
|
3140
|
+
throw new h(o.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
|
|
3141
|
+
if (g === n) {
|
|
3142
|
+
a = t.pin_change_same_error;
|
|
3143
|
+
continue;
|
|
3144
|
+
}
|
|
3145
|
+
try {
|
|
3146
|
+
await e.changePin(n, g), l.log("[CROSSx] PIN 변경 완료");
|
|
3147
|
+
} finally {
|
|
3148
|
+
this.deps.pinStore.clear();
|
|
3149
|
+
}
|
|
3150
|
+
return;
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
/**
|
|
3154
|
+
* PIN 변경의 현재 PIN 확인 오류 → 입력 화면 결과 (UID 11.17).
|
|
3155
|
+
* 지갑 서버는 다음 잠금까지 남은 횟수만 주고 단계 크기(`max_attempts`)는 주지 않는다. 그래서 남은 횟수가 1~4 면
|
|
3156
|
+
* `(5 - 남은)/5` 로 보인다 — "남은 횟수"는 언제나 맞고, 단계가 5회가 아닐 때(예시 설정의 10 → 20 단계)는 분모만 다르다.
|
|
3157
|
+
* 서버가 `max_attempts` 를 주면 그 값으로 바꾼다. 영구 잠금은 화면에 두지 않고 `null` → 오류로 끝낸다.
|
|
3158
|
+
*/
|
|
3159
|
+
static pinChangeErrorResult(e, t) {
|
|
3160
|
+
var s, r;
|
|
3161
|
+
if (e.code === o.PIN_WRONG) {
|
|
3162
|
+
const n = (s = e.details) == null ? void 0 : s.remainingAttempts;
|
|
3163
|
+
return n != null && n > 0 && n < ve ? {
|
|
3164
|
+
ok: !1,
|
|
3165
|
+
error: t.pin_input_error,
|
|
3166
|
+
attemptCount: ve - n,
|
|
3167
|
+
maxAttempts: ve
|
|
3168
|
+
} : { ok: !1, error: t.pin_input_error };
|
|
3169
|
+
}
|
|
3170
|
+
return e.code === o.PIN_LOCKED && ((r = e.details) != null && r.permanent) ? null : e.code === o.PIN_LOCKED || e.code === o.PIN_INVALID ? H.buildPinLockedResult(e, t) : null;
|
|
3171
|
+
}
|
|
3069
3172
|
async ensureVerifiedPin(e, t, s, r) {
|
|
3070
3173
|
var d, g;
|
|
3071
3174
|
if ((g = (d = this.deps).isRNBridgeMode) != null && g.call(d)) return;
|
|
@@ -3081,7 +3184,7 @@ class J {
|
|
|
3081
3184
|
this.verifyPinMutex = new Promise((u, _) => {
|
|
3082
3185
|
n = u, a = _;
|
|
3083
3186
|
});
|
|
3084
|
-
const c =
|
|
3187
|
+
const c = W(this.deps.getLocale() ?? "en");
|
|
3085
3188
|
try {
|
|
3086
3189
|
if (typeof this.deps.walletProvider.verifyPin != "function") {
|
|
3087
3190
|
const _ = await this.deps.confirmation.showPinInputPrompt({
|
|
@@ -3116,7 +3219,7 @@ class J {
|
|
|
3116
3219
|
if (p.code === o.PIN_INVALID)
|
|
3117
3220
|
return { ok: !1, error: p.message };
|
|
3118
3221
|
if (p.code === o.PIN_LOCKED)
|
|
3119
|
-
return
|
|
3222
|
+
return H.buildPinLockedResult(p, c);
|
|
3120
3223
|
}
|
|
3121
3224
|
throw p;
|
|
3122
3225
|
}
|
|
@@ -3130,7 +3233,7 @@ class J {
|
|
|
3130
3233
|
this.deps.pinStore.set(u), l.log("[CROSSx] PIN 갱신 완료 (verify 모달 닫힘)"), n();
|
|
3131
3234
|
} catch (u) {
|
|
3132
3235
|
if (u instanceof h && (u.code === o.AUTH_NOT_AUTHENTICATED || u.code === o.AUTH_TOKEN_EXPIRED || u.code === o.SESSION_EXPIRED) && u.code !== o.SESSION_EXPIRED) {
|
|
3133
|
-
const _ =
|
|
3236
|
+
const _ = W(this.deps.getLocale() ?? "en"), p = this.deps.getUserEmail();
|
|
3134
3237
|
if (await this.deps.confirmation.showSessionAlert({
|
|
3135
3238
|
title: _.session_alert_title,
|
|
3136
3239
|
message: _.alert_session_expired,
|
|
@@ -3144,13 +3247,13 @@ class J {
|
|
|
3144
3247
|
}
|
|
3145
3248
|
}
|
|
3146
3249
|
async withPinRetry(e) {
|
|
3147
|
-
const t =
|
|
3250
|
+
const t = W(this.deps.getLocale() ?? "en");
|
|
3148
3251
|
let s = null;
|
|
3149
3252
|
try {
|
|
3150
3253
|
return await e();
|
|
3151
3254
|
} catch (r) {
|
|
3152
3255
|
if (r instanceof h) {
|
|
3153
|
-
if (s =
|
|
3256
|
+
if (s = H.parsePinError(r, t), !s) throw r;
|
|
3154
3257
|
} else
|
|
3155
3258
|
throw r;
|
|
3156
3259
|
}
|
|
@@ -3164,7 +3267,7 @@ class J {
|
|
|
3164
3267
|
try {
|
|
3165
3268
|
return await e();
|
|
3166
3269
|
} catch (r) {
|
|
3167
|
-
if (r instanceof h && (s =
|
|
3270
|
+
if (r instanceof h && (s = H.parsePinError(r, t), s))
|
|
3168
3271
|
continue;
|
|
3169
3272
|
throw r;
|
|
3170
3273
|
}
|
|
@@ -3189,13 +3292,13 @@ class J {
|
|
|
3189
3292
|
return null;
|
|
3190
3293
|
}
|
|
3191
3294
|
static buildPinLockedResult(e, t) {
|
|
3192
|
-
const s =
|
|
3295
|
+
const s = H.parsePinError(e, t);
|
|
3193
3296
|
if (!s) return { ok: !1, error: e.message };
|
|
3194
3297
|
const { errorMessage: r, ...n } = s;
|
|
3195
3298
|
return { ok: !1, error: r, ...n };
|
|
3196
3299
|
}
|
|
3197
3300
|
}
|
|
3198
|
-
class
|
|
3301
|
+
class zr {
|
|
3199
3302
|
constructor(e) {
|
|
3200
3303
|
this.deps = e, this.signingQueue = Promise.resolve();
|
|
3201
3304
|
}
|
|
@@ -3234,10 +3337,10 @@ class jr {
|
|
|
3234
3337
|
}
|
|
3235
3338
|
}
|
|
3236
3339
|
}
|
|
3237
|
-
function
|
|
3340
|
+
function Jr(i) {
|
|
3238
3341
|
return i === "google" || i === "apple";
|
|
3239
3342
|
}
|
|
3240
|
-
class
|
|
3343
|
+
class Xr {
|
|
3241
3344
|
constructor(e) {
|
|
3242
3345
|
this.deps = e;
|
|
3243
3346
|
}
|
|
@@ -3248,7 +3351,7 @@ class Jr {
|
|
|
3248
3351
|
this.deps.setRecoveringSession(!0);
|
|
3249
3352
|
try {
|
|
3250
3353
|
this.deps.setAuthenticated(!1), this.deps.clearTokenStore();
|
|
3251
|
-
const r =
|
|
3354
|
+
const r = Jr(e.loginType) ? { provider: e.loginType } : void 0;
|
|
3252
3355
|
let n;
|
|
3253
3356
|
try {
|
|
3254
3357
|
n = await this.deps.executeSignIn(r);
|
|
@@ -3263,7 +3366,7 @@ class Jr {
|
|
|
3263
3366
|
"[CROSSx] signInAgain: providerSub/userId 불일치 — 잘못된 계정으로 로그인됨"
|
|
3264
3367
|
), await this.deps.executeSignOut().catch(() => {
|
|
3265
3368
|
});
|
|
3266
|
-
const g =
|
|
3369
|
+
const g = W(this.deps.getLocale() ?? "en");
|
|
3267
3370
|
return await this.deps.showSessionAlert({
|
|
3268
3371
|
title: g.session_alert_title,
|
|
3269
3372
|
message: g.alert_different_account,
|
|
@@ -3288,7 +3391,7 @@ class Jr {
|
|
|
3288
3391
|
try {
|
|
3289
3392
|
return await e();
|
|
3290
3393
|
} catch (t) {
|
|
3291
|
-
const s =
|
|
3394
|
+
const s = W(this.deps.getLocale() ?? "en"), { userEmail: r } = this.deps.getSessionSnapshot(), n = r ? this.deps.maskEmail(r, s.session_alert_apple_account) : void 0;
|
|
3292
3395
|
if (t instanceof h && t.code === o.WITHDRAW_FAILED) {
|
|
3293
3396
|
if (l.warn("[CROSSx] WITHDRAW_FAILED — 로컬 인증 초기화"), await this.deps.showSessionAlert({
|
|
3294
3397
|
title: s.session_alert_title,
|
|
@@ -3328,7 +3431,7 @@ class Jr {
|
|
|
3328
3431
|
}
|
|
3329
3432
|
}
|
|
3330
3433
|
}
|
|
3331
|
-
class
|
|
3434
|
+
class Zr {
|
|
3332
3435
|
constructor(e) {
|
|
3333
3436
|
this.deps = e;
|
|
3334
3437
|
}
|
|
@@ -3375,7 +3478,7 @@ class Xr {
|
|
|
3375
3478
|
l.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", c.address), this.deps.setActiveWallet(c.address, 0);
|
|
3376
3479
|
}
|
|
3377
3480
|
}
|
|
3378
|
-
class
|
|
3481
|
+
class Qr {
|
|
3379
3482
|
constructor(e) {
|
|
3380
3483
|
this.deps = e;
|
|
3381
3484
|
}
|
|
@@ -3443,7 +3546,7 @@ class Zr {
|
|
|
3443
3546
|
l.warn(
|
|
3444
3547
|
"[CROSSx][Migration Phase 4] 세션 만료 — 재로그인 후 PIN 입력 재시도"
|
|
3445
3548
|
);
|
|
3446
|
-
const p =
|
|
3549
|
+
const p = W(this.deps.getLocale() ?? "en"), A = this.deps.getUserEmail();
|
|
3447
3550
|
if (await this.deps.confirmation.showSessionAlert({
|
|
3448
3551
|
title: p.session_alert_title,
|
|
3449
3552
|
message: p.alert_session_expired,
|
|
@@ -3501,7 +3604,7 @@ class Zr {
|
|
|
3501
3604
|
l.warn(
|
|
3502
3605
|
"[CROSSx][Migration Phase 5] 세션 만료 — 재로그인 후 마이그레이션 재시도"
|
|
3503
3606
|
);
|
|
3504
|
-
const _ =
|
|
3607
|
+
const _ = W(this.deps.getLocale() ?? "en"), p = this.deps.getUserEmail();
|
|
3505
3608
|
if (await this.deps.confirmation.showSessionAlert({
|
|
3506
3609
|
title: _.session_alert_title,
|
|
3507
3610
|
message: _.alert_session_expired,
|
|
@@ -3532,7 +3635,7 @@ class Zr {
|
|
|
3532
3635
|
}
|
|
3533
3636
|
}
|
|
3534
3637
|
}
|
|
3535
|
-
class
|
|
3638
|
+
class ei {
|
|
3536
3639
|
constructor(e) {
|
|
3537
3640
|
this.deps = e;
|
|
3538
3641
|
}
|
|
@@ -3559,7 +3662,7 @@ class Qr {
|
|
|
3559
3662
|
if (g && (d.nonce = parseInt(u ?? "0x0", 16), l.log("[CROSSx] nonce 결과:", d.nonce)), n && (d.gasLimit = _, l.log("[CROSSx] estimateGas 결과:", d.gasLimit)), a) {
|
|
3560
3663
|
const A = p;
|
|
3561
3664
|
if (A) {
|
|
3562
|
-
const S =
|
|
3665
|
+
const S = Xe;
|
|
3563
3666
|
d.maxFeePerGas = `0x${(BigInt(A) + BigInt(S)).toString(16)}`, d.maxPriorityFeePerGas = S, l.log(
|
|
3564
3667
|
"[CROSSx] Dynamic 체인 감지 — baseFee:",
|
|
3565
3668
|
A,
|
|
@@ -3568,12 +3671,12 @@ class Qr {
|
|
|
3568
3671
|
"maxPriorityFeePerGas: 1 Gwei"
|
|
3569
3672
|
);
|
|
3570
3673
|
} else
|
|
3571
|
-
d.gasPrice =
|
|
3674
|
+
d.gasPrice = es, l.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
|
|
3572
3675
|
}
|
|
3573
|
-
return !a && c && (d.maxPriorityFeePerGas =
|
|
3676
|
+
return !a && c && (d.maxPriorityFeePerGas = Xe, l.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), d;
|
|
3574
3677
|
}
|
|
3575
3678
|
}
|
|
3576
|
-
class
|
|
3679
|
+
class ti {
|
|
3577
3680
|
constructor(e) {
|
|
3578
3681
|
this.crypto = e;
|
|
3579
3682
|
}
|
|
@@ -3599,10 +3702,10 @@ class ei {
|
|
|
3599
3702
|
}
|
|
3600
3703
|
}
|
|
3601
3704
|
}
|
|
3602
|
-
function
|
|
3705
|
+
function si(i) {
|
|
3603
3706
|
return i ? i.includes("google") ? "google" : i.includes("apple") ? "apple" : i : null;
|
|
3604
3707
|
}
|
|
3605
|
-
class
|
|
3708
|
+
class ri {
|
|
3606
3709
|
constructor(e) {
|
|
3607
3710
|
this.deps = e;
|
|
3608
3711
|
}
|
|
@@ -3624,7 +3727,7 @@ class si {
|
|
|
3624
3727
|
activeWalletIndex: 0,
|
|
3625
3728
|
userEmail: ((n = e.user) == null ? void 0 : n.email) ?? null,
|
|
3626
3729
|
providerSub: ((a = e.user) == null ? void 0 : a.providerSub) ?? null,
|
|
3627
|
-
loginType:
|
|
3730
|
+
loginType: si(
|
|
3628
3731
|
(c = e.user) == null ? void 0 : c.signInProvider
|
|
3629
3732
|
),
|
|
3630
3733
|
tokenSignatureVerified: e.tokenSignatureVerified ?? !1
|
|
@@ -3653,7 +3756,7 @@ class si {
|
|
|
3653
3756
|
});
|
|
3654
3757
|
}
|
|
3655
3758
|
}
|
|
3656
|
-
class
|
|
3759
|
+
class ii {
|
|
3657
3760
|
constructor(e) {
|
|
3658
3761
|
this.deps = e;
|
|
3659
3762
|
}
|
|
@@ -3674,7 +3777,7 @@ class ri {
|
|
|
3674
3777
|
)).address, index: e };
|
|
3675
3778
|
}
|
|
3676
3779
|
}
|
|
3677
|
-
class
|
|
3780
|
+
class ni {
|
|
3678
3781
|
constructor(e) {
|
|
3679
3782
|
this.deps = e;
|
|
3680
3783
|
}
|
|
@@ -3693,7 +3796,7 @@ class ii {
|
|
|
3693
3796
|
);
|
|
3694
3797
|
}
|
|
3695
3798
|
}
|
|
3696
|
-
class
|
|
3799
|
+
class ai {
|
|
3697
3800
|
constructor(e) {
|
|
3698
3801
|
this.deps = e;
|
|
3699
3802
|
}
|
|
@@ -3753,11 +3856,11 @@ class ni {
|
|
|
3753
3856
|
}
|
|
3754
3857
|
}
|
|
3755
3858
|
}
|
|
3756
|
-
function
|
|
3859
|
+
function wt(i, e) {
|
|
3757
3860
|
const t = i.replace(/\/$/, ""), s = e.startsWith("/") ? e : `/${e}`;
|
|
3758
3861
|
return `${t}/cross-auth${s}`;
|
|
3759
3862
|
}
|
|
3760
|
-
class
|
|
3863
|
+
class oi {
|
|
3761
3864
|
constructor(e) {
|
|
3762
3865
|
this.deps = e;
|
|
3763
3866
|
}
|
|
@@ -3793,7 +3896,7 @@ class ai {
|
|
|
3793
3896
|
o.TX_INVALID_PARAMS,
|
|
3794
3897
|
"invalid param body"
|
|
3795
3898
|
);
|
|
3796
|
-
const n = this.deps.getApiBaseUrl(), a =
|
|
3899
|
+
const n = this.deps.getApiBaseUrl(), a = wt(n, `/v2/token-historical/${e}/${r}`), c = { clientVersion: s };
|
|
3797
3900
|
try {
|
|
3798
3901
|
l.log("[TokenHistory] Registering tx:", e, r);
|
|
3799
3902
|
const d = await this.deps.transport.request({
|
|
@@ -3823,7 +3926,7 @@ class ai {
|
|
|
3823
3926
|
*/
|
|
3824
3927
|
async getTokenHistory(e) {
|
|
3825
3928
|
var r;
|
|
3826
|
-
const t = this.deps.getApiBaseUrl(), s = new URL(
|
|
3929
|
+
const t = this.deps.getApiBaseUrl(), s = new URL(wt(t, "/v2/token-historical"));
|
|
3827
3930
|
(e == null ? void 0 : e.lastTimestamp) !== void 0 && s.searchParams.append("last_timestamp", e.lastTimestamp.toString()), (e == null ? void 0 : e.lastTxIndex) !== void 0 && s.searchParams.append("last_tx_index", e.lastTxIndex.toString());
|
|
3828
3931
|
try {
|
|
3829
3932
|
l.log("[TokenHistory] Fetching token history");
|
|
@@ -3898,14 +4001,14 @@ class ai {
|
|
|
3898
4001
|
throw new h(r.code, r.message);
|
|
3899
4002
|
}
|
|
3900
4003
|
}
|
|
3901
|
-
function
|
|
4004
|
+
function ke(i, e = "Apple account") {
|
|
3902
4005
|
if (i.endsWith("@privaterelay.appleid.com")) return e;
|
|
3903
4006
|
const t = i.indexOf("@");
|
|
3904
4007
|
if (t < 0) return "*".repeat(i.length || 3);
|
|
3905
4008
|
const s = i.substring(0, t), r = i.substring(t);
|
|
3906
4009
|
return s.length <= 1 ? `${s}${"*".repeat(Math.max(s.length, 1))}${r}` : `${s[0]}${"*".repeat(s.length - 1)}${r}`;
|
|
3907
4010
|
}
|
|
3908
|
-
function
|
|
4011
|
+
function ci(i) {
|
|
3909
4012
|
const e = ce().oneWalletApiUrl;
|
|
3910
4013
|
if (!e) return !1;
|
|
3911
4014
|
try {
|
|
@@ -3914,10 +4017,10 @@ function oi(i) {
|
|
|
3914
4017
|
return !1;
|
|
3915
4018
|
}
|
|
3916
4019
|
}
|
|
3917
|
-
const U = class U extends
|
|
4020
|
+
const U = class U extends xr {
|
|
3918
4021
|
constructor(e, t, s, r, n, a, c, d, g, u, _, p, A, S) {
|
|
3919
4022
|
var w, m;
|
|
3920
|
-
super(), this.storage = s, this.crypto = r, this.transport = n, this.oauth = a, this.walletProvider = c, this.tokenStore = d, this.pinEncryptor = p, this.oneIdAuth = A, this.oneIdSessionFactory = S, this._warnedUnknownNativeCurrency = /* @__PURE__ */ new Set(), this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._rnBridgeService = null, this._providers = /* @__PURE__ */ new Map(), this._isAuthenticatedViaRNBridge = !1, this._bridgeSessionRestorePromise = null, this._sdkDeprecationNotified = !1, this._sdkUnsupportedNotified = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = t, e.logger &&
|
|
4023
|
+
super(), this.storage = s, this.crypto = r, this.transport = n, this.oauth = a, this.walletProvider = c, this.tokenStore = d, this.pinEncryptor = p, this.oneIdAuth = A, this.oneIdSessionFactory = S, this._warnedUnknownNativeCurrency = /* @__PURE__ */ new Set(), this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._rnBridgeService = null, this._providers = /* @__PURE__ */ new Map(), this._isAuthenticatedViaRNBridge = !1, this._bridgeSessionRestorePromise = null, this._sdkDeprecationNotified = !1, this._sdkUnsupportedNotified = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = t, e.logger && rt(e.logger), this.confirmation = g, this.pinStore = _ ?? new Pt(), this.stateManager = new ri({
|
|
3921
4024
|
setState: (f) => {
|
|
3922
4025
|
f.authenticated !== void 0 && (this.authenticated = f.authenticated), f.userId !== void 0 && (this.userId = f.userId), f.address !== void 0 && (this.address = f.address), f.activeWalletIndex !== void 0 && (this.activeWalletIndex = f.activeWalletIndex), f.userEmail !== void 0 && (this.userEmail = f.userEmail), f.providerSub !== void 0 && (this.providerSub = f.providerSub), f.loginType !== void 0 && (this.loginType = f.loginType), f.tokenSignatureVerified !== void 0 && (this.tokenSignatureVerified = f.tokenSignatureVerified);
|
|
3923
4026
|
},
|
|
@@ -3938,51 +4041,51 @@ const U = class U extends Dr {
|
|
|
3938
4041
|
walletPreferenceKey: U.WALLET_PREF_KEY,
|
|
3939
4042
|
storage: this.storage,
|
|
3940
4043
|
pinStore: this.pinStore
|
|
3941
|
-
}), this.pinOrchestrator = new
|
|
4044
|
+
}), this.pinOrchestrator = new H({
|
|
3942
4045
|
confirmation: this.confirmation,
|
|
3943
4046
|
walletProvider: this.walletProvider,
|
|
3944
4047
|
pinStore: this.pinStore,
|
|
3945
4048
|
getLocale: () => this._config.locale,
|
|
3946
4049
|
getUserEmail: () => this.userEmail,
|
|
3947
|
-
maskEmail:
|
|
4050
|
+
maskEmail: ke,
|
|
3948
4051
|
signInAgain: () => this.signInAgain(),
|
|
3949
4052
|
// §12 native sign delegation: bridge 자동 로그인 세션이면 JS PIN 단계를 스킵한다.
|
|
3950
4053
|
// dApp 이 sdk.pinOrchestrator.ensureVerifiedPin() 을 직접 호출해도 (SigningOrchestrator 우회)
|
|
3951
4054
|
// WebView 안에서 embedded PIN 프롬프트가 뜨지 않도록 게이팅. SigningOrchestrator 와 동일 신호.
|
|
3952
4055
|
isRNBridgeMode: () => this._isAuthenticatedViaRNBridge,
|
|
3953
4056
|
getPinReusePolicy: () => this.internalConfig.pinReuse
|
|
3954
|
-
}), this.signingOrchestrator = new
|
|
4057
|
+
}), this.signingOrchestrator = new zr({
|
|
3955
4058
|
confirmation: this.confirmation,
|
|
3956
4059
|
walletProvider: this.walletProvider,
|
|
3957
4060
|
pinOrchestrator: this.pinOrchestrator,
|
|
3958
4061
|
// §12 native sign delegation: 이 SDK 세션이 RN bridge 자동 로그인으로 인증된 경우만 활성.
|
|
3959
4062
|
// 자동 로그인 거부 / OAuth 로 별도 로그인한 세션에서는 native SDK 가 미인증이라 우회한다.
|
|
3960
4063
|
isRNBridgeMode: () => this._isAuthenticatedViaRNBridge
|
|
3961
|
-
}), this.walletLifecycleService = new
|
|
4064
|
+
}), this.walletLifecycleService = new Zr({
|
|
3962
4065
|
walletProvider: this.walletProvider,
|
|
3963
4066
|
pinOrchestrator: this.pinOrchestrator,
|
|
3964
4067
|
getUserId: () => this.userId,
|
|
3965
4068
|
setActiveWallet: (f, E, T) => this.setActiveWallet(f, E, T)
|
|
3966
|
-
}), this.migrationOrchestrator = new
|
|
4069
|
+
}), this.migrationOrchestrator = new Qr({
|
|
3967
4070
|
confirmation: this.confirmation,
|
|
3968
4071
|
walletProvider: this.walletProvider,
|
|
3969
4072
|
pinOrchestrator: this.pinOrchestrator,
|
|
3970
4073
|
executeMigrate: (f, E) => this.migrateWalletUseCase.execute(f, E),
|
|
3971
4074
|
getLocale: () => this._config.locale,
|
|
3972
4075
|
getUserEmail: () => this.userEmail,
|
|
3973
|
-
maskEmail:
|
|
4076
|
+
maskEmail: ke,
|
|
3974
4077
|
signInAgain: () => this.signInAgain(),
|
|
3975
4078
|
clearAuthState: () => this.clearAuthState(),
|
|
3976
4079
|
getAllowSkip: () => {
|
|
3977
4080
|
var f;
|
|
3978
4081
|
return ((f = this._config.migration) == null ? void 0 : f.allowSkip) ?? !0;
|
|
3979
4082
|
}
|
|
3980
|
-
}), this.transactionLifecycleService = new
|
|
4083
|
+
}), this.transactionLifecycleService = new ei({
|
|
3981
4084
|
getActiveAddress: () => this.address,
|
|
3982
4085
|
estimateGas: (f, E) => this.estimateGas(f, E),
|
|
3983
4086
|
getBaseFeePerGas: (f) => this.getBaseFeePerGas(f),
|
|
3984
4087
|
jsonRpcCall: (f, E, T) => this.jsonRpc.call(f, E, T)
|
|
3985
|
-
}), this.signatureVerifier = new
|
|
4088
|
+
}), this.signatureVerifier = new ti(this.crypto), this.addressResolverService = new ii({
|
|
3986
4089
|
walletProvider: this.walletProvider,
|
|
3987
4090
|
pinOrchestrator: this.pinOrchestrator,
|
|
3988
4091
|
getActiveAddress: () => this.address,
|
|
@@ -3990,10 +4093,10 @@ const U = class U extends Dr {
|
|
|
3990
4093
|
getUserId: () => this.userId,
|
|
3991
4094
|
// one-wallet: 지갑은 처음 쓸 때 만든다 (DEV2TF-2755)
|
|
3992
4095
|
ensureWallet: this.usesOneWallet ? () => this.walletCreationService.createWallet().then((f) => f.address) : void 0
|
|
3993
|
-
}), this.authGuardService = new
|
|
4096
|
+
}), this.authGuardService = new ni({
|
|
3994
4097
|
isInitialized: () => this.initialized,
|
|
3995
4098
|
isAuthenticated: () => this.authenticated
|
|
3996
|
-
}), this.walletCreationService = new
|
|
4099
|
+
}), this.walletCreationService = new ai({
|
|
3997
4100
|
walletProvider: this.walletProvider,
|
|
3998
4101
|
pinOrchestrator: this.pinOrchestrator,
|
|
3999
4102
|
migrationOrchestrator: this.migrationOrchestrator,
|
|
@@ -4005,10 +4108,10 @@ const U = class U extends Dr {
|
|
|
4005
4108
|
var f, E;
|
|
4006
4109
|
return ((E = (f = this.confirmation).showWalletCreatedPrompt) == null ? void 0 : E.call(f)) ?? Promise.resolve();
|
|
4007
4110
|
}
|
|
4008
|
-
}), this.tokenHistoryService = new
|
|
4111
|
+
}), this.tokenHistoryService = new oi({
|
|
4009
4112
|
transport: n,
|
|
4010
4113
|
getApiBaseUrl: () => this.internalConfig.authApiUrl
|
|
4011
|
-
}), this.sessionOrchestrator = new
|
|
4114
|
+
}), this.sessionOrchestrator = new Xr({
|
|
4012
4115
|
ensureInitialized: () => this.ensureInitialized(),
|
|
4013
4116
|
getSessionSnapshot: () => ({
|
|
4014
4117
|
providerSub: this.providerSub,
|
|
@@ -4030,8 +4133,8 @@ const U = class U extends Dr {
|
|
|
4030
4133
|
applyAuthResult: (f) => this.applyAuthResult(f),
|
|
4031
4134
|
loadWalletAfterAuth: () => this.walletLifecycleService.loadWalletAfterAuth(),
|
|
4032
4135
|
getLocale: () => this._config.locale,
|
|
4033
|
-
maskEmail:
|
|
4034
|
-
}), this.chainRegistry = u, this.jsonRpc = new
|
|
4136
|
+
maskEmail: ke
|
|
4137
|
+
}), this.chainRegistry = u, this.jsonRpc = new Dr(u, n), this.signInUseCase = new Ue(
|
|
4035
4138
|
this.internalConfig,
|
|
4036
4139
|
s,
|
|
4037
4140
|
r,
|
|
@@ -4041,12 +4144,12 @@ const U = class U extends Dr {
|
|
|
4041
4144
|
d,
|
|
4042
4145
|
void 0,
|
|
4043
4146
|
() => this._config.locale
|
|
4044
|
-
), this.signOutUseCase = new
|
|
4147
|
+
), this.signOutUseCase = new Is(
|
|
4045
4148
|
this.internalConfig,
|
|
4046
4149
|
s,
|
|
4047
4150
|
d,
|
|
4048
4151
|
this._config.persistWalletPreference !== !1 ? [U.WALLET_PREF_KEY] : []
|
|
4049
|
-
), this.migrateWalletUseCase = new
|
|
4152
|
+
), this.migrateWalletUseCase = new ms(s, c), (w = c.setOnUnauthorized) == null || w.call(c, () => this.forceLogout()), (m = c.setTokenRefresher) == null || m.call(
|
|
4050
4153
|
c,
|
|
4051
4154
|
() => this.signInUseCase.refreshAccessToken()
|
|
4052
4155
|
), e.autoDetectTheme && this._setupAutoDetectTheme();
|
|
@@ -4136,12 +4239,12 @@ const U = class U extends Dr {
|
|
|
4136
4239
|
}
|
|
4137
4240
|
async _doInitialize(e) {
|
|
4138
4241
|
var t, s;
|
|
4139
|
-
l.log("[CROSSx SDK] v3.0.0-beta.
|
|
4242
|
+
l.log("[CROSSx SDK] v3.0.0-beta.9 초기화 중..."), this.confirmation.setMessages(W(this._config.locale));
|
|
4140
4243
|
try {
|
|
4141
4244
|
const r = ce();
|
|
4142
4245
|
if (this.internalConfig.oauthServiceUrl = r.oauthServiceUrl, this.internalConfig.legacyOauthServiceUrl = r.legacyOauthServiceUrl, this.internalConfig.authApiUrl = r.authApiUrl, this.internalConfig.walletGatewayUrl = r.walletGatewayUrl, this.adapterConfig.gatewayUrl = r.walletGatewayUrl, (s = (t = this.crypto).setJWKSEndpoint) == null || s.call(t, `${r.authApiUrl}/.well-known/jwks.json`), this.usesOneWallet) {
|
|
4143
4246
|
const g = await this.restoreOneWalletSession();
|
|
4144
|
-
return this.initialized = !0, l.info("[CROSSx SDK] v3.0.0-beta.
|
|
4247
|
+
return this.initialized = !0, l.info("[CROSSx SDK] v3.0.0-beta.9 초기화 완료 (one-wallet)"), this.emit("initialized", { restored: !!(g != null && g.success) }), g;
|
|
4145
4248
|
}
|
|
4146
4249
|
const n = this._config.persistWalletPreference !== !1 ? await this.storage.get(
|
|
4147
4250
|
U.WALLET_PREF_KEY
|
|
@@ -4175,7 +4278,7 @@ const U = class U extends Dr {
|
|
|
4175
4278
|
throw _;
|
|
4176
4279
|
}
|
|
4177
4280
|
}
|
|
4178
|
-
return this.initialized = !0, l.info("[CROSSx SDK] v3.0.0-beta.
|
|
4281
|
+
return this.initialized = !0, l.info("[CROSSx SDK] v3.0.0-beta.9 초기화 완료"), this.emit("initialized", { restored: !!(d != null && d.success) }), d ?? null;
|
|
4179
4282
|
} catch (r) {
|
|
4180
4283
|
throw new h(o.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", r);
|
|
4181
4284
|
}
|
|
@@ -4195,7 +4298,7 @@ const U = class U extends Dr {
|
|
|
4195
4298
|
l.log("[CROSSx] RN Bridge 감지 — Handshake 시도"), l.info("[CROSSx][RNBridge trace] Bootstrap config", {
|
|
4196
4299
|
appId: this._config.projectId,
|
|
4197
4300
|
appVersion: "1.0.0",
|
|
4198
|
-
sdkVersion: "3.0.0-beta.
|
|
4301
|
+
sdkVersion: "3.0.0-beta.9",
|
|
4199
4302
|
keyId: "key-id-1",
|
|
4200
4303
|
userIdHash: "user-hash-placeholder",
|
|
4201
4304
|
projectId: this._config.projectId
|
|
@@ -4203,7 +4306,7 @@ const U = class U extends Dr {
|
|
|
4203
4306
|
const e = new b({
|
|
4204
4307
|
appId: this._config.projectId,
|
|
4205
4308
|
appVersion: "1.0.0",
|
|
4206
|
-
sdkVersion: "3.0.0-beta.
|
|
4309
|
+
sdkVersion: "3.0.0-beta.9",
|
|
4207
4310
|
keyId: "key-id-1",
|
|
4208
4311
|
userIdHash: "user-hash-placeholder",
|
|
4209
4312
|
projectId: this._config.projectId
|
|
@@ -4349,7 +4452,7 @@ const U = class U extends Dr {
|
|
|
4349
4452
|
let s = e;
|
|
4350
4453
|
if (!(e != null && e.provider)) {
|
|
4351
4454
|
const r = await this.confirmation.showLoginSelector({
|
|
4352
|
-
connectOtherWallets:
|
|
4455
|
+
connectOtherWallets: hs(this._config)
|
|
4353
4456
|
});
|
|
4354
4457
|
if (r === null)
|
|
4355
4458
|
return { success: !1, error: "User cancelled login" };
|
|
@@ -4578,7 +4681,7 @@ const U = class U extends Dr {
|
|
|
4578
4681
|
* @throws `ORIGIN_NOT_ALLOWED` 지갑 서버가 아닌 주소, 그 밖은 {@link getOneIdAccessToken}과 같음
|
|
4579
4682
|
*/
|
|
4580
4683
|
async getOneIdAuthorizationHeaders(e) {
|
|
4581
|
-
if (!
|
|
4684
|
+
if (!ci(e.url))
|
|
4582
4685
|
throw new h(o.ORIGIN_NOT_ALLOWED, "authorization headers are only issued for the one-wallet-api origin");
|
|
4583
4686
|
const t = this.usesOneWallet && this._initPromise ? this.oneIdContextUnchecked() : this.oneIdContext();
|
|
4584
4687
|
try {
|
|
@@ -4593,7 +4696,7 @@ const U = class U extends Dr {
|
|
|
4593
4696
|
*/
|
|
4594
4697
|
async signOutOneId() {
|
|
4595
4698
|
const { sessions: e } = this.oneIdContext();
|
|
4596
|
-
this.walletProvider instanceof
|
|
4699
|
+
this.walletProvider instanceof Fe && await this.walletProvider.signOut().catch((t) => l.warn("[CROSSx] B 키 폐기 실패 (로그아웃은 진행)", t));
|
|
4597
4700
|
try {
|
|
4598
4701
|
await e.signOut();
|
|
4599
4702
|
} finally {
|
|
@@ -4689,7 +4792,7 @@ const U = class U extends Dr {
|
|
|
4689
4792
|
);
|
|
4690
4793
|
const s = { issuer: t, clientId: e.clientId, scope: e.scope };
|
|
4691
4794
|
if (!this._oneIdSessions) {
|
|
4692
|
-
const r = new
|
|
4795
|
+
const r = new Ys(this.oneIdAuth, s, qs(e.storage));
|
|
4693
4796
|
this._oneIdSessions = this.oneIdSessionFactory ? this.oneIdSessionFactory({ port: this.oneIdAuth, config: s, fallback: r }) : r;
|
|
4694
4797
|
}
|
|
4695
4798
|
return { port: this.oneIdAuth, config: s, sessions: this._oneIdSessions };
|
|
@@ -5003,7 +5106,7 @@ const U = class U extends Dr {
|
|
|
5003
5106
|
const s = this.walletProvider;
|
|
5004
5107
|
if (typeof s.setAddressNames != "function")
|
|
5005
5108
|
throw new h(o.WALLET_OPERATION_UNSUPPORTED, "이 지갑 서버는 지갑 이름 변경을 지원하지 않습니다");
|
|
5006
|
-
const r =
|
|
5109
|
+
const r = Gr(t);
|
|
5007
5110
|
if (r === null)
|
|
5008
5111
|
throw new h(o.WALLET_NAME_INVALID, "지갑 이름 규칙에 맞지 않습니다");
|
|
5009
5112
|
const a = (await this.withSessionRecovery(() => s.getAddresses(this.userId))).find((c) => c.address.toLowerCase() === e.toLowerCase());
|
|
@@ -5122,7 +5225,7 @@ const U = class U extends Dr {
|
|
|
5122
5225
|
* sdk.applyLocale('ko');
|
|
5123
5226
|
*/
|
|
5124
5227
|
applyLocale(e = this._config.locale ?? "en") {
|
|
5125
|
-
this._config = Object.freeze({ ...this._config, locale: e }), this.confirmation.setMessages(
|
|
5228
|
+
this._config = Object.freeze({ ...this._config, locale: e }), this.confirmation.setMessages(W(e));
|
|
5126
5229
|
}
|
|
5127
5230
|
/**
|
|
5128
5231
|
* PIN 입력 모달의 키보드 방식을 런타임에 변경합니다.
|
|
@@ -5150,10 +5253,10 @@ const U = class U extends Dr {
|
|
|
5150
5253
|
* 상황은 정상적으로 발생하므로, 조용히 넘어가지 않고 체인당 한 번 경고한다.
|
|
5151
5254
|
*/
|
|
5152
5255
|
resolveNativeCurrency(e) {
|
|
5153
|
-
const t =
|
|
5256
|
+
const t = ps(e, this._config.nativeCurrencies);
|
|
5154
5257
|
return t || (this._warnedUnknownNativeCurrency.has(e) || (this._warnedUnknownNativeCurrency.add(e), console.warn(
|
|
5155
5258
|
`[CROSSx SDK] ${e} 의 native 통화 정보가 없어 심볼을 비우고 decimals 를 18 로 가정합니다. 컨펌 모달 금액이 단위 없이 표시되며, decimals 가 18 이 아니면 금액이 틀립니다. SDKConfig.nativeCurrencies 에 { '${e}': { symbol, decimals } } 를 넘겨 주세요.`
|
|
5156
|
-
)),
|
|
5259
|
+
)), fs);
|
|
5157
5260
|
}
|
|
5158
5261
|
/**
|
|
5159
5262
|
* 지갑 생성/로드 (로그인 후 address가 없는 경우)
|
|
@@ -5193,8 +5296,8 @@ const U = class U extends Dr {
|
|
|
5193
5296
|
});
|
|
5194
5297
|
return { chainId: e, signature: c.signature, message: t, address: this.address ?? "" };
|
|
5195
5298
|
} catch (c) {
|
|
5196
|
-
if (!
|
|
5197
|
-
throw
|
|
5299
|
+
if (!Nt(c))
|
|
5300
|
+
throw z(c, o.SIGNATURE_FAILED);
|
|
5198
5301
|
await this.clearRNBridgeDelegation("native signMessage 가 ERR_BRIDGE_NOT_AUTHORIZED 로 거부"), l.warn("[CROSSx] Bridge 미인증 — 일반 서명 경로로 폴백 (signMessage)");
|
|
5199
5302
|
}
|
|
5200
5303
|
if (this.ensureAuthenticated(), !this.userId)
|
|
@@ -5265,7 +5368,7 @@ const U = class U extends Dr {
|
|
|
5265
5368
|
throw new h(o.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
5266
5369
|
if (!this.walletProvider.signTypedData)
|
|
5267
5370
|
throw new h(o.NOT_IMPLEMENTED, "signTypedData가 구현되어 있지 않습니다");
|
|
5268
|
-
|
|
5371
|
+
Wr(e, t);
|
|
5269
5372
|
const r = await this.resolveAddress(s == null ? void 0 : s.index);
|
|
5270
5373
|
try {
|
|
5271
5374
|
const n = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
|
|
@@ -5289,7 +5392,7 @@ const U = class U extends Dr {
|
|
|
5289
5392
|
r.address
|
|
5290
5393
|
)
|
|
5291
5394
|
});
|
|
5292
|
-
return
|
|
5395
|
+
return Ur(n.signature), {
|
|
5293
5396
|
chainId: e,
|
|
5294
5397
|
signature: n.signature,
|
|
5295
5398
|
address: r.address
|
|
@@ -5367,7 +5470,7 @@ const U = class U extends Dr {
|
|
|
5367
5470
|
c
|
|
5368
5471
|
)
|
|
5369
5472
|
});
|
|
5370
|
-
return
|
|
5473
|
+
return br(a.signature), {
|
|
5371
5474
|
chainId: e,
|
|
5372
5475
|
signedTx: a.signature,
|
|
5373
5476
|
txHash: a.txHash ?? ""
|
|
@@ -5468,7 +5571,7 @@ const U = class U extends Dr {
|
|
|
5468
5571
|
* @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
|
|
5469
5572
|
*/
|
|
5470
5573
|
async waitForTxAndGetReceipt(e, t, s = {}) {
|
|
5471
|
-
const r = s.intervalMs ??
|
|
5574
|
+
const r = s.intervalMs ?? Zt, n = Qt, a = s.timeoutMs ?? Je, c = Date.now() + a;
|
|
5472
5575
|
let d = r;
|
|
5473
5576
|
for (; Date.now() < c; ) {
|
|
5474
5577
|
const g = await this.getTransactionReceipt(e, t);
|
|
@@ -5502,19 +5605,19 @@ const U = class U extends Dr {
|
|
|
5502
5605
|
if (f != null && f.sendTransactionWithWaitForReceipt)
|
|
5503
5606
|
return this.bridgeSendTransactionWithWaitForReceipt(f, e, t, s);
|
|
5504
5607
|
}
|
|
5505
|
-
const { intervalMs: r, timeoutMs: n, ...a } = s, { txHash: c } = await this.sendTransaction(e, t, a), d = r ?? ((w = this._config.receiptPolling) == null ? void 0 : w.intervalMs) ??
|
|
5608
|
+
const { intervalMs: r, timeoutMs: n, ...a } = s, { txHash: c } = await this.sendTransaction(e, t, a), d = r ?? ((w = this._config.receiptPolling) == null ? void 0 : w.intervalMs) ?? Xt, g = n ?? ((m = this._config.receiptPolling) == null ? void 0 : m.timeoutMs) ?? Je, u = this.resolveNativeCurrency(e), _ = t.from ?? "";
|
|
5506
5609
|
let p, A;
|
|
5507
5610
|
const S = this.waitForTxAndGetReceipt(c, e, { intervalMs: d, timeoutMs: g }).then((f) => {
|
|
5508
5611
|
p = f;
|
|
5509
|
-
const E = BigInt(f.gasUsed) * BigInt(f.effectiveGasPrice), T = t.value ? BigInt(t.value) : 0n, y = ue(t.value, u.symbol, u.decimals, this._config.displayDecimals),
|
|
5612
|
+
const E = BigInt(f.gasUsed) * BigInt(f.effectiveGasPrice), T = t.value ? BigInt(t.value) : 0n, y = ue(t.value, u.symbol, u.decimals, this._config.displayDecimals), N = ue("0x" + E.toString(16), u.symbol, u.decimals, this._config.displayDecimals), R = ue("0x" + (T + E).toString(16), u.symbol, u.decimals, this._config.displayDecimals);
|
|
5510
5613
|
return {
|
|
5511
5614
|
chainId: e,
|
|
5512
5615
|
txHash: c,
|
|
5513
5616
|
from: f.from,
|
|
5514
5617
|
to: f.to ?? t.to,
|
|
5515
5618
|
amount: y,
|
|
5516
|
-
fees:
|
|
5517
|
-
total:
|
|
5619
|
+
fees: N,
|
|
5620
|
+
total: R,
|
|
5518
5621
|
nativeSymbol: u.symbol,
|
|
5519
5622
|
status: f.status === "0x1" ? "success" : "reverted"
|
|
5520
5623
|
};
|
|
@@ -5560,7 +5663,7 @@ const U = class U extends Dr {
|
|
|
5560
5663
|
pollIntervalMs: r.intervalMs
|
|
5561
5664
|
});
|
|
5562
5665
|
} catch (a) {
|
|
5563
|
-
throw
|
|
5666
|
+
throw z(a, o.TRANSACTION_FAILED);
|
|
5564
5667
|
}
|
|
5565
5668
|
return {
|
|
5566
5669
|
chainId: t,
|
|
@@ -5627,6 +5730,17 @@ const U = class U extends Dr {
|
|
|
5627
5730
|
isPinRequired() {
|
|
5628
5731
|
return !this.pinStore.has();
|
|
5629
5732
|
}
|
|
5733
|
+
/**
|
|
5734
|
+
* PIN 변경 화면을 띄워 PIN 을 바꿉니다 (GASPQA-6804). 현재 PIN 확인 → 새 PIN 설정 · 재입력 → 지갑 서버 변경.
|
|
5735
|
+
* PIN 을 인자로 받지 않으므로 보안 화면(대리 SDK)으로 내보내도 서비스 페이지가 PIN 을 보지 못합니다.
|
|
5736
|
+
* 지금은 one-wallet 지갑 서버에서만 됩니다.
|
|
5737
|
+
*
|
|
5738
|
+
* @throws `PIN_CANCELLED` 사용자가 닫음(일시 잠금 안내를 보고 닫은 경우 포함) · `PIN_LOCKED` 영구 잠금 또는 변경 단계 잠금 ·
|
|
5739
|
+
* `WALLET_OPERATION_UNSUPPORTED` 2.x 게이트웨이 · RN 브리지
|
|
5740
|
+
*/
|
|
5741
|
+
async changePinWithPrompt() {
|
|
5742
|
+
this.ensureAuthenticated(), await this.pinOrchestrator.changePinWithPrompt();
|
|
5743
|
+
}
|
|
5630
5744
|
/**
|
|
5631
5745
|
* PIN을 변경합니다.
|
|
5632
5746
|
*
|
|
@@ -5639,6 +5753,8 @@ const U = class U extends Dr {
|
|
|
5639
5753
|
async changePin(e, t) {
|
|
5640
5754
|
this.ensureAuthenticated();
|
|
5641
5755
|
const s = this.walletProvider;
|
|
5756
|
+
if (typeof s.checkPinForChange == "function")
|
|
5757
|
+
throw new h(o.WALLET_OPERATION_UNSUPPORTED, "changePinWithPrompt() 를 쓰세요");
|
|
5642
5758
|
if (typeof s.changePin != "function")
|
|
5643
5759
|
throw new h(o.NOT_IMPLEMENTED, "changePin이 구현되어 있지 않습니다");
|
|
5644
5760
|
this.pinStore.set(e);
|
|
@@ -5763,7 +5879,7 @@ const U = class U extends Dr {
|
|
|
5763
5879
|
return { wei: "0x0", formatted: "0", chainId: e };
|
|
5764
5880
|
try {
|
|
5765
5881
|
const r = await this.jsonRpc.call("eth_getBalance", [t, "latest"], e) ?? "0x0";
|
|
5766
|
-
return { wei: r, formatted:
|
|
5882
|
+
return { wei: r, formatted: Lr(r, this._config.displayDecimals), chainId: e };
|
|
5767
5883
|
} catch (s) {
|
|
5768
5884
|
if (s instanceof h) throw s;
|
|
5769
5885
|
const r = s instanceof Error ? s.message : String(s);
|
|
@@ -5791,7 +5907,7 @@ const U = class U extends Dr {
|
|
|
5791
5907
|
getProvider(e) {
|
|
5792
5908
|
this.ensureAuthenticated();
|
|
5793
5909
|
let t = this._providers.get(e);
|
|
5794
|
-
return t || (t = new
|
|
5910
|
+
return t || (t = new ws(this, e), this._providers.set(e, t)), t;
|
|
5795
5911
|
}
|
|
5796
5912
|
/**
|
|
5797
5913
|
* EIP-1193 `accountsChanged` 이벤트를 모든 활성 provider 인스턴스에 dispatch 한다.
|
|
@@ -5894,7 +6010,7 @@ const U = class U extends Dr {
|
|
|
5894
6010
|
}
|
|
5895
6011
|
/** 인증 상태를 초기화합니다. */
|
|
5896
6012
|
clearAuthState() {
|
|
5897
|
-
this.stateManager.clearAuthState(), this.walletProvider instanceof
|
|
6013
|
+
this.stateManager.clearAuthState(), this.walletProvider instanceof Fe && this.walletProvider.forgetSession(), this._isAuthenticatedViaRNBridge = !1;
|
|
5898
6014
|
}
|
|
5899
6015
|
/**
|
|
5900
6016
|
* Gateway -10002(Unauthorized) / -10033(User not found) 수신 시 강제 로그아웃.
|
|
@@ -6012,12 +6128,12 @@ const U = class U extends Dr {
|
|
|
6012
6128
|
*/
|
|
6013
6129
|
dispose() {
|
|
6014
6130
|
var e;
|
|
6015
|
-
(e = this._themeMediaCleanup) == null || e.call(this), this._themeMediaCleanup = null, this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(),
|
|
6131
|
+
(e = this._themeMediaCleanup) == null || e.call(this), this._themeMediaCleanup = null, this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), rt(null);
|
|
6016
6132
|
}
|
|
6017
6133
|
};
|
|
6018
6134
|
U.WALLET_PREF_KEY = "wallet_preference", U.OFFCHAIN_CHAIN_ID = "0";
|
|
6019
|
-
let
|
|
6020
|
-
class
|
|
6135
|
+
let Be = U;
|
|
6136
|
+
class li {
|
|
6021
6137
|
constructor() {
|
|
6022
6138
|
this.prefix = "crossx_";
|
|
6023
6139
|
}
|
|
@@ -6054,8 +6170,8 @@ class ci {
|
|
|
6054
6170
|
}
|
|
6055
6171
|
}
|
|
6056
6172
|
}
|
|
6057
|
-
const ge = "crossx-sdk",
|
|
6058
|
-
class
|
|
6173
|
+
const ge = "crossx-sdk", St = 1, v = "data", B = "keys", _e = "aes-primary", hi = 12;
|
|
6174
|
+
class Et {
|
|
6059
6175
|
constructor(e) {
|
|
6060
6176
|
this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
|
|
6061
6177
|
}
|
|
@@ -6064,7 +6180,7 @@ class St {
|
|
|
6064
6180
|
}
|
|
6065
6181
|
openDB() {
|
|
6066
6182
|
return new Promise((e, t) => {
|
|
6067
|
-
const s = indexedDB.open(this.dbName,
|
|
6183
|
+
const s = indexedDB.open(this.dbName, St);
|
|
6068
6184
|
s.onupgradeneeded = () => {
|
|
6069
6185
|
const r = s.result;
|
|
6070
6186
|
r.objectStoreNames.contains(v) || r.createObjectStore(v), r.objectStoreNames.contains(B) || r.createObjectStore(B);
|
|
@@ -6082,7 +6198,7 @@ class St {
|
|
|
6082
6198
|
openLegacyIfExists() {
|
|
6083
6199
|
return new Promise((e, t) => {
|
|
6084
6200
|
let s = !1;
|
|
6085
|
-
const r = indexedDB.open(ge,
|
|
6201
|
+
const r = indexedDB.open(ge, St);
|
|
6086
6202
|
r.onupgradeneeded = () => {
|
|
6087
6203
|
s = !0;
|
|
6088
6204
|
}, r.onsuccess = () => {
|
|
@@ -6189,7 +6305,7 @@ class St {
|
|
|
6189
6305
|
}
|
|
6190
6306
|
}
|
|
6191
6307
|
async encrypt(e) {
|
|
6192
|
-
const t = new Uint8Array(
|
|
6308
|
+
const t = new Uint8Array(hi);
|
|
6193
6309
|
crypto.getRandomValues(t);
|
|
6194
6310
|
const s = new TextEncoder().encode(e), r = await crypto.subtle.encrypt(
|
|
6195
6311
|
{ name: "AES-GCM", iv: t },
|
|
@@ -6247,14 +6363,14 @@ class St {
|
|
|
6247
6363
|
return typeof indexedDB < "u" && typeof crypto < "u" && typeof crypto.subtle < "u";
|
|
6248
6364
|
}
|
|
6249
6365
|
}
|
|
6250
|
-
const
|
|
6251
|
-
class
|
|
6366
|
+
const di = 60;
|
|
6367
|
+
class ui {
|
|
6252
6368
|
constructor() {
|
|
6253
6369
|
this.jwks = null;
|
|
6254
6370
|
}
|
|
6255
6371
|
setJWKSEndpoint(e) {
|
|
6256
6372
|
try {
|
|
6257
|
-
this.jwks =
|
|
6373
|
+
this.jwks = Yt(new URL(e)), l.log("[CROSSx] JWKS 엔드포인트 설정:", e);
|
|
6258
6374
|
} catch (t) {
|
|
6259
6375
|
l.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", t);
|
|
6260
6376
|
}
|
|
@@ -6268,7 +6384,7 @@ class di {
|
|
|
6268
6384
|
iat: s.iat
|
|
6269
6385
|
});
|
|
6270
6386
|
const r = Math.floor(Date.now() / 1e3);
|
|
6271
|
-
if (s.exp && s.exp +
|
|
6387
|
+
if (s.exp && s.exp + di < r)
|
|
6272
6388
|
return l.warn("[CROSSx] 토큰 만료:", {
|
|
6273
6389
|
exp: s.exp,
|
|
6274
6390
|
now: r,
|
|
@@ -6278,7 +6394,7 @@ class di {
|
|
|
6278
6394
|
return l.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: s, valid: !1, signatureVerified: !1 };
|
|
6279
6395
|
if (this.jwks)
|
|
6280
6396
|
try {
|
|
6281
|
-
const { payload: n } = await
|
|
6397
|
+
const { payload: n } = await qt(e, this.jwks, {
|
|
6282
6398
|
algorithms: ["RS256", "ES256"]
|
|
6283
6399
|
});
|
|
6284
6400
|
return l.log("[CROSSx] JWT 서명 검증 성공"), {
|
|
@@ -6297,7 +6413,7 @@ class di {
|
|
|
6297
6413
|
}
|
|
6298
6414
|
}
|
|
6299
6415
|
decodeJWT(e) {
|
|
6300
|
-
return
|
|
6416
|
+
return jt(e);
|
|
6301
6417
|
}
|
|
6302
6418
|
/**
|
|
6303
6419
|
* EIP-191 personal_sign 서명에서 서명자 Ethereum 주소를 복원합니다.
|
|
@@ -6312,29 +6428,29 @@ class di {
|
|
|
6312
6428
|
${s.length}`
|
|
6313
6429
|
), n = new Uint8Array(r.length + s.length);
|
|
6314
6430
|
n.set(r, 0), n.set(s, r.length);
|
|
6315
|
-
const a =
|
|
6431
|
+
const a = ze(n), c = t.startsWith("0x") ? t.slice(2) : t;
|
|
6316
6432
|
if (c.length !== 130)
|
|
6317
6433
|
throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${c.length}`);
|
|
6318
|
-
const d =
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
).addRecoveryBit(p).recoverPublicKey(a).toBytes(!1).slice(1), m =
|
|
6322
|
-
return "0x" +
|
|
6434
|
+
const d = gi(c), g = d.slice(0, 32), u = d.slice(32, 64), _ = d[64], p = _ >= 27 ? _ - 27 : _, w = new zt.Signature(
|
|
6435
|
+
At(g),
|
|
6436
|
+
At(u)
|
|
6437
|
+
).addRecoveryBit(p).recoverPublicKey(a).toBytes(!1).slice(1), m = ze(w);
|
|
6438
|
+
return "0x" + Jt(m.slice(12));
|
|
6323
6439
|
}
|
|
6324
6440
|
}
|
|
6325
|
-
function
|
|
6441
|
+
function gi(i) {
|
|
6326
6442
|
const e = new Uint8Array(i.length / 2);
|
|
6327
6443
|
for (let t = 0; t < e.length; t++)
|
|
6328
6444
|
e[t] = parseInt(i.substring(t * 2, t * 2 + 2), 16);
|
|
6329
6445
|
return e;
|
|
6330
6446
|
}
|
|
6331
|
-
function
|
|
6447
|
+
function At(i) {
|
|
6332
6448
|
let e = "0x";
|
|
6333
6449
|
for (const t of i) e += t.toString(16).padStart(2, "0");
|
|
6334
6450
|
return BigInt(e);
|
|
6335
6451
|
}
|
|
6336
|
-
const
|
|
6337
|
-
class
|
|
6452
|
+
const _i = 5e3;
|
|
6453
|
+
class fi {
|
|
6338
6454
|
constructor(e, t) {
|
|
6339
6455
|
this.cachedKey = null, this.cachedVersion = null, this.cachedAt = 0, this.keyInFlight = null, this.keyFailedAt = 0, this.required = !1, this.adapterConfig = e, this.transport = t;
|
|
6340
6456
|
}
|
|
@@ -6347,8 +6463,8 @@ class _i {
|
|
|
6347
6463
|
const t = this.required;
|
|
6348
6464
|
if (!t && this.hasFreshFailure()) return e;
|
|
6349
6465
|
try {
|
|
6350
|
-
const { version: s, key: r } = await this.currentKey(), n = await
|
|
6351
|
-
return `${s}.${
|
|
6466
|
+
const { version: s, key: r } = await this.currentKey(), n = await pi(r, e);
|
|
6467
|
+
return `${s}.${wi(n)}`;
|
|
6352
6468
|
} catch (s) {
|
|
6353
6469
|
if (t)
|
|
6354
6470
|
throw this.keyFailedAt = Date.now(), s instanceof h ? s : new h(
|
|
@@ -6358,7 +6474,7 @@ class _i {
|
|
|
6358
6474
|
);
|
|
6359
6475
|
return this.keyFailedAt = Date.now(), l.warn(
|
|
6360
6476
|
"[CROSSx] pin-key 조회 실패 — PIN 평문 전송을 유지합니다",
|
|
6361
|
-
`(${Math.round(
|
|
6477
|
+
`(${Math.round(st / 1e3)}초 후 재확인)`
|
|
6362
6478
|
), e;
|
|
6363
6479
|
}
|
|
6364
6480
|
}
|
|
@@ -6385,15 +6501,15 @@ class _i {
|
|
|
6385
6501
|
}
|
|
6386
6502
|
// ── 공개키 캐시 ─────────────────────────────────────────────────────────────
|
|
6387
6503
|
hasFreshFailure() {
|
|
6388
|
-
return this.keyFailedAt !== 0 && Date.now() - this.keyFailedAt <
|
|
6504
|
+
return this.keyFailedAt !== 0 && Date.now() - this.keyFailedAt < st;
|
|
6389
6505
|
}
|
|
6390
6506
|
async currentKey() {
|
|
6391
|
-
return this.cachedKey && this.cachedVersion && Date.now() - this.cachedAt <
|
|
6507
|
+
return this.cachedKey && this.cachedVersion && Date.now() - this.cachedAt < rs ? { version: this.cachedVersion, key: this.cachedKey } : this.keyInFlight ? this.keyInFlight : (this.keyInFlight = this.fetchAndImportKey().then((e) => (this.cachedVersion = e.version, this.cachedKey = e.key, this.cachedAt = Date.now(), this.keyFailedAt = 0, l.log("[CROSSx] PIN 공개키 캐시 완료 (keyVersion:", e.version, ")"), e)).finally(() => {
|
|
6392
6508
|
this.keyInFlight = null;
|
|
6393
6509
|
}), this.keyInFlight);
|
|
6394
6510
|
}
|
|
6395
6511
|
async fetchAndImportKey() {
|
|
6396
|
-
const e =
|
|
6512
|
+
const e = Gt();
|
|
6397
6513
|
if (!e)
|
|
6398
6514
|
throw new h(
|
|
6399
6515
|
o.PIN_ENCRYPTION_FAILED,
|
|
@@ -6403,16 +6519,16 @@ class _i {
|
|
|
6403
6519
|
url: `${this.baseUrl}/pin-key`,
|
|
6404
6520
|
method: "GET",
|
|
6405
6521
|
headers: { "X-Project-Id": this.adapterConfig.projectId },
|
|
6406
|
-
timeoutMs:
|
|
6407
|
-
}), s =
|
|
6522
|
+
timeoutMs: _i
|
|
6523
|
+
}), s = Ii(t.data);
|
|
6408
6524
|
if (!(s != null && s.keyVersion) || !(s != null && s.publicKey))
|
|
6409
6525
|
throw new h(
|
|
6410
6526
|
o.PIN_ENCRYPTION_FAILED,
|
|
6411
6527
|
"pin-key 응답을 해석할 수 없습니다."
|
|
6412
6528
|
);
|
|
6413
|
-
const r =
|
|
6529
|
+
const r = Ei(s.publicKey), n = await e.importKey(
|
|
6414
6530
|
"spki",
|
|
6415
|
-
|
|
6531
|
+
Ai(r),
|
|
6416
6532
|
{ name: "RSA-OAEP", hash: "SHA-256" },
|
|
6417
6533
|
!1,
|
|
6418
6534
|
["encrypt"]
|
|
@@ -6420,8 +6536,8 @@ class _i {
|
|
|
6420
6536
|
return { version: s.keyVersion, key: n };
|
|
6421
6537
|
}
|
|
6422
6538
|
}
|
|
6423
|
-
async function
|
|
6424
|
-
const t =
|
|
6539
|
+
async function pi(i, e) {
|
|
6540
|
+
const t = Gt();
|
|
6425
6541
|
if (!t)
|
|
6426
6542
|
throw new h(
|
|
6427
6543
|
o.PIN_ENCRYPTION_FAILED,
|
|
@@ -6434,15 +6550,15 @@ async function fi(i, e) {
|
|
|
6434
6550
|
);
|
|
6435
6551
|
return new Uint8Array(s);
|
|
6436
6552
|
}
|
|
6437
|
-
function
|
|
6553
|
+
function Gt() {
|
|
6438
6554
|
const i = globalThis.crypto;
|
|
6439
6555
|
return (i == null ? void 0 : i.subtle) ?? null;
|
|
6440
6556
|
}
|
|
6441
|
-
function
|
|
6442
|
-
return
|
|
6557
|
+
function wi(i) {
|
|
6558
|
+
return Si(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
6443
6559
|
}
|
|
6444
6560
|
const ie = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6445
|
-
function
|
|
6561
|
+
function Si(i) {
|
|
6446
6562
|
let e = "";
|
|
6447
6563
|
for (let t = 0; t < i.length; t += 3) {
|
|
6448
6564
|
const s = i[t], r = i[t + 1], n = i[t + 2];
|
|
@@ -6450,7 +6566,7 @@ function wi(i) {
|
|
|
6450
6566
|
}
|
|
6451
6567
|
return e;
|
|
6452
6568
|
}
|
|
6453
|
-
function
|
|
6569
|
+
function Ei(i) {
|
|
6454
6570
|
const e = i.replace(/-----BEGIN [A-Z ]+-----/g, "").replace(/-----END [A-Z ]+-----/g, "").replace(/\s+/g, "").replace(/-/g, "+").replace(/_/g, "/"), t = e.length % 4 === 0 ? e : e + "=".repeat(4 - e.length % 4), s = [];
|
|
6455
6571
|
for (let r = 0; r < t.length; r += 4) {
|
|
6456
6572
|
const n = [0, 1, 2, 3].map((a) => {
|
|
@@ -6468,11 +6584,11 @@ function Si(i) {
|
|
|
6468
6584
|
}
|
|
6469
6585
|
return new Uint8Array(s);
|
|
6470
6586
|
}
|
|
6471
|
-
function
|
|
6587
|
+
function Ai(i) {
|
|
6472
6588
|
const e = new Uint8Array(i.length);
|
|
6473
6589
|
return e.set(i), e.buffer;
|
|
6474
6590
|
}
|
|
6475
|
-
function
|
|
6591
|
+
function Ii(i) {
|
|
6476
6592
|
if (!i || typeof i != "object") return null;
|
|
6477
6593
|
const e = i;
|
|
6478
6594
|
if (typeof e.code == "number") {
|
|
@@ -6486,8 +6602,8 @@ function Ai(i) {
|
|
|
6486
6602
|
}
|
|
6487
6603
|
return typeof e.keyVersion == "string" && typeof e.publicKey == "string" ? e : null;
|
|
6488
6604
|
}
|
|
6489
|
-
const
|
|
6490
|
-
class
|
|
6605
|
+
const mi = 3e4, Ti = 1e3;
|
|
6606
|
+
class yi {
|
|
6491
6607
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6492
6608
|
async request(e) {
|
|
6493
6609
|
const t = e.retries ?? 0;
|
|
@@ -6498,7 +6614,7 @@ class Ti {
|
|
|
6498
6614
|
} catch (r) {
|
|
6499
6615
|
if (s === t) throw r;
|
|
6500
6616
|
}
|
|
6501
|
-
await new Promise((r) => setTimeout(r,
|
|
6617
|
+
await new Promise((r) => setTimeout(r, Ti * 2 ** s));
|
|
6502
6618
|
}
|
|
6503
6619
|
throw new Error("Unexpected: retry loop exited without result");
|
|
6504
6620
|
}
|
|
@@ -6506,7 +6622,7 @@ class Ti {
|
|
|
6506
6622
|
async _doRequest(e) {
|
|
6507
6623
|
const t = new AbortController(), s = setTimeout(
|
|
6508
6624
|
() => t.abort(),
|
|
6509
|
-
e.timeoutMs ??
|
|
6625
|
+
e.timeoutMs ?? mi
|
|
6510
6626
|
);
|
|
6511
6627
|
try {
|
|
6512
6628
|
const r = await fetch(e.url, {
|
|
@@ -6533,7 +6649,7 @@ class Ti {
|
|
|
6533
6649
|
}
|
|
6534
6650
|
}
|
|
6535
6651
|
}
|
|
6536
|
-
function
|
|
6652
|
+
function Ni(i) {
|
|
6537
6653
|
const e = { raw: i }, t = i.search(/(^|;)\s*info=/i), s = t >= 0 ? i.slice(0, t) : i;
|
|
6538
6654
|
if (t >= 0) {
|
|
6539
6655
|
const r = i.slice(t).replace(/^;?\s*info=/i, "").trim();
|
|
@@ -6548,7 +6664,7 @@ function yi(i) {
|
|
|
6548
6664
|
}
|
|
6549
6665
|
return e;
|
|
6550
6666
|
}
|
|
6551
|
-
function
|
|
6667
|
+
function It(i) {
|
|
6552
6668
|
try {
|
|
6553
6669
|
return new URL(i).origin;
|
|
6554
6670
|
} catch {
|
|
@@ -6564,52 +6680,52 @@ class Ri {
|
|
|
6564
6680
|
if (!this.isGateway(e.url))
|
|
6565
6681
|
return this.inner.request(e);
|
|
6566
6682
|
const t = await this.inner.request(
|
|
6567
|
-
this.options.sendVersionHeader === !1 ? e : { ...e, headers: { ...e.headers, [
|
|
6683
|
+
this.options.sendVersionHeader === !1 ? e : { ...e, headers: { ...e.headers, [is]: this.options.version } }
|
|
6568
6684
|
);
|
|
6569
6685
|
return this.inspect(t), t;
|
|
6570
6686
|
}
|
|
6571
6687
|
isGateway(e) {
|
|
6572
|
-
const t =
|
|
6573
|
-
return t === null ? !1 : this.options.getGatewayBaseUrls().some((s) =>
|
|
6688
|
+
const t = It(e);
|
|
6689
|
+
return t === null ? !1 : this.options.getGatewayBaseUrls().some((s) => It(s) === t);
|
|
6574
6690
|
}
|
|
6575
6691
|
inspect(e) {
|
|
6576
6692
|
var r, n, a, c;
|
|
6577
|
-
const t =
|
|
6578
|
-
t && ((n = (r = this.options).onDeprecation) == null || n.call(r,
|
|
6693
|
+
const t = Pi(e.headers, as);
|
|
6694
|
+
t && ((n = (r = this.options).onDeprecation) == null || n.call(r, Ni(t)));
|
|
6579
6695
|
const s = e.data;
|
|
6580
|
-
s && s.code === we && ((c = (a = this.options).onUnsupported) == null || c.call(a, { message:
|
|
6696
|
+
s && s.code === we && ((c = (a = this.options).onUnsupported) == null || c.call(a, { message: Oi(s) }));
|
|
6581
6697
|
}
|
|
6582
6698
|
}
|
|
6583
|
-
function
|
|
6699
|
+
function Oi(i) {
|
|
6584
6700
|
for (const e of [i.data, i.message])
|
|
6585
6701
|
if (typeof e == "string" && e.trim()) return e;
|
|
6586
6702
|
}
|
|
6587
|
-
function
|
|
6703
|
+
function Pi(i, e) {
|
|
6588
6704
|
if (!i) return;
|
|
6589
6705
|
const t = e.toLowerCase();
|
|
6590
6706
|
for (const [s, r] of Object.entries(i))
|
|
6591
6707
|
if (s.toLowerCase() === t && r) return r;
|
|
6592
6708
|
}
|
|
6593
|
-
const
|
|
6709
|
+
const Ci = [
|
|
6594
6710
|
/CROSSx\/([\d.]+)/i,
|
|
6595
6711
|
/ONE\s?wallet[^\s/]*\/([\d.]+)/i,
|
|
6596
6712
|
/ONE\s?pocket[^\s/]*\/([\d.]+)/i
|
|
6597
6713
|
];
|
|
6598
|
-
function
|
|
6714
|
+
function Ve() {
|
|
6599
6715
|
return typeof window > "u" ? void 0 : window;
|
|
6600
6716
|
}
|
|
6601
|
-
function
|
|
6602
|
-
const i =
|
|
6717
|
+
function Di() {
|
|
6718
|
+
const i = Ve();
|
|
6603
6719
|
return i == null ? void 0 : i.__crossx;
|
|
6604
6720
|
}
|
|
6605
|
-
function
|
|
6721
|
+
function xi(i) {
|
|
6606
6722
|
return i === "ios" || i === "android" ? i : null;
|
|
6607
6723
|
}
|
|
6608
|
-
function
|
|
6724
|
+
function Le() {
|
|
6609
6725
|
const i = typeof navigator > "u" ? "" : navigator.userAgent;
|
|
6610
6726
|
return /Android/i.test(i) ? "android" : /iPhone|iPad|iPod|Macintosh/i.test(i) ? "ios" : null;
|
|
6611
6727
|
}
|
|
6612
|
-
function
|
|
6728
|
+
function vi(i, e) {
|
|
6613
6729
|
const t = (a) => a.split(/[^\d]+/).filter((c) => c !== "").map((c) => Number.parseInt(c, 10)), s = t(i), r = t(e), n = Math.max(s.length, r.length);
|
|
6614
6730
|
for (let a = 0; a < n; a += 1) {
|
|
6615
6731
|
const c = (s[a] ?? 0) - (r[a] ?? 0);
|
|
@@ -6617,42 +6733,42 @@ function xi(i, e) {
|
|
|
6617
6733
|
}
|
|
6618
6734
|
return 0;
|
|
6619
6735
|
}
|
|
6620
|
-
function
|
|
6621
|
-
const i =
|
|
6736
|
+
function ki() {
|
|
6737
|
+
const i = Ve();
|
|
6622
6738
|
if (!i) return !1;
|
|
6623
6739
|
const e = i.__crossxRNBridge;
|
|
6624
6740
|
return e != null && e.isInstalled ? !0 : i.__CROSSX_BRIDGE_INITIALIZED__ === !0 || i.__CROSSX_RN_BRIDGE_READY__ === !0;
|
|
6625
6741
|
}
|
|
6626
|
-
function
|
|
6742
|
+
function mt() {
|
|
6627
6743
|
const i = typeof navigator > "u" ? "" : navigator.userAgent;
|
|
6628
|
-
for (const e of
|
|
6744
|
+
for (const e of Ci) {
|
|
6629
6745
|
const t = e.exec(i);
|
|
6630
6746
|
if (t) return t[1] ?? null;
|
|
6631
6747
|
}
|
|
6632
6748
|
}
|
|
6633
6749
|
function Ee() {
|
|
6634
|
-
const i =
|
|
6750
|
+
const i = Di();
|
|
6635
6751
|
if (i != null && i.browser)
|
|
6636
6752
|
return {
|
|
6637
6753
|
version: i.version ?? null,
|
|
6638
|
-
platform:
|
|
6754
|
+
platform: xi(i.platform) ?? Le(),
|
|
6639
6755
|
detectedBy: "marker"
|
|
6640
6756
|
};
|
|
6641
|
-
if (
|
|
6757
|
+
if (ki())
|
|
6642
6758
|
return {
|
|
6643
|
-
version:
|
|
6644
|
-
platform:
|
|
6759
|
+
version: mt() ?? null,
|
|
6760
|
+
platform: Le(),
|
|
6645
6761
|
detectedBy: "bridge"
|
|
6646
6762
|
};
|
|
6647
|
-
const e =
|
|
6648
|
-
return e !== void 0 ? { version: e, platform:
|
|
6763
|
+
const e = mt();
|
|
6764
|
+
return e !== void 0 ? { version: e, platform: Le(), detectedBy: "user-agent" } : null;
|
|
6649
6765
|
}
|
|
6650
|
-
function
|
|
6766
|
+
function en() {
|
|
6651
6767
|
return Ee() !== null;
|
|
6652
6768
|
}
|
|
6653
|
-
function
|
|
6769
|
+
function tn(i = 3e3) {
|
|
6654
6770
|
const e = Ee();
|
|
6655
|
-
return e ? Promise.resolve(e) :
|
|
6771
|
+
return e ? Promise.resolve(e) : Ve() ? new Promise((t) => {
|
|
6656
6772
|
const s = Date.now(), r = setInterval(() => {
|
|
6657
6773
|
const n = Ee();
|
|
6658
6774
|
if (n) {
|
|
@@ -6663,18 +6779,18 @@ function en(i = 3e3) {
|
|
|
6663
6779
|
}, 50);
|
|
6664
6780
|
}) : Promise.resolve(null);
|
|
6665
6781
|
}
|
|
6666
|
-
const
|
|
6782
|
+
const Li = /* @__PURE__ */ new Set([
|
|
6667
6783
|
"https://cross-wallet-oauth.crosstoken.io",
|
|
6668
6784
|
"https://stg-cross-wallet-oauth.crosstoken.io",
|
|
6669
6785
|
"https://dev-cross-wallet-oauth.crosstoken.io",
|
|
6670
6786
|
"https://one-wallet-oauth.onechain.nexus",
|
|
6671
6787
|
"https://stg-one-wallet-oauth.onechain.nexus",
|
|
6672
6788
|
"https://dev-one-wallet-oauth.onechain.nexus"
|
|
6673
|
-
]),
|
|
6674
|
-
function
|
|
6675
|
-
return i.platform !== "ios" ? !1 : i.version ?
|
|
6789
|
+
]), Ui = "crossx://oauth-callback", bi = "2.3.2";
|
|
6790
|
+
function Wi(i) {
|
|
6791
|
+
return i.platform !== "ios" ? !1 : i.version ? vi(i.version, bi) <= 0 : !0;
|
|
6676
6792
|
}
|
|
6677
|
-
class
|
|
6793
|
+
class V {
|
|
6678
6794
|
constructor() {
|
|
6679
6795
|
this.abortPending = null;
|
|
6680
6796
|
}
|
|
@@ -6709,7 +6825,7 @@ class K {
|
|
|
6709
6825
|
* - Google 및 기타: originalNonce === jwt.nonce
|
|
6710
6826
|
*/
|
|
6711
6827
|
static async verifyIdTokenNonce(e, t) {
|
|
6712
|
-
const s =
|
|
6828
|
+
const s = V.parseJwtPayload(e), r = s.nonce, n = typeof s.iss == "string" ? s.iss : "(unknown)";
|
|
6713
6829
|
if (l.log("[CROSSx] nonce 검증 시작 —", {
|
|
6714
6830
|
iss: n,
|
|
6715
6831
|
nonceClaimType: typeof r,
|
|
@@ -6731,7 +6847,7 @@ class K {
|
|
|
6731
6847
|
return;
|
|
6732
6848
|
}
|
|
6733
6849
|
if (n.includes("appleid.apple.com")) {
|
|
6734
|
-
const a = await
|
|
6850
|
+
const a = await V.sha256Hex(t);
|
|
6735
6851
|
if (l.log("[CROSSx] Apple nonce 검증 —", {
|
|
6736
6852
|
expectedHashLength: a.length,
|
|
6737
6853
|
receivedHashLength: r.length,
|
|
@@ -6748,16 +6864,16 @@ class K {
|
|
|
6748
6864
|
}
|
|
6749
6865
|
openAuth(e) {
|
|
6750
6866
|
return new Promise((t, s) => {
|
|
6751
|
-
const r = Math.max(e.width ?? 500, 500), n = Math.max(e.height ?? 700, 700), a = window.screenX + (window.outerWidth - r) / 2, c = window.screenY + (window.outerHeight - n) / 2, d =
|
|
6867
|
+
const r = Math.max(e.width ?? 500, 500), n = Math.max(e.height ?? 700, 700), a = window.screenX + (window.outerWidth - r) / 2, c = window.screenY + (window.outerHeight - n) / 2, d = V.generateRandom16Hex(), g = V.generateRandom16Hex(), u = Ee();
|
|
6752
6868
|
let _ = e.authUrl;
|
|
6753
|
-
u && e.legacyAuthUrl &&
|
|
6869
|
+
u && e.legacyAuthUrl && Wi(u) && (_ = e.legacyAuthUrl, l.info("[CROSSx] 구버전 iOS 지갑 감지 — 이관 전 OAuth 호스트 사용", {
|
|
6754
6870
|
appVersion: u.version ?? "(unknown)",
|
|
6755
6871
|
detectedBy: u.detectedBy,
|
|
6756
6872
|
authUrlBase: e.legacyAuthUrl
|
|
6757
6873
|
}));
|
|
6758
6874
|
const p = _.includes("?") ? "&" : "?", A = encodeURIComponent(window.location.origin);
|
|
6759
6875
|
let S = `${_}${p}state=${d}&nonce=${g}&origin=${A}`;
|
|
6760
|
-
u && !S.includes("redirectUrl=") && (S += `&redirectUrl=${encodeURIComponent(
|
|
6876
|
+
u && !S.includes("redirectUrl=") && (S += `&redirectUrl=${encodeURIComponent(Ui)}`, l.info("[CROSSx] 지갑 인앱 브라우저 감지 — redirectUrl 콜백 자동 부착", {
|
|
6761
6877
|
detectedBy: u.detectedBy,
|
|
6762
6878
|
appVersion: u.version ?? "(unknown)",
|
|
6763
6879
|
platform: u.platform ?? "(unknown)"
|
|
@@ -6779,13 +6895,13 @@ class K {
|
|
|
6779
6895
|
l.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), O(), s(new Error("Authentication timeout"));
|
|
6780
6896
|
}, 300 * 1e3), f = 10, E = 30;
|
|
6781
6897
|
let T = 0, y = null;
|
|
6782
|
-
const
|
|
6783
|
-
clearInterval(
|
|
6898
|
+
const N = () => {
|
|
6899
|
+
clearInterval(R), l.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + E + "초간 대기합니다"), y = setTimeout(() => {
|
|
6784
6900
|
O(), s(new Error(
|
|
6785
6901
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
6786
6902
|
));
|
|
6787
6903
|
}, E * 1e3);
|
|
6788
|
-
},
|
|
6904
|
+
}, R = setInterval(() => {
|
|
6789
6905
|
T++;
|
|
6790
6906
|
try {
|
|
6791
6907
|
if (!w.closed) return;
|
|
@@ -6794,14 +6910,14 @@ class K {
|
|
|
6794
6910
|
return;
|
|
6795
6911
|
}
|
|
6796
6912
|
const L = typeof document < "u" && document.hasFocus();
|
|
6797
|
-
T <= f && !L ?
|
|
6913
|
+
T <= f && !L ? N() : (O(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다")));
|
|
6798
6914
|
} catch {
|
|
6799
|
-
|
|
6915
|
+
N();
|
|
6800
6916
|
}
|
|
6801
6917
|
}, 1e3), O = () => {
|
|
6802
|
-
this.abortPending = null, clearTimeout(m), clearInterval(
|
|
6918
|
+
this.abortPending = null, clearTimeout(m), clearInterval(R), y && clearTimeout(y), window.removeEventListener("message", P);
|
|
6803
6919
|
}, P = (D) => {
|
|
6804
|
-
if (!
|
|
6920
|
+
if (!Li.has(D.origin)) return;
|
|
6805
6921
|
O();
|
|
6806
6922
|
const L = typeof D.data.status == "string", I = L ? D.data.data ?? {} : D.data;
|
|
6807
6923
|
l.log("[CROSSx] OAuth postMessage 수신 —", {
|
|
@@ -6821,24 +6937,24 @@ class K {
|
|
|
6821
6937
|
l.error("[CROSSx] OAuth 실패:", I.error), s(new Error(I.error || "Authentication failed"));
|
|
6822
6938
|
return;
|
|
6823
6939
|
}
|
|
6824
|
-
const
|
|
6940
|
+
const Y = I == null ? void 0 : I.idToken, ee = I == null ? void 0 : I.accessToken, $e = ee ?? Y, Ye = (I == null ? void 0 : I.email) || void 0;
|
|
6825
6941
|
if (l.log("[CROSSx] OAuth 토큰 수신:", {
|
|
6826
6942
|
hasAccessToken: !!ee,
|
|
6827
|
-
hasIdToken:
|
|
6828
|
-
hasEmail:
|
|
6829
|
-
}),
|
|
6943
|
+
hasIdToken: !!Y,
|
|
6944
|
+
hasEmail: !!Ye
|
|
6945
|
+
}), !$e) {
|
|
6830
6946
|
l.error("[CROSSx] 토큰을 찾을 수 없음:", D.data), s(new Error("Token not found in response"));
|
|
6831
6947
|
return;
|
|
6832
6948
|
}
|
|
6833
|
-
const
|
|
6834
|
-
|
|
6949
|
+
const qe = { token: $e, email: Ye }, Te = (je) => {
|
|
6950
|
+
V.verifyIdTokenNonce(je, g).then(() => t(qe)).catch((ye) => {
|
|
6835
6951
|
l.error("[CROSSx] nonce 검증 실패:", ye), s(ye instanceof Error ? ye : new Error("nonce verification failed"));
|
|
6836
6952
|
});
|
|
6837
6953
|
};
|
|
6838
|
-
ee ? ee.split(".").length === 3 ? Te(ee) :
|
|
6954
|
+
ee ? ee.split(".").length === 3 ? Te(ee) : Y ? Te(Y) : (l.warn(
|
|
6839
6955
|
"[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
|
|
6840
6956
|
"서버 측 nonce 검증이 필요합니다."
|
|
6841
|
-
), t(
|
|
6957
|
+
), t(qe)) : Y ? Te(Y) : s(new Error("Token not found in response"));
|
|
6842
6958
|
};
|
|
6843
6959
|
this.abortPending = (D) => {
|
|
6844
6960
|
O(), s(new Error(D));
|
|
@@ -6846,8 +6962,8 @@ class K {
|
|
|
6846
6962
|
});
|
|
6847
6963
|
}
|
|
6848
6964
|
}
|
|
6849
|
-
const re = "crossx_wallet_data",
|
|
6850
|
-
class
|
|
6965
|
+
const re = "crossx_wallet_data", j = "crossx_mock_pin_hash";
|
|
6966
|
+
class Mi {
|
|
6851
6967
|
constructor(e, t) {
|
|
6852
6968
|
this.storage = e, this.pinStore = t ?? null;
|
|
6853
6969
|
}
|
|
@@ -6876,7 +6992,7 @@ class Wi {
|
|
|
6876
6992
|
};
|
|
6877
6993
|
await this.storage.set(re, r);
|
|
6878
6994
|
const n = (t = this.pinStore) == null ? void 0 : t.get();
|
|
6879
|
-
return n && (await this.storage.set(
|
|
6995
|
+
return n && (await this.storage.set(j, n), l.log("[Mock] 지갑 생성 — PIN 저장됨")), r;
|
|
6880
6996
|
} catch (s) {
|
|
6881
6997
|
throw new h(o.WALLET_CREATION_FAILED, "지갑 생성에 실패했습니다", s);
|
|
6882
6998
|
}
|
|
@@ -6918,8 +7034,8 @@ class Wi {
|
|
|
6918
7034
|
var s;
|
|
6919
7035
|
if (l.log("[Mock] verifyPin"), this.pinScenario === "wrong")
|
|
6920
7036
|
return !1;
|
|
6921
|
-
const t = await this.storage.get(
|
|
6922
|
-
return t && t !== e ? !1 : (t || await this.storage.set(
|
|
7037
|
+
const t = await this.storage.get(j);
|
|
7038
|
+
return t && t !== e ? !1 : (t || await this.storage.set(j, e), (s = this.pinStore) == null || s.set(e), l.log("[Mock] verifyPin → 성공"), !0);
|
|
6923
7039
|
}
|
|
6924
7040
|
/**
|
|
6925
7041
|
* POST /mnemonic/change-password 모킹
|
|
@@ -6929,10 +7045,10 @@ class Wi {
|
|
|
6929
7045
|
var n;
|
|
6930
7046
|
if (l.log("[Mock] changePin"), this.pinScenario === "wrong")
|
|
6931
7047
|
throw new h(o.PIN_WRONG, "Incorrect PIN.");
|
|
6932
|
-
const s = (n = this.pinStore) == null ? void 0 : n.get(), r = await this.storage.get(
|
|
7048
|
+
const s = (n = this.pinStore) == null ? void 0 : n.get(), r = await this.storage.get(j);
|
|
6933
7049
|
if (r && s && r !== s)
|
|
6934
7050
|
throw new h(o.PIN_WRONG, "Incorrect PIN.");
|
|
6935
|
-
await this.storage.set(
|
|
7051
|
+
await this.storage.set(j, t), l.log("[Mock] changePin 완료");
|
|
6936
7052
|
}
|
|
6937
7053
|
async migrateWallet(e, t) {
|
|
6938
7054
|
var n;
|
|
@@ -6965,7 +7081,7 @@ class Wi {
|
|
|
6965
7081
|
};
|
|
6966
7082
|
await this.storage.set(re, s);
|
|
6967
7083
|
const r = (n = this.pinStore) == null ? void 0 : n.get();
|
|
6968
|
-
return r && (await this.storage.set(
|
|
7084
|
+
return r && (await this.storage.set(j, r), l.log("[Mock] 마이그레이션 — PIN 저장됨")), s;
|
|
6969
7085
|
}
|
|
6970
7086
|
/**
|
|
6971
7087
|
* POST /mnemonic/share-c 모킹
|
|
@@ -6992,8 +7108,8 @@ class Wi {
|
|
|
6992
7108
|
).join("");
|
|
6993
7109
|
}
|
|
6994
7110
|
}
|
|
6995
|
-
const
|
|
6996
|
-
class
|
|
7111
|
+
const Fi = ["password", "newPassword", "recoveryPin"];
|
|
7112
|
+
class $ {
|
|
6997
7113
|
constructor(e, t, s, r, n, a) {
|
|
6998
7114
|
this._refreshPromise = null, this._walletStatusCache = null, this.adapterConfig = e, this.projectId = e.projectId, this.storage = t, this.transport = s, this.tokenStore = r, this.pinStore = n ?? null, this.pinEncryptor = a ?? null;
|
|
6999
7115
|
}
|
|
@@ -7020,9 +7136,9 @@ class V {
|
|
|
7020
7136
|
*/
|
|
7021
7137
|
async ensureValidToken() {
|
|
7022
7138
|
const e = this.tokenStore.get();
|
|
7023
|
-
if (e && !this.tokenStore.isExpiringSoon(
|
|
7139
|
+
if (e && !this.tokenStore.isExpiringSoon(et))
|
|
7024
7140
|
return e;
|
|
7025
|
-
const t = !e || this.tokenStore.isExpiringSoon(
|
|
7141
|
+
const t = !e || this.tokenStore.isExpiringSoon(et);
|
|
7026
7142
|
if (this._onTokenRefresh) {
|
|
7027
7143
|
if (await this.deduplicatedRefresh()) {
|
|
7028
7144
|
const r = this.tokenStore.get();
|
|
@@ -7058,7 +7174,7 @@ class V {
|
|
|
7058
7174
|
async sealPinFields(e) {
|
|
7059
7175
|
if (!this.pinEncryptor || !e || typeof e != "object") return e;
|
|
7060
7176
|
let t = null;
|
|
7061
|
-
for (const s of
|
|
7177
|
+
for (const s of Fi) {
|
|
7062
7178
|
const r = e[s];
|
|
7063
7179
|
if (typeof r != "string" || r === "") continue;
|
|
7064
7180
|
const n = await this.pinEncryptor.seal(r);
|
|
@@ -7089,7 +7205,7 @@ class V {
|
|
|
7089
7205
|
url: c,
|
|
7090
7206
|
method: e
|
|
7091
7207
|
});
|
|
7092
|
-
const f =
|
|
7208
|
+
const f = $.mapGatewayError(w.code, w.data);
|
|
7093
7209
|
if (f === o.PIN_ENCRYPTION_INVALID && this.pinEncryptor && (this.pinEncryptor.requireEncryption(), this.pinEncryptor.invalidate(), !n))
|
|
7094
7210
|
return l.warn("[CROSSx] Gateway -10045 감지 — pin-key 재조회 후 재시도"), this.request(e, t, s, r, !0);
|
|
7095
7211
|
if (f === o.AUTH_NOT_AUTHENTICATED && !r && this._onTokenRefresh) {
|
|
@@ -7100,11 +7216,11 @@ class V {
|
|
|
7100
7216
|
if (f === o.USER_NOT_FOUND)
|
|
7101
7217
|
throw l.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (u = this._onUnauthorized) == null || u.call(this), new h(
|
|
7102
7218
|
o.USER_NOT_FOUND,
|
|
7103
|
-
|
|
7219
|
+
$.getGatewayErrorMessage(w.code, m)
|
|
7104
7220
|
);
|
|
7105
|
-
const E = f === o.AUTH_NOT_AUTHENTICATED ? o.SESSION_EXPIRED : f, T = E === o.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." :
|
|
7106
|
-
let
|
|
7107
|
-
throw f === o.PIN_LOCKED ?
|
|
7221
|
+
const E = f === o.AUTH_NOT_AUTHENTICATED ? o.SESSION_EXPIRED : f, T = E === o.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : $.getGatewayErrorMessage(w.code, m), y = w.data;
|
|
7222
|
+
let N;
|
|
7223
|
+
throw f === o.PIN_LOCKED ? N = $.extractLockDetails(y) : f === o.ADDRESS_LIMIT_EXCEEDED ? N = { limit: tt, raw: y } : N = y ?? void 0, new h(E, T, N);
|
|
7108
7224
|
}
|
|
7109
7225
|
return l.log("[CROSSx] Wallet Gateway API 성공:", { code: w.code, url: c, method: e }), w.data ?? w;
|
|
7110
7226
|
}
|
|
@@ -7431,7 +7547,7 @@ class V {
|
|
|
7431
7547
|
return o.SDK_VERSION_UNSUPPORTED;
|
|
7432
7548
|
// PIN 관련
|
|
7433
7549
|
case -10028:
|
|
7434
|
-
return
|
|
7550
|
+
return $.hasLockInfo(t) ? o.PIN_LOCKED : o.PIN_WRONG;
|
|
7435
7551
|
case -10029:
|
|
7436
7552
|
return o.PIN_INVALID;
|
|
7437
7553
|
case -10031:
|
|
@@ -7515,7 +7631,7 @@ class V {
|
|
|
7515
7631
|
case -10033:
|
|
7516
7632
|
return "User not found. You have been signed out.";
|
|
7517
7633
|
case -10036:
|
|
7518
|
-
return `Account limit reached. Maximum ${
|
|
7634
|
+
return `Account limit reached. Maximum ${tt} accounts allowed.`;
|
|
7519
7635
|
case -10045:
|
|
7520
7636
|
return "Could not securely send your PIN. Please try again.";
|
|
7521
7637
|
case -10046:
|
|
@@ -7529,7 +7645,7 @@ class V {
|
|
|
7529
7645
|
}
|
|
7530
7646
|
}
|
|
7531
7647
|
}
|
|
7532
|
-
class
|
|
7648
|
+
class Bi {
|
|
7533
7649
|
constructor(e, t, s, r = () => {
|
|
7534
7650
|
}, n = () => {
|
|
7535
7651
|
}, a = () => {
|
|
@@ -7562,7 +7678,7 @@ class Fi {
|
|
|
7562
7678
|
* 넘길 수 있으면 위임을 해제(SDK 상태 정리)하고 true 를 돌려준다.
|
|
7563
7679
|
*/
|
|
7564
7680
|
async recoverFromUnauthorized(e, t, s, r) {
|
|
7565
|
-
return !
|
|
7681
|
+
return !Nt(e) || !await this.innerOwnsAddress(t, s) ? !1 : (this.onBridgeUnauthorized(
|
|
7566
7682
|
`native 가 ${r} 을 ERR_BRIDGE_NOT_AUTHORIZED 로 거부 — inner provider 로 폴백`
|
|
7567
7683
|
), !0);
|
|
7568
7684
|
}
|
|
@@ -7586,7 +7702,7 @@ class Fi {
|
|
|
7586
7702
|
};
|
|
7587
7703
|
} catch (d) {
|
|
7588
7704
|
if (!await this.recoverFromUnauthorized(d, e, a, "signMessage"))
|
|
7589
|
-
throw
|
|
7705
|
+
throw z(d, o.SIGNATURE_FAILED);
|
|
7590
7706
|
}
|
|
7591
7707
|
}
|
|
7592
7708
|
return this.inner.signMessage(e, t, s, r, n, a);
|
|
@@ -7610,7 +7726,7 @@ class Fi {
|
|
|
7610
7726
|
};
|
|
7611
7727
|
} catch (d) {
|
|
7612
7728
|
if (!await this.recoverFromUnauthorized(d, e, a, "signTypedData"))
|
|
7613
|
-
throw
|
|
7729
|
+
throw z(d, o.SIGNATURE_FAILED);
|
|
7614
7730
|
}
|
|
7615
7731
|
}
|
|
7616
7732
|
if (!this.inner.signTypedData)
|
|
@@ -7636,7 +7752,7 @@ class Fi {
|
|
|
7636
7752
|
};
|
|
7637
7753
|
} catch (c) {
|
|
7638
7754
|
if (!await this.recoverFromUnauthorized(c, e, s.from, "signTransaction"))
|
|
7639
|
-
throw
|
|
7755
|
+
throw z(c, o.SIGNATURE_FAILED);
|
|
7640
7756
|
}
|
|
7641
7757
|
}
|
|
7642
7758
|
return this.inner.signTransaction(e, t, s, r, n);
|
|
@@ -7654,7 +7770,7 @@ class Fi {
|
|
|
7654
7770
|
})).txHash };
|
|
7655
7771
|
} catch (a) {
|
|
7656
7772
|
if (!await this.recoverFromUnauthorized(a, e, s.from, "sendTransaction"))
|
|
7657
|
-
throw
|
|
7773
|
+
throw z(a, o.TRANSACTION_FAILED);
|
|
7658
7774
|
}
|
|
7659
7775
|
}
|
|
7660
7776
|
if (!this.inner.sendTransaction)
|
|
@@ -7727,7 +7843,7 @@ class ae {
|
|
|
7727
7843
|
}
|
|
7728
7844
|
isCacheValid() {
|
|
7729
7845
|
if (this.loadedAt === 0) return !1;
|
|
7730
|
-
const e = this.usingFallback ?
|
|
7846
|
+
const e = this.usingFallback ? ss : ts;
|
|
7731
7847
|
return e === 0 ? !0 : Date.now() - this.loadedAt < e;
|
|
7732
7848
|
}
|
|
7733
7849
|
populateCache(e, t) {
|
|
@@ -7791,7 +7907,7 @@ class ae {
|
|
|
7791
7907
|
}
|
|
7792
7908
|
}
|
|
7793
7909
|
}
|
|
7794
|
-
function
|
|
7910
|
+
function G(i) {
|
|
7795
7911
|
return Promise.reject(
|
|
7796
7912
|
new h(
|
|
7797
7913
|
o.UI_NOT_PROVIDED,
|
|
@@ -7799,28 +7915,28 @@ function H(i) {
|
|
|
7799
7915
|
)
|
|
7800
7916
|
);
|
|
7801
7917
|
}
|
|
7802
|
-
class
|
|
7918
|
+
class Hi {
|
|
7803
7919
|
// ─── 사용자 입력이 필요한 화면 → UI_NOT_PROVIDED ───
|
|
7804
7920
|
requestConfirmation(e) {
|
|
7805
|
-
return
|
|
7921
|
+
return G("requestConfirmation");
|
|
7806
7922
|
}
|
|
7807
7923
|
showLoginSelector() {
|
|
7808
|
-
return
|
|
7924
|
+
return G("showLoginSelector");
|
|
7809
7925
|
}
|
|
7810
7926
|
showMigrationFoundPrompt() {
|
|
7811
|
-
return
|
|
7927
|
+
return G("showMigrationFoundPrompt");
|
|
7812
7928
|
}
|
|
7813
7929
|
showRecoveryPinInputPrompt() {
|
|
7814
|
-
return
|
|
7930
|
+
return G("showRecoveryPinInputPrompt");
|
|
7815
7931
|
}
|
|
7816
7932
|
showWalletSelector() {
|
|
7817
|
-
return
|
|
7933
|
+
return G("showWalletSelector");
|
|
7818
7934
|
}
|
|
7819
7935
|
showPinSetupPrompt() {
|
|
7820
|
-
return
|
|
7936
|
+
return G("showPinSetupPrompt");
|
|
7821
7937
|
}
|
|
7822
7938
|
showPinInputPrompt() {
|
|
7823
|
-
return
|
|
7939
|
+
return G("showPinInputPrompt");
|
|
7824
7940
|
}
|
|
7825
7941
|
// ─── 세션 알림 → 다시 로그인할 화면이 없으므로 로그아웃으로 처리 ───
|
|
7826
7942
|
async showSessionAlert() {
|
|
@@ -7848,7 +7964,7 @@ class Bi {
|
|
|
7848
7964
|
setPinKeyboard() {
|
|
7849
7965
|
}
|
|
7850
7966
|
}
|
|
7851
|
-
class
|
|
7967
|
+
class Gi {
|
|
7852
7968
|
constructor(e, t, s, r = () => !1) {
|
|
7853
7969
|
this.browserConfirmation = e, this.getBridge = t, this.getOrigin = s, this.isAuthenticatedViaRNBridge = r;
|
|
7854
7970
|
}
|
|
@@ -8021,7 +8137,7 @@ class Hi {
|
|
|
8021
8137
|
(s = (t = this.browserConfirmation).setPinKeyboard) == null || s.call(t, e);
|
|
8022
8138
|
}
|
|
8023
8139
|
}
|
|
8024
|
-
class
|
|
8140
|
+
class Ki {
|
|
8025
8141
|
constructor() {
|
|
8026
8142
|
this._accessToken = null, this._expiresAt = 0;
|
|
8027
8143
|
}
|
|
@@ -8053,33 +8169,33 @@ class Gi {
|
|
|
8053
8169
|
return !this._accessToken || this._expiresAt <= 0 ? !0 : Date.now() >= this._expiresAt - e;
|
|
8054
8170
|
}
|
|
8055
8171
|
}
|
|
8056
|
-
const
|
|
8057
|
-
function
|
|
8058
|
-
|
|
8172
|
+
const Kt = /* @__PURE__ */ new WeakMap();
|
|
8173
|
+
function Vi(i, e) {
|
|
8174
|
+
Kt.set(i, e);
|
|
8059
8175
|
}
|
|
8060
|
-
function
|
|
8061
|
-
const e =
|
|
8176
|
+
function sn(i) {
|
|
8177
|
+
const e = Kt.get(i);
|
|
8062
8178
|
if (!e)
|
|
8063
8179
|
throw new Error(
|
|
8064
8180
|
"[CROSSx] Internal context not found — create the SDK with the core factory, and import the root and /internal entries in the same module format (ESM or CJS)."
|
|
8065
8181
|
);
|
|
8066
8182
|
return e;
|
|
8067
8183
|
}
|
|
8068
|
-
const
|
|
8069
|
-
function
|
|
8070
|
-
|
|
8184
|
+
const Vt = /* @__PURE__ */ new WeakMap();
|
|
8185
|
+
function $i(i, e) {
|
|
8186
|
+
Vt.set(i, e);
|
|
8071
8187
|
}
|
|
8072
|
-
function
|
|
8073
|
-
const t =
|
|
8188
|
+
function rn(i, e) {
|
|
8189
|
+
const t = Vt.get(i);
|
|
8074
8190
|
return t ? t(e) : Promise.reject(new Error("[CROSSx] reloadOneIdSession: create the SDK with the core factory"));
|
|
8075
8191
|
}
|
|
8076
|
-
function
|
|
8077
|
-
return
|
|
8192
|
+
function Yi(i) {
|
|
8193
|
+
return $t(i);
|
|
8078
8194
|
}
|
|
8079
|
-
function
|
|
8080
|
-
return
|
|
8195
|
+
function nn(i, e) {
|
|
8196
|
+
return $t(i, e);
|
|
8081
8197
|
}
|
|
8082
|
-
function
|
|
8198
|
+
function $t(i, e) {
|
|
8083
8199
|
var L;
|
|
8084
8200
|
if (!i.projectId)
|
|
8085
8201
|
throw new Error(
|
|
@@ -8103,30 +8219,30 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
8103
8219
|
}, r = {
|
|
8104
8220
|
gatewayUrl: t.walletGatewayUrl,
|
|
8105
8221
|
projectId: i.projectId
|
|
8106
|
-
}, n = s.authMode !== "cookie" &&
|
|
8222
|
+
}, n = s.authMode !== "cookie" && Et.isAvailable();
|
|
8107
8223
|
!n && s.authMode !== "cookie" && l.warn(
|
|
8108
8224
|
"[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
|
|
8109
8225
|
"refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
|
|
8110
8226
|
"IndexedDB를 지원하는 브라우저 사용을 권장합니다."
|
|
8111
8227
|
), s.secureStorageAvailable = n;
|
|
8112
|
-
const a = n ? new
|
|
8228
|
+
const a = n ? new Et(i.projectId) : new li(), c = new ui();
|
|
8113
8229
|
let d = null;
|
|
8114
|
-
const g = new Ri(new
|
|
8230
|
+
const g = new Ri(new yi(), {
|
|
8115
8231
|
version: fe,
|
|
8116
|
-
sendVersionHeader:
|
|
8232
|
+
sendVersionHeader: ns,
|
|
8117
8233
|
getGatewayBaseUrls: () => [r.gatewayUrl],
|
|
8118
8234
|
onDeprecation: (I) => d == null ? void 0 : d.handleSdkVersionDeprecation(I),
|
|
8119
8235
|
onUnsupported: (I) => d == null ? void 0 : d.handleSdkVersionUnsupported(I)
|
|
8120
|
-
}), u = new
|
|
8236
|
+
}), u = new V(), _ = new Ki(), p = e == null ? void 0 : e.pinReuse, A = new Pt({ ttlMs: (p == null ? void 0 : p.mode) === "memory" ? p.ttlMs : void 0 }), S = new fi(r, g);
|
|
8121
8237
|
let w;
|
|
8122
|
-
i.useMockWallet ? (l.log("[CROSSx] Mock Wallet Provider 사용"), w = new
|
|
8238
|
+
i.useMockWallet ? (l.log("[CROSSx] Mock Wallet Provider 사용"), w = new Mi(a, A)) : i.walletServer === "one-wallet" ? (l.log("[CROSSx] one-wallet-api Wallet Provider 사용"), w = new Fe({
|
|
8123
8239
|
baseUrl: () => ce().oneWalletApiUrl,
|
|
8124
8240
|
transport: g,
|
|
8125
8241
|
pinStore: A,
|
|
8126
8242
|
getAccessToken: () => d ? d.getOneIdAccessToken() : Promise.reject(new h(o.AUTH_NOT_INITIALIZED, "SDK가 아직 만들어지지 않았습니다")),
|
|
8127
8243
|
// DPoP 에 묶인 세션(OSG 웹뷰)은 세션 통로가 DPoP 헤더 · 증명을 만든다 (DEV2TF-2950)
|
|
8128
8244
|
getAuthorizationHeaders: (I) => d ? d.getOneIdAuthorizationHeaders(I) : Promise.reject(new h(o.AUTH_NOT_INITIALIZED, "SDK가 아직 만들어지지 않았습니다"))
|
|
8129
|
-
})) : (l.log("[CROSSx] Remote Wallet Provider 사용"), w = new
|
|
8245
|
+
})) : (l.log("[CROSSx] Remote Wallet Provider 사용"), w = new $(
|
|
8130
8246
|
r,
|
|
8131
8247
|
a,
|
|
8132
8248
|
g,
|
|
@@ -8144,7 +8260,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
8144
8260
|
var Q;
|
|
8145
8261
|
(Q = d == null ? void 0 : d.clearRNBridgeDelegation) == null || Q.call(d, I);
|
|
8146
8262
|
};
|
|
8147
|
-
i.walletServer !== "one-wallet" && (w = new
|
|
8263
|
+
i.walletServer !== "one-wallet" && (w = new Bi(
|
|
8148
8264
|
w,
|
|
8149
8265
|
() => {
|
|
8150
8266
|
var I;
|
|
@@ -8155,7 +8271,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
8155
8271
|
() => i.appName,
|
|
8156
8272
|
E
|
|
8157
8273
|
));
|
|
8158
|
-
const T = new ae(r, g), y = ce(),
|
|
8274
|
+
const T = new ae(r, g), y = ce(), N = e != null && e.ui ? e.ui({
|
|
8159
8275
|
theme: i.theme ?? "light",
|
|
8160
8276
|
themeTokens: i.themeTokens,
|
|
8161
8277
|
displayDecimals: i.displayDecimals,
|
|
@@ -8164,15 +8280,15 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
8164
8280
|
contentsBaseUrl: y.contentsBaseUrl,
|
|
8165
8281
|
portraitBaseUrl: y.portraitBaseUrl
|
|
8166
8282
|
}
|
|
8167
|
-
}) : new
|
|
8168
|
-
|
|
8283
|
+
}) : new Hi(), R = new Gi(
|
|
8284
|
+
N,
|
|
8169
8285
|
() => {
|
|
8170
8286
|
var I;
|
|
8171
8287
|
return (I = d == null ? void 0 : d.getRNBridge) == null ? void 0 : I.call(d);
|
|
8172
8288
|
},
|
|
8173
8289
|
() => typeof window < "u" ? window.location.origin : "http://localhost",
|
|
8174
8290
|
m
|
|
8175
|
-
), O = e != null && e.wrapConfirmation ? e.wrapConfirmation(
|
|
8291
|
+
), O = e != null && e.wrapConfirmation ? e.wrapConfirmation(R) : R, P = new Be(
|
|
8176
8292
|
s,
|
|
8177
8293
|
r,
|
|
8178
8294
|
a,
|
|
@@ -8185,10 +8301,10 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
8185
8301
|
T,
|
|
8186
8302
|
A,
|
|
8187
8303
|
S,
|
|
8188
|
-
new
|
|
8304
|
+
new Ks(),
|
|
8189
8305
|
e == null ? void 0 : e.oneIdSessions
|
|
8190
8306
|
);
|
|
8191
|
-
d = P,
|
|
8307
|
+
d = P, Vi(P, {
|
|
8192
8308
|
transport: g,
|
|
8193
8309
|
storage: a,
|
|
8194
8310
|
walletProvider: w,
|
|
@@ -8197,40 +8313,40 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
8197
8313
|
pinStore: A,
|
|
8198
8314
|
adapterConfig: r,
|
|
8199
8315
|
pinEncryptor: S
|
|
8200
|
-
}),
|
|
8316
|
+
}), $i(P, (I) => P.reloadOneIdSession(I));
|
|
8201
8317
|
const D = P.signInUseCase;
|
|
8202
8318
|
return D && typeof D.setFreshTokenCallback == "function" && D.setFreshTokenCallback(() => P.requestFreshFirebaseIdTokenFromBridge()), typeof window < "u" && (window.__crossxSDK = P), P;
|
|
8203
8319
|
}
|
|
8204
|
-
const
|
|
8320
|
+
const an = Yi;
|
|
8205
8321
|
export {
|
|
8206
|
-
|
|
8207
|
-
|
|
8322
|
+
ls as C,
|
|
8323
|
+
Qi as D,
|
|
8208
8324
|
o as E,
|
|
8209
|
-
|
|
8325
|
+
Ot as M,
|
|
8210
8326
|
Ce as O,
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8327
|
+
Pt as P,
|
|
8328
|
+
Ki as T,
|
|
8329
|
+
yt as W,
|
|
8330
|
+
Ys as a,
|
|
8215
8331
|
h as b,
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8332
|
+
nn as c,
|
|
8333
|
+
be as d,
|
|
8334
|
+
ws as e,
|
|
8335
|
+
Be as f,
|
|
8336
|
+
sn as g,
|
|
8337
|
+
Zi as h,
|
|
8222
8338
|
te as i,
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8339
|
+
os as j,
|
|
8340
|
+
Ss as k,
|
|
8341
|
+
tt as l,
|
|
8342
|
+
bs as m,
|
|
8343
|
+
J as n,
|
|
8344
|
+
Tt as o,
|
|
8345
|
+
Yi as p,
|
|
8346
|
+
an as q,
|
|
8347
|
+
rn as r,
|
|
8348
|
+
Xi as s,
|
|
8233
8349
|
Ee as t,
|
|
8234
|
-
|
|
8235
|
-
|
|
8350
|
+
en as u,
|
|
8351
|
+
tn as w
|
|
8236
8352
|
};
|