@nexus-cross/crossx-sdk-core 3.0.0-beta.6 → 3.0.0-beta.7

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.
@@ -1,7 +1,7 @@
1
- import { createRemoteJWKSet as Vt, jwtVerify as $t, decodeJwt as Yt } from "jose";
2
- import { secp256k1 as qt } from "@noble/curves/secp256k1.js";
3
- import { keccak_256 as qe } from "@noble/hashes/sha3.js";
4
- import { bytesToHex as jt } from "@noble/hashes/utils.js";
1
+ import { createRemoteJWKSet as $t, jwtVerify as Yt, decodeJwt as qt } from "jose";
2
+ import { secp256k1 as jt } from "@noble/curves/secp256k1.js";
3
+ import { keccak_256 as je } from "@noble/hashes/sha3.js";
4
+ import { bytesToHex as zt } 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_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 zt = 2e3, je = 6e4, Jt = 1e3, Xt = 1e4, Zt = "0x77359400", ze = "0x3B9ACA00", Je = 130, It = 6, Xe = 18, Ze = 3e4, Qt = 300 * 1e3, es = 30 * 1e3, Qe = 100, ts = 300 * 1e3, et = 60 * 1e3, ge = "crossx-sdk-js/3.0.0-beta.6", ss = "X-SDK-Version", rs = !1, is = "x-sdk-deprecation", fe = -10050, mt = "ONEpocket";
20
- var ns = /* @__PURE__ */ ((i) => (i.MetaMask = "io.metamask", i.Binance = "com.binance.wallet", i.CROSSx = "crossx", i))(ns || {});
21
- const as = {
19
+ const Jt = 2e3, ze = 6e4, Xt = 1e3, Zt = 1e4, Qt = "0x77359400", Je = "0x3B9ACA00", Xe = 130, mt = 6, Ze = 18, Qe = 3e4, es = 300 * 1e3, ts = 30 * 1e3, et = 100, ss = 300 * 1e3, tt = 60 * 1e3, _e = "crossx-sdk-js/3.0.0-beta.7", rs = "X-SDK-Version", is = !1, ns = "x-sdk-deprecation", pe = -10050, Tt = "ONEpocket";
20
+ var as = /* @__PURE__ */ ((i) => (i.MetaMask = "io.metamask", i.Binance = "com.binance.wallet", i.CROSSx = "crossx", i))(as || {});
21
+ const os = {
22
22
  "io.metamask": "MetaMask",
23
23
  "com.binance.wallet": "Binance Wallet",
24
- crossx: mt
25
- }, os = [
24
+ crossx: Tt
25
+ }, cs = [
26
26
  "crossx",
27
27
  "io.metamask",
28
28
  "com.binance.wallet"
29
29
  /* Binance */
30
30
  ];
31
- function Hi(i) {
32
- return as[i] ?? i;
31
+ function Vi(i) {
32
+ return os[i] ?? i;
33
33
  }
34
- function cs(i) {
35
- return Array.isArray(i.connectOtherWallets) && i.connectOtherWallets.length > 0 ? [...i.connectOtherWallets] : i.showConnectOtherWallets === !0 ? [...os] : [];
34
+ function ls(i) {
35
+ return Array.isArray(i.connectOtherWallets) && i.connectOtherWallets.length > 0 ? [...i.connectOtherWallets] : i.showConnectOtherWallets === !0 ? [...cs] : [];
36
36
  }
37
- function Tt(i) {
37
+ function yt(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 ls = /* @__PURE__ */ new Set(["ERR_USER_REJECTED", "USER_REJECTED", "USER_REJECT"]), hs = /user rejected|rejected the request|request (?:was )?cancell?ed|entry was cancell?ed|거부했습니다|취소되었습니다/i;
42
- function yt(i) {
41
+ const hs = /* @__PURE__ */ new Set(["ERR_USER_REJECTED", "USER_REJECTED", "USER_REJECT"]), ds = /user rejected|rejected the request|request (?:was )?cancell?ed|entry was cancell?ed|거부했습니다|취소되었습니다/i;
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 ds(i) {
48
- const e = yt(i);
49
- if (e) return ls.has(e);
47
+ function us(i) {
48
+ const e = Rt(i);
49
+ if (e) return hs.has(e);
50
50
  const t = i instanceof Error ? i.message : String(i);
51
- return hs.test(t);
51
+ return ds.test(t);
52
52
  }
53
53
  function j(i, e) {
54
54
  if (i instanceof h) return i;
55
- const t = yt(i), s = i instanceof Error ? i.message : String(i), r = { nativeCode: t, cause: i };
56
- if (ds(i))
55
+ const t = Rt(i), s = i instanceof Error ? i.message : String(i), r = { nativeCode: t, cause: i };
56
+ if (us(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 Ae = {
107
107
  rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
108
108
  testnet: !0
109
109
  }
110
- }, Ki = Object.fromEntries(
110
+ }, $i = Object.fromEntries(
111
111
  Object.entries(Ae).map(([i, e]) => [i, e.caipId])
112
- ), us = new Map(
112
+ ), gs = new Map(
113
113
  Object.values(Ae).map((i) => [i.caipId, i])
114
114
  );
115
115
  new Map(
116
116
  Object.values(Ae).map((i) => [i.chainId, i])
117
117
  );
118
- const gs = { symbol: "", decimals: 18 };
119
- function _s(i, e) {
118
+ const _s = { symbol: "", decimals: 18 };
119
+ function fs(i, e) {
120
120
  var t;
121
- return (e == null ? void 0 : e[i]) ?? ((t = us.get(i)) == null ? void 0 : t.nativeCurrency);
121
+ return (e == null ? void 0 : e[i]) ?? ((t = gs.get(i)) == null ? void 0 : t.nativeCurrency);
122
122
  }
123
- class fs {
123
+ class ps {
124
124
  constructor(e, t) {
125
125
  this.sdk = e, this.chainId = t, this._listeners = /* @__PURE__ */ new Map();
126
126
  }
@@ -218,7 +218,7 @@ class fs {
218
218
  }
219
219
  }
220
220
  let W = null;
221
- function tt(i) {
221
+ function st(i) {
222
222
  W = i;
223
223
  }
224
224
  const c = {
@@ -248,7 +248,7 @@ const c = {
248
248
  return;
249
249
  }
250
250
  }
251
- }, ps = {
251
+ }, ws = {
252
252
  // ── 공통 버튼 ────────────────────────────────────────────────
253
253
  confirm: "확인",
254
254
  cancel: "취소",
@@ -376,7 +376,7 @@ const c = {
376
376
  session_alert_apple_account: "Apple 계정",
377
377
  session_alert_sign_out_button: "로그아웃",
378
378
  session_alert_sign_in_again_button: "다시 로그인"
379
- }, Rt = {
379
+ }, Nt = {
380
380
  // ── Common buttons ───────────────────────────────────────────
381
381
  confirm: "Confirm",
382
382
  cancel: "Cancel",
@@ -421,7 +421,7 @@ const c = {
421
421
  label_including_fees: "(including fees)",
422
422
  label_primary_type: "Primary Type",
423
423
  // ── Login selector modal ─────────────────────────────────────
424
- login_selector_title: mt,
424
+ login_selector_title: Tt,
425
425
  login_selector_subtitle: "Sign in instantly with your social account",
426
426
  login_selector_google: "Sign in with Google",
427
427
  login_selector_apple: "Sign in with Apple",
@@ -503,17 +503,17 @@ For security, you must continue with the same account.`,
503
503
  session_alert_apple_account: "Apple account",
504
504
  session_alert_sign_out_button: "Sign out",
505
505
  session_alert_sign_in_again_button: "Sign in again"
506
- }, ws = {
507
- ko: ps,
508
- en: Rt
506
+ }, Ss = {
507
+ ko: ws,
508
+ en: Nt
509
509
  };
510
510
  function M(i = "en", e) {
511
- return ws[i] ?? Rt;
511
+ return Ss[i] ?? Nt;
512
512
  }
513
- function Ss(i) {
513
+ function Es(i) {
514
514
  return i === "ko" || i === "en" ? i : typeof navigator < "u" && (navigator.language ?? "").toLowerCase().startsWith("ko") ? "ko" : "en";
515
515
  }
516
- const st = "crossx_access_token", rt = "crossx_refresh_token", it = "crossx_user_info", Ee = class Ee {
516
+ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user_info", Ie = class Ie {
517
517
  constructor(e, t, s, r, n, a, l, d, g = () => {
518
518
  }) {
519
519
  this.config = e, this.storage = t, this.crypto = s, this.oauth = r, this.transport = n, this.walletProvider = a, this.tokenStore = l, this.requestFreshTokenFromBridge = d, this.getLocale = g, this._refreshPromise = null, this._migrated = !1;
@@ -612,9 +612,9 @@ const st = "crossx_access_token", rt = "crossx_refresh_token", it = "crossx_user
612
612
  const r = e == null ? void 0 : e.provider;
613
613
  let n = "/login";
614
614
  r === "google" ? n = "/google" : r === "apple" && (n = "/apple");
615
- const { oauthServiceUrl: a, legacyOauthServiceUrl: l } = this.config, d = Ss(this.getLocale()), g = (A) => {
616
- const E = `${A}${n}`, w = E.includes("?") ? "&" : "?";
617
- return `${E}${w}locale=${d}`;
615
+ const { oauthServiceUrl: a, legacyOauthServiceUrl: l } = this.config, d = Es(this.getLocale()), g = (I) => {
616
+ const S = `${I}${n}`, w = S.includes("?") ? "&" : "?";
617
+ return `${S}${w}locale=${d}`;
618
618
  }, u = g(a), _ = l ? g(l) : void 0;
619
619
  c.log(`[CROSSx] OAuth 팝업 열기 (${r || "일반"} 로그인)`), c.log(`[CROSSx] Auth URL: ${u}`);
620
620
  const p = await this.oauth.openAuth({
@@ -723,22 +723,22 @@ const st = "crossx_access_token", rt = "crossx_refresh_token", it = "crossx_user
723
723
  let s, r = !1;
724
724
  try {
725
725
  const { authApiUrl: u } = this.config, { accessToken: _, refreshToken: p } = await this.exchangeFirebaseToken(e, u);
726
- let A, E, w;
726
+ let I, S, w;
727
727
  try {
728
- const S = this.crypto.decodeJWT(e);
729
- c.log("[CROSSx] Firebase JWT 필드:", Object.keys(S).join(", ")), E = (n = S.firebase) == null ? void 0 : n.sign_in_provider;
730
- const I = ((a = S.firebase) == null ? void 0 : a.identities) ?? {};
731
- w = S.email ?? ((l = I.email) == null ? void 0 : l[0]), E === "google.com" ? A = (d = I["google.com"]) == null ? void 0 : d[0] : E === "apple.com" && (A = (g = I["apple.com"]) == null ? void 0 : g[0]), c.log("[CROSSx] OAuth provider sub 추출 — provider:", E, "hasProviderSub:", !!A, "email:", w ?? "(없음)");
728
+ const f = this.crypto.decodeJWT(e);
729
+ c.log("[CROSSx] Firebase JWT 필드:", Object.keys(f).join(", ")), S = (n = f.firebase) == null ? void 0 : n.sign_in_provider;
730
+ const E = ((a = f.firebase) == null ? void 0 : a.identities) ?? {};
731
+ w = f.email ?? ((l = E.email) == null ? void 0 : l[0]), S === "google.com" ? I = (d = E["google.com"]) == null ? void 0 : d[0] : S === "apple.com" && (I = (g = E["apple.com"]) == null ? void 0 : g[0]), c.log("[CROSSx] OAuth provider sub 추출 — provider:", S, "hasProviderSub:", !!I, "email:", w ?? "(없음)");
732
732
  } catch {
733
733
  c.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
734
734
  }
735
735
  if (_) {
736
- const S = this.crypto.decodeJWT(_);
737
- c.log("[CROSSx] access_token 디코딩 — sub:", S.sub, "exp:", S.exp, "필드:", Object.keys(S).join(", "));
738
- const I = await this.crypto.verifyJWT(_);
739
- if (r = I.signatureVerified ?? !1, !I.valid)
736
+ const f = this.crypto.decodeJWT(_);
737
+ c.log("[CROSSx] access_token 디코딩 — sub:", f.sub, "exp:", f.exp, "필드:", Object.keys(f).join(", "));
738
+ const E = await this.crypto.verifyJWT(_);
739
+ if (r = E.signatureVerified ?? !1, !E.valid)
740
740
  throw c.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
741
- const T = I.payload, O = T.email ?? w ?? t;
741
+ const T = E.payload, y = T.email ?? w ?? t;
742
742
  c.log(
743
743
  "[CROSSx] email 소스 — CROSSx JWT:",
744
744
  T.email ?? "(없음)",
@@ -747,25 +747,25 @@ const st = "crossx_access_token", rt = "crossx_refresh_token", it = "crossx_user
747
747
  "/ OAuth 콜백:",
748
748
  t ?? "(없음)",
749
749
  "→",
750
- O ?? "(없음)"
750
+ y ?? "(없음)"
751
751
  ), s = {
752
752
  id: T.sub,
753
- email: O,
754
- signInProvider: E,
755
- providerSub: A
753
+ email: y,
754
+ signInProvider: S,
755
+ providerSub: I
756
756
  }, this.tokenStore.set(_), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, _), p && this.config.secureStorageAvailable !== !1 ? await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, p) : p && c.warn("[CROSSx] 안전한 스토리지 미사용 — refresh_token 영속 저장을 건너뜁니다"));
757
757
  } else {
758
- const S = this.crypto.decodeJWT(e);
758
+ const f = this.crypto.decodeJWT(e);
759
759
  s = {
760
- id: S.sub,
761
- email: S.email ?? t,
762
- signInProvider: E,
763
- providerSub: A
760
+ id: f.sub,
761
+ email: f.email ?? t,
762
+ signInProvider: S,
763
+ providerSub: I
764
764
  }, c.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", s.id);
765
765
  }
766
766
  c.log("[CROSSx] 사용자 정보 — id:", s.id, "email:", s.email ?? "(없음)");
767
- const f = this.useCookieAuth ? { id: s.id, email: s.email, signInProvider: s.signInProvider, providerSub: s.providerSub } : s;
768
- await this.storage.set(this.STORAGE_KEY_USER, f), await this.clearStoredRNBridgeSession(), c.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
767
+ const m = this.useCookieAuth ? { id: s.id, email: s.email, signInProvider: s.signInProvider, providerSub: s.providerSub } : s;
768
+ await this.storage.set(this.STORAGE_KEY_USER, m), await this.clearStoredRNBridgeSession(), c.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
769
769
  } catch (u) {
770
770
  return c.error("[CROSSx] SignIn 에러 (토큰 교환 단계):", u), {
771
771
  success: !1,
@@ -963,7 +963,7 @@ const st = "crossx_access_token", rt = "crossx_refresh_token", it = "crossx_user
963
963
  c.log("[CROSSx] silentRefresh 응답 — status:", a.status);
964
964
  const l = a.data, d = this.extractResponseErrorCode(l);
965
965
  if (d) {
966
- const u = Ee.REFRESH_RELOGIN_CODES.has(d.code);
966
+ const u = Ie.REFRESH_RELOGIN_CODES.has(d.code);
967
967
  throw new h(
968
968
  u ? o.SESSION_EXPIRED : o.AUTH_FAILED,
969
969
  `토큰 갱신 실패 (코드 ${d.code}): ${d.message}`
@@ -1058,13 +1058,13 @@ const st = "crossx_access_token", rt = "crossx_refresh_token", it = "crossx_user
1058
1058
  if (!this._migrated) {
1059
1059
  this._migrated = !0;
1060
1060
  try {
1061
- const e = await this.storage.get(it);
1061
+ const e = await this.storage.get(nt);
1062
1062
  if (!e || await this.storage.get(this.STORAGE_KEY_USER)) return;
1063
1063
  await this.storage.set(this.STORAGE_KEY_USER, e);
1064
- const s = await this.storage.get(st);
1064
+ const s = await this.storage.get(rt);
1065
1065
  s && await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, s);
1066
- const r = await this.storage.get(rt);
1067
- r && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, r), await this.storage.remove(it), await this.storage.remove(st), await this.storage.remove(rt), c.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
1066
+ const r = await this.storage.get(it);
1067
+ r && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, r), await this.storage.remove(nt), await this.storage.remove(rt), await this.storage.remove(it), c.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
1068
1068
  } catch (e) {
1069
1069
  c.warn("[CROSSx] 스토리지 키 마이그레이션 실패:", e);
1070
1070
  }
@@ -1099,9 +1099,9 @@ const st = "crossx_access_token", rt = "crossx_refresh_token", it = "crossx_user
1099
1099
  return c.log("[CROSSx] loadWallet 결과 — address:", s, "needsMigration:", r), { success: !0, address: s, user: e, needsMigration: r, tokenSignatureVerified: t };
1100
1100
  }
1101
1101
  };
1102
- Ee.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
1103
- let Ue = Ee;
1104
- class Es {
1102
+ Ie.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
1103
+ let Ue = Ie;
1104
+ class Is {
1105
1105
  /**
1106
1106
  * @param preservedKeys 로그아웃 뒤에도 남길 저장소 키. 지금은 선호 지갑(`wallet_preference`)만
1107
1107
  * 쓴다 — 다시 로그인할 때 같은 지갑을 모달 없이 고르기 위해서다 (DEV2TF-2368).
@@ -1150,7 +1150,7 @@ class As {
1150
1150
  };
1151
1151
  }
1152
1152
  }
1153
- class Nt {
1153
+ class Ot {
1154
1154
  /**
1155
1155
  * @param options.ttlMs 주면 PIN 을 넣은 뒤 이 시간이 지나면 다음 서명을 기다리지 않고 메모리에서 지운다.
1156
1156
  * 재사용 정책(PinReusePolicy memory)이 더는 쓰지 않을 PIN 을 들고 있지 않게 한다 (DEV2TF-2912 AC-7).
@@ -1219,36 +1219,36 @@ class Nt {
1219
1219
  return this.encryptedBytes !== null;
1220
1220
  }
1221
1221
  }
1222
- const Is = "/authorize/result", ms = "one-oauth:authorization_response", Ot = "one-oauth:authorization_error", Ts = "one-oauth:authorization_ack", ys = "openid profile offline_access";
1223
- function Fe(i) {
1222
+ const ms = "/authorize/result", Ts = "one-oauth:authorization_response", Pt = "one-oauth:authorization_error", ys = "one-oauth:authorization_ack", Rs = "openid profile offline_access";
1223
+ function Be(i) {
1224
1224
  let e = "";
1225
1225
  for (const t of i) e += String.fromCharCode(t);
1226
1226
  return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1227
1227
  }
1228
- function ye(i = 32) {
1228
+ function Re(i = 32) {
1229
1229
  const e = new Uint8Array(i);
1230
- return crypto.getRandomValues(e), Fe(e);
1230
+ return crypto.getRandomValues(e), Be(e);
1231
1231
  }
1232
- async function Re(i) {
1232
+ async function Ne(i) {
1233
1233
  const e = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(i));
1234
- return Fe(new Uint8Array(e));
1234
+ return Be(new Uint8Array(e));
1235
1235
  }
1236
1236
  function Y(i = 16) {
1237
1237
  const e = new Uint8Array(i);
1238
- return crypto.getRandomValues(e), Fe(e);
1238
+ return crypto.getRandomValues(e), Be(e);
1239
1239
  }
1240
- const Rs = "onepocketSecureFrame", Be = 1;
1240
+ const Ns = "onepocketSecureFrame", Ge = 1;
1241
1241
  function ae() {
1242
1242
  return new h(o.USER_REJECTED, "앱 요청을 중단했습니다");
1243
1243
  }
1244
- let nt = 0;
1245
- function pe() {
1246
- return nt += 1, `${typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : String(Math.random())}-${nt}`;
1244
+ let at = 0;
1245
+ function we() {
1246
+ return at += 1, `${typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : String(Math.random())}-${at}`;
1247
1247
  }
1248
- function Ns(i) {
1248
+ function Os(i) {
1249
1249
  return i === "cancelled" ? o.USER_REJECTED : o.ONEID_AUTHORIZATION_FAILED;
1250
1250
  }
1251
- function Pt(i, e) {
1251
+ function Ct(i, e) {
1252
1252
  var r, n;
1253
1253
  let t = e;
1254
1254
  if (typeof e == "string")
@@ -1258,17 +1258,17 @@ function Pt(i, e) {
1258
1258
  t = null;
1259
1259
  }
1260
1260
  const s = typeof t == "object" && t !== null ? t : {};
1261
- if (s.v !== void 0 && s.v !== Be)
1261
+ if (s.v !== void 0 && s.v !== Ge)
1262
1262
  throw new h(o.ONEID_AUTHORIZATION_FAILED, "앱 채널 버전이 다릅니다", { appError: "unsupported" });
1263
1263
  if (s.id !== i)
1264
1264
  throw new h(o.ONEID_AUTHORIZATION_FAILED, "앱 응답의 요청 id 가 다릅니다");
1265
1265
  if (s.ok !== !0) {
1266
1266
  const a = (r = s.error) == null ? void 0 : r.code, l = typeof ((n = s.error) == null ? void 0 : n.message) == "string" && s.error.message ? s.error.message : "앱이 요청을 처리하지 못했습니다";
1267
- throw new h(Ns(a), l, { appError: typeof a == "string" ? a : "unknown" });
1267
+ throw new h(Os(a), l, { appError: typeof a == "string" ? a : "unknown" });
1268
1268
  }
1269
1269
  return typeof s.payload == "object" && s.payload !== null ? s.payload : {};
1270
1270
  }
1271
- function Os(i, e) {
1271
+ function Ps(i, e) {
1272
1272
  return new Promise((t, s) => {
1273
1273
  const r = () => s(ae());
1274
1274
  e.addEventListener("abort", r, { once: !0 }), Promise.resolve(i).then(
@@ -1281,29 +1281,29 @@ function Os(i, e) {
1281
1281
  );
1282
1282
  });
1283
1283
  }
1284
- function Ps(i) {
1285
- const e = (t, s, r) => i.postMessage({ v: Be, id: r, type: t, payload: s });
1284
+ function Cs(i) {
1285
+ const e = (t, s, r) => i.postMessage({ v: Ge, id: r, type: t, payload: s });
1286
1286
  return {
1287
1287
  async request(t, s, r) {
1288
1288
  if (r != null && r.aborted) throw ae();
1289
- const n = pe();
1289
+ const n = we();
1290
1290
  let a;
1291
1291
  try {
1292
- a = await (r ? Os(e(t, s, n), r) : e(t, s, n));
1292
+ a = await (r ? Ps(e(t, s, n), r) : e(t, s, n));
1293
1293
  } catch (l) {
1294
1294
  throw r != null && r.aborted ? ae() : new h(o.ONEID_AUTHORIZATION_FAILED, "앱이 요청을 거부했습니다", l);
1295
1295
  }
1296
1296
  if (a === void 0)
1297
1297
  throw new h(o.ONEID_AUTHORIZATION_FAILED, "앱이 이 요청을 지원하지 않습니다", { appError: "unsupported" });
1298
- return Pt(n, a);
1298
+ return Ct(n, a);
1299
1299
  },
1300
1300
  notify(t, s) {
1301
- Promise.resolve(e(t, s, pe())).catch(() => {
1301
+ Promise.resolve(e(t, s, we())).catch(() => {
1302
1302
  });
1303
1303
  }
1304
1304
  };
1305
1305
  }
1306
- function Cs(i) {
1306
+ function Ds(i) {
1307
1307
  const e = /* @__PURE__ */ new Map();
1308
1308
  i.onmessage = (s) => {
1309
1309
  var a;
@@ -1317,10 +1317,10 @@ function Cs(i) {
1317
1317
  const n = e.get(r);
1318
1318
  n && (e.delete(r), n(s.data));
1319
1319
  };
1320
- const t = (s, r, n) => i.postMessage(JSON.stringify({ v: Be, id: n, type: s, payload: r }));
1320
+ const t = (s, r, n) => i.postMessage(JSON.stringify({ v: Ge, id: n, type: s, payload: r }));
1321
1321
  return {
1322
1322
  request(s, r, n) {
1323
- const a = pe();
1323
+ const a = we();
1324
1324
  return new Promise((l, d) => {
1325
1325
  if (n != null && n.aborted) {
1326
1326
  d(ae());
@@ -1332,7 +1332,7 @@ function Cs(i) {
1332
1332
  n == null || n.addEventListener("abort", g, { once: !0 }), e.set(a, (u) => {
1333
1333
  n == null || n.removeEventListener("abort", g);
1334
1334
  try {
1335
- l(Pt(a, u));
1335
+ l(Ct(a, u));
1336
1336
  } catch (_) {
1337
1337
  d(_);
1338
1338
  }
@@ -1346,29 +1346,29 @@ function Cs(i) {
1346
1346
  },
1347
1347
  notify(s, r) {
1348
1348
  try {
1349
- t(s, r, pe());
1349
+ t(s, r, we());
1350
1350
  } catch {
1351
1351
  }
1352
1352
  }
1353
1353
  };
1354
1354
  }
1355
- function Ds(i = typeof window < "u" ? window : void 0) {
1355
+ function xs(i = typeof window < "u" ? window : void 0) {
1356
1356
  var r, n;
1357
1357
  if (!i) return null;
1358
1358
  const e = i;
1359
1359
  if (e.self === e.top) return null;
1360
- const t = (n = (r = e.webkit) == null ? void 0 : r.messageHandlers) == null ? void 0 : n[Rs];
1361
- if (t && typeof t.postMessage == "function") return ot(t, () => Ps(t));
1360
+ const t = (n = (r = e.webkit) == null ? void 0 : r.messageHandlers) == null ? void 0 : n[Ns];
1361
+ if (t && typeof t.postMessage == "function") return ct(t, () => Cs(t));
1362
1362
  const s = e.onepocketSecureFrame;
1363
- return s && typeof s.postMessage == "function" ? ot(s, () => Cs(s)) : null;
1363
+ return s && typeof s.postMessage == "function" ? ct(s, () => Ds(s)) : null;
1364
1364
  }
1365
- const at = /* @__PURE__ */ new WeakMap();
1366
- function ot(i, e) {
1367
- let t = at.get(i);
1368
- return t || (t = e(), at.set(i, t)), t;
1365
+ const ot = /* @__PURE__ */ new WeakMap();
1366
+ function ct(i, e) {
1367
+ let t = ot.get(i);
1368
+ return t || (t = e(), ot.set(i, t)), t;
1369
1369
  }
1370
- const ct = 300 * 1e3, xs = 600 * 1e3, Ne = "crossx.oneid.pending", vs = "/auth/app-callback", ks = 1e3;
1371
- function Ct(i) {
1370
+ const lt = 300 * 1e3, vs = 600 * 1e3, Oe = "crossx.oneid.pending", ks = "/auth/app-callback", Us = 1e3;
1371
+ function Dt(i) {
1372
1372
  switch (i) {
1373
1373
  case "access_denied":
1374
1374
  return o.USER_REJECTED;
@@ -1382,7 +1382,7 @@ function Ct(i) {
1382
1382
  return o.ONEID_AUTHORIZATION_FAILED;
1383
1383
  }
1384
1384
  }
1385
- function Us(i) {
1385
+ function bs(i) {
1386
1386
  switch (i) {
1387
1387
  case "session_evicted":
1388
1388
  return o.ONEID_SESSION_EVICTED;
@@ -1394,11 +1394,11 @@ function Us(i) {
1394
1394
  return o.ONEID_SESSION_INVALID;
1395
1395
  }
1396
1396
  }
1397
- const bs = 15 * 1e3;
1398
- function Ls(i) {
1397
+ const Ls = 15 * 1e3;
1398
+ function Ws(i) {
1399
1399
  return typeof AbortSignal < "u" && typeof AbortSignal.timeout == "function" ? AbortSignal.timeout(i) : void 0;
1400
1400
  }
1401
- const Ws = 300 * 1e3, oe = "https://return-to.invalid";
1401
+ const Ms = 300 * 1e3, oe = "https://return-to.invalid";
1402
1402
  function ce(i) {
1403
1403
  if (typeof i != "string" || !i.startsWith("/") || /[\u0000-\u001f\u007f\\]/.test(i)) return;
1404
1404
  let e;
@@ -1421,7 +1421,7 @@ function z(i) {
1421
1421
  }
1422
1422
  return e.toString().replace(/\/+$/, "");
1423
1423
  }
1424
- function Dt(i) {
1424
+ function be(i) {
1425
1425
  const e = i.split(".")[1];
1426
1426
  if (!e) return null;
1427
1427
  try {
@@ -1433,10 +1433,10 @@ function Dt(i) {
1433
1433
  return null;
1434
1434
  }
1435
1435
  }
1436
- function Ms(i) {
1436
+ function Fs(i) {
1437
1437
  return { get: (e) => typeof i[e] == "string" ? i[e] : null };
1438
1438
  }
1439
- function lt(i, e, t) {
1439
+ function ht(i, e, t) {
1440
1440
  const s = i.get("state");
1441
1441
  if (!s || s !== e)
1442
1442
  throw new h(o.ONEID_STATE_MISMATCH, "ONE ID 로그인 결과의 state가 다릅니다");
@@ -1445,7 +1445,7 @@ function lt(i, e, t) {
1445
1445
  const r = i.get("error");
1446
1446
  if (r) {
1447
1447
  const a = i.get("error_description") ?? void 0;
1448
- throw new h(Ct(r), a || `ONE ID 인가 오류: ${r}`, {
1448
+ throw new h(Dt(r), a || `ONE ID 인가 오류: ${r}`, {
1449
1449
  error: r,
1450
1450
  error_description: a
1451
1451
  });
@@ -1455,12 +1455,12 @@ function lt(i, e, t) {
1455
1455
  throw new h(o.ONEID_AUTHORIZATION_FAILED, "ONE ID 로그인 결과에 code가 없습니다");
1456
1456
  return n;
1457
1457
  }
1458
- function Fs(i) {
1458
+ function Bs(i) {
1459
1459
  if (typeof i != "object" || i === null) return !1;
1460
1460
  const e = i.type;
1461
- return e === ms || e === Ot;
1461
+ return e === Ts || e === Pt;
1462
1462
  }
1463
- function ht(i, e) {
1463
+ function dt(i, e) {
1464
1464
  if (typeof i.access_token != "string" || i.access_token === "")
1465
1465
  throw new h(o.ONEID_AUTHORIZATION_FAILED, "토큰 응답에 access_token이 없습니다");
1466
1466
  const t = typeof i.expires_in == "number" ? i.expires_in : 0;
@@ -1473,7 +1473,7 @@ function ht(i, e) {
1473
1473
  scope: typeof i.scope == "string" ? i.scope : void 0
1474
1474
  };
1475
1475
  }
1476
- class Bs {
1476
+ class Gs {
1477
1477
  constructor() {
1478
1478
  this.reason = null, this.onAbort = null;
1479
1479
  }
@@ -1486,7 +1486,7 @@ class Bs {
1486
1486
  throw new h(o.USER_REJECTED, this.reason);
1487
1487
  }
1488
1488
  }
1489
- class Gs {
1489
+ class Hs {
1490
1490
  constructor(e = {}) {
1491
1491
  this.abortPending = null, this.popupSeq = 0, this.options = e;
1492
1492
  }
@@ -1517,7 +1517,7 @@ class Gs {
1517
1517
  if (!e.clientId)
1518
1518
  throw new h(o.INVALID_CONFIG, "ONE ID clientId가 비어 있습니다");
1519
1519
  this.cancelPending("새 ONE ID 로그인 요청으로 이전 대기를 중단했습니다");
1520
- const n = new Bs(), a = (l) => n.abort(l);
1520
+ const n = new Gs(), a = (l) => n.abort(l);
1521
1521
  this.abortPending = a;
1522
1522
  try {
1523
1523
  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);
@@ -1539,9 +1539,9 @@ class Gs {
1539
1539
  o.ONEID_STATE_MISMATCH,
1540
1540
  "진행 중인 ONE ID 로그인이 없습니다. 다시 로그인해 주세요."
1541
1541
  );
1542
- if (this.now() - r.createdAt > xs)
1542
+ if (this.now() - r.createdAt > vs)
1543
1543
  throw new h(o.ONEID_TIMEOUT, "ONE ID 로그인 시간이 지났습니다");
1544
- const a = lt(n, r.state, s);
1544
+ const a = ht(n, r.state, s);
1545
1545
  return { tokens: await this.exchangeCode(
1546
1546
  { ...e, issuer: s },
1547
1547
  a,
@@ -1563,16 +1563,16 @@ class Gs {
1563
1563
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
1564
1564
  body: r,
1565
1565
  // refresh 는 탭 사이 잠금을 쥔 채 기다린다 — 응답이 안 오면 다른 탭까지 멈추므로 끊는다 (DEV2TF-2912)
1566
- signal: Ls(bs)
1566
+ signal: Ws(Ls)
1567
1567
  });
1568
1568
  } catch (d) {
1569
1569
  throw new h(o.NETWORK_ERROR, "ONE ID 세션을 갱신하지 못했습니다", d);
1570
1570
  }
1571
- const a = await Oe(n);
1571
+ const a = await Pe(n);
1572
1572
  if (!n.ok) {
1573
1573
  if (n.status === 400 && a.error === "invalid_grant") {
1574
1574
  const d = typeof a.error_reason == "string" ? a.error_reason : void 0;
1575
- throw new h(Us(d), "ONE ID 세션이 끝났습니다. 다시 로그인해 주세요.", {
1575
+ throw new h(bs(d), "ONE ID 세션이 끝났습니다. 다시 로그인해 주세요.", {
1576
1576
  error: "invalid_grant",
1577
1577
  error_reason: d
1578
1578
  });
@@ -1585,7 +1585,7 @@ class Gs {
1585
1585
  error: a.error
1586
1586
  });
1587
1587
  }
1588
- const l = ht(a, this.now());
1588
+ const l = dt(a, this.now());
1589
1589
  return { ...l, refreshToken: l.refreshToken ?? t };
1590
1590
  }
1591
1591
  async logout(e, t) {
@@ -1606,34 +1606,34 @@ class Gs {
1606
1606
  }
1607
1607
  // ─── 내부 ───────────────────────────────────────────────
1608
1608
  findAppChannel() {
1609
- return this.options.appChannel !== void 0 ? this.options.appChannel : Ds();
1609
+ return this.options.appChannel !== void 0 ? this.options.appChannel : xs();
1610
1610
  }
1611
1611
  /**
1612
1612
  * 원포켓 앱에 인증을 맡긴다 (docs/30 §5). PAR · 토큰 교환은 이 페이지(보안 화면 origin)에서 하고,
1613
1613
  * 앱은 인증 화면을 열어 결과만 돌려준다. PKCE verifier 는 이 함수 밖으로 나가지 않는다.
1614
1614
  */
1615
1615
  async authorizeWithApp(e, t, s) {
1616
- const r = `${window.location.origin}${vs}`, n = Y(), a = Y(), l = ye(), d = await Re(l), g = await this.pushAuthorizationRequest(t, r, n, a, d);
1616
+ const r = `${window.location.origin}${ks}`, n = Y(), a = Y(), l = Re(), d = await Ne(l), g = await this.pushAuthorizationRequest(t, r, n, a, d);
1617
1617
  s.throwIfAborted(), c.log("[CROSSx] ONE ID 로그인 — 원포켓 앱 인증 화면", { issuer: t.issuer, clientId: t.clientId });
1618
- const u = this.authorizeUrl(t, g), _ = await new Promise((E, w) => {
1619
- let f = !1;
1620
- const S = new AbortController(), I = (y) => {
1621
- f || (f = !0, s.onAbort = null, clearTimeout(O), S.abort(), y());
1622
- }, T = () => e.notify("oneid.cancel", {}), O = setTimeout(() => {
1623
- I(() => {
1618
+ const u = this.authorizeUrl(t, g), _ = await new Promise((S, w) => {
1619
+ let m = !1;
1620
+ const f = new AbortController(), E = (R) => {
1621
+ m || (m = !0, s.onAbort = null, clearTimeout(y), f.abort(), R());
1622
+ }, T = () => e.notify("oneid.cancel", {}), y = setTimeout(() => {
1623
+ E(() => {
1624
1624
  T(), w(new h(o.ONEID_TIMEOUT, "ONE ID 로그인 응답 시간이 지났습니다"));
1625
1625
  });
1626
- }, ct);
1627
- s.onAbort = (y) => {
1628
- I(() => {
1629
- T(), w(new h(o.USER_REJECTED, y));
1626
+ }, lt);
1627
+ s.onAbort = (R) => {
1628
+ E(() => {
1629
+ T(), w(new h(o.USER_REJECTED, R));
1630
1630
  });
1631
- }, e.request("oneid.authorize", { authorizeUrl: u, state: n }, S.signal).then(
1632
- (y) => I(() => E(y)),
1633
- (y) => I(() => w(y))
1631
+ }, e.request("oneid.authorize", { authorizeUrl: u, state: n }, f.signal).then(
1632
+ (R) => E(() => S(R)),
1633
+ (R) => E(() => w(R))
1634
1634
  );
1635
- }), p = lt(Ms(_), n, t.issuer), A = await this.exchangeCode(t, p, l, r, a);
1636
- return c.log("[CROSSx] ONE ID 로그인 완료 (원포켓 앱)"), { status: "completed", tokens: A, returnTo: ce(t.returnTo) };
1635
+ }), p = ht(Fs(_), n, t.issuer), I = await this.exchangeCode(t, p, l, r, a);
1636
+ return c.log("[CROSSx] ONE ID 로그인 완료 (원포켓 앱)"), { status: "completed", tokens: I, returnTo: ce(t.returnTo) };
1637
1637
  }
1638
1638
  openBlankPopup(e = 500, t = 700) {
1639
1639
  const s = Math.max(e, 500), r = Math.max(t, 700), n = window.screenX + (window.outerWidth - s) / 2, a = window.screenY + (window.outerHeight - r) / 2;
@@ -1649,7 +1649,7 @@ class Gs {
1649
1649
  client_id: e.clientId,
1650
1650
  response_type: "code",
1651
1651
  redirect_uri: t,
1652
- scope: e.scope ?? ys,
1652
+ scope: e.scope ?? Rs,
1653
1653
  state: s,
1654
1654
  nonce: r,
1655
1655
  code_challenge: n,
@@ -1665,7 +1665,7 @@ class Gs {
1665
1665
  } catch (g) {
1666
1666
  throw new h(o.NETWORK_ERROR, "ONE ID 로그인 요청을 보내지 못했습니다", g);
1667
1667
  }
1668
- const d = await Oe(l);
1668
+ const d = await Pe(l);
1669
1669
  if (!l.ok || typeof d.request_uri != "string")
1670
1670
  throw new h(o.ONEID_AUTHORIZATION_FAILED, "ONE ID 로그인 요청이 거부되었습니다", {
1671
1671
  status: l.status,
@@ -1695,83 +1695,83 @@ class Gs {
1695
1695
  } catch (u) {
1696
1696
  throw new h(o.NETWORK_ERROR, "ONE ID 토큰을 받지 못했습니다", u);
1697
1697
  }
1698
- const d = await Oe(l);
1698
+ const d = await Pe(l);
1699
1699
  if (!l.ok)
1700
1700
  throw new h(o.ONEID_AUTHORIZATION_FAILED, "ONE ID 토큰 교환이 거부되었습니다", {
1701
1701
  status: l.status,
1702
1702
  error: d.error
1703
1703
  });
1704
- const g = ht(d, this.now());
1704
+ const g = dt(d, this.now());
1705
1705
  if (g.idToken) {
1706
- const u = Dt(g.idToken);
1706
+ const u = be(g.idToken);
1707
1707
  if (!u || u.iss !== e.issuer || u.nonce !== n)
1708
1708
  throw new h(o.ONEID_ISSUER_MISMATCH, "ONE ID id_token의 발급자나 nonce가 요청과 다릅니다");
1709
- 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 + Ws > this.now()))
1709
+ const _ = u.aud, p = _ === e.clientId || Array.isArray(_) && _.includes(e.clientId), I = typeof u.exp == "number" ? u.exp * 1e3 : Number.NaN;
1710
+ if (!p || !(I + Ms > this.now()))
1711
1711
  throw new h(o.ONEID_ISSUER_MISMATCH, "ONE ID id_token의 대상이 이 앱이 아니거나 만료되었습니다");
1712
1712
  }
1713
1713
  return g;
1714
1714
  }
1715
1715
  async authorizeWithPopup(e, t, s) {
1716
- const r = new URL(t.issuer).origin, n = `${t.issuer}${Is}`, a = Y(), l = Y(), d = ye(), g = await Re(d), u = await this.pushAuthorizationRequest(t, n, a, l, g);
1716
+ const r = new URL(t.issuer).origin, n = `${t.issuer}${ms}`, a = Y(), l = Y(), d = Re(), g = await Ne(d), u = await this.pushAuthorizationRequest(t, n, a, l, g);
1717
1717
  s.throwIfAborted(), c.log("[CROSSx] ONE ID 로그인 팝업 이동", { issuer: t.issuer, clientId: t.clientId }), e.location.href = this.authorizeUrl(t, u);
1718
- const _ = await new Promise((A, E) => {
1719
- let w = 0, f = 0;
1720
- const S = () => {
1721
- s.onAbort = null, clearTimeout(T), clearInterval(O), window.removeEventListener("message", y);
1722
- }, I = (R) => {
1723
- S(), E(R);
1718
+ const _ = await new Promise((I, S) => {
1719
+ let w = 0, m = 0;
1720
+ const f = () => {
1721
+ s.onAbort = null, clearTimeout(T), clearInterval(y), window.removeEventListener("message", R);
1722
+ }, E = (N) => {
1723
+ f(), S(N);
1724
1724
  }, T = setTimeout(() => {
1725
- I(new h(o.ONEID_TIMEOUT, "ONE ID 로그인 응답 시간이 지났습니다"));
1726
- }, ct), O = setInterval(() => {
1727
- f++;
1728
- let R;
1725
+ E(new h(o.ONEID_TIMEOUT, "ONE ID 로그인 응답 시간이 지났습니다"));
1726
+ }, lt), y = setInterval(() => {
1727
+ m++;
1728
+ let N;
1729
1729
  try {
1730
- R = e.closed;
1730
+ N = e.closed;
1731
1731
  } catch {
1732
1732
  return;
1733
1733
  }
1734
- if (R) {
1734
+ if (N) {
1735
1735
  if (w === 0) {
1736
- w = f;
1736
+ w = m;
1737
1737
  return;
1738
1738
  }
1739
- c.warn("[CROSSx] ONE ID 팝업이 닫혔거나 연결이 끊겼습니다(COOP) — 로그인을 취소합니다"), I(new h(o.USER_REJECTED, "ONE ID 로그인이 취소되었습니다", { reason: "popup_closed_or_detached" }));
1739
+ c.warn("[CROSSx] ONE ID 팝업이 닫혔거나 연결이 끊겼습니다(COOP) — 로그인을 취소합니다"), E(new h(o.USER_REJECTED, "ONE ID 로그인이 취소되었습니다", { reason: "popup_closed_or_detached" }));
1740
1740
  }
1741
- }, ks), y = (R) => {
1742
- if (R.origin !== r || R.source !== e || !Fs(R.data)) return;
1743
- const N = R.data;
1744
- if (N.state !== a) {
1741
+ }, Us), R = (N) => {
1742
+ if (N.origin !== r || N.source !== e || !Bs(N.data)) return;
1743
+ const O = N.data;
1744
+ if (O.state !== a) {
1745
1745
  c.warn("[CROSSx] ONE ID 결과 state가 현재 요청과 달라 무시합니다");
1746
1746
  return;
1747
1747
  }
1748
1748
  try {
1749
- e.postMessage({ type: Ts, state: a }, r);
1749
+ e.postMessage({ type: ys, state: a }, r);
1750
1750
  } catch {
1751
1751
  }
1752
- if (N.iss !== t.issuer) {
1753
- I(new h(o.ONEID_ISSUER_MISMATCH, "ONE ID 로그인 결과의 발급자가 다릅니다"));
1752
+ if (O.iss !== t.issuer) {
1753
+ E(new h(o.ONEID_ISSUER_MISMATCH, "ONE ID 로그인 결과의 발급자가 다릅니다"));
1754
1754
  return;
1755
1755
  }
1756
- if (N.type === Ot || N.error) {
1757
- const D = N.error ?? "unknown_error";
1758
- c.warn("[CROSSx] ONE ID 인가 오류:", D), I(
1759
- new h(Ct(D), N.error_description || `ONE ID 인가 오류: ${D}`, {
1760
- error: D,
1761
- error_description: N.error_description
1756
+ if (O.type === Pt || O.error) {
1757
+ const P = O.error ?? "unknown_error";
1758
+ c.warn("[CROSSx] ONE ID 인가 오류:", P), E(
1759
+ new h(Dt(P), O.error_description || `ONE ID 인가 오류: ${P}`, {
1760
+ error: P,
1761
+ error_description: O.error_description
1762
1762
  })
1763
1763
  );
1764
1764
  return;
1765
1765
  }
1766
- if (!N.code) {
1767
- I(new h(o.ONEID_AUTHORIZATION_FAILED, "ONE ID 로그인 결과에 code가 없습니다"));
1766
+ if (!O.code) {
1767
+ E(new h(o.ONEID_AUTHORIZATION_FAILED, "ONE ID 로그인 결과에 code가 없습니다"));
1768
1768
  return;
1769
1769
  }
1770
- S(), A(N.code);
1770
+ f(), I(O.code);
1771
1771
  };
1772
- s.onAbort = (R) => {
1773
- I(new h(o.USER_REJECTED, R));
1774
- }, window.addEventListener("message", y);
1772
+ s.onAbort = (N) => {
1773
+ E(new h(o.USER_REJECTED, N));
1774
+ }, window.addEventListener("message", R);
1775
1775
  }), p = await this.exchangeCode(t, _, d, n, l);
1776
1776
  return c.log("[CROSSx] ONE ID 로그인 완료 (팝업)"), { status: "completed", tokens: p, returnTo: ce(t.returnTo) };
1777
1777
  }
@@ -1779,7 +1779,7 @@ class Gs {
1779
1779
  const s = e.redirectUri ?? `${window.location.origin}/auth/callback`;
1780
1780
  if (new URL(s).origin !== window.location.origin)
1781
1781
  throw new h(o.INVALID_CONFIG, "ONE ID redirectUri는 지금 페이지와 같은 origin이어야 합니다");
1782
- const r = Y(), n = Y(), a = ye(), l = await Re(a), d = await this.pushAuthorizationRequest(e, s, r, n, l);
1782
+ const r = Y(), n = Y(), a = Re(), l = await Ne(a), d = await this.pushAuthorizationRequest(e, s, r, n, l);
1783
1783
  t.throwIfAborted();
1784
1784
  const g = {
1785
1785
  issuer: e.issuer,
@@ -1791,14 +1791,14 @@ class Gs {
1791
1791
  returnTo: ce(e.returnTo),
1792
1792
  createdAt: this.now()
1793
1793
  };
1794
- this.pendingStorage.setItem(Ne, JSON.stringify(g)), c.log("[CROSSx] ONE ID 로그인 같은 창 이동", { issuer: e.issuer, clientId: e.clientId });
1794
+ this.pendingStorage.setItem(Oe, JSON.stringify(g)), c.log("[CROSSx] ONE ID 로그인 같은 창 이동", { issuer: e.issuer, clientId: e.clientId });
1795
1795
  const u = this.authorizeUrl(e, d);
1796
1796
  return (this.options.navigate ?? ((_) => window.location.assign(_)))(u), { status: "redirecting" };
1797
1797
  }
1798
1798
  /** 진행 정보를 꺼내고 지운다 (한 번만 쓴다) */
1799
1799
  takePending() {
1800
- const e = this.pendingStorage.getItem(Ne);
1801
- if (this.pendingStorage.removeItem(Ne), !e) return null;
1800
+ const e = this.pendingStorage.getItem(Oe);
1801
+ if (this.pendingStorage.removeItem(Oe), !e) return null;
1802
1802
  try {
1803
1803
  const t = JSON.parse(e);
1804
1804
  return typeof (t == null ? void 0 : t.state) == "string" && typeof t.codeVerifier == "string" ? t : null;
@@ -1807,7 +1807,7 @@ class Gs {
1807
1807
  }
1808
1808
  }
1809
1809
  }
1810
- async function Oe(i) {
1810
+ async function Pe(i) {
1811
1811
  try {
1812
1812
  const e = await i.json();
1813
1813
  return typeof e == "object" && e !== null ? e : {};
@@ -1815,21 +1815,21 @@ async function Oe(i) {
1815
1815
  return {};
1816
1816
  }
1817
1817
  }
1818
- const le = "crossx.oneid.session", Pe = 60 * 1e3, be = /* @__PURE__ */ new Set([
1818
+ const le = "crossx.oneid.session", Ce = 60 * 1e3, Le = /* @__PURE__ */ new Set([
1819
1819
  o.ONEID_SESSION_EVICTED,
1820
1820
  o.ONEID_SESSION_REVOKED,
1821
1821
  o.ONEID_SESSION_EXPIRED,
1822
1822
  o.ONEID_SESSION_INVALID
1823
1823
  ]);
1824
- function Ce(i) {
1825
- return i instanceof h && be.has(i.code);
1824
+ function he(i) {
1825
+ return i instanceof h && Le.has(i.code);
1826
1826
  }
1827
- const Hs = "crossx.oneid.refresh";
1828
- function Ks(i) {
1827
+ const Ks = "crossx.oneid.refresh";
1828
+ function Vs(i) {
1829
1829
  const e = typeof navigator < "u" ? navigator.locks : void 0;
1830
- return e ? e.request(Hs, i) : i();
1830
+ return e ? e.request(Ks, i) : i();
1831
1831
  }
1832
- class Vs {
1832
+ class $s {
1833
1833
  constructor(e, t, s, r = () => Date.now()) {
1834
1834
  this.port = e, this.config = t, this.storage = s, this.now = r, this.refreshing = null, this.generation = 0;
1835
1835
  }
@@ -1841,7 +1841,7 @@ class Vs {
1841
1841
  clientId: this.config.clientId,
1842
1842
  tokens: e
1843
1843
  };
1844
- return this.storage.setItem(le, JSON.stringify(t)), dt(t);
1844
+ return this.storage.setItem(le, JSON.stringify(t)), ut(t);
1845
1845
  }
1846
1846
  /**
1847
1847
  * 보관한 세션을 돌려준다. access token이 끝나 가면 갱신한다. 없으면 null.
@@ -1849,7 +1849,7 @@ class Vs {
1849
1849
  */
1850
1850
  async get() {
1851
1851
  const e = await this.ensureFresh();
1852
- return e ? dt(e) : null;
1852
+ return e ? ut(e) : null;
1853
1853
  }
1854
1854
  /** 유효한 access token. 로그인하지 않았으면 `AUTH_NOT_AUTHENTICATED` */
1855
1855
  async getAccessToken() {
@@ -1869,11 +1869,11 @@ class Vs {
1869
1869
  const e = this.read();
1870
1870
  if (this.clear(), !e) return;
1871
1871
  let t = e.tokens.accessToken;
1872
- if (e.tokens.refreshToken && e.tokens.expiresAt - Pe <= this.now())
1872
+ if (e.tokens.refreshToken && e.tokens.expiresAt - Ce <= this.now())
1873
1873
  try {
1874
1874
  t = (await this.port.refresh(this.config, e.tokens.refreshToken)).accessToken;
1875
1875
  } catch (s) {
1876
- if (s instanceof h && be.has(s.code)) return;
1876
+ if (s instanceof h && Le.has(s.code)) return;
1877
1877
  }
1878
1878
  await this.port.logout(this.config, t);
1879
1879
  }
@@ -1894,13 +1894,13 @@ class Vs {
1894
1894
  async ensureFresh() {
1895
1895
  const e = this.read();
1896
1896
  if (!e) return null;
1897
- if (e.tokens.expiresAt - Pe > this.now())
1897
+ if (e.tokens.expiresAt - Ce > this.now())
1898
1898
  return e;
1899
1899
  if (!e.tokens.refreshToken) {
1900
1900
  if (e.tokens.expiresAt > this.now()) return e;
1901
1901
  throw this.clear(), new h(o.ONEID_SESSION_EXPIRED, "ONE ID 로그인이 만료되었습니다. 다시 로그인해 주세요.");
1902
1902
  }
1903
- return this.refreshing ?? (this.refreshing = Ks(() => this.refresh(e.tokens.refreshToken)).finally(() => {
1903
+ return this.refreshing ?? (this.refreshing = Vs(() => this.refresh(e.tokens.refreshToken)).finally(() => {
1904
1904
  this.refreshing = null;
1905
1905
  })), this.refreshing;
1906
1906
  }
@@ -1912,7 +1912,7 @@ class Vs {
1912
1912
  async refresh(e) {
1913
1913
  const t = this.read();
1914
1914
  if (!t) return null;
1915
- if (t.tokens.refreshToken !== e && t.tokens.expiresAt - Pe > this.now())
1915
+ if (t.tokens.refreshToken !== e && t.tokens.expiresAt - Ce > this.now())
1916
1916
  return t;
1917
1917
  if (!t.tokens.refreshToken) {
1918
1918
  if (t.tokens.expiresAt > this.now()) return t;
@@ -1920,35 +1920,35 @@ class Vs {
1920
1920
  }
1921
1921
  const s = this.generation;
1922
1922
  try {
1923
- const r = await this.port.refresh(this.config, t.tokens.refreshToken), n = { ...t, tokens: r };
1923
+ const r = await this.port.refresh(this.config, t.tokens.refreshToken), n = { ...r, idToken: r.idToken ?? t.tokens.idToken }, a = { ...t, tokens: n };
1924
1924
  if (s !== this.generation)
1925
1925
  throw new h(o.AUTH_NOT_AUTHENTICATED, "ONE ID 세션이 바뀌었습니다");
1926
- return this.storage.setItem(le, JSON.stringify(n)), n;
1926
+ return this.storage.setItem(le, JSON.stringify(a)), a;
1927
1927
  } catch (r) {
1928
1928
  if (s !== this.generation) throw r;
1929
- if (r instanceof h && be.has(r.code))
1929
+ if (r instanceof h && Le.has(r.code))
1930
1930
  throw this.clear(), r;
1931
1931
  if (t.tokens.expiresAt > this.now()) return t;
1932
1932
  throw r;
1933
1933
  }
1934
1934
  }
1935
1935
  }
1936
- function dt(i) {
1937
- const e = i.tokens.idToken ? Dt(i.tokens.idToken) : null;
1936
+ function ut(i) {
1937
+ 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
1938
  return {
1939
- subject: typeof (e == null ? void 0 : e.sub) == "string" ? e.sub : "",
1939
+ subject: typeof (t == null ? void 0 : t.sub) == "string" ? t.sub : "",
1940
1940
  clientId: i.clientId,
1941
1941
  issuer: i.issuer,
1942
1942
  scope: i.tokens.scope,
1943
1943
  expiresAt: i.tokens.expiresAt
1944
1944
  };
1945
1945
  }
1946
- function $s(i) {
1946
+ function Ys(i) {
1947
1947
  return i === "local" ? window.localStorage : window.sessionStorage;
1948
1948
  }
1949
- const Ys = new TextEncoder();
1950
- function P(i) {
1951
- return Ys.encode(i);
1949
+ const qs = new TextEncoder();
1950
+ function C(i) {
1951
+ return qs.encode(i);
1952
1952
  }
1953
1953
  function F(...i) {
1954
1954
  const e = new Uint8Array(i.reduce((s, r) => s + r.length, 0));
@@ -1957,7 +1957,7 @@ function F(...i) {
1957
1957
  e.set(s, t), t += s.length;
1958
1958
  return e;
1959
1959
  }
1960
- function qs(i) {
1960
+ function js(i) {
1961
1961
  return new Uint8Array([i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, i & 255]);
1962
1962
  }
1963
1963
  function k(i) {
@@ -1973,74 +1973,74 @@ function Z(i) {
1973
1973
  function De(i) {
1974
1974
  return k(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1975
1975
  }
1976
- function js(i) {
1976
+ function zs(i) {
1977
1977
  let e = i.replace(/-/g, "+").replace(/_/g, "/");
1978
1978
  for (; e.length % 4; ) e += "=";
1979
1979
  return Z(e);
1980
1980
  }
1981
- function zs(i) {
1981
+ function Js(i) {
1982
1982
  return globalThis.crypto.getRandomValues(new Uint8Array(i));
1983
1983
  }
1984
1984
  async function xt(i) {
1985
1985
  return new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", i));
1986
1986
  }
1987
- const x = globalThis.crypto.subtle, Ge = { name: "ECDH", namedCurve: "P-256" }, Js = 32, Xs = 12, Zs = 32;
1987
+ const x = globalThis.crypto.subtle, He = { name: "ECDH", namedCurve: "P-256" }, Xs = 32, Zs = 12, Qs = 32;
1988
1988
  function ie(i) {
1989
1989
  return new Uint8Array([i >>> 8 & 255, i & 255]);
1990
1990
  }
1991
- const te = F(P("HPKE"), ie(16), ie(1), ie(2)), ut = F(P("KEM"), ie(16)), H = new Uint8Array(0);
1991
+ const te = F(C("HPKE"), ie(16), ie(1), ie(2)), gt = F(C("KEM"), ie(16)), H = new Uint8Array(0);
1992
1992
  async function vt(i, e) {
1993
1993
  const t = i.length === 0 ? new Uint8Array(32) : i, s = await x.importKey("raw", t, { name: "HMAC", hash: "SHA-256" }, !1, ["sign"]);
1994
1994
  return new Uint8Array(await x.sign("HMAC", s, e));
1995
1995
  }
1996
- async function Qs(i, e, t) {
1996
+ async function er(i, e, t) {
1997
1997
  const s = new Uint8Array(t);
1998
1998
  let r = H;
1999
1999
  for (let n = 1, a = 0; a < t; n++)
2000
2000
  r = await vt(i, F(r, e, new Uint8Array([n]))), s.set(r.subarray(0, Math.min(32, t - a)), a), a += 32;
2001
2001
  return s;
2002
2002
  }
2003
- function _e(i, e, t, s) {
2004
- return vt(i, F(P("HPKE-v1"), s, P(e), t));
2003
+ function fe(i, e, t, s) {
2004
+ return vt(i, F(C("HPKE-v1"), s, C(e), t));
2005
2005
  }
2006
- function Le(i, e, t, s, r) {
2007
- return Qs(i, F(ie(s), P("HPKE-v1"), r, P(e), t), s);
2006
+ function We(i, e, t, s, r) {
2007
+ return er(i, F(ie(s), C("HPKE-v1"), r, C(e), t), s);
2008
2008
  }
2009
2009
  async function kt(i, e) {
2010
- const t = await x.importKey("raw", e, Ge, !1, []);
2010
+ const t = await x.importKey("raw", e, He, !1, []);
2011
2011
  return new Uint8Array(await x.deriveBits({ name: "ECDH", public: t }, i, 256));
2012
2012
  }
2013
2013
  async function Ut(i, e, t) {
2014
- const s = await _e(H, "eae_prk", i, ut);
2015
- return Le(s, "shared_secret", F(e, t), Zs, ut);
2014
+ const s = await fe(H, "eae_prk", i, gt);
2015
+ return We(s, "shared_secret", F(e, t), Qs, gt);
2016
2016
  }
2017
2017
  async function bt(i) {
2018
- const e = await _e(H, "psk_id_hash", H, te), t = await _e(H, "info_hash", H, te), s = F(new Uint8Array([0]), e, t), r = await _e(i, "secret", H, te), n = await Le(r, "key", s, Js, te), a = await Le(r, "base_nonce", s, Xs, te);
2018
+ const e = await fe(H, "psk_id_hash", H, te), t = await fe(H, "info_hash", H, te), s = F(new Uint8Array([0]), e, t), r = await fe(i, "secret", H, te), n = await We(r, "key", s, Xs, te), a = await We(r, "base_nonce", s, Zs, te);
2019
2019
  return { key: n, baseNonce: a };
2020
2020
  }
2021
- function Ie(i, e) {
2021
+ function me(i, e) {
2022
2022
  if (i.length !== 65 || i[0] !== 4)
2023
2023
  throw new Error(`${e} must be SEC1 uncompressed P-256 (65B)`);
2024
2024
  }
2025
2025
  async function Lt() {
2026
- const i = await x.generateKey(Ge, !1, ["deriveBits"]), e = new Uint8Array(await x.exportKey("raw", i.publicKey));
2026
+ const i = await x.generateKey(He, !1, ["deriveBits"]), e = new Uint8Array(await x.exportKey("raw", i.publicKey));
2027
2027
  return { privateKey: i.privateKey, publicKey: e };
2028
2028
  }
2029
- async function er(i, e, t) {
2030
- Ie(i, "recipient public key");
2031
- const s = await x.generateKey(Ge, !1, ["deriveBits"]), r = new Uint8Array(await x.exportKey("raw", s.publicKey)), n = await Ut(await kt(s.privateKey, i), r, i), { key: a, baseNonce: l } = await bt(n), d = await x.importKey("raw", a, "AES-GCM", !1, ["encrypt"]), g = new Uint8Array(
2029
+ async function tr(i, e, t) {
2030
+ me(i, "recipient public key");
2031
+ const s = await x.generateKey(He, !1, ["deriveBits"]), r = new Uint8Array(await x.exportKey("raw", s.publicKey)), n = await Ut(await kt(s.privateKey, i), r, i), { key: a, baseNonce: l } = await bt(n), d = await x.importKey("raw", a, "AES-GCM", !1, ["encrypt"]), g = new Uint8Array(
2032
2032
  await x.encrypt({ name: "AES-GCM", iv: l, additionalData: t }, d, e)
2033
2033
  );
2034
2034
  return { enc: r, ciphertext: g };
2035
2035
  }
2036
- async function tr(i, e, t, s) {
2037
- Ie(e, "enc");
2036
+ async function sr(i, e, t, s) {
2037
+ me(e, "enc");
2038
2038
  const r = await Ut(await kt(i.privateKey, e), e, i.publicKey), { key: n, baseNonce: a } = await bt(r), l = await x.importKey("raw", n, "AES-GCM", !1, ["decrypt"]);
2039
2039
  return new Uint8Array(
2040
2040
  await x.decrypt({ name: "AES-GCM", iv: a, additionalData: s }, l, t)
2041
2041
  );
2042
2042
  }
2043
- const Wt = globalThis.crypto.subtle, sr = { name: "ECDSA", namedCurve: "P-256" }, rr = "one-wallet/authz-sig/v1", ir = "one-wallet/seal-aad/v1", nr = 60, ar = 32, or = {
2043
+ const Wt = globalThis.crypto.subtle, rr = { name: "ECDSA", namedCurve: "P-256" }, ir = "one-wallet/authz-sig/v1", nr = "one-wallet/seal-aad/v1", ar = 60, or = 32, cr = {
2044
2044
  generate: 1,
2045
2045
  recover: 3,
2046
2046
  verify_pin: 4,
@@ -2054,35 +2054,35 @@ const Wt = globalThis.crypto.subtle, sr = { name: "ECDSA", namedCurve: "P-256" }
2054
2054
  sign_typed_data: 21,
2055
2055
  sign_message: 22
2056
2056
  };
2057
- function cr(i) {
2058
- return F(qs(i.length), i);
2057
+ function lr(i) {
2058
+ return F(js(i.length), i);
2059
2059
  }
2060
2060
  function Mt(i, e, t) {
2061
- return F(P(i), ...e.map(cr), new Uint8Array([t]));
2061
+ return F(C(i), ...e.map(lr), new Uint8Array([t]));
2062
2062
  }
2063
- function lr(i, e, t) {
2063
+ function hr(i, e, t) {
2064
2064
  return Mt(
2065
- ir,
2066
- [i.nonce, P(i.expiresAt), i.intentHash, P(e), P(i.authzKeyId)],
2065
+ nr,
2066
+ [i.nonce, C(i.expiresAt), i.intentHash, C(e), C(i.authzKeyId)],
2067
2067
  t
2068
2068
  );
2069
2069
  }
2070
- function hr(i, e, t) {
2070
+ function dr(i, e, t) {
2071
2071
  return Mt(
2072
- rr,
2073
- [i.enc, i.ciphertext, i.nonce, P(i.expiresAt), i.intentHash, P(e), P(i.authzKeyId)],
2072
+ ir,
2073
+ [i.enc, i.ciphertext, i.nonce, C(i.expiresAt), i.intentHash, C(e), C(i.authzKeyId)],
2074
2074
  t
2075
2075
  );
2076
2076
  }
2077
- function dr(i, e, t) {
2078
- return xt(lr(i, e, t));
2077
+ function ur(i, e, t) {
2078
+ return xt(hr(i, e, t));
2079
2079
  }
2080
- function ur(i) {
2080
+ function gr(i) {
2081
2081
  return i.toISOString().replace(/\.\d+Z$/, "Z");
2082
2082
  }
2083
- async function gr(i, e) {
2083
+ async function _r(i, e) {
2084
2084
  if (i.length !== 32) throw new Error("authz private key must be a 32B P-256 scalar");
2085
- return Ie(e, "authz public key"), Wt.importKey(
2085
+ return me(e, "authz public key"), Wt.importKey(
2086
2086
  "jwk",
2087
2087
  {
2088
2088
  kty: "EC",
@@ -2092,22 +2092,22 @@ async function gr(i, e) {
2092
2092
  d: De(i),
2093
2093
  ext: !1
2094
2094
  },
2095
- sr,
2095
+ rr,
2096
2096
  !1,
2097
2097
  ["sign"]
2098
2098
  );
2099
2099
  }
2100
- async function _r(i) {
2100
+ async function fr(i) {
2101
2101
  if (i.intent.command !== i.command) throw new Error("intent.command must match command");
2102
- const e = or[i.command], t = P(JSON.stringify(i.intent)), s = {
2103
- nonce: zs(ar),
2104
- expiresAt: ur(new Date((i.now ?? /* @__PURE__ */ new Date()).getTime() + (i.ttlSec ?? nr) * 1e3)),
2102
+ const e = cr[i.command], t = C(JSON.stringify(i.intent)), s = {
2103
+ nonce: Js(or),
2104
+ expiresAt: gr(new Date((i.now ?? /* @__PURE__ */ new Date()).getTime() + (i.ttlSec ?? ar) * 1e3)),
2105
2105
  intentHash: await xt(t),
2106
2106
  authzKeyId: i.authz.keyId
2107
- }, r = await dr(s, i.bindingId, e), n = { pin: i.plaintext.pin };
2107
+ }, r = await ur(s, i.bindingId, e), n = { pin: i.plaintext.pin };
2108
2108
  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: l } = await er(i.recipientPub, P(JSON.stringify(n)), r), d = new Uint8Array(
2110
- await Wt.sign({ name: "ECDSA", hash: "SHA-256" }, i.authz.signingKey, hr({ ...s, enc: a, ciphertext: l }, i.bindingId, e))
2109
+ const { enc: a, ciphertext: l } = await tr(i.recipientPub, C(JSON.stringify(n)), r), d = new Uint8Array(
2110
+ await Wt.sign({ name: "ECDSA", hash: "SHA-256" }, i.authz.signingKey, dr({ ...s, enc: a, ciphertext: l }, i.bindingId, e))
2111
2111
  );
2112
2112
  return {
2113
2113
  envelope: {
@@ -2125,17 +2125,17 @@ async function _r(i) {
2125
2125
  };
2126
2126
  }
2127
2127
  function Ft(i, e, t) {
2128
- return tr(i, Z(e.enc), Z(e.ciphertext), t);
2128
+ return sr(i, Z(e.enc), Z(e.ciphertext), t);
2129
2129
  }
2130
- const fr = 90 * 1e3;
2131
- class pr {
2130
+ const pr = 90 * 1e3;
2131
+ class wr {
2132
2132
  constructor(e) {
2133
2133
  this.opts = e, this.current = null, this.pending = null, this.generation = 0, this.now = e.now ?? Date.now;
2134
2134
  }
2135
2135
  /** 쓸 수 있는 B 키. 없거나 만료가 가까우면 발급한다 */
2136
2136
  async get() {
2137
2137
  const e = this.current;
2138
- if (e && e.expiresAtMs - this.now() > fr) return e;
2138
+ if (e && e.expiresAtMs - this.now() > pr) return e;
2139
2139
  if (!this.pending) {
2140
2140
  const t = this.issue().finally(() => {
2141
2141
  this.pending === t && (this.pending = null);
@@ -2178,7 +2178,7 @@ class pr {
2178
2178
  } catch (u) {
2179
2179
  throw new h(o.AUTH_FAILED, "failed to open sealed authz key", { cause: u });
2180
2180
  }
2181
- const a = await gr(n, Z(r.key_cert.pubkey));
2181
+ const a = await _r(n, Z(r.key_cert.pubkey));
2182
2182
  n.fill(0);
2183
2183
  const l = Date.parse(r.key_cert.expires_at);
2184
2184
  if (Number.isNaN(l))
@@ -2194,7 +2194,7 @@ class pr {
2194
2194
  return this.current = d, d;
2195
2195
  }
2196
2196
  }
2197
- const wr = 600 * 1e3, Sr = {
2197
+ const Sr = 600 * 1e3, Er = {
2198
2198
  UNAUTHORIZED: o.AUTH_TOKEN_INVALID,
2199
2199
  AUTHZ_TOKEN_INVALID: o.AUTH_TOKEN_INVALID,
2200
2200
  FORBIDDEN: o.AUTH_FAILED,
@@ -2230,8 +2230,8 @@ const wr = 600 * 1e3, Sr = {
2230
2230
  ENVELOPE_INVALID: o.SIGNATURE_FAILED,
2231
2231
  REPLAY: o.SIGNATURE_FAILED
2232
2232
  };
2233
- function Er(i, e) {
2234
- const t = (e == null ? void 0 : e.code) ?? "", s = Sr[t] ?? (i === 401 ? o.AUTH_TOKEN_INVALID : i >= 500 ? o.GATEWAY_INTERNAL_ERROR : o.UNKNOWN_ERROR), r = { status: i, serverCode: t };
2233
+ function Ir(i, e) {
2234
+ const t = (e == null ? void 0 : e.code) ?? "", s = Er[t] ?? (i === 401 ? o.AUTH_TOKEN_INVALID : i >= 500 ? o.GATEWAY_INTERNAL_ERROR : o.UNKNOWN_ERROR), r = { status: i, serverCode: t };
2235
2235
  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);
2236
2236
  }
2237
2237
  class Ar {
@@ -2249,13 +2249,13 @@ class Ar {
2249
2249
  }
2250
2250
  /** enclave 수신 공개키(SEC1 65B) */
2251
2251
  async getRecipientKey() {
2252
- if (this.recipient && this.now() - this.recipient.fetchedAt < wr)
2252
+ if (this.recipient && this.now() - this.recipient.fetchedAt < Sr)
2253
2253
  return this.recipient.key;
2254
2254
  const e = await this.callPublic("GET", "/attestation");
2255
2255
  if (!(e != null && e.recipient_public_key))
2256
2256
  throw new h(o.GATEWAY_INTERNAL_ERROR, "attestation has no recipient_public_key");
2257
2257
  const t = Z(e.recipient_public_key);
2258
- return Ie(t, "recipient_public_key"), this.recipient = { key: t, fetchedAt: this.now() }, t;
2258
+ return me(t, "recipient_public_key"), this.recipient = { key: t, fetchedAt: this.now() }, t;
2259
2259
  }
2260
2260
  /** 수신키 회전 등으로 봉투가 거부되면 다음 요청에서 다시 받는다 */
2261
2261
  forgetRecipientKey() {
@@ -2277,28 +2277,28 @@ class Ar {
2277
2277
  throw new h(o.NETWORK_ERROR, "one-wallet-api request failed", { cause: l });
2278
2278
  }
2279
2279
  if (a.status < 200 || a.status >= 300)
2280
- throw Er(a.status, a.data);
2280
+ throw Ir(a.status, a.data);
2281
2281
  return a.data;
2282
2282
  }
2283
2283
  }
2284
- const xe = (i) => `m/44'/60'/0'/0/${i}`, Ir = /^0x(?:[0-9a-fA-F]{2})*$/;
2285
- function mr(i) {
2284
+ const xe = (i) => `m/44'/60'/0'/0/${i}`, mr = /^0x(?:[0-9a-fA-F]{2})*$/;
2285
+ function Tr(i) {
2286
2286
  try {
2287
- const e = JSON.parse(new TextDecoder().decode(js(i.split(".")[1] ?? "")));
2287
+ const e = JSON.parse(new TextDecoder().decode(zs(i.split(".")[1] ?? "")));
2288
2288
  if (typeof (e == null ? void 0 : e.sub) == "string" && e.sub) return e.sub;
2289
2289
  } catch {
2290
2290
  }
2291
2291
  throw new h(o.AUTH_TOKEN_INVALID, "access token has no sub");
2292
2292
  }
2293
- function Tr(i) {
2294
- if (Ir.test(i)) {
2293
+ function yr(i) {
2294
+ if (mr.test(i)) {
2295
2295
  const e = i.slice(2);
2296
2296
  return Uint8Array.from({ length: e.length / 2 }, (t, s) => parseInt(e.slice(s * 2, s * 2 + 2), 16));
2297
2297
  }
2298
- return P(i);
2298
+ return C(i);
2299
2299
  }
2300
- const gt = (i) => `0x${i.toString(16)}`;
2301
- function _t(i, e) {
2300
+ const _t = (i) => `0x${i.toString(16)}`;
2301
+ function ft(i, e) {
2302
2302
  const t = i.chainId ?? Number(e.split(":")[1]);
2303
2303
  if (!Number.isSafeInteger(t))
2304
2304
  throw new h(o.TX_INVALID_PARAMS, `invalid chain id: ${e}`);
@@ -2312,19 +2312,19 @@ function _t(i, e) {
2312
2312
  gas_price: i.gasPrice,
2313
2313
  max_fee_per_gas: i.maxFeePerGas,
2314
2314
  max_priority_fee_per_gas: i.maxPriorityFeePerGas,
2315
- nonce: gt(i.nonce),
2316
- chain_id: gt(t)
2315
+ nonce: _t(i.nonce),
2316
+ chain_id: _t(t)
2317
2317
  };
2318
2318
  return Object.fromEntries(Object.entries(s).filter(([, r]) => r !== void 0));
2319
2319
  }
2320
- class We {
2320
+ class Me {
2321
2321
  constructor(e) {
2322
2322
  this.opts = e, this.walletAddress = null, this.client = new Ar({
2323
2323
  baseUrl: e.baseUrl,
2324
2324
  transport: e.transport,
2325
2325
  getAccessToken: e.getAccessToken,
2326
2326
  now: e.now
2327
- }), this.authzKeys = new pr({ client: this.client, getIssuanceJwt: e.getAccessToken, now: e.now });
2327
+ }), this.authzKeys = new wr({ client: this.client, getIssuanceJwt: e.getAccessToken, now: e.now });
2328
2328
  }
2329
2329
  async checkWallet() {
2330
2330
  return await this.findWallet() ? "exists" : "not_found";
@@ -2333,7 +2333,7 @@ class We {
2333
2333
  if (this.walletAddress) return this.walletData(this.walletAddress);
2334
2334
  const t = await this.findWallet();
2335
2335
  if (t) return this.walletData(t.address);
2336
- const s = this.requirePin(), r = mr(await this.opts.getAccessToken()), n = await Lt(), { result: a, aad: l } = await this.withEnvelope(
2336
+ const s = this.requirePin(), r = Tr(await this.opts.getAccessToken()), n = await Lt(), { result: a, aad: l } = await this.withEnvelope(
2337
2337
  "generate",
2338
2338
  r,
2339
2339
  { command: "generate" },
@@ -2373,7 +2373,7 @@ class We {
2373
2373
  const l = await this.resolveTarget(r, a), { result: d } = await this.withEnvelope(
2374
2374
  "sign_message",
2375
2375
  l.address,
2376
- { command: "sign_message", index: l.index, message: k(Tr(s)) },
2376
+ { command: "sign_message", index: l.index, message: k(yr(s)) },
2377
2377
  { pin: this.requirePin() },
2378
2378
  (g, u) => this.client.call("POST", `/wallets/${l.address}/signatures`, { type: "message", envelope: g, intent: u })
2379
2379
  );
@@ -2398,7 +2398,7 @@ class We {
2398
2398
  const n = await this.resolveTarget(r, s.from), { result: a } = await this.withEnvelope(
2399
2399
  "sign",
2400
2400
  n.address,
2401
- { command: "sign", index: n.index, unsigned_tx: _t(s, t) },
2401
+ { command: "sign", index: n.index, unsigned_tx: ft(s, t) },
2402
2402
  { pin: this.requirePin() },
2403
2403
  (l, d) => this.client.call("POST", `/wallets/${n.address}/signatures`, {
2404
2404
  type: "transaction",
@@ -2413,7 +2413,7 @@ class We {
2413
2413
  const r = await this.resolveTarget(void 0, s.from), { result: n } = await this.withEnvelope(
2414
2414
  "sign",
2415
2415
  r.address,
2416
- { command: "sign", index: r.index, unsigned_tx: _t(s, t) },
2416
+ { command: "sign", index: r.index, unsigned_tx: ft(s, t) },
2417
2417
  { pin: this.requirePin() },
2418
2418
  (a, l) => this.client.call("POST", `/wallets/${r.address}/transactions`, { chain_id: t, envelope: a, intent: l })
2419
2419
  );
@@ -2470,7 +2470,7 @@ class We {
2470
2470
  async withEnvelope(e, t, s, r, n) {
2471
2471
  var a;
2472
2472
  for (let l = 0; ; l++) {
2473
- const d = await _r({
2473
+ const d = await fr({
2474
2474
  recipientPub: await this.client.getRecipientKey(),
2475
2475
  bindingId: t,
2476
2476
  command: e,
@@ -2491,11 +2491,11 @@ class We {
2491
2491
  }
2492
2492
  }
2493
2493
  }
2494
- const yr = 3, Rr = /^0x(?:[0-9a-fA-F]{2}){4,}$/;
2495
- function Nr(i) {
2496
- return i.code === yr || /execution reverted/i.test(i.message ?? "");
2494
+ const Rr = 3, Nr = /^0x(?:[0-9a-fA-F]{2}){4,}$/;
2495
+ function Or(i) {
2496
+ return i.code === Rr || /execution reverted/i.test(i.message ?? "");
2497
2497
  }
2498
- class Or {
2498
+ class Pr {
2499
2499
  constructor(e, t) {
2500
2500
  this.chainRegistry = e, this.transport = t, this._nextId = 1;
2501
2501
  }
@@ -2520,8 +2520,8 @@ class Or {
2520
2520
  body: n
2521
2521
  })).data;
2522
2522
  if (l != null && l.error) {
2523
- const { code: d, message: g } = l.error, u = { method: e, chainId: s, code: d, message: g, data: l.error.data }, _ = Nr(l.error);
2524
- throw _ && typeof u.data == "string" && Rr.test(u.data) && (u.revertData = u.data, u.selector = u.data.slice(0, 10).toLowerCase()), new h(
2523
+ const { code: d, message: g } = l.error, u = { method: e, chainId: s, code: d, message: g, data: l.error.data }, _ = Or(l.error);
2524
+ throw _ && typeof u.data == "string" && Nr.test(u.data) && (u.revertData = u.data, u.selector = u.data.slice(0, 10).toLowerCase()), new h(
2525
2525
  _ ? o.EXECUTION_REVERTED : o.UNKNOWN_ERROR,
2526
2526
  `RPC 오류 [${e}] (${s}): ${g} (코드: ${d})`,
2527
2527
  u
@@ -2530,7 +2530,7 @@ class Or {
2530
2530
  return l == null ? void 0 : l.result;
2531
2531
  }
2532
2532
  }
2533
- class Pr {
2533
+ class Cr {
2534
2534
  constructor() {
2535
2535
  this.listeners = /* @__PURE__ */ new Map();
2536
2536
  }
@@ -2553,7 +2553,7 @@ class Pr {
2553
2553
  this.listeners.clear();
2554
2554
  }
2555
2555
  }
2556
- function Cr() {
2556
+ function Dr() {
2557
2557
  var e;
2558
2558
  if (typeof globalThis < "u" && ((e = globalThis.crypto) != null && e.getRandomValues)) {
2559
2559
  const t = new Uint8Array(16);
@@ -2623,7 +2623,7 @@ class L {
2623
2623
  async handshake() {
2624
2624
  if (!this.bridge)
2625
2625
  throw new h(o.AUTH_NOT_INITIALIZED, "Bridge not initialized");
2626
- const e = Cr(), t = Date.now(), s = {
2626
+ const e = Dr(), t = Date.now(), s = {
2627
2627
  version: 1,
2628
2628
  appId: this.config.appId,
2629
2629
  appVersion: this.config.appVersion,
@@ -2820,7 +2820,7 @@ const X = {
2820
2820
  oneWalletApiUrl: "https://dev-one-pocket-api.onechain.nexus/embed/v1"
2821
2821
  }
2822
2822
  };
2823
- function Dr(i) {
2823
+ function xr(i) {
2824
2824
  const e = i.environment, t = e && e in X ? X[e] : null;
2825
2825
  if (!t)
2826
2826
  return null;
@@ -2832,10 +2832,10 @@ function Dr(i) {
2832
2832
  typeof a == "string" && a.trim() !== "" && (r[n] = a);
2833
2833
  return r;
2834
2834
  }
2835
- function we() {
2835
+ function Se() {
2836
2836
  try {
2837
2837
  if (typeof __CROSSX_CONFIG__ < "u") {
2838
- const i = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = Dr(i);
2838
+ const i = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = xr(i);
2839
2839
  if (e) return e;
2840
2840
  }
2841
2841
  } catch {
@@ -2853,18 +2853,18 @@ function Bt(i) {
2853
2853
  for (; e > 0 && i.charCodeAt(e - 1) === 48; ) e--;
2854
2854
  return i.slice(0, e);
2855
2855
  }
2856
- function xr(i, e = It) {
2856
+ function vr(i, e = mt) {
2857
2857
  if (!i || i === "0x0" || i === "0x") return "0";
2858
2858
  try {
2859
2859
  const t = BigInt(i);
2860
2860
  if (t === 0n) return "0";
2861
- const s = 10n ** BigInt(Xe), r = t / s, a = (t % s).toString().padStart(Xe, "0"), l = Bt(a).slice(0, e);
2861
+ const s = 10n ** BigInt(Ze), r = t / s, a = (t % s).toString().padStart(Ze, "0"), l = Bt(a).slice(0, e);
2862
2862
  return l ? `${r}.${l}` : `${r}`;
2863
2863
  } catch {
2864
2864
  return "?";
2865
2865
  }
2866
2866
  }
2867
- function he(i, e, t, s = It) {
2867
+ function de(i, e, t, s = mt) {
2868
2868
  if (!(!i || i === "0x" || i === "0x0"))
2869
2869
  try {
2870
2870
  const r = BigInt(i);
@@ -2875,20 +2875,20 @@ function he(i, e, t, s = It) {
2875
2875
  return;
2876
2876
  }
2877
2877
  }
2878
- function vr(i) {
2878
+ function kr(i) {
2879
2879
  const e = i.startsWith("0x") ? i.slice(2) : i;
2880
2880
  if (!/^[0-9a-fA-F]+$/.test(e))
2881
2881
  throw new h(
2882
2882
  o.SIGNATURE_FAILED,
2883
2883
  "유효하지 않은 서명: 올바른 hex 문자열이 아닙니다"
2884
2884
  );
2885
- if (e.length !== Je)
2885
+ if (e.length !== Xe)
2886
2886
  throw new h(
2887
2887
  o.SIGNATURE_FAILED,
2888
- `서명 길이가 유효하지 않습니다: ${Je} hex 문자(65 바이트) 예상, 현재 ${e.length}`
2888
+ `서명 길이가 유효하지 않습니다: ${Xe} hex 문자(65 바이트) 예상, 현재 ${e.length}`
2889
2889
  );
2890
2890
  }
2891
- function kr(i) {
2891
+ function Ur(i) {
2892
2892
  const e = i.startsWith("0x") ? i.slice(2) : i;
2893
2893
  if (!/^[0-9a-fA-F]+$/.test(e))
2894
2894
  throw new h(
@@ -2901,8 +2901,8 @@ function kr(i) {
2901
2901
  "유효하지 않은 서명된 트랜잭션: 너무 짧습니다"
2902
2902
  );
2903
2903
  }
2904
- function Ur(i, e) {
2905
- const t = br(e);
2904
+ function br(i, e) {
2905
+ const t = Lr(e);
2906
2906
  if (i === "0") {
2907
2907
  if (t !== void 0 && t !== 0)
2908
2908
  throw new h(
@@ -2926,7 +2926,7 @@ function Ur(i, e) {
2926
2926
  );
2927
2927
  }
2928
2928
  }
2929
- function br(i) {
2929
+ function Lr(i) {
2930
2930
  if (i == null || typeof i != "object") return;
2931
2931
  const e = i.domain;
2932
2932
  if (e == null || typeof e != "object") return;
@@ -2935,7 +2935,7 @@ function br(i) {
2935
2935
  const s = Number(t);
2936
2936
  return Number.isFinite(s) ? s : void 0;
2937
2937
  }
2938
- const Vi = 900 * 1e3, Lr = /* @__PURE__ */ new Set([
2938
+ const Yi = 900 * 1e3, Wr = /* @__PURE__ */ new Set([
2939
2939
  "095ea7b3",
2940
2940
  // approve(address,uint256)
2941
2941
  "a22cb465",
@@ -2946,7 +2946,7 @@ const Vi = 900 * 1e3, Lr = /* @__PURE__ */ new Set([
2946
2946
  // increaseApproval(address,uint256) — 예전 OpenZeppelin
2947
2947
  "87517c45"
2948
2948
  // Permit2 approve(address,address,uint160,uint48)
2949
- ]), Wr = /* @__PURE__ */ new Set([
2949
+ ]), Mr = /* @__PURE__ */ new Set([
2950
2950
  "Permit",
2951
2951
  "PermitSingle",
2952
2952
  "PermitBatch",
@@ -2955,22 +2955,22 @@ const Vi = 900 * 1e3, Lr = /* @__PURE__ */ new Set([
2955
2955
  "PermitWitnessTransferFrom",
2956
2956
  "PermitBatchWitnessTransferFrom"
2957
2957
  ]);
2958
- function Mr(i) {
2958
+ function Fr(i) {
2959
2959
  var s;
2960
2960
  const { action: e, context: t } = i;
2961
2961
  if (e === "sign" || e === "send") {
2962
2962
  const r = (s = t.tx) == null ? void 0 : s.data;
2963
2963
  if (typeof r != "string") return !1;
2964
2964
  const n = r.trim().toLowerCase().replace(/^0x/, "");
2965
- return n.length >= 8 && Lr.has(n.slice(0, 8));
2965
+ return n.length >= 8 && Wr.has(n.slice(0, 8));
2966
2966
  }
2967
2967
  if (e === "sign-typed-data") {
2968
- const r = Fr(t.typedData);
2969
- return r === null || Wr.has(r);
2968
+ const r = Br(t.typedData);
2969
+ return r === null || Mr.has(r);
2970
2970
  }
2971
2971
  return !1;
2972
2972
  }
2973
- function Fr(i) {
2973
+ function Br(i) {
2974
2974
  let e = i;
2975
2975
  if (typeof e == "string")
2976
2976
  try {
@@ -2984,13 +2984,13 @@ function Fr(i) {
2984
2984
  }
2985
2985
  return null;
2986
2986
  }
2987
- function Br(i, e, t, s) {
2987
+ function Gr(i, e, t, s) {
2988
2988
  if (!i) return !0;
2989
2989
  if (i.mode === "off" || e === null) return !1;
2990
2990
  const r = t - e;
2991
- return r < 0 || r >= i.ttlMs ? !1 : !Mr(s);
2991
+ return r < 0 || r >= i.ttlMs ? !1 : !Fr(s);
2992
2992
  }
2993
- function Gr(i) {
2993
+ function Hr(i) {
2994
2994
  return (i == null ? void 0 : i.mode) === "off";
2995
2995
  }
2996
2996
  class J {
@@ -3005,12 +3005,12 @@ class J {
3005
3005
  var s, r;
3006
3006
  if (this.deps.pinStore.hold(), !this.deps.pinStore.has()) return;
3007
3007
  const t = (r = (s = this.deps).getPinReusePolicy) == null ? void 0 : r.call(s);
3008
- Br(t, this.deps.pinStore.getSetAt(), Date.now(), e) || this.deps.pinStore.clear();
3008
+ Gr(t, this.deps.pinStore.getSetAt(), Date.now(), e) || this.deps.pinStore.clear();
3009
3009
  }
3010
3010
  /** 서명이 끝난 뒤 — 서명마다 PIN 을 받는 정책이면 PIN 을 메모리에 남기지 않는다. */
3011
3011
  finishSigning() {
3012
3012
  var e, t;
3013
- Gr((t = (e = this.deps).getPinReusePolicy) == null ? void 0 : t.call(e)) && this.deps.pinStore.clear(), this.deps.pinStore.release();
3013
+ Hr((t = (e = this.deps).getPinReusePolicy) == null ? void 0 : t.call(e)) && this.deps.pinStore.clear(), this.deps.pinStore.release();
3014
3014
  }
3015
3015
  /** PIN 재사용 정책이 있으면 true — 서명을 하나씩 처리해야 한다 (SigningOrchestrator). */
3016
3016
  hasReusePolicy() {
@@ -3168,7 +3168,7 @@ class J {
3168
3168
  return { ok: !1, error: r, ...n };
3169
3169
  }
3170
3170
  }
3171
- class Hr {
3171
+ class Kr {
3172
3172
  constructor(e) {
3173
3173
  this.deps = e, this.signingQueue = Promise.resolve();
3174
3174
  }
@@ -3207,10 +3207,10 @@ class Hr {
3207
3207
  }
3208
3208
  }
3209
3209
  }
3210
- function Kr(i) {
3210
+ function Vr(i) {
3211
3211
  return i === "google" || i === "apple";
3212
3212
  }
3213
- class Vr {
3213
+ class $r {
3214
3214
  constructor(e) {
3215
3215
  this.deps = e;
3216
3216
  }
@@ -3221,7 +3221,7 @@ class Vr {
3221
3221
  this.deps.setRecoveringSession(!0);
3222
3222
  try {
3223
3223
  this.deps.setAuthenticated(!1), this.deps.clearTokenStore();
3224
- const r = Kr(e.loginType) ? { provider: e.loginType } : void 0;
3224
+ const r = Vr(e.loginType) ? { provider: e.loginType } : void 0;
3225
3225
  let n;
3226
3226
  try {
3227
3227
  n = await this.deps.executeSignIn(r);
@@ -3301,7 +3301,7 @@ class Vr {
3301
3301
  }
3302
3302
  }
3303
3303
  }
3304
- class $r {
3304
+ class Yr {
3305
3305
  constructor(e) {
3306
3306
  this.deps = e;
3307
3307
  }
@@ -3348,7 +3348,7 @@ class $r {
3348
3348
  c.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", l.address), this.deps.setActiveWallet(l.address, 0);
3349
3349
  }
3350
3350
  }
3351
- class Yr {
3351
+ class qr {
3352
3352
  constructor(e) {
3353
3353
  this.deps = e;
3354
3354
  }
@@ -3396,14 +3396,14 @@ class Yr {
3396
3396
  }
3397
3397
  const p = _.pinStatus;
3398
3398
  if (a = p.maxAttempts, n = a - p.remainingAttempts, p.remainingAttempts === 0 && p.lockExpiresAt) {
3399
- const A = p.lockExpiresAt * 1e3, E = Math.max(
3399
+ const I = p.lockExpiresAt * 1e3, S = Math.max(
3400
3400
  1,
3401
- Math.round((A - Date.now()) / 1e3)
3402
- ), w = E <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
3401
+ Math.round((I - Date.now()) / 1e3)
3402
+ ), w = S <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
3403
3403
  c.warn(
3404
- `[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${E}초, 메시지: ${w}`
3404
+ `[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${S}초, 메시지: ${w}`
3405
3405
  ), await this.deps.confirmation.showRecoveryPinLockedPrompt(
3406
- E,
3406
+ S,
3407
3407
  w
3408
3408
  ), n = 0, r = "Your account lock has been lifted. You may try again.";
3409
3409
  } else
@@ -3416,11 +3416,11 @@ class Yr {
3416
3416
  c.warn(
3417
3417
  "[CROSSx][Migration Phase 4] 세션 만료 — 재로그인 후 PIN 입력 재시도"
3418
3418
  );
3419
- const p = M(this.deps.getLocale() ?? "en"), A = this.deps.getUserEmail();
3419
+ const p = M(this.deps.getLocale() ?? "en"), I = this.deps.getUserEmail();
3420
3420
  if (await this.deps.confirmation.showSessionAlert({
3421
3421
  title: p.session_alert_title,
3422
3422
  message: p.alert_session_expired,
3423
- email: A ? this.deps.maskEmail(A, p.session_alert_apple_account) : void 0
3423
+ email: I ? this.deps.maskEmail(I, p.session_alert_apple_account) : void 0
3424
3424
  }) === "signin-again" && (await this.deps.signInAgain()).success) {
3425
3425
  c.log(
3426
3426
  "[CROSSx][Migration Phase 4] 재로그인 성공 — PIN 입력 루프 계속"
@@ -3438,14 +3438,14 @@ class Yr {
3438
3438
  0,
3439
3439
  "Your account has been permanently locked due to too many failed attempts."
3440
3440
  ), null;
3441
- const A = ((p == null ? void 0 : p.lockExpiresAt) ?? 0) * 1e3, E = Math.max(
3441
+ const I = ((p == null ? void 0 : p.lockExpiresAt) ?? 0) * 1e3, S = Math.max(
3442
3442
  1,
3443
- Math.round((A - Date.now()) / 1e3)
3444
- ), w = E <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
3443
+ Math.round((I - Date.now()) / 1e3)
3444
+ ), w = S <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
3445
3445
  c.warn(
3446
- `[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${E}초`
3446
+ `[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${S}초`
3447
3447
  ), await this.deps.confirmation.showRecoveryPinLockedPrompt(
3448
- E,
3448
+ S,
3449
3449
  w
3450
3450
  ), n = 0, r = "Your account lock has been lifted. You may try again.";
3451
3451
  } else
@@ -3505,12 +3505,12 @@ class Yr {
3505
3505
  }
3506
3506
  }
3507
3507
  }
3508
- class qr {
3508
+ class jr {
3509
3509
  constructor(e) {
3510
3510
  this.deps = e;
3511
3511
  }
3512
3512
  async withResolvedGasAndFee(e, t) {
3513
- const s = (A) => !(A != null && A.trim()), r = e.nonce === void 0 || e.nonce === null, n = s(e.gasLimit), a = s(e.gasPrice) && s(e.maxFeePerGas), l = !s(e.maxFeePerGas) && s(e.maxPriorityFeePerGas);
3513
+ const s = (I) => !(I != null && I.trim()), r = e.nonce === void 0 || e.nonce === null, n = s(e.gasLimit), a = s(e.gasPrice) && s(e.maxFeePerGas), l = !s(e.maxFeePerGas) && s(e.maxPriorityFeePerGas);
3514
3514
  if (!r && !n && !a && !l) return e;
3515
3515
  const d = { ...e }, g = r ? d.from ?? this.deps.getActiveAddress() ?? void 0 : void 0;
3516
3516
  g && c.log(
@@ -3530,23 +3530,23 @@ class qr {
3530
3530
  a ? this.deps.getBaseFeePerGas(t) : null
3531
3531
  ]);
3532
3532
  if (g && (d.nonce = parseInt(u ?? "0x0", 16), c.log("[CROSSx] nonce 결과:", d.nonce)), n && (d.gasLimit = _, c.log("[CROSSx] estimateGas 결과:", d.gasLimit)), a) {
3533
- const A = p;
3534
- if (A) {
3535
- const E = ze;
3536
- d.maxFeePerGas = `0x${(BigInt(A) + BigInt(E)).toString(16)}`, d.maxPriorityFeePerGas = E, c.log(
3533
+ const I = p;
3534
+ if (I) {
3535
+ const S = Je;
3536
+ d.maxFeePerGas = `0x${(BigInt(I) + BigInt(S)).toString(16)}`, d.maxPriorityFeePerGas = S, c.log(
3537
3537
  "[CROSSx] Dynamic 체인 감지 — baseFee:",
3538
- A,
3538
+ I,
3539
3539
  "maxFeePerGas:",
3540
3540
  d.maxFeePerGas,
3541
3541
  "maxPriorityFeePerGas: 1 Gwei"
3542
3542
  );
3543
3543
  } else
3544
- d.gasPrice = Zt, c.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
3544
+ d.gasPrice = Qt, c.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
3545
3545
  }
3546
- return !a && l && (d.maxPriorityFeePerGas = ze, c.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), d;
3546
+ return !a && l && (d.maxPriorityFeePerGas = Je, c.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), d;
3547
3547
  }
3548
3548
  }
3549
- class jr {
3549
+ class zr {
3550
3550
  constructor(e) {
3551
3551
  this.crypto = e;
3552
3552
  }
@@ -3572,10 +3572,10 @@ class jr {
3572
3572
  }
3573
3573
  }
3574
3574
  }
3575
- function zr(i) {
3575
+ function Jr(i) {
3576
3576
  return i ? i.includes("google") ? "google" : i.includes("apple") ? "apple" : i : null;
3577
3577
  }
3578
- class Jr {
3578
+ class Xr {
3579
3579
  constructor(e) {
3580
3580
  this.deps = e;
3581
3581
  }
@@ -3597,7 +3597,7 @@ class Jr {
3597
3597
  activeWalletIndex: 0,
3598
3598
  userEmail: ((n = e.user) == null ? void 0 : n.email) ?? null,
3599
3599
  providerSub: ((a = e.user) == null ? void 0 : a.providerSub) ?? null,
3600
- loginType: zr(
3600
+ loginType: Jr(
3601
3601
  (l = e.user) == null ? void 0 : l.signInProvider
3602
3602
  ),
3603
3603
  tokenSignatureVerified: e.tokenSignatureVerified ?? !1
@@ -3626,7 +3626,7 @@ class Jr {
3626
3626
  });
3627
3627
  }
3628
3628
  }
3629
- class Xr {
3629
+ class Zr {
3630
3630
  constructor(e) {
3631
3631
  this.deps = e;
3632
3632
  }
@@ -3647,7 +3647,7 @@ class Xr {
3647
3647
  )).address, index: e };
3648
3648
  }
3649
3649
  }
3650
- class Zr {
3650
+ class Qr {
3651
3651
  constructor(e) {
3652
3652
  this.deps = e;
3653
3653
  }
@@ -3666,7 +3666,7 @@ class Zr {
3666
3666
  );
3667
3667
  }
3668
3668
  }
3669
- class Qr {
3669
+ class ei {
3670
3670
  constructor(e) {
3671
3671
  this.deps = e;
3672
3672
  }
@@ -3726,11 +3726,11 @@ class Qr {
3726
3726
  }
3727
3727
  }
3728
3728
  }
3729
- function ft(i, e) {
3729
+ function pt(i, e) {
3730
3730
  const t = i.replace(/\/$/, ""), s = e.startsWith("/") ? e : `/${e}`;
3731
3731
  return `${t}/cross-auth${s}`;
3732
3732
  }
3733
- class ei {
3733
+ class ti {
3734
3734
  constructor(e) {
3735
3735
  this.deps = e;
3736
3736
  }
@@ -3766,7 +3766,7 @@ class ei {
3766
3766
  o.TX_INVALID_PARAMS,
3767
3767
  "invalid param body"
3768
3768
  );
3769
- const n = this.deps.getApiBaseUrl(), a = ft(n, `/v2/token-historical/${e}/${r}`), l = { clientVersion: s };
3769
+ const n = this.deps.getApiBaseUrl(), a = pt(n, `/v2/token-historical/${e}/${r}`), l = { clientVersion: s };
3770
3770
  try {
3771
3771
  c.log("[TokenHistory] Registering tx:", e, r);
3772
3772
  const d = await this.deps.transport.request({
@@ -3796,7 +3796,7 @@ class ei {
3796
3796
  */
3797
3797
  async getTokenHistory(e) {
3798
3798
  var r;
3799
- const t = this.deps.getApiBaseUrl(), s = new URL(ft(t, "/v2/token-historical"));
3799
+ const t = this.deps.getApiBaseUrl(), s = new URL(pt(t, "/v2/token-historical"));
3800
3800
  (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());
3801
3801
  try {
3802
3802
  c.log("[TokenHistory] Fetching token history");
@@ -3878,24 +3878,24 @@ function ve(i, e = "Apple account") {
3878
3878
  const s = i.substring(0, t), r = i.substring(t);
3879
3879
  return s.length <= 1 ? `${s}${"*".repeat(Math.max(s.length, 1))}${r}` : `${s[0]}${"*".repeat(s.length - 1)}${r}`;
3880
3880
  }
3881
- const b = class b extends Pr {
3882
- constructor(e, t, s, r, n, a, l, d, g, u, _, p, A) {
3883
- var E, w;
3884
- super(), this.storage = s, this.crypto = r, this.transport = n, this.oauth = a, this.walletProvider = l, this.tokenStore = d, this.pinEncryptor = p, this.oneIdAuth = A, 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 && tt(e.logger), this.confirmation = g, this.pinStore = _ ?? new Nt(), this.stateManager = new Jr({
3881
+ const b = class b extends Cr {
3882
+ constructor(e, t, s, r, n, a, l, d, g, u, _, p, I, S) {
3883
+ var w, m;
3884
+ super(), this.storage = s, this.crypto = r, this.transport = n, this.oauth = a, this.walletProvider = l, this.tokenStore = d, this.pinEncryptor = p, this.oneIdAuth = I, 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 && st(e.logger), this.confirmation = g, this.pinStore = _ ?? new Ot(), this.stateManager = new Xr({
3885
3885
  setState: (f) => {
3886
3886
  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);
3887
3887
  },
3888
3888
  getIsRecoveringSession: () => this._isRecoveringSession,
3889
- emitAddressChanged: ({ address: f, index: S, walletName: I }) => {
3890
- const T = { address: f, index: S };
3891
- I !== void 0 && (T.walletName = I), this.emit("addressChanged", T);
3889
+ emitAddressChanged: ({ address: f, index: E, walletName: T }) => {
3890
+ const y = { address: f, index: E };
3891
+ T !== void 0 && (y.walletName = T), this.emit("addressChanged", y);
3892
3892
  },
3893
- emitAuthChanged: ({ isAuthenticated: f, address: S, userId: I, source: T }) => {
3893
+ emitAuthChanged: ({ isAuthenticated: f, address: E, userId: T, source: y }) => {
3894
3894
  this.emit("authChanged", {
3895
3895
  isAuthenticated: f,
3896
- address: S,
3897
- userId: I,
3898
- ...T ? { source: T } : {}
3896
+ address: E,
3897
+ userId: T,
3898
+ ...y ? { source: y } : {}
3899
3899
  });
3900
3900
  },
3901
3901
  shouldPersistWalletPreference: () => this._config.persistWalletPreference !== !1,
@@ -3915,23 +3915,23 @@ const b = class b extends Pr {
3915
3915
  // WebView 안에서 embedded PIN 프롬프트가 뜨지 않도록 게이팅. SigningOrchestrator 와 동일 신호.
3916
3916
  isRNBridgeMode: () => this._isAuthenticatedViaRNBridge,
3917
3917
  getPinReusePolicy: () => this.internalConfig.pinReuse
3918
- }), this.signingOrchestrator = new Hr({
3918
+ }), this.signingOrchestrator = new Kr({
3919
3919
  confirmation: this.confirmation,
3920
3920
  walletProvider: this.walletProvider,
3921
3921
  pinOrchestrator: this.pinOrchestrator,
3922
3922
  // §12 native sign delegation: 이 SDK 세션이 RN bridge 자동 로그인으로 인증된 경우만 활성.
3923
3923
  // 자동 로그인 거부 / OAuth 로 별도 로그인한 세션에서는 native SDK 가 미인증이라 우회한다.
3924
3924
  isRNBridgeMode: () => this._isAuthenticatedViaRNBridge
3925
- }), this.walletLifecycleService = new $r({
3925
+ }), this.walletLifecycleService = new Yr({
3926
3926
  walletProvider: this.walletProvider,
3927
3927
  pinOrchestrator: this.pinOrchestrator,
3928
3928
  getUserId: () => this.userId,
3929
- setActiveWallet: (f, S, I) => this.setActiveWallet(f, S, I)
3930
- }), this.migrationOrchestrator = new Yr({
3929
+ setActiveWallet: (f, E, T) => this.setActiveWallet(f, E, T)
3930
+ }), this.migrationOrchestrator = new qr({
3931
3931
  confirmation: this.confirmation,
3932
3932
  walletProvider: this.walletProvider,
3933
3933
  pinOrchestrator: this.pinOrchestrator,
3934
- executeMigrate: (f, S) => this.migrateWalletUseCase.execute(f, S),
3934
+ executeMigrate: (f, E) => this.migrateWalletUseCase.execute(f, E),
3935
3935
  getLocale: () => this._config.locale,
3936
3936
  getUserEmail: () => this.userEmail,
3937
3937
  maskEmail: ve,
@@ -3941,12 +3941,12 @@ const b = class b extends Pr {
3941
3941
  var f;
3942
3942
  return ((f = this._config.migration) == null ? void 0 : f.allowSkip) ?? !0;
3943
3943
  }
3944
- }), this.transactionLifecycleService = new qr({
3944
+ }), this.transactionLifecycleService = new jr({
3945
3945
  getActiveAddress: () => this.address,
3946
- estimateGas: (f, S) => this.estimateGas(f, S),
3946
+ estimateGas: (f, E) => this.estimateGas(f, E),
3947
3947
  getBaseFeePerGas: (f) => this.getBaseFeePerGas(f),
3948
- jsonRpcCall: (f, S, I) => this.jsonRpc.call(f, S, I)
3949
- }), this.signatureVerifier = new jr(this.crypto), this.addressResolverService = new Xr({
3948
+ jsonRpcCall: (f, E, T) => this.jsonRpc.call(f, E, T)
3949
+ }), this.signatureVerifier = new zr(this.crypto), this.addressResolverService = new Zr({
3950
3950
  walletProvider: this.walletProvider,
3951
3951
  pinOrchestrator: this.pinOrchestrator,
3952
3952
  getActiveAddress: () => this.address,
@@ -3954,25 +3954,25 @@ const b = class b extends Pr {
3954
3954
  getUserId: () => this.userId,
3955
3955
  // one-wallet: 지갑은 처음 쓸 때 만든다 (DEV2TF-2755)
3956
3956
  ensureWallet: this.usesOneWallet ? () => this.walletCreationService.createWallet().then((f) => f.address) : void 0
3957
- }), this.authGuardService = new Zr({
3957
+ }), this.authGuardService = new Qr({
3958
3958
  isInitialized: () => this.initialized,
3959
3959
  isAuthenticated: () => this.authenticated
3960
- }), this.walletCreationService = new Qr({
3960
+ }), this.walletCreationService = new ei({
3961
3961
  walletProvider: this.walletProvider,
3962
3962
  pinOrchestrator: this.pinOrchestrator,
3963
3963
  migrationOrchestrator: this.migrationOrchestrator,
3964
3964
  walletLifecycleService: this.walletLifecycleService,
3965
3965
  getUserId: () => this.userId,
3966
3966
  getProviderSub: () => this.providerSub,
3967
- setActiveWallet: (f, S) => this.setActiveWallet(f, S),
3967
+ setActiveWallet: (f, E) => this.setActiveWallet(f, E),
3968
3968
  showWalletCreated: () => {
3969
- var f, S;
3970
- return ((S = (f = this.confirmation).showWalletCreatedPrompt) == null ? void 0 : S.call(f)) ?? Promise.resolve();
3969
+ var f, E;
3970
+ return ((E = (f = this.confirmation).showWalletCreatedPrompt) == null ? void 0 : E.call(f)) ?? Promise.resolve();
3971
3971
  }
3972
- }), this.tokenHistoryService = new ei({
3972
+ }), this.tokenHistoryService = new ti({
3973
3973
  transport: n,
3974
3974
  getApiBaseUrl: () => this.internalConfig.authApiUrl
3975
- }), this.sessionOrchestrator = new Vr({
3975
+ }), this.sessionOrchestrator = new $r({
3976
3976
  ensureInitialized: () => this.ensureInitialized(),
3977
3977
  getSessionSnapshot: () => ({
3978
3978
  providerSub: this.providerSub,
@@ -3995,7 +3995,7 @@ const b = class b extends Pr {
3995
3995
  loadWalletAfterAuth: () => this.walletLifecycleService.loadWalletAfterAuth(),
3996
3996
  getLocale: () => this._config.locale,
3997
3997
  maskEmail: ve
3998
- }), this.chainRegistry = u, this.jsonRpc = new Or(u, n), this.signInUseCase = new Ue(
3998
+ }), this.chainRegistry = u, this.jsonRpc = new Pr(u, n), this.signInUseCase = new Ue(
3999
3999
  this.internalConfig,
4000
4000
  s,
4001
4001
  r,
@@ -4005,12 +4005,12 @@ const b = class b extends Pr {
4005
4005
  d,
4006
4006
  void 0,
4007
4007
  () => this._config.locale
4008
- ), this.signOutUseCase = new Es(
4008
+ ), this.signOutUseCase = new Is(
4009
4009
  this.internalConfig,
4010
4010
  s,
4011
4011
  d,
4012
4012
  this._config.persistWalletPreference !== !1 ? [b.WALLET_PREF_KEY] : []
4013
- ), this.migrateWalletUseCase = new As(s, l), (E = l.setOnUnauthorized) == null || E.call(l, () => this.forceLogout()), (w = l.setTokenRefresher) == null || w.call(
4013
+ ), this.migrateWalletUseCase = new As(s, l), (w = l.setOnUnauthorized) == null || w.call(l, () => this.forceLogout()), (m = l.setTokenRefresher) == null || m.call(
4014
4014
  l,
4015
4015
  () => this.signInUseCase.refreshAccessToken()
4016
4016
  ), e.autoDetectTheme && this._setupAutoDetectTheme();
@@ -4022,7 +4022,7 @@ const b = class b extends Pr {
4022
4022
  handleSdkVersionDeprecation(e) {
4023
4023
  if (this._sdkDeprecationNotified) return;
4024
4024
  this._sdkDeprecationNotified = !0;
4025
- const t = ge;
4025
+ const t = _e;
4026
4026
  console.warn(
4027
4027
  `[CROSSx] ${t} is deprecated` + (e.sunset ? ` and will stop working on ${e.sunset}` : "") + ". Update @nexus-cross/crossx-sdk-core." + (e.infoUrl ? ` See ${e.infoUrl}` : "")
4028
4028
  ), this.emit("versionDeprecated", { version: t, sunset: e.sunset, infoUrl: e.infoUrl });
@@ -4034,7 +4034,7 @@ const b = class b extends Pr {
4034
4034
  */
4035
4035
  handleSdkVersionUnsupported(e) {
4036
4036
  this._sdkUnsupportedNotified || (this._sdkUnsupportedNotified = !0, console.error(
4037
- `[CROSSx] ${ge} is no longer supported by the wallet gateway. Update @nexus-cross/crossx-sdk-core.` + (e.message ? ` (${e.message})` : "")
4037
+ `[CROSSx] ${_e} is no longer supported by the wallet gateway. Update @nexus-cross/crossx-sdk-core.` + (e.message ? ` (${e.message})` : "")
4038
4038
  ), this.confirmation.showUpdateRequired().catch((t) => {
4039
4039
  c.warn("[CROSSx] 업데이트 필요 모달 표시 실패:", t);
4040
4040
  }));
@@ -4100,12 +4100,12 @@ const b = class b extends Pr {
4100
4100
  }
4101
4101
  async _doInitialize(e) {
4102
4102
  var t, s;
4103
- c.log("[CROSSx SDK] v3.0.0-beta.6 초기화 중..."), this.confirmation.setMessages(M(this._config.locale));
4103
+ c.log("[CROSSx SDK] v3.0.0-beta.7 초기화 중..."), this.confirmation.setMessages(M(this._config.locale));
4104
4104
  try {
4105
- const r = we();
4105
+ const r = Se();
4106
4106
  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) {
4107
4107
  const g = await this.restoreOneWalletSession();
4108
- return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.6 초기화 완료 (one-wallet)"), this.emit("initialized", { restored: !!(g != null && g.success) }), g;
4108
+ return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.7 초기화 완료 (one-wallet)"), this.emit("initialized", { restored: !!(g != null && g.success) }), g;
4109
4109
  }
4110
4110
  const n = this._config.persistWalletPreference !== !1 ? await this.storage.get(
4111
4111
  b.WALLET_PREF_KEY
@@ -4139,7 +4139,7 @@ const b = class b extends Pr {
4139
4139
  throw _;
4140
4140
  }
4141
4141
  }
4142
- return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.6 초기화 완료"), this.emit("initialized", { restored: !!(d != null && d.success) }), d ?? null;
4142
+ return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.7 초기화 완료"), this.emit("initialized", { restored: !!(d != null && d.success) }), d ?? null;
4143
4143
  } catch (r) {
4144
4144
  throw new h(o.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", r);
4145
4145
  }
@@ -4159,7 +4159,7 @@ const b = class b extends Pr {
4159
4159
  c.log("[CROSSx] RN Bridge 감지 — Handshake 시도"), c.info("[CROSSx][RNBridge trace] Bootstrap config", {
4160
4160
  appId: this._config.projectId,
4161
4161
  appVersion: "1.0.0",
4162
- sdkVersion: "3.0.0-beta.6",
4162
+ sdkVersion: "3.0.0-beta.7",
4163
4163
  keyId: "key-id-1",
4164
4164
  userIdHash: "user-hash-placeholder",
4165
4165
  projectId: this._config.projectId
@@ -4167,7 +4167,7 @@ const b = class b extends Pr {
4167
4167
  const e = new L({
4168
4168
  appId: this._config.projectId,
4169
4169
  appVersion: "1.0.0",
4170
- sdkVersion: "3.0.0-beta.6",
4170
+ sdkVersion: "3.0.0-beta.7",
4171
4171
  keyId: "key-id-1",
4172
4172
  userIdHash: "user-hash-placeholder",
4173
4173
  projectId: this._config.projectId
@@ -4313,7 +4313,7 @@ const b = class b extends Pr {
4313
4313
  let s = e;
4314
4314
  if (!(e != null && e.provider)) {
4315
4315
  const r = await this.confirmation.showLoginSelector({
4316
- connectOtherWallets: cs(this._config)
4316
+ connectOtherWallets: ls(this._config)
4317
4317
  });
4318
4318
  if (r === null)
4319
4319
  return { success: !1, error: "User cancelled login" };
@@ -4531,7 +4531,7 @@ const b = class b extends Pr {
4531
4531
  try {
4532
4532
  return await e.sessions.getAccessToken();
4533
4533
  } catch (t) {
4534
- throw this.usesOneWallet && Ce(t) && this.clearAuthState(), t;
4534
+ throw this.usesOneWallet && he(t) && this.clearAuthState(), t;
4535
4535
  }
4536
4536
  }
4537
4537
  /**
@@ -4539,7 +4539,7 @@ const b = class b extends Pr {
4539
4539
  */
4540
4540
  async signOutOneId() {
4541
4541
  const { sessions: e } = this.oneIdContext();
4542
- this.walletProvider instanceof We && await this.walletProvider.signOut().catch((t) => c.warn("[CROSSx] B 키 폐기 실패 (로그아웃은 진행)", t));
4542
+ this.walletProvider instanceof Me && await this.walletProvider.signOut().catch((t) => c.warn("[CROSSx] B 키 폐기 실패 (로그아웃은 진행)", t));
4543
4543
  try {
4544
4544
  await e.signOut();
4545
4545
  } finally {
@@ -4592,7 +4592,7 @@ const b = class b extends Pr {
4592
4592
  try {
4593
4593
  await ((a = (n = this.walletProvider).checkWallet) == null ? void 0 : a.call(n)) === "exists" && (t = (await this.walletProvider.getOrCreateWallet(e.subject)).address);
4594
4594
  } catch (l) {
4595
- if (Ce(l)) throw l;
4595
+ if (he(l)) throw l;
4596
4596
  c.warn("[CROSSx] one-wallet: 지갑 조회 실패 — 주소 없이 로그인 상태로 둔다", l);
4597
4597
  }
4598
4598
  const s = t ? await this.preferredOneWallet(e.subject, t) : void 0, r = { success: !0, address: s == null ? void 0 : s.address, user: { id: e.subject } };
@@ -4612,7 +4612,7 @@ const b = class b extends Pr {
4612
4612
  const a = (await this.walletProvider.getAddresses(e)).find((l) => l.address.toLowerCase() === r.address.toLowerCase());
4613
4613
  return a ? { address: a.address, index: a.index } : s;
4614
4614
  } catch (n) {
4615
- if (Ce(n)) throw n;
4615
+ if (he(n)) throw n;
4616
4616
  return c.warn("[CROSSx] one-wallet: 선호 지갑 확인 실패 — 첫 지갑을 쓴다", n), s;
4617
4617
  }
4618
4618
  }
@@ -4627,18 +4627,39 @@ const b = class b extends Pr {
4627
4627
  o.NOT_IMPLEMENTED,
4628
4628
  "이 환경에서는 ONE ID 로그인을 사용할 수 없습니다 (SDKConfig.oneId 필요)"
4629
4629
  );
4630
- const t = e.issuer || we().oneIdIssuer;
4630
+ const t = e.issuer || Se().oneIdIssuer;
4631
4631
  if (!t)
4632
4632
  throw new h(
4633
4633
  o.NOT_IMPLEMENTED,
4634
4634
  "ONE ID issuer가 정해지지 않았습니다. SDKConfig.oneId.issuer를 지정하세요"
4635
4635
  );
4636
4636
  const s = { issuer: t, clientId: e.clientId, scope: e.scope };
4637
- return this._oneIdSessions ?? (this._oneIdSessions = new Vs(
4638
- this.oneIdAuth,
4639
- s,
4640
- $s(e.storage)
4641
- )), { port: this.oneIdAuth, config: s, sessions: this._oneIdSessions };
4637
+ if (!this._oneIdSessions) {
4638
+ const r = new $s(this.oneIdAuth, s, Ys(e.storage));
4639
+ this._oneIdSessions = this.oneIdSessionFactory ? this.oneIdSessionFactory({ port: this.oneIdAuth, config: s, fallback: r }) : r;
4640
+ }
4641
+ return { port: this.oneIdAuth, config: s, sessions: this._oneIdSessions };
4642
+ }
4643
+ /**
4644
+ * 세션 통로(`OneIdSessionSource`)를 다시 읽어 SDK 로그인 상태를 맞춘다 (DEV2TF-2925, `/internal` 의
4645
+ * `reloadOneIdSession`). 보안 화면 앱이 OSG walletToken 교환 · 회원 확인 · 로그아웃 뒤에 부른다.
4646
+ * - 세션이 없으면 로그인 상태(메모리 PIN · B 키 포함)를 정리하고 null
4647
+ * - 다른 사용자로 로그인돼 있었으면 먼저 정리한 뒤 새 세션을 싣는다
4648
+ * - 세션이 끝났으면(`ONEID_SESSION_*`) 정리하고 그 오류를 던진다
4649
+ * - `reset` 이면 사용자가 같아도 먼저 정리한다(B 키 · 메모리 PIN) — 세션 통로가 바뀔 때 이전 통로의 상태를 넘기지 않게
4650
+ */
4651
+ async reloadOneIdSession(e) {
4652
+ if (!this.usesOneWallet)
4653
+ throw new h(o.NOT_IMPLEMENTED, "reloadOneIdSession requires walletServer 'one-wallet'");
4654
+ const { sessions: t } = this.oneIdContext();
4655
+ e != null && e.reset && (this.authenticated || this.pinStore.has()) && this.clearAuthState();
4656
+ let s;
4657
+ try {
4658
+ s = await t.get();
4659
+ } catch (r) {
4660
+ throw he(r) && this.clearAuthState(), r;
4661
+ }
4662
+ return !s || !s.subject ? (this.authenticated && this.clearAuthState(), null) : (this.authenticated && this.currentUserId !== s.subject && this.clearAuthState(), this.applyOneIdSession(s));
4642
4663
  }
4643
4664
  async signOut() {
4644
4665
  if (this.ensureInitialized(), this.usesOneWallet) {
@@ -5049,10 +5070,10 @@ const b = class b extends Pr {
5049
5070
  * 상황은 정상적으로 발생하므로, 조용히 넘어가지 않고 체인당 한 번 경고한다.
5050
5071
  */
5051
5072
  resolveNativeCurrency(e) {
5052
- const t = _s(e, this._config.nativeCurrencies);
5073
+ const t = fs(e, this._config.nativeCurrencies);
5053
5074
  return t || (this._warnedUnknownNativeCurrency.has(e) || (this._warnedUnknownNativeCurrency.add(e), console.warn(
5054
5075
  `[CROSSx SDK] ${e} 의 native 통화 정보가 없어 심볼을 비우고 decimals 를 18 로 가정합니다. 컨펌 모달 금액이 단위 없이 표시되며, decimals 가 18 이 아니면 금액이 틀립니다. SDKConfig.nativeCurrencies 에 { '${e}': { symbol, decimals } } 를 넘겨 주세요.`
5055
- )), gs);
5076
+ )), _s);
5056
5077
  }
5057
5078
  /**
5058
5079
  * 지갑 생성/로드 (로그인 후 address가 없는 경우)
@@ -5092,7 +5113,7 @@ const b = class b extends Pr {
5092
5113
  });
5093
5114
  return { chainId: e, signature: l.signature, message: t, address: this.address ?? "" };
5094
5115
  } catch (l) {
5095
- if (!Tt(l))
5116
+ if (!yt(l))
5096
5117
  throw j(l, o.SIGNATURE_FAILED);
5097
5118
  await this.clearRNBridgeDelegation("native signMessage 가 ERR_BRIDGE_NOT_AUTHORIZED 로 거부"), c.warn("[CROSSx] Bridge 미인증 — 일반 서명 경로로 폴백 (signMessage)");
5098
5119
  }
@@ -5164,7 +5185,7 @@ const b = class b extends Pr {
5164
5185
  throw new h(o.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
5165
5186
  if (!this.walletProvider.signTypedData)
5166
5187
  throw new h(o.NOT_IMPLEMENTED, "signTypedData가 구현되어 있지 않습니다");
5167
- Ur(e, t);
5188
+ br(e, t);
5168
5189
  const r = await this.resolveAddress(s == null ? void 0 : s.index);
5169
5190
  try {
5170
5191
  const n = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
@@ -5188,7 +5209,7 @@ const b = class b extends Pr {
5188
5209
  r.address
5189
5210
  )
5190
5211
  });
5191
- return vr(n.signature), {
5212
+ return kr(n.signature), {
5192
5213
  chainId: e,
5193
5214
  signature: n.signature,
5194
5215
  address: r.address
@@ -5266,7 +5287,7 @@ const b = class b extends Pr {
5266
5287
  l
5267
5288
  )
5268
5289
  });
5269
- return kr(a.signature), {
5290
+ return Ur(a.signature), {
5270
5291
  chainId: e,
5271
5292
  signedTx: a.signature,
5272
5293
  txHash: a.txHash ?? ""
@@ -5335,7 +5356,7 @@ const b = class b extends Pr {
5335
5356
  return _.txHash ?? _.signature;
5336
5357
  }
5337
5358
  }), l = (t.data ?? "").toLowerCase().replace(/^0x/, ""), d = l === "" || l === "00000000", g = l.startsWith("a9059cbb");
5338
- return (d || g) && this.tokenHistoryService.registerHistoryFireAndForget(e, a, ge).catch(
5359
+ return (d || g) && this.tokenHistoryService.registerHistoryFireAndForget(e, a, _e).catch(
5339
5360
  (u) => c.log("[TokenHistory] register failed (non-critical):", u)
5340
5361
  ), { chainId: e, txHash: a, status: "pending" };
5341
5362
  } catch (a) {
@@ -5367,7 +5388,7 @@ const b = class b extends Pr {
5367
5388
  * @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
5368
5389
  */
5369
5390
  async waitForTxAndGetReceipt(e, t, s = {}) {
5370
- const r = s.intervalMs ?? Jt, n = Xt, a = s.timeoutMs ?? je, l = Date.now() + a;
5391
+ const r = s.intervalMs ?? Xt, n = Zt, a = s.timeoutMs ?? ze, l = Date.now() + a;
5371
5392
  let d = r;
5372
5393
  for (; Date.now() < l; ) {
5373
5394
  const g = await this.getTransactionReceipt(e, t);
@@ -5395,41 +5416,41 @@ const b = class b extends Pr {
5395
5416
  * logger.log(receipt.status); // '0x1' | '0x0'
5396
5417
  */
5397
5418
  async sendTransactionWithWaitForReceipt(e, t, s = {}) {
5398
- var w, f;
5419
+ var w, m;
5399
5420
  if (this._isAuthenticatedViaRNBridge) {
5400
- const S = L.getBridge();
5401
- if (S != null && S.sendTransactionWithWaitForReceipt)
5402
- return this.bridgeSendTransactionWithWaitForReceipt(S, e, t, s);
5403
- }
5404
- const { intervalMs: r, timeoutMs: n, ...a } = s, { txHash: l } = await this.sendTransaction(e, t, a), d = r ?? ((w = this._config.receiptPolling) == null ? void 0 : w.intervalMs) ?? zt, g = n ?? ((f = this._config.receiptPolling) == null ? void 0 : f.timeoutMs) ?? je, u = this.resolveNativeCurrency(e), _ = t.from ?? "";
5405
- let p, A;
5406
- const E = this.waitForTxAndGetReceipt(l, e, { intervalMs: d, timeoutMs: g }).then((S) => {
5407
- p = S;
5408
- const I = BigInt(S.gasUsed) * BigInt(S.effectiveGasPrice), T = t.value ? BigInt(t.value) : 0n, O = he(t.value, u.symbol, u.decimals, this._config.displayDecimals), y = he("0x" + I.toString(16), u.symbol, u.decimals, this._config.displayDecimals), R = he("0x" + (T + I).toString(16), u.symbol, u.decimals, this._config.displayDecimals);
5421
+ const f = L.getBridge();
5422
+ if (f != null && f.sendTransactionWithWaitForReceipt)
5423
+ return this.bridgeSendTransactionWithWaitForReceipt(f, e, t, s);
5424
+ }
5425
+ const { intervalMs: r, timeoutMs: n, ...a } = s, { txHash: l } = await this.sendTransaction(e, t, a), d = r ?? ((w = this._config.receiptPolling) == null ? void 0 : w.intervalMs) ?? Jt, g = n ?? ((m = this._config.receiptPolling) == null ? void 0 : m.timeoutMs) ?? ze, u = this.resolveNativeCurrency(e), _ = t.from ?? "";
5426
+ let p, I;
5427
+ const S = this.waitForTxAndGetReceipt(l, e, { intervalMs: d, timeoutMs: g }).then((f) => {
5428
+ p = f;
5429
+ const E = BigInt(f.gasUsed) * BigInt(f.effectiveGasPrice), T = t.value ? BigInt(t.value) : 0n, y = de(t.value, u.symbol, u.decimals, this._config.displayDecimals), R = de("0x" + E.toString(16), u.symbol, u.decimals, this._config.displayDecimals), N = de("0x" + (T + E).toString(16), u.symbol, u.decimals, this._config.displayDecimals);
5409
5430
  return {
5410
5431
  chainId: e,
5411
5432
  txHash: l,
5412
- from: S.from,
5413
- to: S.to ?? t.to,
5414
- amount: O,
5415
- fees: y,
5416
- total: R,
5433
+ from: f.from,
5434
+ to: f.to ?? t.to,
5435
+ amount: y,
5436
+ fees: R,
5437
+ total: N,
5417
5438
  nativeSymbol: u.symbol,
5418
- status: S.status === "0x1" ? "success" : "reverted"
5439
+ status: f.status === "0x1" ? "success" : "reverted"
5419
5440
  };
5420
- }).catch((S) => (A = S instanceof Error ? S : new Error(String(S)), {
5441
+ }).catch((f) => (I = f instanceof Error ? f : new Error(String(f)), {
5421
5442
  chainId: e,
5422
5443
  txHash: l,
5423
5444
  from: _,
5424
5445
  to: t.to,
5425
- amount: he(t.value, u.symbol, u.decimals, this._config.displayDecimals),
5446
+ amount: de(t.value, u.symbol, u.decimals, this._config.displayDecimals),
5426
5447
  nativeSymbol: u.symbol,
5427
5448
  status: "timeout"
5428
5449
  }));
5429
5450
  if (await this.confirmation.showTransactionProgress(
5430
5451
  { chainId: e, txHash: l, from: _, to: t.to },
5431
- E
5432
- ), A) throw A;
5452
+ S
5453
+ ), I) throw I;
5433
5454
  return { chainId: e, txHash: l, receipt: p };
5434
5455
  }
5435
5456
  /**
@@ -5662,7 +5683,7 @@ const b = class b extends Pr {
5662
5683
  return { wei: "0x0", formatted: "0", chainId: e };
5663
5684
  try {
5664
5685
  const r = await this.jsonRpc.call("eth_getBalance", [t, "latest"], e) ?? "0x0";
5665
- return { wei: r, formatted: xr(r, this._config.displayDecimals), chainId: e };
5686
+ return { wei: r, formatted: vr(r, this._config.displayDecimals), chainId: e };
5666
5687
  } catch (s) {
5667
5688
  if (s instanceof h) throw s;
5668
5689
  const r = s instanceof Error ? s.message : String(s);
@@ -5690,7 +5711,7 @@ const b = class b extends Pr {
5690
5711
  getProvider(e) {
5691
5712
  this.ensureAuthenticated();
5692
5713
  let t = this._providers.get(e);
5693
- return t || (t = new fs(this, e), this._providers.set(e, t)), t;
5714
+ return t || (t = new ps(this, e), this._providers.set(e, t)), t;
5694
5715
  }
5695
5716
  /**
5696
5717
  * EIP-1193 `accountsChanged` 이벤트를 모든 활성 provider 인스턴스에 dispatch 한다.
@@ -5793,7 +5814,7 @@ const b = class b extends Pr {
5793
5814
  }
5794
5815
  /** 인증 상태를 초기화합니다. */
5795
5816
  clearAuthState() {
5796
- this.stateManager.clearAuthState(), this.walletProvider instanceof We && this.walletProvider.forgetSession(), this._isAuthenticatedViaRNBridge = !1;
5817
+ this.stateManager.clearAuthState(), this.walletProvider instanceof Me && this.walletProvider.forgetSession(), this._isAuthenticatedViaRNBridge = !1;
5797
5818
  }
5798
5819
  /**
5799
5820
  * Gateway -10002(Unauthorized) / -10033(User not found) 수신 시 강제 로그아웃.
@@ -5911,12 +5932,12 @@ const b = class b extends Pr {
5911
5932
  */
5912
5933
  dispose() {
5913
5934
  var e;
5914
- (e = this._themeMediaCleanup) == null || e.call(this), this._themeMediaCleanup = null, this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), tt(null);
5935
+ (e = this._themeMediaCleanup) == null || e.call(this), this._themeMediaCleanup = null, this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), st(null);
5915
5936
  }
5916
5937
  };
5917
5938
  b.WALLET_PREF_KEY = "wallet_preference", b.OFFCHAIN_CHAIN_ID = "0";
5918
- let Me = b;
5919
- class ti {
5939
+ let Fe = b;
5940
+ class si {
5920
5941
  constructor() {
5921
5942
  this.prefix = "crossx_";
5922
5943
  }
@@ -5953,8 +5974,8 @@ class ti {
5953
5974
  }
5954
5975
  }
5955
5976
  }
5956
- const de = "crossx-sdk", pt = 1, v = "data", B = "keys", ue = "aes-primary", si = 12;
5957
- class wt {
5977
+ const ue = "crossx-sdk", wt = 1, v = "data", B = "keys", ge = "aes-primary", ri = 12;
5978
+ class St {
5958
5979
  constructor(e) {
5959
5980
  this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
5960
5981
  }
@@ -5963,7 +5984,7 @@ class wt {
5963
5984
  }
5964
5985
  openDB() {
5965
5986
  return new Promise((e, t) => {
5966
- const s = indexedDB.open(this.dbName, pt);
5987
+ const s = indexedDB.open(this.dbName, wt);
5967
5988
  s.onupgradeneeded = () => {
5968
5989
  const r = s.result;
5969
5990
  r.objectStoreNames.contains(v) || r.createObjectStore(v), r.objectStoreNames.contains(B) || r.createObjectStore(B);
@@ -5981,13 +6002,13 @@ class wt {
5981
6002
  openLegacyIfExists() {
5982
6003
  return new Promise((e, t) => {
5983
6004
  let s = !1;
5984
- const r = indexedDB.open(de, pt);
6005
+ const r = indexedDB.open(ue, wt);
5985
6006
  r.onupgradeneeded = () => {
5986
6007
  s = !0;
5987
6008
  }, r.onsuccess = () => {
5988
6009
  const n = r.result;
5989
6010
  if (s) {
5990
- n.close(), this.deleteDB(de).then(() => e(null));
6011
+ n.close(), this.deleteDB(ue).then(() => e(null));
5991
6012
  return;
5992
6013
  }
5993
6014
  if (!n.objectStoreNames.contains(B) || !n.objectStoreNames.contains(v)) {
@@ -6041,7 +6062,7 @@ class wt {
6041
6062
  }
6042
6063
  async init() {
6043
6064
  this.db = await this.openDB();
6044
- const e = await this.idbGet(B, ue);
6065
+ const e = await this.idbGet(B, ge);
6045
6066
  if (e) {
6046
6067
  this.cryptoKey = e;
6047
6068
  return;
@@ -6055,18 +6076,18 @@ class wt {
6055
6076
  { name: "AES-GCM", length: 256 },
6056
6077
  !1,
6057
6078
  ["encrypt", "decrypt"]
6058
- ), await this.idbPut(B, ue, this.cryptoKey);
6079
+ ), await this.idbPut(B, ge, this.cryptoKey);
6059
6080
  }
6060
6081
  /**
6061
6082
  * 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
6062
6083
  * 마이그레이션 성공 시 레거시 DB 삭제.
6063
6084
  */
6064
6085
  async migrateFromLegacyDB() {
6065
- if (this.dbName === de) return null;
6086
+ if (this.dbName === ue) return null;
6066
6087
  try {
6067
6088
  const e = await this.openLegacyIfExists();
6068
6089
  if (!e) return null;
6069
- const t = e.transaction([B, v], "readonly"), s = t.objectStore(B).get(ue), r = await new Promise((g, u) => {
6090
+ const t = e.transaction([B, v], "readonly"), s = t.objectStore(B).get(ge), r = await new Promise((g, u) => {
6070
6091
  s.onsuccess = () => g(s.result), s.onerror = () => u(s.error);
6071
6092
  });
6072
6093
  if (!r)
@@ -6079,16 +6100,16 @@ class wt {
6079
6100
  a.onsuccess = () => g(a.result), a.onerror = () => u(a.error);
6080
6101
  })
6081
6102
  ]);
6082
- e.close(), await this.idbPut(B, ue, r);
6103
+ e.close(), await this.idbPut(B, ge, r);
6083
6104
  for (let g = 0; g < d.length; g++)
6084
6105
  await this.idbPut(v, String(d[g]), l[g]);
6085
- return await this.deleteDB(de), c.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), r;
6106
+ return await this.deleteDB(ue), c.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), r;
6086
6107
  } catch (e) {
6087
6108
  return c.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
6088
6109
  }
6089
6110
  }
6090
6111
  async encrypt(e) {
6091
- const t = new Uint8Array(si);
6112
+ const t = new Uint8Array(ri);
6092
6113
  crypto.getRandomValues(t);
6093
6114
  const s = new TextEncoder().encode(e), r = await crypto.subtle.encrypt(
6094
6115
  { name: "AES-GCM", iv: t },
@@ -6146,14 +6167,14 @@ class wt {
6146
6167
  return typeof indexedDB < "u" && typeof crypto < "u" && typeof crypto.subtle < "u";
6147
6168
  }
6148
6169
  }
6149
- const ri = 60;
6150
- class ii {
6170
+ const ii = 60;
6171
+ class ni {
6151
6172
  constructor() {
6152
6173
  this.jwks = null;
6153
6174
  }
6154
6175
  setJWKSEndpoint(e) {
6155
6176
  try {
6156
- this.jwks = Vt(new URL(e)), c.log("[CROSSx] JWKS 엔드포인트 설정:", e);
6177
+ this.jwks = $t(new URL(e)), c.log("[CROSSx] JWKS 엔드포인트 설정:", e);
6157
6178
  } catch (t) {
6158
6179
  c.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", t);
6159
6180
  }
@@ -6167,7 +6188,7 @@ class ii {
6167
6188
  iat: s.iat
6168
6189
  });
6169
6190
  const r = Math.floor(Date.now() / 1e3);
6170
- if (s.exp && s.exp + ri < r)
6191
+ if (s.exp && s.exp + ii < r)
6171
6192
  return c.warn("[CROSSx] 토큰 만료:", {
6172
6193
  exp: s.exp,
6173
6194
  now: r,
@@ -6177,7 +6198,7 @@ class ii {
6177
6198
  return c.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: s, valid: !1, signatureVerified: !1 };
6178
6199
  if (this.jwks)
6179
6200
  try {
6180
- const { payload: n } = await $t(e, this.jwks, {
6201
+ const { payload: n } = await Yt(e, this.jwks, {
6181
6202
  algorithms: ["RS256", "ES256"]
6182
6203
  });
6183
6204
  return c.log("[CROSSx] JWT 서명 검증 성공"), {
@@ -6196,7 +6217,7 @@ class ii {
6196
6217
  }
6197
6218
  }
6198
6219
  decodeJWT(e) {
6199
- return Yt(e);
6220
+ return qt(e);
6200
6221
  }
6201
6222
  /**
6202
6223
  * EIP-191 personal_sign 서명에서 서명자 Ethereum 주소를 복원합니다.
@@ -6211,29 +6232,29 @@ class ii {
6211
6232
  ${s.length}`
6212
6233
  ), n = new Uint8Array(r.length + s.length);
6213
6234
  n.set(r, 0), n.set(s, r.length);
6214
- const a = qe(n), l = t.startsWith("0x") ? t.slice(2) : t;
6235
+ const a = je(n), l = t.startsWith("0x") ? t.slice(2) : t;
6215
6236
  if (l.length !== 130)
6216
6237
  throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${l.length}`);
6217
- const d = ni(l), g = d.slice(0, 32), u = d.slice(32, 64), _ = d[64], p = _ >= 27 ? _ - 27 : _, w = new qt.Signature(
6218
- St(g),
6219
- St(u)
6220
- ).addRecoveryBit(p).recoverPublicKey(a).toBytes(!1).slice(1), f = qe(w);
6221
- return "0x" + jt(f.slice(12));
6238
+ const d = ai(l), g = d.slice(0, 32), u = d.slice(32, 64), _ = d[64], p = _ >= 27 ? _ - 27 : _, w = new jt.Signature(
6239
+ Et(g),
6240
+ Et(u)
6241
+ ).addRecoveryBit(p).recoverPublicKey(a).toBytes(!1).slice(1), m = je(w);
6242
+ return "0x" + zt(m.slice(12));
6222
6243
  }
6223
6244
  }
6224
- function ni(i) {
6245
+ function ai(i) {
6225
6246
  const e = new Uint8Array(i.length / 2);
6226
6247
  for (let t = 0; t < e.length; t++)
6227
6248
  e[t] = parseInt(i.substring(t * 2, t * 2 + 2), 16);
6228
6249
  return e;
6229
6250
  }
6230
- function St(i) {
6251
+ function Et(i) {
6231
6252
  let e = "0x";
6232
6253
  for (const t of i) e += t.toString(16).padStart(2, "0");
6233
6254
  return BigInt(e);
6234
6255
  }
6235
- const ai = 5e3;
6236
- class oi {
6256
+ const oi = 5e3;
6257
+ class ci {
6237
6258
  constructor(e, t) {
6238
6259
  this.cachedKey = null, this.cachedVersion = null, this.cachedAt = 0, this.keyInFlight = null, this.keyFailedAt = 0, this.required = !1, this.adapterConfig = e, this.transport = t;
6239
6260
  }
@@ -6246,8 +6267,8 @@ class oi {
6246
6267
  const t = this.required;
6247
6268
  if (!t && this.hasFreshFailure()) return e;
6248
6269
  try {
6249
- const { version: s, key: r } = await this.currentKey(), n = await ci(r, e);
6250
- return `${s}.${li(n)}`;
6270
+ const { version: s, key: r } = await this.currentKey(), n = await li(r, e);
6271
+ return `${s}.${hi(n)}`;
6251
6272
  } catch (s) {
6252
6273
  if (t)
6253
6274
  throw this.keyFailedAt = Date.now(), s instanceof h ? s : new h(
@@ -6257,7 +6278,7 @@ class oi {
6257
6278
  );
6258
6279
  return this.keyFailedAt = Date.now(), c.warn(
6259
6280
  "[CROSSx] pin-key 조회 실패 — PIN 평문 전송을 유지합니다",
6260
- `(${Math.round(et / 1e3)}초 후 재확인)`
6281
+ `(${Math.round(tt / 1e3)}초 후 재확인)`
6261
6282
  ), e;
6262
6283
  }
6263
6284
  }
@@ -6284,10 +6305,10 @@ class oi {
6284
6305
  }
6285
6306
  // ── 공개키 캐시 ─────────────────────────────────────────────────────────────
6286
6307
  hasFreshFailure() {
6287
- return this.keyFailedAt !== 0 && Date.now() - this.keyFailedAt < et;
6308
+ return this.keyFailedAt !== 0 && Date.now() - this.keyFailedAt < tt;
6288
6309
  }
6289
6310
  async currentKey() {
6290
- return this.cachedKey && this.cachedVersion && Date.now() - this.cachedAt < ts ? { 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, c.log("[CROSSx] PIN 공개키 캐시 완료 (keyVersion:", e.version, ")"), e)).finally(() => {
6311
+ return this.cachedKey && this.cachedVersion && Date.now() - this.cachedAt < ss ? { 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, c.log("[CROSSx] PIN 공개키 캐시 완료 (keyVersion:", e.version, ")"), e)).finally(() => {
6291
6312
  this.keyInFlight = null;
6292
6313
  }), this.keyInFlight);
6293
6314
  }
@@ -6302,16 +6323,16 @@ class oi {
6302
6323
  url: `${this.baseUrl}/pin-key`,
6303
6324
  method: "GET",
6304
6325
  headers: { "X-Project-Id": this.adapterConfig.projectId },
6305
- timeoutMs: ai
6306
- }), s = gi(t.data);
6326
+ timeoutMs: oi
6327
+ }), s = _i(t.data);
6307
6328
  if (!(s != null && s.keyVersion) || !(s != null && s.publicKey))
6308
6329
  throw new h(
6309
6330
  o.PIN_ENCRYPTION_FAILED,
6310
6331
  "pin-key 응답을 해석할 수 없습니다."
6311
6332
  );
6312
- const r = di(s.publicKey), n = await e.importKey(
6333
+ const r = ui(s.publicKey), n = await e.importKey(
6313
6334
  "spki",
6314
- ui(r),
6335
+ gi(r),
6315
6336
  { name: "RSA-OAEP", hash: "SHA-256" },
6316
6337
  !1,
6317
6338
  ["encrypt"]
@@ -6319,7 +6340,7 @@ class oi {
6319
6340
  return { version: s.keyVersion, key: n };
6320
6341
  }
6321
6342
  }
6322
- async function ci(i, e) {
6343
+ async function li(i, e) {
6323
6344
  const t = Gt();
6324
6345
  if (!t)
6325
6346
  throw new h(
@@ -6337,11 +6358,11 @@ function Gt() {
6337
6358
  const i = globalThis.crypto;
6338
6359
  return (i == null ? void 0 : i.subtle) ?? null;
6339
6360
  }
6340
- function li(i) {
6341
- return hi(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
6361
+ function hi(i) {
6362
+ return di(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
6342
6363
  }
6343
6364
  const re = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6344
- function hi(i) {
6365
+ function di(i) {
6345
6366
  let e = "";
6346
6367
  for (let t = 0; t < i.length; t += 3) {
6347
6368
  const s = i[t], r = i[t + 1], n = i[t + 2];
@@ -6349,7 +6370,7 @@ function hi(i) {
6349
6370
  }
6350
6371
  return e;
6351
6372
  }
6352
- function di(i) {
6373
+ function ui(i) {
6353
6374
  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 = [];
6354
6375
  for (let r = 0; r < t.length; r += 4) {
6355
6376
  const n = [0, 1, 2, 3].map((a) => {
@@ -6367,11 +6388,11 @@ function di(i) {
6367
6388
  }
6368
6389
  return new Uint8Array(s);
6369
6390
  }
6370
- function ui(i) {
6391
+ function gi(i) {
6371
6392
  const e = new Uint8Array(i.length);
6372
6393
  return e.set(i), e.buffer;
6373
6394
  }
6374
- function gi(i) {
6395
+ function _i(i) {
6375
6396
  if (!i || typeof i != "object") return null;
6376
6397
  const e = i;
6377
6398
  if (typeof e.code == "number") {
@@ -6385,8 +6406,8 @@ function gi(i) {
6385
6406
  }
6386
6407
  return typeof e.keyVersion == "string" && typeof e.publicKey == "string" ? e : null;
6387
6408
  }
6388
- const _i = 3e4, fi = 1e3;
6389
- class pi {
6409
+ const fi = 3e4, pi = 1e3;
6410
+ class wi {
6390
6411
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6391
6412
  async request(e) {
6392
6413
  const t = e.retries ?? 0;
@@ -6397,7 +6418,7 @@ class pi {
6397
6418
  } catch (r) {
6398
6419
  if (s === t) throw r;
6399
6420
  }
6400
- await new Promise((r) => setTimeout(r, fi * 2 ** s));
6421
+ await new Promise((r) => setTimeout(r, pi * 2 ** s));
6401
6422
  }
6402
6423
  throw new Error("Unexpected: retry loop exited without result");
6403
6424
  }
@@ -6405,7 +6426,7 @@ class pi {
6405
6426
  async _doRequest(e) {
6406
6427
  const t = new AbortController(), s = setTimeout(
6407
6428
  () => t.abort(),
6408
- e.timeoutMs ?? _i
6429
+ e.timeoutMs ?? fi
6409
6430
  );
6410
6431
  try {
6411
6432
  const r = await fetch(e.url, {
@@ -6432,7 +6453,7 @@ class pi {
6432
6453
  }
6433
6454
  }
6434
6455
  }
6435
- function wi(i) {
6456
+ function Si(i) {
6436
6457
  const e = { raw: i }, t = i.search(/(^|;)\s*info=/i), s = t >= 0 ? i.slice(0, t) : i;
6437
6458
  if (t >= 0) {
6438
6459
  const r = i.slice(t).replace(/^;?\s*info=/i, "").trim();
@@ -6447,14 +6468,14 @@ function wi(i) {
6447
6468
  }
6448
6469
  return e;
6449
6470
  }
6450
- function Et(i) {
6471
+ function It(i) {
6451
6472
  try {
6452
6473
  return new URL(i).origin;
6453
6474
  } catch {
6454
6475
  return null;
6455
6476
  }
6456
6477
  }
6457
- class Si {
6478
+ class Ei {
6458
6479
  constructor(e, t) {
6459
6480
  this.inner = e, this.options = t;
6460
6481
  }
@@ -6463,23 +6484,23 @@ class Si {
6463
6484
  if (!this.isGateway(e.url))
6464
6485
  return this.inner.request(e);
6465
6486
  const t = await this.inner.request(
6466
- this.options.sendVersionHeader === !1 ? e : { ...e, headers: { ...e.headers, [ss]: this.options.version } }
6487
+ this.options.sendVersionHeader === !1 ? e : { ...e, headers: { ...e.headers, [rs]: this.options.version } }
6467
6488
  );
6468
6489
  return this.inspect(t), t;
6469
6490
  }
6470
6491
  isGateway(e) {
6471
- const t = Et(e);
6472
- return t === null ? !1 : this.options.getGatewayBaseUrls().some((s) => Et(s) === t);
6492
+ const t = It(e);
6493
+ return t === null ? !1 : this.options.getGatewayBaseUrls().some((s) => It(s) === t);
6473
6494
  }
6474
6495
  inspect(e) {
6475
6496
  var r, n, a, l;
6476
- const t = Ai(e.headers, is);
6477
- t && ((n = (r = this.options).onDeprecation) == null || n.call(r, wi(t)));
6497
+ const t = Ai(e.headers, ns);
6498
+ t && ((n = (r = this.options).onDeprecation) == null || n.call(r, Si(t)));
6478
6499
  const s = e.data;
6479
- s && s.code === fe && ((l = (a = this.options).onUnsupported) == null || l.call(a, { message: Ei(s) }));
6500
+ s && s.code === pe && ((l = (a = this.options).onUnsupported) == null || l.call(a, { message: Ii(s) }));
6480
6501
  }
6481
6502
  }
6482
- function Ei(i) {
6503
+ function Ii(i) {
6483
6504
  for (const e of [i.data, i.message])
6484
6505
  if (typeof e == "string" && e.trim()) return e;
6485
6506
  }
@@ -6489,26 +6510,26 @@ function Ai(i, e) {
6489
6510
  for (const [s, r] of Object.entries(i))
6490
6511
  if (s.toLowerCase() === t && r) return r;
6491
6512
  }
6492
- const Ii = [
6513
+ const mi = [
6493
6514
  /CROSSx\/([\d.]+)/i,
6494
6515
  /ONE\s?wallet[^\s/]*\/([\d.]+)/i,
6495
6516
  /ONE\s?pocket[^\s/]*\/([\d.]+)/i
6496
6517
  ];
6497
- function He() {
6518
+ function Ke() {
6498
6519
  return typeof window > "u" ? void 0 : window;
6499
6520
  }
6500
- function mi() {
6501
- const i = He();
6521
+ function Ti() {
6522
+ const i = Ke();
6502
6523
  return i == null ? void 0 : i.__crossx;
6503
6524
  }
6504
- function Ti(i) {
6525
+ function yi(i) {
6505
6526
  return i === "ios" || i === "android" ? i : null;
6506
6527
  }
6507
6528
  function ke() {
6508
6529
  const i = typeof navigator > "u" ? "" : navigator.userAgent;
6509
6530
  return /Android/i.test(i) ? "android" : /iPhone|iPad|iPod|Macintosh/i.test(i) ? "ios" : null;
6510
6531
  }
6511
- function yi(i, e) {
6532
+ function Ri(i, e) {
6512
6533
  const t = (a) => a.split(/[^\d]+/).filter((l) => l !== "").map((l) => Number.parseInt(l, 10)), s = t(i), r = t(e), n = Math.max(s.length, r.length);
6513
6534
  for (let a = 0; a < n; a += 1) {
6514
6535
  const l = (s[a] ?? 0) - (r[a] ?? 0);
@@ -6516,28 +6537,28 @@ function yi(i, e) {
6516
6537
  }
6517
6538
  return 0;
6518
6539
  }
6519
- function Ri() {
6520
- const i = He();
6540
+ function Ni() {
6541
+ const i = Ke();
6521
6542
  if (!i) return !1;
6522
6543
  const e = i.__crossxRNBridge;
6523
6544
  return e != null && e.isInstalled ? !0 : i.__CROSSX_BRIDGE_INITIALIZED__ === !0 || i.__CROSSX_RN_BRIDGE_READY__ === !0;
6524
6545
  }
6525
6546
  function At() {
6526
6547
  const i = typeof navigator > "u" ? "" : navigator.userAgent;
6527
- for (const e of Ii) {
6548
+ for (const e of mi) {
6528
6549
  const t = e.exec(i);
6529
6550
  if (t) return t[1] ?? null;
6530
6551
  }
6531
6552
  }
6532
- function Se() {
6533
- const i = mi();
6553
+ function Ee() {
6554
+ const i = Ti();
6534
6555
  if (i != null && i.browser)
6535
6556
  return {
6536
6557
  version: i.version ?? null,
6537
- platform: Ti(i.platform) ?? ke(),
6558
+ platform: yi(i.platform) ?? ke(),
6538
6559
  detectedBy: "marker"
6539
6560
  };
6540
- if (Ri())
6561
+ if (Ni())
6541
6562
  return {
6542
6563
  version: At() ?? null,
6543
6564
  platform: ke(),
@@ -6546,14 +6567,14 @@ function Se() {
6546
6567
  const e = At();
6547
6568
  return e !== void 0 ? { version: e, platform: ke(), detectedBy: "user-agent" } : null;
6548
6569
  }
6549
- function $i() {
6550
- return Se() !== null;
6570
+ function qi() {
6571
+ return Ee() !== null;
6551
6572
  }
6552
- function Yi(i = 3e3) {
6553
- const e = Se();
6554
- return e ? Promise.resolve(e) : He() ? new Promise((t) => {
6573
+ function ji(i = 3e3) {
6574
+ const e = Ee();
6575
+ return e ? Promise.resolve(e) : Ke() ? new Promise((t) => {
6555
6576
  const s = Date.now(), r = setInterval(() => {
6556
- const n = Se();
6577
+ const n = Ee();
6557
6578
  if (n) {
6558
6579
  clearInterval(r), t(n);
6559
6580
  return;
@@ -6562,16 +6583,16 @@ function Yi(i = 3e3) {
6562
6583
  }, 50);
6563
6584
  }) : Promise.resolve(null);
6564
6585
  }
6565
- const Ni = /* @__PURE__ */ new Set([
6586
+ const Oi = /* @__PURE__ */ new Set([
6566
6587
  "https://cross-wallet-oauth.crosstoken.io",
6567
6588
  "https://stg-cross-wallet-oauth.crosstoken.io",
6568
6589
  "https://dev-cross-wallet-oauth.crosstoken.io",
6569
6590
  "https://one-wallet-oauth.onechain.nexus",
6570
6591
  "https://stg-one-wallet-oauth.onechain.nexus",
6571
6592
  "https://dev-one-wallet-oauth.onechain.nexus"
6572
- ]), Oi = "crossx://oauth-callback", Pi = "2.3.2";
6573
- function Ci(i) {
6574
- return i.platform !== "ios" ? !1 : i.version ? yi(i.version, Pi) <= 0 : !0;
6593
+ ]), Pi = "crossx://oauth-callback", Ci = "2.3.2";
6594
+ function Di(i) {
6595
+ return i.platform !== "ios" ? !1 : i.version ? Ri(i.version, Ci) <= 0 : !0;
6575
6596
  }
6576
6597
  class K {
6577
6598
  constructor() {
@@ -6647,16 +6668,16 @@ class K {
6647
6668
  }
6648
6669
  openAuth(e) {
6649
6670
  return new Promise((t, s) => {
6650
- const r = Math.max(e.width ?? 500, 500), n = Math.max(e.height ?? 700, 700), a = window.screenX + (window.outerWidth - r) / 2, l = window.screenY + (window.outerHeight - n) / 2, d = K.generateRandom16Hex(), g = K.generateRandom16Hex(), u = Se();
6671
+ const r = Math.max(e.width ?? 500, 500), n = Math.max(e.height ?? 700, 700), a = window.screenX + (window.outerWidth - r) / 2, l = window.screenY + (window.outerHeight - n) / 2, d = K.generateRandom16Hex(), g = K.generateRandom16Hex(), u = Ee();
6651
6672
  let _ = e.authUrl;
6652
- u && e.legacyAuthUrl && Ci(u) && (_ = e.legacyAuthUrl, c.info("[CROSSx] 구버전 iOS 지갑 감지 — 이관 전 OAuth 호스트 사용", {
6673
+ u && e.legacyAuthUrl && Di(u) && (_ = e.legacyAuthUrl, c.info("[CROSSx] 구버전 iOS 지갑 감지 — 이관 전 OAuth 호스트 사용", {
6653
6674
  appVersion: u.version ?? "(unknown)",
6654
6675
  detectedBy: u.detectedBy,
6655
6676
  authUrlBase: e.legacyAuthUrl
6656
6677
  }));
6657
- const p = _.includes("?") ? "&" : "?", A = encodeURIComponent(window.location.origin);
6658
- let E = `${_}${p}state=${d}&nonce=${g}&origin=${A}`;
6659
- u && !E.includes("redirectUrl=") && (E += `&redirectUrl=${encodeURIComponent(Oi)}`, c.info("[CROSSx] 지갑 인앱 브라우저 감지 — redirectUrl 콜백 자동 부착", {
6678
+ const p = _.includes("?") ? "&" : "?", I = encodeURIComponent(window.location.origin);
6679
+ let S = `${_}${p}state=${d}&nonce=${g}&origin=${I}`;
6680
+ u && !S.includes("redirectUrl=") && (S += `&redirectUrl=${encodeURIComponent(Pi)}`, c.info("[CROSSx] 지갑 인앱 브라우저 감지 — redirectUrl 콜백 자동 부착", {
6660
6681
  detectedBy: u.detectedBy,
6661
6682
  appVersion: u.version ?? "(unknown)",
6662
6683
  platform: u.platform ?? "(unknown)"
@@ -6666,7 +6687,7 @@ class K {
6666
6687
  authUrlBase: _
6667
6688
  });
6668
6689
  const w = window.open(
6669
- E,
6690
+ S,
6670
6691
  u ? "_blank" : "CROSSx OAuth",
6671
6692
  `width=${r},height=${n},left=${a},top=${l}`
6672
6693
  );
@@ -6674,79 +6695,79 @@ class K {
6674
6695
  s(new Error("팝업 창을 열 수 없습니다. 팝업 차단을 해제해 주세요."));
6675
6696
  return;
6676
6697
  }
6677
- const f = setTimeout(() => {
6678
- c.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), N(), s(new Error("Authentication timeout"));
6679
- }, 300 * 1e3), S = 10, I = 30;
6680
- let T = 0, O = null;
6681
- const y = () => {
6682
- clearInterval(R), c.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + I + "초간 대기합니다"), O = setTimeout(() => {
6683
- N(), s(new Error(
6698
+ const m = setTimeout(() => {
6699
+ c.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), O(), s(new Error("Authentication timeout"));
6700
+ }, 300 * 1e3), f = 10, E = 30;
6701
+ let T = 0, y = null;
6702
+ const R = () => {
6703
+ clearInterval(N), c.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + E + "초간 대기합니다"), y = setTimeout(() => {
6704
+ O(), s(new Error(
6684
6705
  "OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
6685
6706
  ));
6686
- }, I * 1e3);
6687
- }, R = setInterval(() => {
6707
+ }, E * 1e3);
6708
+ }, N = setInterval(() => {
6688
6709
  T++;
6689
6710
  try {
6690
6711
  if (!w.closed) return;
6691
6712
  if (!!u) {
6692
- N(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다"));
6713
+ O(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다"));
6693
6714
  return;
6694
6715
  }
6695
6716
  const U = typeof document < "u" && document.hasFocus();
6696
- T <= S && !U ? y() : (N(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다")));
6717
+ T <= f && !U ? R() : (O(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다")));
6697
6718
  } catch {
6698
- y();
6719
+ R();
6699
6720
  }
6700
- }, 1e3), N = () => {
6701
- this.abortPending = null, clearTimeout(f), clearInterval(R), O && clearTimeout(O), window.removeEventListener("message", D);
6702
- }, D = (C) => {
6703
- if (!Ni.has(C.origin)) return;
6704
- N();
6705
- const U = typeof C.data.status == "string", m = U ? C.data.data ?? {} : C.data;
6721
+ }, 1e3), O = () => {
6722
+ this.abortPending = null, clearTimeout(m), clearInterval(N), y && clearTimeout(y), window.removeEventListener("message", P);
6723
+ }, P = (D) => {
6724
+ if (!Oi.has(D.origin)) return;
6725
+ O();
6726
+ const U = typeof D.data.status == "string", A = U ? D.data.data ?? {} : D.data;
6706
6727
  c.log("[CROSSx] OAuth postMessage 수신 —", {
6707
6728
  format: U ? "wrapped" : "flat",
6708
- status: U ? C.data.status : "(flat)"
6729
+ status: U ? D.data.status : "(flat)"
6709
6730
  });
6710
- const Q = (m == null ? void 0 : m.state) ?? C.data.state;
6731
+ const Q = (A == null ? void 0 : A.state) ?? D.data.state;
6711
6732
  if (!Q || Q !== d) {
6712
6733
  s(new Error("OAuth state mismatch — possible CSRF attack"));
6713
6734
  return;
6714
6735
  }
6715
- if (U && C.data.status !== "success") {
6716
- c.error("[CROSSx] OAuth 실패:", m == null ? void 0 : m.error), s(new Error((m == null ? void 0 : m.error) || "Authentication failed"));
6736
+ if (U && D.data.status !== "success") {
6737
+ c.error("[CROSSx] OAuth 실패:", A == null ? void 0 : A.error), s(new Error((A == null ? void 0 : A.error) || "Authentication failed"));
6717
6738
  return;
6718
6739
  }
6719
- if (!U && (m != null && m.error)) {
6720
- c.error("[CROSSx] OAuth 실패:", m.error), s(new Error(m.error || "Authentication failed"));
6740
+ if (!U && (A != null && A.error)) {
6741
+ c.error("[CROSSx] OAuth 실패:", A.error), s(new Error(A.error || "Authentication failed"));
6721
6742
  return;
6722
6743
  }
6723
- const $ = m == null ? void 0 : m.idToken, ee = m == null ? void 0 : m.accessToken, Ke = ee ?? $, Ve = (m == null ? void 0 : m.email) || void 0;
6744
+ const $ = A == null ? void 0 : A.idToken, ee = A == null ? void 0 : A.accessToken, Ve = ee ?? $, $e = (A == null ? void 0 : A.email) || void 0;
6724
6745
  if (c.log("[CROSSx] OAuth 토큰 수신:", {
6725
6746
  hasAccessToken: !!ee,
6726
6747
  hasIdToken: !!$,
6727
- hasEmail: !!Ve
6728
- }), !Ke) {
6729
- c.error("[CROSSx] 토큰을 찾을 수 없음:", C.data), s(new Error("Token not found in response"));
6748
+ hasEmail: !!$e
6749
+ }), !Ve) {
6750
+ c.error("[CROSSx] 토큰을 찾을 수 없음:", D.data), s(new Error("Token not found in response"));
6730
6751
  return;
6731
6752
  }
6732
- const $e = { token: Ke, email: Ve }, me = (Ye) => {
6733
- K.verifyIdTokenNonce(Ye, g).then(() => t($e)).catch((Te) => {
6734
- c.error("[CROSSx] nonce 검증 실패:", Te), s(Te instanceof Error ? Te : new Error("nonce verification failed"));
6753
+ const Ye = { token: Ve, email: $e }, Te = (qe) => {
6754
+ K.verifyIdTokenNonce(qe, g).then(() => t(Ye)).catch((ye) => {
6755
+ c.error("[CROSSx] nonce 검증 실패:", ye), s(ye instanceof Error ? ye : new Error("nonce verification failed"));
6735
6756
  });
6736
6757
  };
6737
- ee ? ee.split(".").length === 3 ? me(ee) : $ ? me($) : (c.warn(
6758
+ ee ? ee.split(".").length === 3 ? Te(ee) : $ ? Te($) : (c.warn(
6738
6759
  "[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
6739
6760
  "서버 측 nonce 검증이 필요합니다."
6740
- ), t($e)) : $ ? me($) : s(new Error("Token not found in response"));
6761
+ ), t(Ye)) : $ ? Te($) : s(new Error("Token not found in response"));
6741
6762
  };
6742
- this.abortPending = (C) => {
6743
- N(), s(new Error(C));
6744
- }, window.addEventListener("message", D);
6763
+ this.abortPending = (D) => {
6764
+ O(), s(new Error(D));
6765
+ }, window.addEventListener("message", P);
6745
6766
  });
6746
6767
  }
6747
6768
  }
6748
6769
  const se = "crossx_wallet_data", q = "crossx_mock_pin_hash";
6749
- class Di {
6770
+ class xi {
6750
6771
  constructor(e, t) {
6751
6772
  this.storage = e, this.pinStore = t ?? null;
6752
6773
  }
@@ -6891,7 +6912,7 @@ class Di {
6891
6912
  ).join("");
6892
6913
  }
6893
6914
  }
6894
- const xi = ["password", "newPassword", "recoveryPin"];
6915
+ const vi = ["password", "newPassword", "recoveryPin"];
6895
6916
  class V {
6896
6917
  constructor(e, t, s, r, n, a) {
6897
6918
  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;
@@ -6919,9 +6940,9 @@ class V {
6919
6940
  */
6920
6941
  async ensureValidToken() {
6921
6942
  const e = this.tokenStore.get();
6922
- if (e && !this.tokenStore.isExpiringSoon(Ze))
6943
+ if (e && !this.tokenStore.isExpiringSoon(Qe))
6923
6944
  return e;
6924
- const t = !e || this.tokenStore.isExpiringSoon(Ze);
6945
+ const t = !e || this.tokenStore.isExpiringSoon(Qe);
6925
6946
  if (this._onTokenRefresh) {
6926
6947
  if (await this.deduplicatedRefresh()) {
6927
6948
  const r = this.tokenStore.get();
@@ -6957,7 +6978,7 @@ class V {
6957
6978
  async sealPinFields(e) {
6958
6979
  if (!this.pinEncryptor || !e || typeof e != "object") return e;
6959
6980
  let t = null;
6960
- for (const s of xi) {
6981
+ for (const s of vi) {
6961
6982
  const r = e[s];
6962
6983
  if (typeof r != "string" || r === "") continue;
6963
6984
  const n = await this.pinEncryptor.seal(r);
@@ -6966,7 +6987,7 @@ class V {
6966
6987
  return t ?? e;
6967
6988
  }
6968
6989
  async request(e, t, s, r = !1, n = !1) {
6969
- var u, _, p, A;
6990
+ var u, _, p, I;
6970
6991
  const a = await this.ensureValidToken(), l = `${this.baseUrl}${t}`, d = {
6971
6992
  Authorization: `Bearer ${a}`,
6972
6993
  "Content-Type": "application/json",
@@ -6981,36 +7002,36 @@ class V {
6981
7002
  })).data;
6982
7003
  if (w && typeof w.code == "number") {
6983
7004
  if (w.code < 0 || w.code >= 400) {
6984
- const f = w.message || w.data || "API 요청에 실패했습니다";
7005
+ const m = w.message || w.data || "API 요청에 실패했습니다";
6985
7006
  c.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
6986
7007
  code: w.code,
6987
- message: f,
7008
+ message: m,
6988
7009
  url: l,
6989
7010
  method: e
6990
7011
  });
6991
- const S = V.mapGatewayError(w.code, w.data);
6992
- if (S === o.PIN_ENCRYPTION_INVALID && this.pinEncryptor && (this.pinEncryptor.requireEncryption(), this.pinEncryptor.invalidate(), !n))
7012
+ const f = V.mapGatewayError(w.code, w.data);
7013
+ if (f === o.PIN_ENCRYPTION_INVALID && this.pinEncryptor && (this.pinEncryptor.requireEncryption(), this.pinEncryptor.invalidate(), !n))
6993
7014
  return c.warn("[CROSSx] Gateway -10045 감지 — pin-key 재조회 후 재시도"), this.request(e, t, s, r, !0);
6994
- if (S === o.AUTH_NOT_AUTHENTICATED && !r && this._onTokenRefresh) {
7015
+ if (f === o.AUTH_NOT_AUTHENTICATED && !r && this._onTokenRefresh) {
6995
7016
  if (c.warn("[CROSSx] Gateway -10002 감지 — 토큰 갱신 후 재시도"), await this.deduplicatedRefresh())
6996
7017
  return this.request(e, t, s, !0, n);
6997
7018
  throw new h(o.SESSION_EXPIRED, "인증 세션이 만료되었습니다. 다시 로그인해 주세요.");
6998
7019
  }
6999
- if (S === o.USER_NOT_FOUND)
7020
+ if (f === o.USER_NOT_FOUND)
7000
7021
  throw c.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (u = this._onUnauthorized) == null || u.call(this), new h(
7001
7022
  o.USER_NOT_FOUND,
7002
- V.getGatewayErrorMessage(w.code, f)
7023
+ V.getGatewayErrorMessage(w.code, m)
7003
7024
  );
7004
- const I = S === o.AUTH_NOT_AUTHENTICATED ? o.SESSION_EXPIRED : S, T = I === o.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : V.getGatewayErrorMessage(w.code, f), O = w.data;
7005
- let y;
7006
- throw S === o.PIN_LOCKED ? y = V.extractLockDetails(O) : S === o.ADDRESS_LIMIT_EXCEEDED ? y = { limit: Qe, raw: O } : y = O ?? void 0, new h(I, T, y);
7025
+ const E = f === o.AUTH_NOT_AUTHENTICATED ? o.SESSION_EXPIRED : f, T = E === o.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : V.getGatewayErrorMessage(w.code, m), y = w.data;
7026
+ let R;
7027
+ throw f === o.PIN_LOCKED ? R = V.extractLockDetails(y) : f === o.ADDRESS_LIMIT_EXCEEDED ? R = { limit: et, raw: y } : R = y ?? void 0, new h(E, T, R);
7007
7028
  }
7008
7029
  return c.log("[CROSSx] Wallet Gateway API 성공:", { code: w.code, url: l, method: e }), w.data ?? w;
7009
7030
  }
7010
7031
  return w;
7011
- } catch (E) {
7012
- if (E instanceof h) throw E;
7013
- const w = ((_ = E.response) == null ? void 0 : _.status) ?? E.status;
7032
+ } catch (S) {
7033
+ if (S instanceof h) throw S;
7034
+ const w = ((_ = S.response) == null ? void 0 : _.status) ?? S.status;
7014
7035
  if ((w === 401 || w === 403) && !r && this._onTokenRefresh) {
7015
7036
  if (c.warn(`[CROSSx] HTTP ${w} 감지 — 토큰 갱신 후 재시도`), await this.deduplicatedRefresh())
7016
7037
  return this.request(e, t, s, !0, n);
@@ -7019,20 +7040,20 @@ class V {
7019
7040
  "인증 세션이 만료되었습니다. 다시 로그인해 주세요."
7020
7041
  );
7021
7042
  }
7022
- if ((p = E.response) != null && p.data) {
7023
- const f = E.response.data, S = f.message || f.data || "API 요청에 실패했습니다", I = f.code || "UNKNOWN";
7043
+ if ((p = S.response) != null && p.data) {
7044
+ const m = S.response.data, f = m.message || m.data || "API 요청에 실패했습니다", E = m.code || "UNKNOWN";
7024
7045
  throw c.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
7025
- code: I,
7026
- message: S,
7046
+ code: E,
7047
+ message: f,
7027
7048
  url: l,
7028
7049
  method: e,
7029
- status: (A = E.response) == null ? void 0 : A.status
7050
+ status: (I = S.response) == null ? void 0 : I.status
7030
7051
  }), new h(
7031
7052
  o.UNKNOWN_ERROR,
7032
- `Wallet Gateway 오류 (${I}): ${S}`
7053
+ `Wallet Gateway 오류 (${E}): ${f}`
7033
7054
  );
7034
7055
  }
7035
- throw E;
7056
+ throw S;
7036
7057
  }
7037
7058
  }
7038
7059
  /**
@@ -7326,7 +7347,7 @@ class V {
7326
7347
  return o.ORIGIN_NOT_ALLOWED;
7327
7348
  case -10025:
7328
7349
  return o.INVALID_APP_TYPE;
7329
- case fe:
7350
+ case pe:
7330
7351
  return o.SDK_VERSION_UNSUPPORTED;
7331
7352
  // PIN 관련
7332
7353
  case -10028:
@@ -7395,7 +7416,7 @@ class V {
7395
7416
  return "Origin or App ID is required. Register the current domain or set X-App-Id header.";
7396
7417
  case -10025:
7397
7418
  return "Invalid app type. X-App-Type must be android, ios, or windows.";
7398
- case fe:
7419
+ case pe:
7399
7420
  return `This SDK version is no longer supported. Update @nexus-cross/crossx-sdk-core.${t ? ` (${t})` : ""}`;
7400
7421
  case -10026:
7401
7422
  return "Domain chainId mismatch: the chainId in typedData.domain does not match the request chainId.";
@@ -7414,7 +7435,7 @@ class V {
7414
7435
  case -10033:
7415
7436
  return "User not found. You have been signed out.";
7416
7437
  case -10036:
7417
- return `Account limit reached. Maximum ${Qe} accounts allowed.`;
7438
+ return `Account limit reached. Maximum ${et} accounts allowed.`;
7418
7439
  case -10045:
7419
7440
  return "Could not securely send your PIN. Please try again.";
7420
7441
  case -10046:
@@ -7428,7 +7449,7 @@ class V {
7428
7449
  }
7429
7450
  }
7430
7451
  }
7431
- class vi {
7452
+ class ki {
7432
7453
  constructor(e, t, s, r = () => {
7433
7454
  }, n = () => {
7434
7455
  }, a = () => {
@@ -7461,7 +7482,7 @@ class vi {
7461
7482
  * 넘길 수 있으면 위임을 해제(SDK 상태 정리)하고 true 를 돌려준다.
7462
7483
  */
7463
7484
  async recoverFromUnauthorized(e, t, s, r) {
7464
- return !Tt(e) || !await this.innerOwnsAddress(t, s) ? !1 : (this.onBridgeUnauthorized(
7485
+ return !yt(e) || !await this.innerOwnsAddress(t, s) ? !1 : (this.onBridgeUnauthorized(
7465
7486
  `native 가 ${r} 을 ERR_BRIDGE_NOT_AUTHORIZED 로 거부 — inner provider 로 폴백`
7466
7487
  ), !0);
7467
7488
  }
@@ -7626,7 +7647,7 @@ class ne {
7626
7647
  }
7627
7648
  isCacheValid() {
7628
7649
  if (this.loadedAt === 0) return !1;
7629
- const e = this.usingFallback ? es : Qt;
7650
+ const e = this.usingFallback ? ts : es;
7630
7651
  return e === 0 ? !0 : Date.now() - this.loadedAt < e;
7631
7652
  }
7632
7653
  populateCache(e, t) {
@@ -7683,7 +7704,7 @@ class ne {
7683
7704
  return o.APP_IDENTIFIER_MISSING;
7684
7705
  case -10025:
7685
7706
  return o.INVALID_APP_TYPE;
7686
- case fe:
7707
+ case pe:
7687
7708
  return o.SDK_VERSION_UNSUPPORTED;
7688
7709
  default:
7689
7710
  return o.UNKNOWN_ERROR;
@@ -7698,7 +7719,7 @@ function G(i) {
7698
7719
  )
7699
7720
  );
7700
7721
  }
7701
- class ki {
7722
+ class Ui {
7702
7723
  // ─── 사용자 입력이 필요한 화면 → UI_NOT_PROVIDED ───
7703
7724
  requestConfirmation(e) {
7704
7725
  return G("requestConfirmation");
@@ -7747,7 +7768,7 @@ class ki {
7747
7768
  setPinKeyboard() {
7748
7769
  }
7749
7770
  }
7750
- class Ui {
7771
+ class bi {
7751
7772
  constructor(e, t, s, r = () => !1) {
7752
7773
  this.browserConfirmation = e, this.getBridge = t, this.getOrigin = s, this.isAuthenticatedViaRNBridge = r;
7753
7774
  }
@@ -7920,7 +7941,7 @@ class Ui {
7920
7941
  (s = (t = this.browserConfirmation).setPinKeyboard) == null || s.call(t, e);
7921
7942
  }
7922
7943
  }
7923
- class bi {
7944
+ class Li {
7924
7945
  constructor() {
7925
7946
  this._accessToken = null, this._expiresAt = 0;
7926
7947
  }
@@ -7953,10 +7974,10 @@ class bi {
7953
7974
  }
7954
7975
  }
7955
7976
  const Ht = /* @__PURE__ */ new WeakMap();
7956
- function Li(i, e) {
7977
+ function Wi(i, e) {
7957
7978
  Ht.set(i, e);
7958
7979
  }
7959
- function qi(i) {
7980
+ function zi(i) {
7960
7981
  const e = Ht.get(i);
7961
7982
  if (!e)
7962
7983
  throw new Error(
@@ -7964,13 +7985,21 @@ function qi(i) {
7964
7985
  );
7965
7986
  return e;
7966
7987
  }
7967
- function Wi(i) {
7968
- return Kt(i);
7988
+ const Kt = /* @__PURE__ */ new WeakMap();
7989
+ function Mi(i, e) {
7990
+ Kt.set(i, e);
7991
+ }
7992
+ function Ji(i, e) {
7993
+ const t = Kt.get(i);
7994
+ return t ? t(e) : Promise.reject(new Error("[CROSSx] reloadOneIdSession: create the SDK with the core factory"));
7995
+ }
7996
+ function Fi(i) {
7997
+ return Vt(i);
7969
7998
  }
7970
- function ji(i, e) {
7971
- return Kt(i, e);
7999
+ function Xi(i, e) {
8000
+ return Vt(i, e);
7972
8001
  }
7973
- function Kt(i, e) {
8002
+ function Vt(i, e) {
7974
8003
  var U;
7975
8004
  if (!i.projectId)
7976
8005
  throw new Error(
@@ -7994,74 +8023,74 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
7994
8023
  }, r = {
7995
8024
  gatewayUrl: t.walletGatewayUrl,
7996
8025
  projectId: i.projectId
7997
- }, n = s.authMode !== "cookie" && wt.isAvailable();
8026
+ }, n = s.authMode !== "cookie" && St.isAvailable();
7998
8027
  !n && s.authMode !== "cookie" && c.warn(
7999
8028
  "[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
8000
8029
  "refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
8001
8030
  "IndexedDB를 지원하는 브라우저 사용을 권장합니다."
8002
8031
  ), s.secureStorageAvailable = n;
8003
- const a = n ? new wt(i.projectId) : new ti(), l = new ii();
8032
+ const a = n ? new St(i.projectId) : new si(), l = new ni();
8004
8033
  let d = null;
8005
- const g = new Si(new pi(), {
8006
- version: ge,
8007
- sendVersionHeader: rs,
8034
+ const g = new Ei(new wi(), {
8035
+ version: _e,
8036
+ sendVersionHeader: is,
8008
8037
  getGatewayBaseUrls: () => [r.gatewayUrl],
8009
- onDeprecation: (m) => d == null ? void 0 : d.handleSdkVersionDeprecation(m),
8010
- onUnsupported: (m) => d == null ? void 0 : d.handleSdkVersionUnsupported(m)
8011
- }), u = new K(), _ = new bi(), p = e == null ? void 0 : e.pinReuse, A = new Nt({ ttlMs: (p == null ? void 0 : p.mode) === "memory" ? p.ttlMs : void 0 }), E = new oi(r, g);
8038
+ onDeprecation: (A) => d == null ? void 0 : d.handleSdkVersionDeprecation(A),
8039
+ onUnsupported: (A) => d == null ? void 0 : d.handleSdkVersionUnsupported(A)
8040
+ }), u = new K(), _ = new Li(), p = e == null ? void 0 : e.pinReuse, I = new Ot({ ttlMs: (p == null ? void 0 : p.mode) === "memory" ? p.ttlMs : void 0 }), S = new ci(r, g);
8012
8041
  let w;
8013
- i.useMockWallet ? (c.log("[CROSSx] Mock Wallet Provider 사용"), w = new Di(a, A)) : i.walletServer === "one-wallet" ? (c.log("[CROSSx] one-wallet-api Wallet Provider 사용"), w = new We({
8014
- baseUrl: () => we().oneWalletApiUrl,
8042
+ i.useMockWallet ? (c.log("[CROSSx] Mock Wallet Provider 사용"), w = new xi(a, I)) : i.walletServer === "one-wallet" ? (c.log("[CROSSx] one-wallet-api Wallet Provider 사용"), w = new Me({
8043
+ baseUrl: () => Se().oneWalletApiUrl,
8015
8044
  transport: g,
8016
- pinStore: A,
8045
+ pinStore: I,
8017
8046
  getAccessToken: () => d ? d.getOneIdAccessToken() : Promise.reject(new h(o.AUTH_NOT_INITIALIZED, "SDK가 아직 만들어지지 않았습니다"))
8018
8047
  })) : (c.log("[CROSSx] Remote Wallet Provider 사용"), w = new V(
8019
8048
  r,
8020
8049
  a,
8021
8050
  g,
8022
8051
  _,
8023
- A,
8024
- E
8052
+ I,
8053
+ S
8025
8054
  ));
8026
- const f = () => {
8027
- var m;
8028
- return ((m = d == null ? void 0 : d.isAuthenticatedViaRNBridge) == null ? void 0 : m.call(d)) ?? !1;
8029
- }, S = () => {
8030
- var m;
8031
- return (m = d == null ? void 0 : d.assertRNBridgeSessionActive) == null ? void 0 : m.call(d);
8032
- }, I = (m) => {
8055
+ const m = () => {
8056
+ var A;
8057
+ return ((A = d == null ? void 0 : d.isAuthenticatedViaRNBridge) == null ? void 0 : A.call(d)) ?? !1;
8058
+ }, f = () => {
8059
+ var A;
8060
+ return (A = d == null ? void 0 : d.assertRNBridgeSessionActive) == null ? void 0 : A.call(d);
8061
+ }, E = (A) => {
8033
8062
  var Q;
8034
- (Q = d == null ? void 0 : d.clearRNBridgeDelegation) == null || Q.call(d, m);
8063
+ (Q = d == null ? void 0 : d.clearRNBridgeDelegation) == null || Q.call(d, A);
8035
8064
  };
8036
- i.walletServer !== "one-wallet" && (w = new vi(
8065
+ i.walletServer !== "one-wallet" && (w = new ki(
8037
8066
  w,
8038
8067
  () => {
8039
- var m;
8040
- return (m = d == null ? void 0 : d.getRNBridge) == null ? void 0 : m.call(d);
8068
+ var A;
8069
+ return (A = d == null ? void 0 : d.getRNBridge) == null ? void 0 : A.call(d);
8041
8070
  },
8071
+ m,
8042
8072
  f,
8043
- S,
8044
8073
  () => i.appName,
8045
- I
8074
+ E
8046
8075
  ));
8047
- const T = new ne(r, g), O = we(), y = e != null && e.ui ? e.ui({
8076
+ const T = new ne(r, g), y = Se(), R = e != null && e.ui ? e.ui({
8048
8077
  theme: i.theme ?? "light",
8049
8078
  themeTokens: i.themeTokens,
8050
8079
  displayDecimals: i.displayDecimals,
8051
8080
  pinKeyboard: i.pinKeyboard,
8052
8081
  endpoints: {
8053
- contentsBaseUrl: O.contentsBaseUrl,
8054
- portraitBaseUrl: O.portraitBaseUrl
8082
+ contentsBaseUrl: y.contentsBaseUrl,
8083
+ portraitBaseUrl: y.portraitBaseUrl
8055
8084
  }
8056
- }) : new ki(), R = new Ui(
8057
- y,
8085
+ }) : new Ui(), N = new bi(
8086
+ R,
8058
8087
  () => {
8059
- var m;
8060
- return (m = d == null ? void 0 : d.getRNBridge) == null ? void 0 : m.call(d);
8088
+ var A;
8089
+ return (A = d == null ? void 0 : d.getRNBridge) == null ? void 0 : A.call(d);
8061
8090
  },
8062
8091
  () => typeof window < "u" ? window.location.origin : "http://localhost",
8063
- f
8064
- ), N = e != null && e.wrapConfirmation ? e.wrapConfirmation(R) : R, D = new Me(
8092
+ m
8093
+ ), O = e != null && e.wrapConfirmation ? e.wrapConfirmation(N) : N, P = new Fe(
8065
8094
  s,
8066
8095
  r,
8067
8096
  a,
@@ -8070,48 +8099,56 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
8070
8099
  u,
8071
8100
  w,
8072
8101
  _,
8073
- N,
8102
+ O,
8074
8103
  T,
8075
- A,
8076
- E,
8077
- new Gs()
8104
+ I,
8105
+ S,
8106
+ new Hs(),
8107
+ e == null ? void 0 : e.oneIdSessions
8078
8108
  );
8079
- d = D, Li(D, {
8109
+ d = P, Wi(P, {
8080
8110
  transport: g,
8081
8111
  storage: a,
8082
8112
  walletProvider: w,
8083
- confirmation: N,
8113
+ confirmation: O,
8084
8114
  tokenStore: _,
8085
- pinStore: A,
8115
+ pinStore: I,
8086
8116
  adapterConfig: r,
8087
- pinEncryptor: E
8088
- });
8089
- const C = D.signInUseCase;
8090
- return C && typeof C.setFreshTokenCallback == "function" && C.setFreshTokenCallback(() => D.requestFreshFirebaseIdTokenFromBridge()), typeof window < "u" && (window.__crossxSDK = D), D;
8117
+ pinEncryptor: S
8118
+ }), Mi(P, (A) => P.reloadOneIdSession(A));
8119
+ const D = P.signInUseCase;
8120
+ return D && typeof D.setFreshTokenCallback == "function" && D.setFreshTokenCallback(() => P.requestFreshFirebaseIdTokenFromBridge()), typeof window < "u" && (window.__crossxSDK = P), P;
8091
8121
  }
8092
- const zi = Wi;
8122
+ const Zi = Fi;
8093
8123
  export {
8094
- os as C,
8095
- Vi as D,
8124
+ cs as C,
8125
+ Yi as D,
8096
8126
  o as E,
8097
- Rt as M,
8098
- Nt as P,
8099
- bi as T,
8100
- mt as W,
8101
- h as a,
8102
- fs as b,
8103
- ji as c,
8104
- Me as d,
8105
- Ki as e,
8106
- ns as f,
8107
- qi as g,
8108
- ps as h,
8109
- Qe as i,
8110
- It as j,
8111
- Wi as k,
8112
- zi as l,
8113
- Hi as m,
8114
- Se as n,
8115
- $i as o,
8116
- Yi as w
8127
+ Nt as M,
8128
+ Ce as O,
8129
+ Ot as P,
8130
+ Li as T,
8131
+ Tt as W,
8132
+ $s as a,
8133
+ h as b,
8134
+ Xi as c,
8135
+ be as d,
8136
+ ps as e,
8137
+ Fe as f,
8138
+ zi as g,
8139
+ $i as h,
8140
+ he as i,
8141
+ as as j,
8142
+ ws as k,
8143
+ et as l,
8144
+ bs as m,
8145
+ z as n,
8146
+ mt as o,
8147
+ Fi as p,
8148
+ Zi as q,
8149
+ Ji as r,
8150
+ Vi as s,
8151
+ Ee as t,
8152
+ qi as u,
8153
+ ji as w
8117
8154
  };