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

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.
@@ -2,7 +2,7 @@ import { createRemoteJWKSet as $t, jwtVerify as Yt, decodeJwt as qt } from "jose
2
2
  import { secp256k1 as jt } from "@noble/curves/secp256k1.js";
3
3
  import { keccak_256 as je } from "@noble/hashes/sha3.js";
4
4
  import { bytesToHex as zt } from "@noble/hashes/utils.js";
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 || {});
5
+ var o = /* @__PURE__ */ ((i) => (i.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", i.AUTH_FAILED = "AUTH_FAILED", i.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", i.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", i.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", i.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", i.SESSION_EXPIRED = "SESSION_EXPIRED", i.OAUTH_POPUP_BLOCKED = "OAUTH_POPUP_BLOCKED", i.ONEID_TERMS_NOT_AGREED = "ONEID_TERMS_NOT_AGREED", i.ONEID_ACCOUNT_NOT_FOUND = "ONEID_ACCOUNT_NOT_FOUND", i.ONEID_SERVICE_NOT_LINKED = "ONEID_SERVICE_NOT_LINKED", i.ONEID_AUTHORIZATION_FAILED = "ONEID_AUTHORIZATION_FAILED", i.ONEID_STATE_MISMATCH = "ONEID_STATE_MISMATCH", i.ONEID_ISSUER_MISMATCH = "ONEID_ISSUER_MISMATCH", i.ONEID_TIMEOUT = "ONEID_TIMEOUT", i.ONEID_SESSION_EVICTED = "ONEID_SESSION_EVICTED", i.ONEID_SESSION_REVOKED = "ONEID_SESSION_REVOKED", i.ONEID_SESSION_EXPIRED = "ONEID_SESSION_EXPIRED", i.ONEID_SESSION_INVALID = "ONEID_SESSION_INVALID", i.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", i.WALLET_NAME_INVALID = "WALLET_NAME_INVALID", i.WALLET_OPERATION_UNSUPPORTED = "WALLET_OPERATION_UNSUPPORTED", i.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", i.WALLET_ALREADY_EXISTS = "WALLET_ALREADY_EXISTS", i.ADDRESS_LIMIT_EXCEEDED = "ADDRESS_LIMIT_EXCEEDED", i.SIGN_FAILED = "SIGN_FAILED", i.SIGN_REJECTED = "SIGN_REJECTED", i.TX_FAILED = "TX_FAILED", i.TX_REJECTED = "TX_REJECTED", i.BROADCAST_FAILED = "BROADCAST_FAILED", i.USER_REJECTED = "USER_REJECTED", i.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", i.NETWORK_ERROR = "NETWORK_ERROR", i.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", i.INVALID_CHAIN = "INVALID_CHAIN", i.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", i.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", i.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", i.SIGNATURE_FAILED = "SIGNATURE_FAILED", i.TRANSACTION_FAILED = "TRANSACTION_FAILED", i.PREPARE_FAILED = "PREPARE_FAILED", i.PREPARE_EXPIRED = "PREPARE_EXPIRED", i.PREPARE_MISMATCH = "PREPARE_MISMATCH", i.MIGRATION_FAILED = "MIGRATION_FAILED", i.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", i.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", i.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", i.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", i.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", i.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", i.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", i.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", i.INVALID_APP_TYPE = "INVALID_APP_TYPE", i.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", i.SDK_VERSION_UNSUPPORTED = "SDK_VERSION_UNSUPPORTED", i.UI_NOT_PROVIDED = "UI_NOT_PROVIDED", i.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", i.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", i.EXECUTION_REVERTED = "EXECUTION_REVERTED", i.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", i.PIN_NOT_SET = "PIN_NOT_SET", i.PIN_WRONG = "PIN_WRONG", i.PIN_INVALID = "PIN_INVALID", i.PIN_REPEATED_PATTERN = "PIN_REPEATED_PATTERN", i.PIN_CANCELLED = "PIN_CANCELLED", i.EXTERNAL_WALLET_REQUESTED = "EXTERNAL_WALLET_REQUESTED", i.PIN_LOCKED = "PIN_LOCKED", i.PIN_ENCRYPTION_INVALID = "PIN_ENCRYPTION_INVALID", i.PIN_POLICY_VIOLATION = "PIN_POLICY_VIOLATION", i.PIN_ENCRYPTION_FAILED = "PIN_ENCRYPTION_FAILED", i.HMAC_REQUIRED = "HMAC_REQUIRED", i.HMAC_VERIFICATION_FAILED = "HMAC_VERIFICATION_FAILED", i.WITHDRAW_FAILED = "WITHDRAW_FAILED", i.USER_NOT_FOUND = "USER_NOT_FOUND", i.RN_BRIDGE_NOT_AVAILABLE = "RN_BRIDGE_NOT_AVAILABLE", i.RN_BRIDGE_HANDSHAKE_FAILED = "RN_BRIDGE_HANDSHAKE_FAILED", i.RN_NATIVE_SESSION_EXPIRED = "RN_NATIVE_SESSION_EXPIRED", i.INVALID_CONFIG = "INVALID_CONFIG", i.UNKNOWN_ERROR = "UNKNOWN_ERROR", i))(o || {});
6
6
  class h extends Error {
7
7
  constructor(e, t, s) {
8
8
  super(t), this.code = e, this.details = s, this.name = "CROSSxError", Object.setPrototypeOf(this, h.prototype);
@@ -16,7 +16,7 @@ class h extends Error {
16
16
  };
17
17
  }
18
18
  }
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";
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, fe = "crossx-sdk-js/3.0.0-beta.8", rs = "X-SDK-Version", is = !1, ns = "x-sdk-deprecation", we = -10050, Tt = "ONEpocket";
20
20
  var as = /* @__PURE__ */ ((i) => (i.MetaMask = "io.metamask", i.Binance = "com.binance.wallet", i.CROSSx = "crossx", i))(as || {});
21
21
  const os = {
22
22
  "io.metamask": "MetaMask",
@@ -28,7 +28,7 @@ const os = {
28
28
  "com.binance.wallet"
29
29
  /* Binance */
30
30
  ];
31
- function Vi(i) {
31
+ function Ji(i) {
32
32
  return os[i] ?? i;
33
33
  }
34
34
  function ls(i) {
@@ -58,7 +58,7 @@ function j(i, e) {
58
58
  const n = t && !s.includes(t) ? `${s} (${t})` : s;
59
59
  return new h(e, n, r);
60
60
  }
61
- const Ae = {
61
+ const Ie = {
62
62
  // ─── CROSS ────────────────────────────────────────────
63
63
  ONE_MAINNET: {
64
64
  caipId: "eip155:612055",
@@ -107,13 +107,13 @@ const Ae = {
107
107
  rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
108
108
  testnet: !0
109
109
  }
110
- }, $i = Object.fromEntries(
111
- Object.entries(Ae).map(([i, e]) => [i, e.caipId])
110
+ }, Xi = Object.fromEntries(
111
+ Object.entries(Ie).map(([i, e]) => [i, e.caipId])
112
112
  ), gs = new Map(
113
- Object.values(Ae).map((i) => [i.caipId, i])
113
+ Object.values(Ie).map((i) => [i.caipId, i])
114
114
  );
115
115
  new Map(
116
- Object.values(Ae).map((i) => [i.chainId, i])
116
+ Object.values(Ie).map((i) => [i.chainId, i])
117
117
  );
118
118
  const _s = { symbol: "", decimals: 18 };
119
119
  function fs(i, e) {
@@ -221,7 +221,7 @@ let W = null;
221
221
  function st(i) {
222
222
  W = i;
223
223
  }
224
- const c = {
224
+ const l = {
225
225
  /** 빌드 모드와 무관하게 항상 출력되는 정보성 로그 (SDK 수명주기 등) */
226
226
  info(...i) {
227
227
  if (W) {
@@ -513,10 +513,10 @@ function M(i = "en", e) {
513
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 rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user_info", Ie = class Ie {
517
- constructor(e, t, s, r, n, a, l, d, g = () => {
516
+ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user_info", Ae = class Ae {
517
+ constructor(e, t, s, r, n, a, c, d, g = () => {
518
518
  }) {
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;
519
+ this.config = e, this.storage = t, this.crypto = s, this.oauth = r, this.transport = n, this.walletProvider = a, this.tokenStore = c, this.requestFreshTokenFromBridge = d, this.getLocale = g, this._refreshPromise = null, this._migrated = !1;
520
520
  const u = e.projectId;
521
521
  this.STORAGE_KEY_ACCESS_TOKEN = `crossx_${u}_access_token`, this.STORAGE_KEY_REFRESH_TOKEN = `crossx_${u}_refresh_token`, this.STORAGE_KEY_USER = `crossx_${u}_user_info`, this.STORAGE_KEY_RN_BRIDGE_SESSION = `crossx_${u}_rn_bridge_session`;
522
522
  }
@@ -612,19 +612,19 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "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 = Es(this.getLocale()), g = (I) => {
616
- const S = `${I}${n}`, w = S.includes("?") ? "&" : "?";
615
+ const { oauthServiceUrl: a, legacyOauthServiceUrl: c } = this.config, d = Es(this.getLocale()), g = (A) => {
616
+ const S = `${A}${n}`, w = S.includes("?") ? "&" : "?";
617
617
  return `${S}${w}locale=${d}`;
618
- }, u = g(a), _ = l ? g(l) : void 0;
619
- c.log(`[CROSSx] OAuth 팝업 열기 (${r || "일반"} 로그인)`), c.log(`[CROSSx] Auth URL: ${u}`);
618
+ }, u = g(a), _ = c ? g(c) : void 0;
619
+ l.log(`[CROSSx] OAuth 팝업 열기 (${r || "일반"} 로그인)`), l.log(`[CROSSx] Auth URL: ${u}`);
620
620
  const p = await this.oauth.openAuth({
621
621
  authUrl: u,
622
622
  ..._ ? { legacyAuthUrl: _ } : {},
623
623
  expectedOrigin: new URL(a).origin
624
624
  });
625
- t = p.token, s = p.email, c.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", t.length, ")"), s && c.log("[CROSSx] OAuth 콜백 email:", s);
625
+ t = p.token, s = p.email, l.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", t.length, ")"), s && l.log("[CROSSx] OAuth 콜백 email:", s);
626
626
  } catch (r) {
627
- if (c.error("[CROSSx] SignIn 에러 (OAuth 단계):", r), r instanceof h) throw r;
627
+ if (l.error("[CROSSx] SignIn 에러 (OAuth 단계):", r), r instanceof h) throw r;
628
628
  const n = r instanceof Error ? r.message : "Sign in failed";
629
629
  throw /팝업|popup/i.test(n) ? new h(
630
630
  o.OAUTH_POPUP_BLOCKED,
@@ -643,7 +643,7 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
643
643
  * @param firebaseToken OAuth 서비스에서 발급받은 Firebase JWT
644
644
  */
645
645
  async executeWithOAuthToken(e) {
646
- return c.log("[CROSSx] signInWithOAuthToken — Firebase 토큰 주입 (length:", e.length, ")"), this.processFirebaseToken(e);
646
+ return l.log("[CROSSx] signInWithOAuthToken — Firebase 토큰 주입 (length:", e.length, ")"), this.processFirebaseToken(e);
647
647
  }
648
648
  /**
649
649
  * RN Native Bridge에서 수신한 Firebase ID token으로 로그인
@@ -659,7 +659,7 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
659
659
  * @param nativeToken Native에서 받은 Firebase ID token 정보
660
660
  */
661
661
  async executeWithNativeFirebaseIdToken(e) {
662
- return c.log("[CROSSx] RN Bridge Firebase token 처리 (length:", e.idToken.length, ")"), this.processNativeFirebaseToken(e);
662
+ return l.log("[CROSSx] RN Bridge Firebase token 처리 (length:", e.idToken.length, ")"), this.processNativeFirebaseToken(e);
663
663
  }
664
664
  /**
665
665
  * RN Native Firebase token 처리 (bridge 모드 전용)
@@ -671,7 +671,7 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
671
671
  var s, r, n;
672
672
  let t;
673
673
  try {
674
- const { authApiUrl: a } = this.config, { accessToken: l } = await this.exchangeNativeFirebaseToken(
674
+ const { authApiUrl: a } = this.config, { accessToken: c } = await this.exchangeNativeFirebaseToken(
675
675
  e.idToken,
676
676
  a
677
677
  );
@@ -680,12 +680,12 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
680
680
  const u = this.crypto.decodeJWT(e.idToken);
681
681
  g = e.provider ?? ((s = u.firebase) == null ? void 0 : s.sign_in_provider);
682
682
  const _ = ((r = u.firebase) == null ? void 0 : r.identities) ?? {};
683
- d = u.email ?? ((n = _.email) == null ? void 0 : n[0]), c.log("[CROSSx] RN Bridge Firebase token 정보 — provider:", g, "email:", d ?? "(없음)");
683
+ d = u.email ?? ((n = _.email) == null ? void 0 : n[0]), l.log("[CROSSx] RN Bridge Firebase token 정보 — provider:", g, "email:", d ?? "(없음)");
684
684
  } catch {
685
- c.warn("[CROSSx] RN Bridge Firebase token에서 정보 추출 실패");
685
+ l.warn("[CROSSx] RN Bridge Firebase token에서 정보 추출 실패");
686
686
  }
687
- if (l) {
688
- const u = await this.crypto.verifyJWT(l);
687
+ if (c) {
688
+ const u = await this.crypto.verifyJWT(c);
689
689
  if (!u.valid)
690
690
  throw new h(
691
691
  o.AUTH_FAILED,
@@ -697,20 +697,20 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
697
697
  email: _.email ?? d,
698
698
  signInProvider: g,
699
699
  providerSub: e.providerSub
700
- }, this.tokenStore.set(l), await this.storage.set(this.STORAGE_KEY_RN_BRIDGE_SESSION, !0), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, l), c.log("[CROSSx] RN Bridge — access_token 저장 (refresh_token 제외)")), c.log("[CROSSx] 사용자 정보 — id:", t.id, "email:", t.email ?? "(없음)"), await this.storage.set(this.STORAGE_KEY_USER, t);
700
+ }, this.tokenStore.set(c), await this.storage.set(this.STORAGE_KEY_RN_BRIDGE_SESSION, !0), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, c), l.log("[CROSSx] RN Bridge — access_token 저장 (refresh_token 제외)")), l.log("[CROSSx] 사용자 정보 — id:", t.id, "email:", t.email ?? "(없음)"), await this.storage.set(this.STORAGE_KEY_USER, t);
701
701
  } else
702
702
  throw new h(
703
703
  o.AUTH_FAILED,
704
704
  "Access token 교환 실패"
705
705
  );
706
706
  } catch (a) {
707
- const l = a instanceof Error ? a.message : String(a), d = a instanceof Error ? a.stack : void 0, g = a instanceof Error ? a.name : "UnknownError";
708
- return c.error("[CROSSx] RN Bridge 로그인 실패 — name:", g, "message:", l, "stack:", d), {
707
+ const c = a instanceof Error ? a.message : String(a), d = a instanceof Error ? a.stack : void 0, g = a instanceof Error ? a.name : "UnknownError";
708
+ return l.error("[CROSSx] RN Bridge 로그인 실패 — name:", g, "message:", c, "stack:", d), {
709
709
  success: !1,
710
- error: l || "RN Bridge login failed"
710
+ error: c || "RN Bridge login failed"
711
711
  };
712
712
  }
713
- return c.log("[CROSSx] RN Bridge 로그인 완료, 지갑 로드 시작 — userId:", t.id), this.loadWallet(t, !1);
713
+ return l.log("[CROSSx] RN Bridge 로그인 완료, 지갑 로드 시작 — userId:", t.id), this.loadWallet(t, !1);
714
714
  }
715
715
  /**
716
716
  * Firebase 토큰 → CROSSx 인증 교환 → 사용자 정보 추출 → 토큰 저장 → 지갑 로드.
@@ -719,27 +719,27 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
719
719
  * @param oauthEmail OAuth 콜백에서 직접 수신한 email (JWT에 없을 때 fallback)
720
720
  */
721
721
  async processFirebaseToken(e, t) {
722
- var n, a, l, d, g;
722
+ var n, a, c, d, g;
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 I, S, w;
726
+ let A, S, w;
727
727
  try {
728
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;
729
+ l.log("[CROSSx] Firebase JWT 필드:", Object.keys(f).join(", ")), S = (n = f.firebase) == null ? void 0 : n.sign_in_provider;
730
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 ?? "(없음)");
731
+ w = f.email ?? ((c = E.email) == null ? void 0 : c[0]), S === "google.com" ? A = (d = E["google.com"]) == null ? void 0 : d[0] : S === "apple.com" && (A = (g = E["apple.com"]) == null ? void 0 : g[0]), l.log("[CROSSx] OAuth provider sub 추출 — provider:", S, "hasProviderSub:", !!A, "email:", w ?? "(없음)");
732
732
  } catch {
733
- c.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
733
+ l.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
734
734
  }
735
735
  if (_) {
736
736
  const f = this.crypto.decodeJWT(_);
737
- c.log("[CROSSx] access_token 디코딩 — sub:", f.sub, "exp:", f.exp, "필드:", Object.keys(f).join(", "));
737
+ l.log("[CROSSx] access_token 디코딩 — sub:", f.sub, "exp:", f.exp, "필드:", Object.keys(f).join(", "));
738
738
  const E = await this.crypto.verifyJWT(_);
739
739
  if (r = E.signatureVerified ?? !1, !E.valid)
740
- throw c.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
740
+ throw l.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
741
741
  const T = E.payload, y = T.email ?? w ?? t;
742
- c.log(
742
+ l.log(
743
743
  "[CROSSx] email 소스 — CROSSx JWT:",
744
744
  T.email ?? "(없음)",
745
745
  "/ Firebase JWT:",
@@ -752,27 +752,27 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
752
752
  id: T.sub,
753
753
  email: y,
754
754
  signInProvider: S,
755
- providerSub: I
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 영속 저장을 건너뜁니다"));
755
+ providerSub: A
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 && l.warn("[CROSSx] 안전한 스토리지 미사용 — refresh_token 영속 저장을 건너뜁니다"));
757
757
  } else {
758
758
  const f = this.crypto.decodeJWT(e);
759
759
  s = {
760
760
  id: f.sub,
761
761
  email: f.email ?? t,
762
762
  signInProvider: S,
763
- providerSub: I
764
- }, c.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", s.id);
763
+ providerSub: A
764
+ }, l.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", s.id);
765
765
  }
766
- c.log("[CROSSx] 사용자 정보 — id:", s.id, "email:", s.email ?? "(없음)");
766
+ l.log("[CROSSx] 사용자 정보 — id:", s.id, "email:", s.email ?? "(없음)");
767
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", ")");
768
+ await this.storage.set(this.STORAGE_KEY_USER, m), await this.clearStoredRNBridgeSession(), l.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
769
769
  } catch (u) {
770
- return c.error("[CROSSx] SignIn 에러 (토큰 교환 단계):", u), {
770
+ return l.error("[CROSSx] SignIn 에러 (토큰 교환 단계):", u), {
771
771
  success: !1,
772
772
  error: u instanceof Error ? u.message : "Sign in failed"
773
773
  };
774
774
  }
775
- return c.log("[CROSSx][Migration Phase 1] 로그인 완료, 지갑 로드 시작 — userId:", s.id), this.loadWallet(s, r);
775
+ return l.log("[CROSSx][Migration Phase 1] 로그인 완료, 지갑 로드 시작 — userId:", s.id), this.loadWallet(s, r);
776
776
  }
777
777
  /**
778
778
  * RN Native Firebase token 교환
@@ -781,7 +781,7 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
781
781
  */
782
782
  async exchangeNativeFirebaseToken(e, t) {
783
783
  const s = `${t}/cross-auth/social/login`;
784
- c.log("[CROSSx] RN Bridge Firebase 토큰 교환 요청 — url:", s, "projectId:", this.config.projectId);
784
+ l.log("[CROSSx] RN Bridge Firebase 토큰 교환 요청 — url:", s, "projectId:", this.config.projectId);
785
785
  let r;
786
786
  try {
787
787
  r = await this.transport.request({
@@ -792,16 +792,16 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
792
792
  },
793
793
  body: { auth_code: e, login_type: "firebase" }
794
794
  });
795
- } catch (l) {
796
- c.error("[CROSSx] RN Bridge 토큰 교환 fetch 실패 — url:", s, "error:", l);
797
- const d = l instanceof Error ? l.message : String(l);
795
+ } catch (c) {
796
+ l.error("[CROSSx] RN Bridge 토큰 교환 fetch 실패 — url:", s, "error:", c);
797
+ const d = c instanceof Error ? c.message : String(c);
798
798
  throw new h(
799
799
  o.AUTH_FAILED,
800
800
  `RN Bridge 토큰 교환 네트워크 실패: ${d}`,
801
- l
801
+ c
802
802
  );
803
803
  }
804
- c.log("[CROSSx] RN Bridge 토큰 교환 응답 — status:", r.status);
804
+ l.log("[CROSSx] RN Bridge 토큰 교환 응답 — status:", r.status);
805
805
  const n = r.data;
806
806
  this.checkResponseError(n, "RN Bridge token exchange");
807
807
  const a = this.extractAccessToken(n);
@@ -810,7 +810,7 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
810
810
  o.AUTH_FAILED,
811
811
  "RN Bridge 토큰 교환 응답에서 access_token을 찾을 수 없습니다"
812
812
  );
813
- return c.log("[CROSSx] RN Bridge access_token 교환 성공 (refresh_token 미저장)"), { accessToken: a };
813
+ return l.log("[CROSSx] RN Bridge access_token 교환 성공 (refresh_token 미저장)"), { accessToken: a };
814
814
  }
815
815
  /**
816
816
  * Firebase 토큰 → CROSSx 인증 교환
@@ -819,7 +819,7 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
819
819
  */
820
820
  async exchangeFirebaseToken(e, t) {
821
821
  const s = this.useCookieAuth, r = s ? `${t}/cross-auth/social/login/cookie` : `${t}/cross-auth/social/login`;
822
- c.log("[CROSSx] Firebase 토큰 교환 요청");
822
+ l.log("[CROSSx] Firebase 토큰 교환 요청");
823
823
  const n = await this.transport.request({
824
824
  url: r,
825
825
  method: "POST",
@@ -827,20 +827,20 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
827
827
  body: { auth_code: e, login_type: "firebase" },
828
828
  ...s ? { credentials: "include" } : {}
829
829
  });
830
- c.log("[CROSSx] 토큰 교환 응답 — status:", n.status);
830
+ l.log("[CROSSx] 토큰 교환 응답 — status:", n.status);
831
831
  const a = n.data;
832
832
  this.checkResponseError(a, "Token exchange");
833
- const l = this.extractAccessToken(a);
834
- if (s && !l)
835
- return c.log("[CROSSx] Cookie 모드 — 로그인 성공 (JWT는 HttpOnly 쿠키)"), {};
836
- if (!l)
833
+ const c = this.extractAccessToken(a);
834
+ if (s && !c)
835
+ return l.log("[CROSSx] Cookie 모드 — 로그인 성공 (JWT는 HttpOnly 쿠키)"), {};
836
+ if (!c)
837
837
  throw new h(
838
838
  o.AUTH_FAILED,
839
839
  "토큰 교환 응답에서 access_token을 찾을 수 없습니다"
840
840
  );
841
- c.log("[CROSSx] access_token 교환 성공");
841
+ l.log("[CROSSx] access_token 교환 성공");
842
842
  let d;
843
- return s || (d = this.extractRefreshToken(a)), { accessToken: l, refreshToken: d };
843
+ return s || (d = this.extractRefreshToken(a)), { accessToken: c, refreshToken: d };
844
844
  }
845
845
  /**
846
846
  * 응답에서 access_token을 추출.
@@ -901,17 +901,17 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
901
901
  if (s.valid) {
902
902
  const r = await this.storage.get(this.STORAGE_KEY_USER);
903
903
  if (r)
904
- return c.log("[CROSSx] restoreSession — 메모리 토큰 유효, 세션 복원"), this.loadWallet(r, s.signatureVerified);
904
+ return l.log("[CROSSx] restoreSession — 메모리 토큰 유효, 세션 복원"), this.loadWallet(r, s.signatureVerified);
905
905
  }
906
906
  this.tokenStore.clear();
907
907
  }
908
908
  if (this.useCookieAuth) {
909
- c.log("[CROSSx] restoreSession — 쿠키 기반 silentRefresh 시도");
909
+ l.log("[CROSSx] restoreSession — 쿠키 기반 silentRefresh 시도");
910
910
  const s = await this.silentRefresh();
911
911
  s && this.tokenStore.set(s);
912
912
  } else {
913
913
  const s = await this.storage.get(this.STORAGE_KEY_ACCESS_TOKEN), r = await this.storage.get(this.STORAGE_KEY_REFRESH_TOKEN);
914
- if (c.log(
914
+ if (l.log(
915
915
  "[CROSSx] restoreSession — access_token:",
916
916
  s ? "있음" : "없음",
917
917
  "refresh_token:",
@@ -919,27 +919,27 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
919
919
  ), r) {
920
920
  s && this.tokenStore.set(s);
921
921
  const n = await this.silentRefresh(r);
922
- c.log("[CROSSx] restoreSession — silentRefresh 결과:", n ? "토큰 발급 성공" : "토큰 없음"), n && this.tokenStore.set(n);
922
+ l.log("[CROSSx] restoreSession — silentRefresh 결과:", n ? "토큰 발급 성공" : "토큰 없음"), n && this.tokenStore.set(n);
923
923
  } else {
924
924
  if (!s)
925
- return c.log("[CROSSx] restoreSession — refresh_token 및 access_token 없음, 세션 복원 생략"), null;
925
+ return l.log("[CROSSx] restoreSession — refresh_token 및 access_token 없음, 세션 복원 생략"), null;
926
926
  if (!(await this.crypto.verifyJWT(s)).valid)
927
- return c.log("[CROSSx] restoreSession — refresh_token 없음, access_token도 invalid, 세션 복원 생략"), null;
928
- c.log("[CROSSx] restoreSession — refresh_token 없음, access_token만으로 복원 (RN Bridge 모드)"), this.tokenStore.set(s);
927
+ return l.log("[CROSSx] restoreSession — refresh_token 없음, access_token도 invalid, 세션 복원 생략"), null;
928
+ l.log("[CROSSx] restoreSession — refresh_token 없음, access_token만으로 복원 (RN Bridge 모드)"), this.tokenStore.set(s);
929
929
  }
930
930
  }
931
931
  const t = await this.storage.get(this.STORAGE_KEY_USER);
932
- if (c.log("[CROSSx] restoreSession — userInfo 조회:", t ? `있음 (id: ${t.id})` : "없음"), !t)
932
+ if (l.log("[CROSSx] restoreSession — userInfo 조회:", t ? `있음 (id: ${t.id})` : "없음"), !t)
933
933
  return null;
934
- c.log("[CROSSx] restoreSession — silentRefresh 성공, 세션 복원 — userId:", t.id);
934
+ l.log("[CROSSx] restoreSession — silentRefresh 성공, 세션 복원 — userId:", t.id);
935
935
  try {
936
936
  return await this.loadWallet(t, !1);
937
937
  } catch (s) {
938
- return c.warn("[CROSSx] restoreSession — 지갑 로드 실패 (세션은 유지):", s), { success: !0, user: t, tokenSignatureVerified: !1 };
938
+ return l.warn("[CROSSx] restoreSession — 지갑 로드 실패 (세션은 유지):", s), { success: !0, user: t, tokenSignatureVerified: !1 };
939
939
  }
940
940
  } catch (e) {
941
941
  const t = e instanceof h && e.code === o.SESSION_EXPIRED;
942
- return c.log("[CROSSx] restoreSession —", t ? "세션 만료 (재로그인 필요)" : "세션 복원 실패:", e), this.tokenStore.clear(), t && (this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN), await this.storage.remove(this.STORAGE_KEY_USER)), null;
942
+ return l.log("[CROSSx] restoreSession —", t ? "세션 만료 (재로그인 필요)" : "세션 복원 실패:", e), this.tokenStore.clear(), t && (this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN), await this.storage.remove(this.STORAGE_KEY_USER)), null;
943
943
  }
944
944
  }
945
945
  silentRefresh(e) {
@@ -960,28 +960,28 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
960
960
  body: n,
961
961
  ...s ? { credentials: "include" } : {}
962
962
  });
963
- c.log("[CROSSx] silentRefresh 응답 — status:", a.status);
964
- const l = a.data, d = this.extractResponseErrorCode(l);
963
+ l.log("[CROSSx] silentRefresh 응답 — status:", a.status);
964
+ const c = a.data, d = this.extractResponseErrorCode(c);
965
965
  if (d) {
966
- const u = Ie.REFRESH_RELOGIN_CODES.has(d.code);
966
+ const u = Ae.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}`
970
970
  );
971
971
  }
972
- const g = this.extractAccessToken(l);
972
+ const g = this.extractAccessToken(c);
973
973
  if (s && !g) {
974
- c.log("[CROSSx] silentRefresh 성공 (cookie 갱신)");
974
+ l.log("[CROSSx] silentRefresh 성공 (cookie 갱신)");
975
975
  return;
976
976
  }
977
977
  if (!g)
978
978
  throw new h(o.AUTH_FAILED, "토큰 자동 갱신 실패: 응답에 토큰이 없습니다");
979
979
  if (this.tokenStore.set(g), !s) {
980
980
  await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, g);
981
- const u = this.extractRefreshToken(l);
981
+ const u = this.extractRefreshToken(c);
982
982
  u && this.config.secureStorageAvailable !== !1 && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, u);
983
983
  }
984
- return c.log("[CROSSx] silentRefresh 성공"), g;
984
+ return l.log("[CROSSx] silentRefresh 성공"), g;
985
985
  }
986
986
  /**
987
987
  * access_token을 자동 갱신합니다.
@@ -994,23 +994,23 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
994
994
  async refreshAccessToken() {
995
995
  try {
996
996
  if (this.requestFreshTokenFromBridge && await this.hasStoredRNBridgeSession()) {
997
- c.log("[CROSSx] RN Bridge access token 갱신 시도");
997
+ l.log("[CROSSx] RN Bridge access token 갱신 시도");
998
998
  try {
999
999
  const s = await this.requestFreshTokenFromBridge(), { accessToken: r } = await this.exchangeNativeFirebaseToken(
1000
1000
  s.idToken,
1001
1001
  this.config.authApiUrl
1002
1002
  );
1003
- return r ? (this.tokenStore.set(r), await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, r), await this.storage.set(this.STORAGE_KEY_RN_BRIDGE_SESSION, !0), c.log("[CROSSx] RN Bridge access token 갱신 성공"), !0) : !1;
1003
+ return r ? (this.tokenStore.set(r), await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, r), await this.storage.set(this.STORAGE_KEY_RN_BRIDGE_SESSION, !0), l.log("[CROSSx] RN Bridge access token 갱신 성공"), !0) : !1;
1004
1004
  } catch (s) {
1005
- throw s instanceof h && s.code === o.RN_NATIVE_SESSION_EXPIRED && (c.warn("[CROSSx] RN Native session expired — 재로그인 필요"), this.tokenStore.clear(), await this.storage.remove(this.STORAGE_KEY_USER)), s;
1005
+ throw s instanceof h && s.code === o.RN_NATIVE_SESSION_EXPIRED && (l.warn("[CROSSx] RN Native session expired — 재로그인 필요"), this.tokenStore.clear(), await this.storage.remove(this.STORAGE_KEY_USER)), s;
1006
1006
  }
1007
1007
  }
1008
1008
  if (this.useCookieAuth)
1009
1009
  return !!await this.silentRefresh() || this.tokenStore.has();
1010
1010
  const e = await this.storage.get(this.STORAGE_KEY_REFRESH_TOKEN);
1011
- return e ? !!await this.silentRefresh(e) : (c.warn("[CROSSx] refreshAccessToken: refresh_token 없음 — 갱신 불가"), !1);
1011
+ return e ? !!await this.silentRefresh(e) : (l.warn("[CROSSx] refreshAccessToken: refresh_token 없음 — 갱신 불가"), !1);
1012
1012
  } catch (e) {
1013
- return e instanceof h && e.code === o.SESSION_EXPIRED ? (c.warn("[CROSSx] refreshAccessToken: 세션 만료 — 재로그인 필요"), this.tokenStore.clear(), this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN)) : c.warn("[CROSSx] refreshAccessToken 실패:", e), !1;
1013
+ return e instanceof h && e.code === o.SESSION_EXPIRED ? (l.warn("[CROSSx] refreshAccessToken: 세션 만료 — 재로그인 필요"), this.tokenStore.clear(), this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN)) : l.warn("[CROSSx] refreshAccessToken 실패:", e), !1;
1014
1014
  }
1015
1015
  }
1016
1016
  /**
@@ -1028,22 +1028,22 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
1028
1028
  let n = await this.crypto.verifyJWT(e);
1029
1029
  if (r = n.signatureVerified ?? !1, !n.valid) {
1030
1030
  if (!t)
1031
- return c.error("[CROSSx] signInWithJWT: access_token 검증 실패, refreshToken 없음"), { success: !1, error: "유효하지 않은 access token" };
1032
- c.log("[CROSSx] signInWithJWT: access_token 만료, refreshToken으로 갱신 시도");
1033
- const l = await this.silentRefresh(t);
1034
- if (!l)
1035
- return c.error("[CROSSx] signInWithJWT: silentRefresh 실패"), { success: !1, error: "access token이 만료되었고 갱신에 실패했습니다" };
1036
- if (e = l, n = await this.crypto.verifyJWT(e), r = n.signatureVerified ?? !1, !n.valid)
1037
- return c.error("[CROSSx] signInWithJWT: 갱신된 access_token도 유효하지 않음"), { success: !1, error: "갱신된 access token이 유효하지 않습니다" };
1038
- c.log("[CROSSx] signInWithJWT: silentRefresh 성공, 새 access_token 사용");
1031
+ return l.error("[CROSSx] signInWithJWT: access_token 검증 실패, refreshToken 없음"), { success: !1, error: "유효하지 않은 access token" };
1032
+ l.log("[CROSSx] signInWithJWT: access_token 만료, refreshToken으로 갱신 시도");
1033
+ const c = await this.silentRefresh(t);
1034
+ if (!c)
1035
+ return l.error("[CROSSx] signInWithJWT: silentRefresh 실패"), { success: !1, error: "access token이 만료되었고 갱신에 실패했습니다" };
1036
+ if (e = c, n = await this.crypto.verifyJWT(e), r = n.signatureVerified ?? !1, !n.valid)
1037
+ return l.error("[CROSSx] signInWithJWT: 갱신된 access_token도 유효하지 않음"), { success: !1, error: "갱신된 access token이 유효하지 않습니다" };
1038
+ l.log("[CROSSx] signInWithJWT: silentRefresh 성공, 새 access_token 사용");
1039
1039
  }
1040
1040
  const a = n.payload;
1041
- c.log("[CROSSx] signInWithJWT — sub:", a.sub, "signatureVerified:", r), s = {
1041
+ l.log("[CROSSx] signInWithJWT — sub:", a.sub, "signatureVerified:", r), s = {
1042
1042
  id: a.sub,
1043
1043
  email: a.email
1044
- }, this.tokenStore.set(e), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, e), t && this.config.secureStorageAvailable !== !1 && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, t), await this.clearStoredRNBridgeSession()), await this.storage.set(this.STORAGE_KEY_USER, s), c.log("[CROSSx] signInWithJWT — 토큰 및 사용자 정보 저장 완료");
1044
+ }, this.tokenStore.set(e), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, e), t && this.config.secureStorageAvailable !== !1 && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, t), await this.clearStoredRNBridgeSession()), await this.storage.set(this.STORAGE_KEY_USER, s), l.log("[CROSSx] signInWithJWT — 토큰 및 사용자 정보 저장 완료");
1045
1045
  } catch (n) {
1046
- return c.error("[CROSSx] signInWithJWT 에러:", n), {
1046
+ return l.error("[CROSSx] signInWithJWT 에러:", n), {
1047
1047
  success: !1,
1048
1048
  error: n instanceof Error ? n.message : "JWT sign in failed"
1049
1049
  };
@@ -1064,9 +1064,9 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
1064
1064
  const s = await this.storage.get(rt);
1065
1065
  s && await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, s);
1066
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 스코프)");
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), l.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
1068
1068
  } catch (e) {
1069
- c.warn("[CROSSx] 스토리지 키 마이그레이션 실패:", e);
1069
+ l.warn("[CROSSx] 스토리지 키 마이그레이션 실패:", e);
1070
1070
  }
1071
1071
  }
1072
1072
  }
@@ -1074,34 +1074,34 @@ const rt = "crossx_access_token", it = "crossx_refresh_token", nt = "crossx_user
1074
1074
  let s, r = !1;
1075
1075
  try {
1076
1076
  if (typeof this.walletProvider.checkWallet == "function") {
1077
- c.log("[CROSSx] GET /mnemonic/check — 지갑 상태 확인 (비밀번호 불필요)");
1077
+ l.log("[CROSSx] GET /mnemonic/check — 지갑 상태 확인 (비밀번호 불필요)");
1078
1078
  const n = await this.walletProvider.checkWallet();
1079
- if (c.log("[CROSSx] 지갑 상태:", n), n === "migration_required")
1080
- c.log("[CROSSx] migration_required → needsMigration = true"), r = !0;
1079
+ if (l.log("[CROSSx] 지갑 상태:", n), n === "migration_required")
1080
+ l.log("[CROSSx] migration_required → needsMigration = true"), r = !0;
1081
1081
  else if (n === "exists")
1082
1082
  try {
1083
1083
  const a = await this.walletProvider.getAddresses(e.id);
1084
- a.length > 0 ? (s = a[0].address, c.log("[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):", s)) : c.log("[CROSSx] 주소 캐시 없음 — createWallet 단계에서 비밀번호 입력 후 로드");
1084
+ a.length > 0 ? (s = a[0].address, l.log("[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):", s)) : l.log("[CROSSx] 주소 캐시 없음 — createWallet 단계에서 비밀번호 입력 후 로드");
1085
1085
  } catch (a) {
1086
- c.warn("[CROSSx] getAddresses 실패, createWallet 단계에서 재시도:", a);
1086
+ l.warn("[CROSSx] getAddresses 실패, createWallet 단계에서 재시도:", a);
1087
1087
  }
1088
1088
  } else
1089
- c.log("[CROSSx] getOrCreateWallet 직접 호출 (폴백)"), s = (await this.walletProvider.getOrCreateWallet(e.id)).address, c.log("[CROSSx] 지갑 로드 완료 — address:", s);
1089
+ l.log("[CROSSx] getOrCreateWallet 직접 호출 (폴백)"), s = (await this.walletProvider.getOrCreateWallet(e.id)).address, l.log("[CROSSx] 지갑 로드 완료 — address:", s);
1090
1090
  } catch (n) {
1091
1091
  if (n instanceof h && n.code === o.MIGRATION_BACKUP_EXISTS)
1092
- c.log("[CROSSx] MIGRATION_BACKUP_EXISTS 감지 → needsMigration = true"), r = !0;
1092
+ l.log("[CROSSx] MIGRATION_BACKUP_EXISTS 감지 → needsMigration = true"), r = !0;
1093
1093
  else {
1094
1094
  if (n instanceof h && (n.code === o.PROJECT_NOT_REGISTERED || n.code === o.PROJECT_ID_MISSING || n.code === o.ORIGIN_NOT_ALLOWED || n.code === o.SDK_VERSION_UNSUPPORTED))
1095
- throw c.error("[CROSSx] 프로젝트 설정 에러:", n.message), n;
1096
- c.warn("[CROSSx] 지갑 상태 확인 실패 (로그인은 유지):", n);
1095
+ throw l.error("[CROSSx] 프로젝트 설정 에러:", n.message), n;
1096
+ l.warn("[CROSSx] 지갑 상태 확인 실패 (로그인은 유지):", n);
1097
1097
  }
1098
1098
  }
1099
- return c.log("[CROSSx] loadWallet 결과 — address:", s, "needsMigration:", r), { success: !0, address: s, user: e, needsMigration: r, tokenSignatureVerified: t };
1099
+ return l.log("[CROSSx] loadWallet 결과 — address:", s, "needsMigration:", r), { success: !0, address: s, user: e, needsMigration: r, tokenSignatureVerified: t };
1100
1100
  }
1101
1101
  };
1102
- Ie.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
1103
- let Ue = Ie;
1104
- class Is {
1102
+ Ae.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
1103
+ let Le = Ae;
1104
+ class As {
1105
1105
  /**
1106
1106
  * @param preservedKeys 로그아웃 뒤에도 남길 저장소 키. 지금은 선호 지갑(`wallet_preference`)만
1107
1107
  * 쓴다 — 다시 로그인할 때 같은 지갑을 모달 없이 고르기 위해서다 (DEV2TF-2368).
@@ -1133,7 +1133,7 @@ class Is {
1133
1133
  });
1134
1134
  }
1135
1135
  }
1136
- class As {
1136
+ class Is {
1137
1137
  constructor(e, t) {
1138
1138
  this.storage = e, this.walletProvider = t;
1139
1139
  }
@@ -1143,9 +1143,9 @@ class As {
1143
1143
  o.NOT_IMPLEMENTED,
1144
1144
  "현재 환경에서는 마이그레이션이 지원되지 않습니다"
1145
1145
  );
1146
- c.log("[CROSSx][Migration Phase 4] MigrateWalletUseCase.execute() — pin 길이:", e.length, "sub:", t);
1146
+ l.log("[CROSSx][Migration Phase 4] MigrateWalletUseCase.execute() — pin 길이:", e.length, "sub:", t);
1147
1147
  const s = await this.walletProvider.migrateWallet(e, t);
1148
- return c.log("[CROSSx][Migration Phase 5] MigrateWalletUseCase 완료 — address:", s.address), {
1148
+ return l.log("[CROSSx][Migration Phase 5] MigrateWalletUseCase 완료 — address:", s.address), {
1149
1149
  address: s.address
1150
1150
  };
1151
1151
  }
@@ -1237,12 +1237,12 @@ function Y(i = 16) {
1237
1237
  const e = new Uint8Array(i);
1238
1238
  return crypto.getRandomValues(e), Be(e);
1239
1239
  }
1240
- const Ns = "onepocketSecureFrame", Ge = 1;
1241
- function ae() {
1240
+ const Ns = "onepocketSecureFrame", He = 1;
1241
+ function oe() {
1242
1242
  return new h(o.USER_REJECTED, "앱 요청을 중단했습니다");
1243
1243
  }
1244
1244
  let at = 0;
1245
- function we() {
1245
+ function Se() {
1246
1246
  return at += 1, `${typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : String(Math.random())}-${at}`;
1247
1247
  }
1248
1248
  function Os(i) {
@@ -1258,19 +1258,19 @@ function Ct(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 !== Ge)
1261
+ if (s.v !== void 0 && s.v !== He)
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
- 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(Os(a), l, { appError: typeof a == "string" ? a : "unknown" });
1266
+ const a = (r = s.error) == null ? void 0 : r.code, c = typeof ((n = s.error) == null ? void 0 : n.message) == "string" && s.error.message ? s.error.message : "앱이 요청을 처리하지 못했습니다";
1267
+ throw new h(Os(a), c, { appError: typeof a == "string" ? a : "unknown" });
1268
1268
  }
1269
1269
  return typeof s.payload == "object" && s.payload !== null ? s.payload : {};
1270
1270
  }
1271
1271
  function Ps(i, e) {
1272
1272
  return new Promise((t, s) => {
1273
- const r = () => s(ae());
1273
+ const r = () => s(oe());
1274
1274
  e.addEventListener("abort", r, { once: !0 }), Promise.resolve(i).then(
1275
1275
  (n) => {
1276
1276
  e.removeEventListener("abort", r), t(n);
@@ -1282,23 +1282,23 @@ function Ps(i, e) {
1282
1282
  });
1283
1283
  }
1284
1284
  function Cs(i) {
1285
- const e = (t, s, r) => i.postMessage({ v: Ge, id: r, type: t, payload: s });
1285
+ const e = (t, s, r) => i.postMessage({ v: He, id: r, type: t, payload: s });
1286
1286
  return {
1287
1287
  async request(t, s, r) {
1288
- if (r != null && r.aborted) throw ae();
1289
- const n = we();
1288
+ if (r != null && r.aborted) throw oe();
1289
+ const n = Se();
1290
1290
  let a;
1291
1291
  try {
1292
1292
  a = await (r ? Ps(e(t, s, n), r) : e(t, s, n));
1293
- } catch (l) {
1294
- throw r != null && r.aborted ? ae() : new h(o.ONEID_AUTHORIZATION_FAILED, "앱이 요청을 거부했습니다", l);
1293
+ } catch (c) {
1294
+ throw r != null && r.aborted ? oe() : new h(o.ONEID_AUTHORIZATION_FAILED, "앱이 요청을 거부했습니다", c);
1295
1295
  }
1296
1296
  if (a === void 0)
1297
1297
  throw new h(o.ONEID_AUTHORIZATION_FAILED, "앱이 이 요청을 지원하지 않습니다", { appError: "unsupported" });
1298
1298
  return Ct(n, a);
1299
1299
  },
1300
1300
  notify(t, s) {
1301
- Promise.resolve(e(t, s, we())).catch(() => {
1301
+ Promise.resolve(e(t, s, Se())).catch(() => {
1302
1302
  });
1303
1303
  }
1304
1304
  };
@@ -1317,22 +1317,22 @@ function Ds(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: Ge, id: n, type: s, payload: r }));
1320
+ const t = (s, r, n) => i.postMessage(JSON.stringify({ v: He, id: n, type: s, payload: r }));
1321
1321
  return {
1322
1322
  request(s, r, n) {
1323
- const a = we();
1324
- return new Promise((l, d) => {
1323
+ const a = Se();
1324
+ return new Promise((c, d) => {
1325
1325
  if (n != null && n.aborted) {
1326
- d(ae());
1326
+ d(oe());
1327
1327
  return;
1328
1328
  }
1329
1329
  const g = () => {
1330
- e.delete(a), d(ae());
1330
+ e.delete(a), d(oe());
1331
1331
  };
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(Ct(a, u));
1335
+ c(Ct(a, u));
1336
1336
  } catch (_) {
1337
1337
  d(_);
1338
1338
  }
@@ -1346,7 +1346,7 @@ function Ds(i) {
1346
1346
  },
1347
1347
  notify(s, r) {
1348
1348
  try {
1349
- t(s, r, we());
1349
+ t(s, r, Se());
1350
1350
  } catch {
1351
1351
  }
1352
1352
  }
@@ -1367,7 +1367,7 @@ function ct(i, e) {
1367
1367
  let t = ot.get(i);
1368
1368
  return t || (t = e(), ot.set(i, t)), t;
1369
1369
  }
1370
- const lt = 300 * 1e3, vs = 600 * 1e3, Oe = "crossx.oneid.pending", ks = "/auth/app-callback", Us = 1e3;
1370
+ const lt = 300 * 1e3, vs = 600 * 1e3, Oe = "crossx.oneid.pending", ks = "/auth/app-callback", Ls = 1e3;
1371
1371
  function Dt(i) {
1372
1372
  switch (i) {
1373
1373
  case "access_denied":
@@ -1382,7 +1382,7 @@ function Dt(i) {
1382
1382
  return o.ONEID_AUTHORIZATION_FAILED;
1383
1383
  }
1384
1384
  }
1385
- function bs(i) {
1385
+ function Us(i) {
1386
1386
  switch (i) {
1387
1387
  case "session_evicted":
1388
1388
  return o.ONEID_SESSION_EVICTED;
@@ -1394,22 +1394,22 @@ function bs(i) {
1394
1394
  return o.ONEID_SESSION_INVALID;
1395
1395
  }
1396
1396
  }
1397
- const Ls = 15 * 1e3;
1397
+ const bs = 15 * 1e3;
1398
1398
  function Ws(i) {
1399
1399
  return typeof AbortSignal < "u" && typeof AbortSignal.timeout == "function" ? AbortSignal.timeout(i) : void 0;
1400
1400
  }
1401
- const Ms = 300 * 1e3, oe = "https://return-to.invalid";
1402
- function ce(i) {
1401
+ const Ms = 300 * 1e3, le = "https://return-to.invalid";
1402
+ function he(i) {
1403
1403
  if (typeof i != "string" || !i.startsWith("/") || /[\u0000-\u001f\u007f\\]/.test(i)) return;
1404
1404
  let e;
1405
1405
  try {
1406
- e = new URL(i, oe);
1406
+ e = new URL(i, le);
1407
1407
  } catch {
1408
1408
  return;
1409
1409
  }
1410
- if (e.origin !== oe) return;
1410
+ if (e.origin !== le) return;
1411
1411
  const t = `${e.pathname}${e.search}${e.hash}`;
1412
- if (!(t.startsWith("//") || new URL(t, oe).origin !== oe))
1412
+ if (!(t.startsWith("//") || new URL(t, le).origin !== le))
1413
1413
  return t;
1414
1414
  }
1415
1415
  function z(i) {
@@ -1421,7 +1421,7 @@ function z(i) {
1421
1421
  }
1422
1422
  return e.toString().replace(/\/+$/, "");
1423
1423
  }
1424
- function be(i) {
1424
+ function Ue(i) {
1425
1425
  const e = i.split(".")[1];
1426
1426
  if (!e) return null;
1427
1427
  try {
@@ -1473,7 +1473,7 @@ function dt(i, e) {
1473
1473
  scope: typeof i.scope == "string" ? i.scope : void 0
1474
1474
  };
1475
1475
  }
1476
- class Gs {
1476
+ class Hs {
1477
1477
  constructor() {
1478
1478
  this.reason = null, this.onAbort = null;
1479
1479
  }
@@ -1486,7 +1486,7 @@ class Gs {
1486
1486
  throw new h(o.USER_REJECTED, this.reason);
1487
1487
  }
1488
1488
  }
1489
- class Hs {
1489
+ class Gs {
1490
1490
  constructor(e = {}) {
1491
1491
  this.abortPending = null, this.popupSeq = 0, this.options = e;
1492
1492
  }
@@ -1517,7 +1517,7 @@ class Hs {
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 Gs(), a = (l) => n.abort(l);
1520
+ const n = new Hs(), a = (c) => n.abort(c);
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);
@@ -1548,7 +1548,7 @@ class Hs {
1548
1548
  r.codeVerifier,
1549
1549
  r.redirectUri,
1550
1550
  r.nonce
1551
- ), returnTo: ce(r.returnTo) };
1551
+ ), returnTo: he(r.returnTo) };
1552
1552
  }
1553
1553
  async refresh(e, t) {
1554
1554
  const s = z(e.issuer), r = new URLSearchParams({
@@ -1563,7 +1563,7 @@ class Hs {
1563
1563
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
1564
1564
  body: r,
1565
1565
  // refresh 는 탭 사이 잠금을 쥔 채 기다린다 — 응답이 안 오면 다른 탭까지 멈추므로 끊는다 (DEV2TF-2912)
1566
- signal: Ws(Ls)
1566
+ signal: Ws(bs)
1567
1567
  });
1568
1568
  } catch (d) {
1569
1569
  throw new h(o.NETWORK_ERROR, "ONE ID 세션을 갱신하지 못했습니다", d);
@@ -1572,7 +1572,7 @@ class Hs {
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(bs(d), "ONE ID 세션이 끝났습니다. 다시 로그인해 주세요.", {
1575
+ throw new h(Us(d), "ONE ID 세션이 끝났습니다. 다시 로그인해 주세요.", {
1576
1576
  error: "invalid_grant",
1577
1577
  error_reason: d
1578
1578
  });
@@ -1585,8 +1585,8 @@ class Hs {
1585
1585
  error: a.error
1586
1586
  });
1587
1587
  }
1588
- const l = dt(a, this.now());
1589
- return { ...l, refreshToken: l.refreshToken ?? t };
1588
+ const c = dt(a, this.now());
1589
+ return { ...c, refreshToken: c.refreshToken ?? t };
1590
1590
  }
1591
1591
  async logout(e, t) {
1592
1592
  const s = z(e.issuer);
@@ -1613,8 +1613,8 @@ class Hs {
1613
1613
  * 앱은 인증 화면을 열어 결과만 돌려준다. PKCE verifier 는 이 함수 밖으로 나가지 않는다.
1614
1614
  */
1615
1615
  async authorizeWithApp(e, t, s) {
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
- s.throwIfAborted(), c.log("[CROSSx] ONE ID 로그인 — 원포켓 앱 인증 화면", { issuer: t.issuer, clientId: t.clientId });
1616
+ const r = `${window.location.origin}${ks}`, n = Y(), a = Y(), c = Re(), d = await Ne(c), g = await this.pushAuthorizationRequest(t, r, n, a, d);
1617
+ s.throwIfAborted(), l.log("[CROSSx] ONE ID 로그인 — 원포켓 앱 인증 화면", { issuer: t.issuer, clientId: t.clientId });
1618
1618
  const u = this.authorizeUrl(t, g), _ = await new Promise((S, w) => {
1619
1619
  let m = !1;
1620
1620
  const f = new AbortController(), E = (R) => {
@@ -1632,8 +1632,8 @@ class Hs {
1632
1632
  (R) => E(() => S(R)),
1633
1633
  (R) => E(() => w(R))
1634
1634
  );
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) };
1635
+ }), p = ht(Fs(_), n, t.issuer), A = await this.exchangeCode(t, p, c, r, a);
1636
+ return l.log("[CROSSx] ONE ID 로그인 완료 (원포켓 앱)"), { status: "completed", tokens: A, returnTo: he(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;
@@ -1655,9 +1655,9 @@ class Hs {
1655
1655
  code_challenge: n,
1656
1656
  code_challenge_method: "S256"
1657
1657
  });
1658
- let l;
1658
+ let c;
1659
1659
  try {
1660
- l = await this.fetchImpl(`${e.issuer}/par`, {
1660
+ c = await this.fetchImpl(`${e.issuer}/par`, {
1661
1661
  method: "POST",
1662
1662
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
1663
1663
  body: a
@@ -1665,10 +1665,10 @@ class Hs {
1665
1665
  } catch (g) {
1666
1666
  throw new h(o.NETWORK_ERROR, "ONE ID 로그인 요청을 보내지 못했습니다", g);
1667
1667
  }
1668
- const d = await Pe(l);
1669
- if (!l.ok || typeof d.request_uri != "string")
1668
+ const d = await Pe(c);
1669
+ if (!c.ok || typeof d.request_uri != "string")
1670
1670
  throw new h(o.ONEID_AUTHORIZATION_FAILED, "ONE ID 로그인 요청이 거부되었습니다", {
1671
- status: l.status,
1671
+ status: c.status,
1672
1672
  error: d.error
1673
1673
  });
1674
1674
  return d.request_uri;
@@ -1685,9 +1685,9 @@ class Hs {
1685
1685
  redirect_uri: r,
1686
1686
  code_verifier: s
1687
1687
  });
1688
- let l;
1688
+ let c;
1689
1689
  try {
1690
- l = await this.fetchImpl(`${e.issuer}/token`, {
1690
+ c = await this.fetchImpl(`${e.issuer}/token`, {
1691
1691
  method: "POST",
1692
1692
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
1693
1693
  body: a
@@ -1695,27 +1695,27 @@ class Hs {
1695
1695
  } catch (u) {
1696
1696
  throw new h(o.NETWORK_ERROR, "ONE ID 토큰을 받지 못했습니다", u);
1697
1697
  }
1698
- const d = await Pe(l);
1699
- if (!l.ok)
1698
+ const d = await Pe(c);
1699
+ if (!c.ok)
1700
1700
  throw new h(o.ONEID_AUTHORIZATION_FAILED, "ONE ID 토큰 교환이 거부되었습니다", {
1701
- status: l.status,
1701
+ status: c.status,
1702
1702
  error: d.error
1703
1703
  });
1704
1704
  const g = dt(d, this.now());
1705
1705
  if (g.idToken) {
1706
- const u = be(g.idToken);
1706
+ const u = Ue(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), I = typeof u.exp == "number" ? u.exp * 1e3 : Number.NaN;
1710
- if (!p || !(I + Ms > this.now()))
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 + 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}${ms}`, a = Y(), l = Y(), d = Re(), g = await Ne(d), u = await this.pushAuthorizationRequest(t, n, a, l, g);
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((I, S) => {
1716
+ const r = new URL(t.issuer).origin, n = `${t.issuer}${ms}`, a = Y(), c = Y(), d = Re(), g = await Ne(d), u = await this.pushAuthorizationRequest(t, n, a, c, g);
1717
+ s.throwIfAborted(), l.log("[CROSSx] ONE ID 로그인 팝업 이동", { issuer: t.issuer, clientId: t.clientId }), e.location.href = this.authorizeUrl(t, u);
1718
+ const _ = await new Promise((A, S) => {
1719
1719
  let w = 0, m = 0;
1720
1720
  const f = () => {
1721
1721
  s.onAbort = null, clearTimeout(T), clearInterval(y), window.removeEventListener("message", R);
@@ -1736,13 +1736,13 @@ class Hs {
1736
1736
  w = m;
1737
1737
  return;
1738
1738
  }
1739
- c.warn("[CROSSx] ONE ID 팝업이 닫혔거나 연결이 끊겼습니다(COOP) — 로그인을 취소합니다"), E(new h(o.USER_REJECTED, "ONE ID 로그인이 취소되었습니다", { reason: "popup_closed_or_detached" }));
1739
+ l.warn("[CROSSx] ONE ID 팝업이 닫혔거나 연결이 끊겼습니다(COOP) — 로그인을 취소합니다"), E(new h(o.USER_REJECTED, "ONE ID 로그인이 취소되었습니다", { reason: "popup_closed_or_detached" }));
1740
1740
  }
1741
- }, Us), R = (N) => {
1741
+ }, Ls), R = (N) => {
1742
1742
  if (N.origin !== r || N.source !== e || !Bs(N.data)) return;
1743
1743
  const O = N.data;
1744
1744
  if (O.state !== a) {
1745
- c.warn("[CROSSx] ONE ID 결과 state가 현재 요청과 달라 무시합니다");
1745
+ l.warn("[CROSSx] ONE ID 결과 state가 현재 요청과 달라 무시합니다");
1746
1746
  return;
1747
1747
  }
1748
1748
  try {
@@ -1755,7 +1755,7 @@ class Hs {
1755
1755
  }
1756
1756
  if (O.type === Pt || O.error) {
1757
1757
  const P = O.error ?? "unknown_error";
1758
- c.warn("[CROSSx] ONE ID 인가 오류:", P), E(
1758
+ l.warn("[CROSSx] ONE ID 인가 오류:", P), E(
1759
1759
  new h(Dt(P), O.error_description || `ONE ID 인가 오류: ${P}`, {
1760
1760
  error: P,
1761
1761
  error_description: O.error_description
@@ -1767,19 +1767,19 @@ class Hs {
1767
1767
  E(new h(o.ONEID_AUTHORIZATION_FAILED, "ONE ID 로그인 결과에 code가 없습니다"));
1768
1768
  return;
1769
1769
  }
1770
- f(), I(O.code);
1770
+ f(), A(O.code);
1771
1771
  };
1772
1772
  s.onAbort = (N) => {
1773
1773
  E(new h(o.USER_REJECTED, N));
1774
1774
  }, window.addEventListener("message", R);
1775
- }), p = await this.exchangeCode(t, _, d, n, l);
1776
- return c.log("[CROSSx] ONE ID 로그인 완료 (팝업)"), { status: "completed", tokens: p, returnTo: ce(t.returnTo) };
1775
+ }), p = await this.exchangeCode(t, _, d, n, c);
1776
+ return l.log("[CROSSx] ONE ID 로그인 완료 (팝업)"), { status: "completed", tokens: p, returnTo: he(t.returnTo) };
1777
1777
  }
1778
1778
  async authorizeWithRedirect(e, t) {
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 = Re(), l = await Ne(a), d = await this.pushAuthorizationRequest(e, s, r, n, l);
1782
+ const r = Y(), n = Y(), a = Re(), c = await Ne(a), d = await this.pushAuthorizationRequest(e, s, r, n, c);
1783
1783
  t.throwIfAborted();
1784
1784
  const g = {
1785
1785
  issuer: e.issuer,
@@ -1788,10 +1788,10 @@ class Hs {
1788
1788
  nonce: n,
1789
1789
  codeVerifier: a,
1790
1790
  redirectUri: s,
1791
- returnTo: ce(e.returnTo),
1791
+ returnTo: he(e.returnTo),
1792
1792
  createdAt: this.now()
1793
1793
  };
1794
- this.pendingStorage.setItem(Oe, JSON.stringify(g)), c.log("[CROSSx] ONE ID 로그인 같은 창 이동", { issuer: e.issuer, clientId: e.clientId });
1794
+ this.pendingStorage.setItem(Oe, JSON.stringify(g)), l.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
  }
@@ -1815,14 +1815,14 @@ async function Pe(i) {
1815
1815
  return {};
1816
1816
  }
1817
1817
  }
1818
- const le = "crossx.oneid.session", Ce = 60 * 1e3, Le = /* @__PURE__ */ new Set([
1818
+ const de = "crossx.oneid.session", Ce = 60 * 1e3, be = /* @__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 he(i) {
1825
- return i instanceof h && Le.has(i.code);
1824
+ function te(i) {
1825
+ return i instanceof h && be.has(i.code);
1826
1826
  }
1827
1827
  const Ks = "crossx.oneid.refresh";
1828
1828
  function Vs(i) {
@@ -1841,7 +1841,7 @@ class $s {
1841
1841
  clientId: this.config.clientId,
1842
1842
  tokens: e
1843
1843
  };
1844
- return this.storage.setItem(le, JSON.stringify(t)), ut(t);
1844
+ return this.storage.setItem(de, JSON.stringify(t)), ut(t);
1845
1845
  }
1846
1846
  /**
1847
1847
  * 보관한 세션을 돌려준다. access token이 끝나 가면 갱신한다. 없으면 null.
@@ -1873,16 +1873,16 @@ class $s {
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 && Le.has(s.code)) return;
1876
+ if (s instanceof h && be.has(s.code)) return;
1877
1877
  }
1878
1878
  await this.port.logout(this.config, t);
1879
1879
  }
1880
1880
  clear() {
1881
- this.generation += 1, this.storage.removeItem(le);
1881
+ this.generation += 1, this.storage.removeItem(de);
1882
1882
  }
1883
1883
  read() {
1884
1884
  var t;
1885
- const e = this.storage.getItem(le);
1885
+ const e = this.storage.getItem(de);
1886
1886
  if (!e) return null;
1887
1887
  try {
1888
1888
  const s = JSON.parse(e);
@@ -1923,10 +1923,10 @@ class $s {
1923
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(a)), a;
1926
+ return this.storage.setItem(de, JSON.stringify(a)), a;
1927
1927
  } catch (r) {
1928
1928
  if (s !== this.generation) throw r;
1929
- if (r instanceof h && Le.has(r.code))
1929
+ if (r instanceof h && be.has(r.code))
1930
1930
  throw this.clear(), r;
1931
1931
  if (t.tokens.expiresAt > this.now()) return t;
1932
1932
  throw r;
@@ -1934,7 +1934,7 @@ class $s {
1934
1934
  }
1935
1935
  }
1936
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);
1937
+ const e = i.tokens.idToken ? Ue(i.tokens.idToken) : null, t = typeof (e == null ? void 0 : e.sub) == "string" && e.sub ? e : Ue(i.tokens.accessToken);
1938
1938
  return {
1939
1939
  subject: typeof (t == null ? void 0 : t.sub) == "string" ? t.sub : "",
1940
1940
  clientId: i.clientId,
@@ -1984,60 +1984,60 @@ function Js(i) {
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, He = { name: "ECDH", namedCurve: "P-256" }, Xs = 32, Zs = 12, Qs = 32;
1988
- function ie(i) {
1987
+ const x = globalThis.crypto.subtle, Ge = { name: "ECDH", namedCurve: "P-256" }, Xs = 32, Zs = 12, Qs = 32;
1988
+ function ne(i) {
1989
1989
  return new Uint8Array([i >>> 8 & 255, i & 255]);
1990
1990
  }
1991
- const te = F(C("HPKE"), ie(16), ie(1), ie(2)), gt = F(C("KEM"), ie(16)), H = new Uint8Array(0);
1991
+ const se = F(C("HPKE"), ne(16), ne(1), ne(2)), gt = F(C("KEM"), ne(16)), G = 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
1996
  async function er(i, e, t) {
1997
1997
  const s = new Uint8Array(t);
1998
- let r = H;
1998
+ let r = G;
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 fe(i, e, t, s) {
2003
+ function pe(i, e, t, s) {
2004
2004
  return vt(i, F(C("HPKE-v1"), s, C(e), t));
2005
2005
  }
2006
2006
  function We(i, e, t, s, r) {
2007
- return er(i, F(ie(s), C("HPKE-v1"), r, C(e), t), s);
2007
+ return er(i, F(ne(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, He, !1, []);
2010
+ const t = await x.importKey("raw", e, Ge, !1, []);
2011
2011
  return new Uint8Array(await x.deriveBits({ name: "ECDH", public: t }, i, 256));
2012
2012
  }
2013
- async function Ut(i, e, t) {
2014
- const s = await fe(H, "eae_prk", i, gt);
2013
+ async function Lt(i, e, t) {
2014
+ const s = await pe(G, "eae_prk", i, gt);
2015
2015
  return We(s, "shared_secret", F(e, t), Qs, gt);
2016
2016
  }
2017
- async function bt(i) {
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);
2017
+ async function Ut(i) {
2018
+ const e = await pe(G, "psk_id_hash", G, se), t = await pe(G, "info_hash", G, se), s = F(new Uint8Array([0]), e, t), r = await pe(i, "secret", G, se), n = await We(r, "key", s, Xs, se), a = await We(r, "base_nonce", s, Zs, se);
2019
2019
  return { key: n, baseNonce: a };
2020
2020
  }
2021
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
- async function Lt() {
2026
- const i = await x.generateKey(He, !1, ["deriveBits"]), e = new Uint8Array(await x.exportKey("raw", i.publicKey));
2025
+ async function bt() {
2026
+ const i = await x.generateKey(Ge, !1, ["deriveBits"]), e = new Uint8Array(await x.exportKey("raw", i.publicKey));
2027
2027
  return { privateKey: i.privateKey, publicKey: e };
2028
2028
  }
2029
2029
  async function tr(i, e, t) {
2030
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
- await x.encrypt({ name: "AES-GCM", iv: l, additionalData: t }, d, e)
2031
+ const s = await x.generateKey(Ge, !1, ["deriveBits"]), r = new Uint8Array(await x.exportKey("raw", s.publicKey)), n = await Lt(await kt(s.privateKey, i), r, i), { key: a, baseNonce: c } = await Ut(n), d = await x.importKey("raw", a, "AES-GCM", !1, ["encrypt"]), g = new Uint8Array(
2032
+ await x.encrypt({ name: "AES-GCM", iv: c, additionalData: t }, d, e)
2033
2033
  );
2034
2034
  return { enc: r, ciphertext: g };
2035
2035
  }
2036
2036
  async function sr(i, e, t, s) {
2037
2037
  me(e, "enc");
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"]);
2038
+ const r = await Lt(await kt(i.privateKey, e), e, i.publicKey), { key: n, baseNonce: a } = await Ut(r), c = await x.importKey("raw", n, "AES-GCM", !1, ["decrypt"]);
2039
2039
  return new Uint8Array(
2040
- await x.decrypt({ name: "AES-GCM", iv: a, additionalData: s }, l, t)
2040
+ await x.decrypt({ name: "AES-GCM", iv: a, additionalData: s }, c, t)
2041
2041
  );
2042
2042
  }
2043
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 = {
@@ -2106,13 +2106,13 @@ async function fr(i) {
2106
2106
  authzKeyId: i.authz.keyId
2107
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 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))
2109
+ const { enc: a, ciphertext: c } = 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: c }, i.bindingId, e))
2111
2111
  );
2112
2112
  return {
2113
2113
  envelope: {
2114
2114
  enc: k(a),
2115
- ciphertext: k(l),
2115
+ ciphertext: k(c),
2116
2116
  nonce: k(s.nonce),
2117
2117
  expires_at: s.expiresAt,
2118
2118
  intent_hash: k(s.intentHash),
@@ -2166,7 +2166,7 @@ class wr {
2166
2166
  }
2167
2167
  async issue() {
2168
2168
  var g;
2169
- const e = this.generation, t = await Lt(), s = await this.opts.getIssuanceJwt(), r = await this.opts.client.call("POST", "/authz-keys", {
2169
+ const e = this.generation, t = await bt(), s = await this.opts.getIssuanceJwt(), r = await this.opts.client.call("POST", "/authz-keys", {
2170
2170
  jwt: s,
2171
2171
  response_key: k(t.publicKey)
2172
2172
  });
@@ -2180,14 +2180,14 @@ class wr {
2180
2180
  }
2181
2181
  const a = await _r(n, Z(r.key_cert.pubkey));
2182
2182
  n.fill(0);
2183
- const l = Date.parse(r.key_cert.expires_at);
2184
- if (Number.isNaN(l))
2183
+ const c = Date.parse(r.key_cert.expires_at);
2184
+ if (Number.isNaN(c))
2185
2185
  throw new h(o.AUTH_FAILED, "authz key_cert has no valid expires_at");
2186
2186
  const d = {
2187
2187
  signingKey: a,
2188
2188
  keyId: r.key_cert.key_id,
2189
2189
  cert: { ...r.key_cert, sig: r.cert_sig },
2190
- expiresAtMs: l
2190
+ expiresAtMs: c
2191
2191
  };
2192
2192
  if (e !== this.generation)
2193
2193
  throw new h(o.AUTH_NOT_AUTHENTICATED, "authz key issuance was cancelled by sign-out");
@@ -2207,6 +2207,7 @@ const Sr = 600 * 1e3, Er = {
2207
2207
  WALLET_ALREADY_EXISTS: o.WALLET_ALREADY_EXISTS,
2208
2208
  WALLET_NOT_FOUND: o.WALLET_NOT_FOUND,
2209
2209
  ADDRESS_NOT_FOUND: o.WALLET_NOT_FOUND,
2210
+ INVALID_ADDRESS_NAME: o.WALLET_NAME_INVALID,
2210
2211
  WALLET_DELETED: o.WALLET_NOT_FOUND,
2211
2212
  WALLET_NOT_ACTIVATED: o.WALLET_INCONSISTENT_STATE,
2212
2213
  WALLET_LOAD_FAILED: o.WALLET_INCONSISTENT_STATE,
@@ -2230,22 +2231,32 @@ const Sr = 600 * 1e3, Er = {
2230
2231
  ENVELOPE_INVALID: o.SIGNATURE_FAILED,
2231
2232
  REPLAY: o.SIGNATURE_FAILED
2232
2233
  };
2233
- function Ir(i, e) {
2234
+ function Ar(i, e) {
2234
2235
  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
2236
  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
2237
  }
2237
- class Ar {
2238
+ function Ir(i) {
2239
+ if (!(i instanceof h)) return !1;
2240
+ const e = i.details;
2241
+ return (e == null ? void 0 : e.status) === 401 && (!e.serverCode || e.serverCode === "UNAUTHORIZED");
2242
+ }
2243
+ class mr {
2238
2244
  constructor(e) {
2239
2245
  this.opts = e, this.recipient = null, this.now = e.now ?? Date.now;
2240
2246
  }
2241
2247
  /** 인증이 필요한 요청. 2xx 가 아니면 CROSSxError 를 던진다 */
2242
2248
  async call(e, t, s) {
2243
- const r = await this.opts.getAccessToken();
2244
- return this.send(e, t, s, { Authorization: `Bearer ${r}` });
2249
+ const r = this.url(t), n = this.opts.getAuthorizationHeaders, a = n ? await n({ method: e, url: r }) : { Authorization: `Bearer ${await this.opts.getAccessToken()}` };
2250
+ try {
2251
+ return await this.send(e, r, s, a);
2252
+ } catch (c) {
2253
+ if (!n || !a.DPoP || !Ir(c)) throw c;
2254
+ return this.send(e, r, s, await n({ method: e, url: r, retry: !0 }));
2255
+ }
2245
2256
  }
2246
2257
  /** 인증 없는 요청(`/attestation`, `/chains`) */
2247
2258
  async callPublic(e, t) {
2248
- return this.send(e, t, void 0, {});
2259
+ return this.send(e, this.url(t), void 0, {});
2249
2260
  }
2250
2261
  /** enclave 수신 공개키(SEC1 65B) */
2251
2262
  async getRecipientKey() {
@@ -2261,28 +2272,32 @@ class Ar {
2261
2272
  forgetRecipientKey() {
2262
2273
  this.recipient = null;
2263
2274
  }
2264
- async send(e, t, s, r) {
2265
- const n = typeof this.opts.baseUrl == "function" ? this.opts.baseUrl() : this.opts.baseUrl;
2266
- if (!n)
2275
+ /** 요청 주소. 환경 설정이 비어 있으면 INVALID_CONFIG */
2276
+ url(e) {
2277
+ const t = typeof this.opts.baseUrl == "function" ? this.opts.baseUrl() : this.opts.baseUrl;
2278
+ if (!t)
2267
2279
  throw new h(o.INVALID_CONFIG, "one-wallet-api URL is not configured for this environment");
2268
- let a;
2280
+ return `${t.replace(/\/+$/, "")}${e}`;
2281
+ }
2282
+ async send(e, t, s, r) {
2283
+ let n;
2269
2284
  try {
2270
- a = await this.opts.transport.request({
2271
- url: `${n.replace(/\/+$/, "")}${t}`,
2285
+ n = await this.opts.transport.request({
2286
+ url: t,
2272
2287
  method: e,
2273
2288
  headers: s === void 0 ? r : { ...r, "Content-Type": "application/json" },
2274
2289
  body: s
2275
2290
  });
2276
- } catch (l) {
2277
- throw new h(o.NETWORK_ERROR, "one-wallet-api request failed", { cause: l });
2291
+ } catch (a) {
2292
+ throw new h(o.NETWORK_ERROR, "one-wallet-api request failed", { cause: a });
2278
2293
  }
2279
- if (a.status < 200 || a.status >= 300)
2280
- throw Ir(a.status, a.data);
2281
- return a.data;
2294
+ if (n.status < 200 || n.status >= 300)
2295
+ throw Ar(n.status, n.data);
2296
+ return n.data;
2282
2297
  }
2283
2298
  }
2284
- const xe = (i) => `m/44'/60'/0'/0/${i}`, mr = /^0x(?:[0-9a-fA-F]{2})*$/;
2285
- function Tr(i) {
2299
+ const xe = (i) => `m/44'/60'/0'/0/${i}`, Tr = /^0x(?:[0-9a-fA-F]{2})*$/;
2300
+ function yr(i) {
2286
2301
  try {
2287
2302
  const e = JSON.parse(new TextDecoder().decode(zs(i.split(".")[1] ?? "")));
2288
2303
  if (typeof (e == null ? void 0 : e.sub) == "string" && e.sub) return e.sub;
@@ -2290,8 +2305,8 @@ function Tr(i) {
2290
2305
  }
2291
2306
  throw new h(o.AUTH_TOKEN_INVALID, "access token has no sub");
2292
2307
  }
2293
- function yr(i) {
2294
- if (mr.test(i)) {
2308
+ function Rr(i) {
2309
+ if (Tr.test(i)) {
2295
2310
  const e = i.slice(2);
2296
2311
  return Uint8Array.from({ length: e.length / 2 }, (t, s) => parseInt(e.slice(s * 2, s * 2 + 2), 16));
2297
2312
  }
@@ -2319,10 +2334,11 @@ function ft(i, e) {
2319
2334
  }
2320
2335
  class Me {
2321
2336
  constructor(e) {
2322
- this.opts = e, this.walletAddress = null, this.client = new Ar({
2337
+ this.opts = e, this.walletAddress = null, this.client = new mr({
2323
2338
  baseUrl: e.baseUrl,
2324
2339
  transport: e.transport,
2325
2340
  getAccessToken: e.getAccessToken,
2341
+ getAuthorizationHeaders: e.getAuthorizationHeaders,
2326
2342
  now: e.now
2327
2343
  }), this.authzKeys = new wr({ client: this.client, getIssuanceJwt: e.getAccessToken, now: e.now });
2328
2344
  }
@@ -2333,7 +2349,7 @@ class Me {
2333
2349
  if (this.walletAddress) return this.walletData(this.walletAddress);
2334
2350
  const t = await this.findWallet();
2335
2351
  if (t) return this.walletData(t.address);
2336
- const s = this.requirePin(), r = Tr(await this.opts.getAccessToken()), n = await Lt(), { result: a, aad: l } = await this.withEnvelope(
2352
+ const s = this.requirePin(), r = yr(await this.opts.getAccessToken()), n = await bt(), { result: a, aad: c } = await this.withEnvelope(
2337
2353
  "generate",
2338
2354
  r,
2339
2355
  { command: "generate" },
@@ -2345,7 +2361,7 @@ class Me {
2345
2361
  })
2346
2362
  );
2347
2363
  if (this.walletAddress = a.address, a.sealed_share_c && this.opts.onShareC) {
2348
- const d = await Ft(n, a.sealed_share_c, l);
2364
+ const d = await Ft(n, a.sealed_share_c, c);
2349
2365
  await this.opts.onShareC(d, a.address);
2350
2366
  }
2351
2367
  return this.walletData(a.address);
@@ -2357,6 +2373,11 @@ class Me {
2357
2373
  );
2358
2374
  return ((s == null ? void 0 : s.addresses) ?? []).map((r) => ({ address: r.address, index: r.index, name: r.name || void 0 }));
2359
2375
  }
2376
+ /** `PATCH /wallets/{addr}/addresses` — 봉투 없음, 한 번에 1~10개 (docs/26 §5.1, GASPQA-6803) */
2377
+ async setAddressNames(e, t) {
2378
+ const s = await this.requireWalletAddress();
2379
+ await this.client.call("PATCH", `/wallets/${s}/addresses`, { names: t });
2380
+ }
2360
2381
  async getAddress(e, t) {
2361
2382
  const s = await this.requireWalletAddress(), r = (await this.getAddresses(e)).find((a) => a.index === t);
2362
2383
  if (r) return { address: r.address, derivationPath: xe(t) };
@@ -2365,27 +2386,27 @@ class Me {
2365
2386
  s,
2366
2387
  { command: "get_address", index: t },
2367
2388
  { pin: this.requirePin() },
2368
- (a, l) => this.client.call("PUT", `/wallets/${s}/addresses/${t}`, { envelope: a, intent: l })
2389
+ (a, c) => this.client.call("PUT", `/wallets/${s}/addresses/${t}`, { envelope: a, intent: c })
2369
2390
  );
2370
2391
  return { address: n.address, derivationPath: xe(t) };
2371
2392
  }
2372
2393
  async signMessage(e, t, s, r, n, a) {
2373
- const l = await this.resolveTarget(r, a), { result: d } = await this.withEnvelope(
2394
+ const c = await this.resolveTarget(r, a), { result: d } = await this.withEnvelope(
2374
2395
  "sign_message",
2375
- l.address,
2376
- { command: "sign_message", index: l.index, message: k(yr(s)) },
2396
+ c.address,
2397
+ { command: "sign_message", index: c.index, message: k(Rr(s)) },
2377
2398
  { pin: this.requirePin() },
2378
- (g, u) => this.client.call("POST", `/wallets/${l.address}/signatures`, { type: "message", envelope: g, intent: u })
2399
+ (g, u) => this.client.call("POST", `/wallets/${c.address}/signatures`, { type: "message", envelope: g, intent: u })
2379
2400
  );
2380
2401
  return { chainId: t, signature: d.signature, format: "hex" };
2381
2402
  }
2382
2403
  async signTypedData(e, t, s, r, n, a) {
2383
- const l = await this.resolveTarget(r, a), d = typeof s == "string" ? JSON.parse(s) : s, { result: g } = await this.withEnvelope(
2404
+ const c = await this.resolveTarget(r, a), d = typeof s == "string" ? JSON.parse(s) : s, { result: g } = await this.withEnvelope(
2384
2405
  "sign_typed_data",
2385
- l.address,
2386
- { command: "sign_typed_data", index: l.index, typed_data: d },
2406
+ c.address,
2407
+ { command: "sign_typed_data", index: c.index, typed_data: d },
2387
2408
  { pin: this.requirePin() },
2388
- (u, _) => this.client.call("POST", `/wallets/${l.address}/signatures`, {
2409
+ (u, _) => this.client.call("POST", `/wallets/${c.address}/signatures`, {
2389
2410
  type: "typed_data",
2390
2411
  chain_id: t,
2391
2412
  envelope: u,
@@ -2400,10 +2421,10 @@ class Me {
2400
2421
  n.address,
2401
2422
  { command: "sign", index: n.index, unsigned_tx: ft(s, t) },
2402
2423
  { pin: this.requirePin() },
2403
- (l, d) => this.client.call("POST", `/wallets/${n.address}/signatures`, {
2424
+ (c, d) => this.client.call("POST", `/wallets/${n.address}/signatures`, {
2404
2425
  type: "transaction",
2405
2426
  chain_id: t,
2406
- envelope: l,
2427
+ envelope: c,
2407
2428
  intent: d
2408
2429
  })
2409
2430
  );
@@ -2415,7 +2436,7 @@ class Me {
2415
2436
  r.address,
2416
2437
  { command: "sign", index: r.index, unsigned_tx: ft(s, t) },
2417
2438
  { pin: this.requirePin() },
2418
- (a, l) => this.client.call("POST", `/wallets/${r.address}/transactions`, { chain_id: t, envelope: a, intent: l })
2439
+ (a, c) => this.client.call("POST", `/wallets/${r.address}/transactions`, { chain_id: t, envelope: a, intent: c })
2419
2440
  );
2420
2441
  return { txHash: n.tx_hash };
2421
2442
  }
@@ -2469,7 +2490,7 @@ class Me {
2469
2490
  /** 봉투를 만들어 보낸다. 키 · 수신키 문제로 거부되면 새로 받아 한 번 더 보낸다 */
2470
2491
  async withEnvelope(e, t, s, r, n) {
2471
2492
  var a;
2472
- for (let l = 0; ; l++) {
2493
+ for (let c = 0; ; c++) {
2473
2494
  const d = await fr({
2474
2495
  recipientPub: await this.client.getRecipientKey(),
2475
2496
  bindingId: t,
@@ -2482,7 +2503,7 @@ class Me {
2482
2503
  try {
2483
2504
  return { result: await n(d.envelope, d.intent), aad: d.aad };
2484
2505
  } catch (g) {
2485
- if (l > 0 || !(g instanceof h)) throw g;
2506
+ if (c > 0 || !(g instanceof h)) throw g;
2486
2507
  const u = (a = g.details) == null ? void 0 : a.serverCode;
2487
2508
  if (u === "AUTHZ_INVALID") this.authzKeys.invalidate();
2488
2509
  else if (u === "ENVELOPE_INVALID") this.client.forgetRecipientKey();
@@ -2491,11 +2512,11 @@ class Me {
2491
2512
  }
2492
2513
  }
2493
2514
  }
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 ?? "");
2515
+ const Nr = 3, Or = /^0x(?:[0-9a-fA-F]{2}){4,}$/;
2516
+ function Pr(i) {
2517
+ return i.code === Nr || /execution reverted/i.test(i.message ?? "");
2497
2518
  }
2498
- class Pr {
2519
+ class Cr {
2499
2520
  constructor(e, t) {
2500
2521
  this.chainRegistry = e, this.transport = t, this._nextId = 1;
2501
2522
  }
@@ -2513,24 +2534,24 @@ class Pr {
2513
2534
  method: e,
2514
2535
  params: t,
2515
2536
  id: this._nextId++
2516
- }, l = (await this.transport.request({
2537
+ }, c = (await this.transport.request({
2517
2538
  url: r.rpcUrl,
2518
2539
  method: "POST",
2519
2540
  headers: { "Content-Type": "application/json" },
2520
2541
  body: n
2521
2542
  })).data;
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 }, _ = 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(
2543
+ if (c != null && c.error) {
2544
+ const { code: d, message: g } = c.error, u = { method: e, chainId: s, code: d, message: g, data: c.error.data }, _ = Pr(c.error);
2545
+ throw _ && typeof u.data == "string" && Or.test(u.data) && (u.revertData = u.data, u.selector = u.data.slice(0, 10).toLowerCase()), new h(
2525
2546
  _ ? o.EXECUTION_REVERTED : o.UNKNOWN_ERROR,
2526
2547
  `RPC 오류 [${e}] (${s}): ${g} (코드: ${d})`,
2527
2548
  u
2528
2549
  );
2529
2550
  }
2530
- return l == null ? void 0 : l.result;
2551
+ return c == null ? void 0 : c.result;
2531
2552
  }
2532
2553
  }
2533
- class Cr {
2554
+ class Dr {
2534
2555
  constructor() {
2535
2556
  this.listeners = /* @__PURE__ */ new Map();
2536
2557
  }
@@ -2553,7 +2574,7 @@ class Cr {
2553
2574
  this.listeners.clear();
2554
2575
  }
2555
2576
  }
2556
- function Dr() {
2577
+ function xr() {
2557
2578
  var e;
2558
2579
  if (typeof globalThis < "u" && ((e = globalThis.crypto) != null && e.getRandomValues)) {
2559
2580
  const t = new Uint8Array(16);
@@ -2561,7 +2582,7 @@ function Dr() {
2561
2582
  }
2562
2583
  return require("crypto").randomBytes(16).toString("hex");
2563
2584
  }
2564
- class L {
2585
+ class b {
2565
2586
  constructor(e) {
2566
2587
  this.config = e, this.context = null;
2567
2588
  }
@@ -2573,10 +2594,10 @@ class L {
2573
2594
  const t = Date.now();
2574
2595
  for (; Date.now() - t < e; ) {
2575
2596
  if (window.__CROSSX_RN_BRIDGE_READY__ === !0)
2576
- return c.log("[RNBridge] Bridge is ready"), !0;
2597
+ return l.log("[RNBridge] Bridge is ready"), !0;
2577
2598
  await new Promise((r) => setTimeout(r, 50));
2578
2599
  }
2579
- return c.warn("[RNBridge] Bridge ready timeout after", e, "ms"), !1;
2600
+ return l.warn("[RNBridge] Bridge ready timeout after", e, "ms"), !1;
2580
2601
  }
2581
2602
  /**
2582
2603
  * Detect if RN bridge is available
@@ -2598,13 +2619,13 @@ class L {
2598
2619
  * Initialize and activate bridge
2599
2620
  */
2600
2621
  async initialize() {
2601
- if (await L.waitForBridgeReady(5e3) || c.warn("[RNBridge] Bridge did not become ready in time"), this.bridge = L.getBridge(), !this.bridge)
2622
+ if (await b.waitForBridgeReady(5e3) || l.warn("[RNBridge] Bridge did not become ready in time"), this.bridge = b.getBridge(), !this.bridge)
2602
2623
  throw new h(
2603
2624
  o.AUTH_NOT_INITIALIZED,
2604
2625
  "RN Bridge not available in this environment"
2605
2626
  );
2606
2627
  if (typeof this.bridge.handshake != "function")
2607
- throw c.error("[RNBridge] Bridge.handshake is not a function", {
2628
+ throw l.error("[RNBridge] Bridge.handshake is not a function", {
2608
2629
  handshake: typeof this.bridge.handshake,
2609
2630
  bridge: Object.keys(this.bridge)
2610
2631
  }), new h(
@@ -2612,7 +2633,7 @@ class L {
2612
2633
  "RN Bridge handshake method not available"
2613
2634
  );
2614
2635
  const t = await this.handshake();
2615
- return this.context = t, c.log("[RNBridge] Bootstrap initialization complete", {
2636
+ return this.context = t, l.log("[RNBridge] Bootstrap initialization complete", {
2616
2637
  activated: t.isActivated,
2617
2638
  ttl: `${t.absoluteTtlMs / 1e3 / 60}min`
2618
2639
  }), t;
@@ -2623,7 +2644,7 @@ class L {
2623
2644
  async handshake() {
2624
2645
  if (!this.bridge)
2625
2646
  throw new h(o.AUTH_NOT_INITIALIZED, "Bridge not initialized");
2626
- const e = Dr(), t = Date.now(), s = {
2647
+ const e = xr(), t = Date.now(), s = {
2627
2648
  version: 1,
2628
2649
  appId: this.config.appId,
2629
2650
  appVersion: this.config.appVersion,
@@ -2642,7 +2663,7 @@ class L {
2642
2663
  o.AUTH_FAILED,
2643
2664
  "Bridge handshake rejected by native"
2644
2665
  );
2645
- const n = typeof r.walletName == "string" ? r.walletName.trim() : "", a = n.length > 0 && n.length <= 64 ? n : void 0, l = r.provider === "google" || r.provider === "apple" ? r.provider : void 0;
2666
+ const n = typeof r.walletName == "string" ? r.walletName.trim() : "", a = n.length > 0 && n.length <= 64 ? n : void 0, c = r.provider === "google" || r.provider === "apple" ? r.provider : void 0;
2646
2667
  return {
2647
2668
  isActivated: !0,
2648
2669
  absoluteTtlMs: r.absoluteTtlMs,
@@ -2652,10 +2673,10 @@ class L {
2652
2673
  lastActivityAt: Date.now(),
2653
2674
  walletAddress: r.walletAddress,
2654
2675
  walletName: a,
2655
- walletProvider: l
2676
+ walletProvider: c
2656
2677
  };
2657
2678
  } catch (r) {
2658
- throw c.error("[RNBridge] Handshake failed", r), new h(
2679
+ throw l.error("[RNBridge] Handshake failed", r), new h(
2659
2680
  o.AUTH_FAILED,
2660
2681
  "Bridge handshake failed",
2661
2682
  r
@@ -2685,7 +2706,7 @@ class L {
2685
2706
  o.USER_REJECTED,
2686
2707
  "Firebase ID token request rejected by user",
2687
2708
  e
2688
- ) : (c.error("[RNBridge] Firebase token request failed", e), new h(
2709
+ ) : (l.error("[RNBridge] Firebase token request failed", e), new h(
2689
2710
  o.AUTH_FAILED,
2690
2711
  "Firebase token request failed",
2691
2712
  e
@@ -2708,7 +2729,7 @@ class L {
2708
2729
  );
2709
2730
  return this.touchActivity(), e;
2710
2731
  } catch (e) {
2711
- throw e instanceof h ? e : (c.error("[RNBridge] Fresh Firebase token request failed", e), new h(
2732
+ throw e instanceof h ? e : (l.error("[RNBridge] Fresh Firebase token request failed", e), new h(
2712
2733
  o.SESSION_EXPIRED,
2713
2734
  "Native session expired. Please sign in again in the app.",
2714
2735
  e
@@ -2744,7 +2765,7 @@ class L {
2744
2765
  );
2745
2766
  return t;
2746
2767
  } catch (t) {
2747
- throw t instanceof h ? t : (c.warn("[RNBridge] Session restore Firebase token request failed", t), new h(
2768
+ throw t instanceof h ? t : (l.warn("[RNBridge] Session restore Firebase token request failed", t), new h(
2748
2769
  o.RN_NATIVE_SESSION_EXPIRED,
2749
2770
  "Native bridge session restore failed. Please sign in again.",
2750
2771
  t
@@ -2807,7 +2828,7 @@ const X = {
2807
2828
  portraitBaseUrl: "https://dev-portrait.crosstoken.io",
2808
2829
  contentsBaseUrl: "https://stg-contents.crosstoken.io/frontend/common/app-launcher",
2809
2830
  oneIdIssuer: "https://stg-oauth2.onechain.nexus",
2810
- oneWalletApiUrl: ""
2831
+ oneWalletApiUrl: "https://stg-one-pocket-api.onechain.nexus/embed/v1"
2811
2832
  },
2812
2833
  development: {
2813
2834
  oauthServiceUrl: "https://dev-one-wallet-oauth.onechain.nexus",
@@ -2820,7 +2841,7 @@ const X = {
2820
2841
  oneWalletApiUrl: "https://dev-one-pocket-api.onechain.nexus/embed/v1"
2821
2842
  }
2822
2843
  };
2823
- function xr(i) {
2844
+ function vr(i) {
2824
2845
  const e = i.environment, t = e && e in X ? X[e] : null;
2825
2846
  if (!t)
2826
2847
  return null;
@@ -2832,10 +2853,10 @@ function xr(i) {
2832
2853
  typeof a == "string" && a.trim() !== "" && (r[n] = a);
2833
2854
  return r;
2834
2855
  }
2835
- function Se() {
2856
+ function ce() {
2836
2857
  try {
2837
2858
  if (typeof __CROSSX_CONFIG__ < "u") {
2838
- const i = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = xr(i);
2859
+ const i = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = vr(i);
2839
2860
  if (e) return e;
2840
2861
  }
2841
2862
  } catch {
@@ -2853,18 +2874,18 @@ function Bt(i) {
2853
2874
  for (; e > 0 && i.charCodeAt(e - 1) === 48; ) e--;
2854
2875
  return i.slice(0, e);
2855
2876
  }
2856
- function vr(i, e = mt) {
2877
+ function kr(i, e = mt) {
2857
2878
  if (!i || i === "0x0" || i === "0x") return "0";
2858
2879
  try {
2859
2880
  const t = BigInt(i);
2860
2881
  if (t === 0n) return "0";
2861
- const s = 10n ** BigInt(Ze), r = t / s, a = (t % s).toString().padStart(Ze, "0"), l = Bt(a).slice(0, e);
2862
- return l ? `${r}.${l}` : `${r}`;
2882
+ const s = 10n ** BigInt(Ze), r = t / s, a = (t % s).toString().padStart(Ze, "0"), c = Bt(a).slice(0, e);
2883
+ return c ? `${r}.${c}` : `${r}`;
2863
2884
  } catch {
2864
2885
  return "?";
2865
2886
  }
2866
2887
  }
2867
- function de(i, e, t, s = mt) {
2888
+ function ue(i, e, t, s = mt) {
2868
2889
  if (!(!i || i === "0x" || i === "0x0"))
2869
2890
  try {
2870
2891
  const r = BigInt(i);
@@ -2875,7 +2896,7 @@ function de(i, e, t, s = mt) {
2875
2896
  return;
2876
2897
  }
2877
2898
  }
2878
- function kr(i) {
2899
+ function Lr(i) {
2879
2900
  const e = i.startsWith("0x") ? i.slice(2) : i;
2880
2901
  if (!/^[0-9a-fA-F]+$/.test(e))
2881
2902
  throw new h(
@@ -2902,7 +2923,7 @@ function Ur(i) {
2902
2923
  );
2903
2924
  }
2904
2925
  function br(i, e) {
2905
- const t = Lr(e);
2926
+ const t = Wr(e);
2906
2927
  if (i === "0") {
2907
2928
  if (t !== void 0 && t !== 0)
2908
2929
  throw new h(
@@ -2926,7 +2947,7 @@ function br(i, e) {
2926
2947
  );
2927
2948
  }
2928
2949
  }
2929
- function Lr(i) {
2950
+ function Wr(i) {
2930
2951
  if (i == null || typeof i != "object") return;
2931
2952
  const e = i.domain;
2932
2953
  if (e == null || typeof e != "object") return;
@@ -2935,7 +2956,13 @@ function Lr(i) {
2935
2956
  const s = Number(t);
2936
2957
  return Number.isFinite(s) ? s : void 0;
2937
2958
  }
2938
- const Yi = 900 * 1e3, Wr = /* @__PURE__ */ new Set([
2959
+ const Mr = 4, Fr = 24, Br = /^[\p{L}\p{N} _\-.,()[\]@#%^*~/:+=!?]+$/u;
2960
+ function Hr(i) {
2961
+ if (typeof i != "string") return null;
2962
+ const e = i.trim(), t = [...e].length;
2963
+ return t < Mr || t > Fr ? null : Br.test(e) ? e : null;
2964
+ }
2965
+ const Zi = 900 * 1e3, Gr = /* @__PURE__ */ new Set([
2939
2966
  "095ea7b3",
2940
2967
  // approve(address,uint256)
2941
2968
  "a22cb465",
@@ -2946,7 +2973,7 @@ const Yi = 900 * 1e3, Wr = /* @__PURE__ */ new Set([
2946
2973
  // increaseApproval(address,uint256) — 예전 OpenZeppelin
2947
2974
  "87517c45"
2948
2975
  // Permit2 approve(address,address,uint160,uint48)
2949
- ]), Mr = /* @__PURE__ */ new Set([
2976
+ ]), Kr = /* @__PURE__ */ new Set([
2950
2977
  "Permit",
2951
2978
  "PermitSingle",
2952
2979
  "PermitBatch",
@@ -2955,22 +2982,22 @@ const Yi = 900 * 1e3, Wr = /* @__PURE__ */ new Set([
2955
2982
  "PermitWitnessTransferFrom",
2956
2983
  "PermitBatchWitnessTransferFrom"
2957
2984
  ]);
2958
- function Fr(i) {
2985
+ function Vr(i) {
2959
2986
  var s;
2960
2987
  const { action: e, context: t } = i;
2961
2988
  if (e === "sign" || e === "send") {
2962
2989
  const r = (s = t.tx) == null ? void 0 : s.data;
2963
2990
  if (typeof r != "string") return !1;
2964
2991
  const n = r.trim().toLowerCase().replace(/^0x/, "");
2965
- return n.length >= 8 && Wr.has(n.slice(0, 8));
2992
+ return n.length >= 8 && Gr.has(n.slice(0, 8));
2966
2993
  }
2967
2994
  if (e === "sign-typed-data") {
2968
- const r = Br(t.typedData);
2969
- return r === null || Mr.has(r);
2995
+ const r = $r(t.typedData);
2996
+ return r === null || Kr.has(r);
2970
2997
  }
2971
2998
  return !1;
2972
2999
  }
2973
- function Br(i) {
3000
+ function $r(i) {
2974
3001
  let e = i;
2975
3002
  if (typeof e == "string")
2976
3003
  try {
@@ -2984,13 +3011,13 @@ function Br(i) {
2984
3011
  }
2985
3012
  return null;
2986
3013
  }
2987
- function Gr(i, e, t, s) {
3014
+ function Yr(i, e, t, s) {
2988
3015
  if (!i) return !0;
2989
3016
  if (i.mode === "off" || e === null) return !1;
2990
3017
  const r = t - e;
2991
- return r < 0 || r >= i.ttlMs ? !1 : !Fr(s);
3018
+ return r < 0 || r >= i.ttlMs ? !1 : !Vr(s);
2992
3019
  }
2993
- function Hr(i) {
3020
+ function qr(i) {
2994
3021
  return (i == null ? void 0 : i.mode) === "off";
2995
3022
  }
2996
3023
  class J {
@@ -3005,12 +3032,12 @@ class J {
3005
3032
  var s, r;
3006
3033
  if (this.deps.pinStore.hold(), !this.deps.pinStore.has()) return;
3007
3034
  const t = (r = (s = this.deps).getPinReusePolicy) == null ? void 0 : r.call(s);
3008
- Gr(t, this.deps.pinStore.getSetAt(), Date.now(), e) || this.deps.pinStore.clear();
3035
+ Yr(t, this.deps.pinStore.getSetAt(), Date.now(), e) || this.deps.pinStore.clear();
3009
3036
  }
3010
3037
  /** 서명이 끝난 뒤 — 서명마다 PIN 을 받는 정책이면 PIN 을 메모리에 남기지 않는다. */
3011
3038
  finishSigning() {
3012
3039
  var e, t;
3013
- Hr((t = (e = this.deps).getPinReusePolicy) == null ? void 0 : t.call(e)) && this.deps.pinStore.clear(), this.deps.pinStore.release();
3040
+ qr((t = (e = this.deps).getPinReusePolicy) == null ? void 0 : t.call(e)) && this.deps.pinStore.clear(), this.deps.pinStore.release();
3014
3041
  }
3015
3042
  /** PIN 재사용 정책이 있으면 true — 서명을 하나씩 처리해야 한다 (SigningOrchestrator). */
3016
3043
  hasReusePolicy() {
@@ -3025,7 +3052,7 @@ class J {
3025
3052
  o.PIN_CANCELLED,
3026
3053
  "사용자가 PIN 설정을 취소했습니다"
3027
3054
  );
3028
- this.deps.pinStore.set(e), c.log("[CROSSx] PIN 설정 완료 (메모리 캐시)");
3055
+ this.deps.pinStore.set(e), l.log("[CROSSx] PIN 설정 완료 (메모리 캐시)");
3029
3056
  }
3030
3057
  async ensurePinForSigning(e) {
3031
3058
  var s, r;
@@ -3037,7 +3064,7 @@ class J {
3037
3064
  o.PIN_CANCELLED,
3038
3065
  "사용자가 PIN 입력을 취소했습니다"
3039
3066
  );
3040
- this.deps.pinStore.set(t), c.log("[CROSSx] PIN 입력 완료 (메모리 캐시)");
3067
+ this.deps.pinStore.set(t), l.log("[CROSSx] PIN 입력 완료 (메모리 캐시)");
3041
3068
  }
3042
3069
  async ensureVerifiedPin(e, t, s, r) {
3043
3070
  var d, g;
@@ -3047,14 +3074,14 @@ class J {
3047
3074
  else if (this.deps.pinStore.has())
3048
3075
  return;
3049
3076
  if (this.verifyPinMutex && !e) {
3050
- c.log("[CROSSx] ensureVerifiedPin: 진행 중인 검증 대기"), await this.verifyPinMutex;
3077
+ l.log("[CROSSx] ensureVerifiedPin: 진행 중인 검증 대기"), await this.verifyPinMutex;
3051
3078
  return;
3052
3079
  }
3053
3080
  let n, a;
3054
3081
  this.verifyPinMutex = new Promise((u, _) => {
3055
3082
  n = u, a = _;
3056
3083
  });
3057
- const l = M(this.deps.getLocale() ?? "en");
3084
+ const c = M(this.deps.getLocale() ?? "en");
3058
3085
  try {
3059
3086
  if (typeof this.deps.walletProvider.verifyPin != "function") {
3060
3087
  const _ = await this.deps.confirmation.showPinInputPrompt({
@@ -3069,7 +3096,7 @@ class J {
3069
3096
  o.PIN_CANCELLED,
3070
3097
  "사용자가 PIN 입력을 취소했습니다"
3071
3098
  );
3072
- this.deps.pinStore.set(_), c.log("[CROSSx] PIN 캐시 완료 (verifyPin 미지원, 로컬 전용)"), n();
3099
+ this.deps.pinStore.set(_), l.log("[CROSSx] PIN 캐시 완료 (verifyPin 미지원, 로컬 전용)"), n();
3073
3100
  return;
3074
3101
  }
3075
3102
  const u = await this.deps.confirmation.showPinInputPrompt({
@@ -3081,15 +3108,15 @@ class J {
3081
3108
  onSubmit: async (_) => {
3082
3109
  this.deps.pinStore.set(_);
3083
3110
  try {
3084
- return await this.deps.walletProvider.verifyPin(_) ? (c.log("[CROSSx] PIN 서버 검증 완료 (verify-password)"), { ok: !0 }) : (this.deps.pinStore.clear(), { ok: !1, error: l.pin_input_error });
3111
+ return await this.deps.walletProvider.verifyPin(_) ? (l.log("[CROSSx] PIN 서버 검증 완료 (verify-password)"), { ok: !0 }) : (this.deps.pinStore.clear(), { ok: !1, error: c.pin_input_error });
3085
3112
  } catch (p) {
3086
3113
  if (this.deps.pinStore.clear(), p instanceof h) {
3087
3114
  if (p.code === o.PIN_WRONG)
3088
- return { ok: !1, error: l.pin_input_error };
3115
+ return { ok: !1, error: c.pin_input_error };
3089
3116
  if (p.code === o.PIN_INVALID)
3090
3117
  return { ok: !1, error: p.message };
3091
3118
  if (p.code === o.PIN_LOCKED)
3092
- return J.buildPinLockedResult(p, l);
3119
+ return J.buildPinLockedResult(p, c);
3093
3120
  }
3094
3121
  throw p;
3095
3122
  }
@@ -3100,7 +3127,7 @@ class J {
3100
3127
  o.PIN_CANCELLED,
3101
3128
  "사용자가 PIN 입력을 취소했습니다"
3102
3129
  );
3103
- this.deps.pinStore.set(u), c.log("[CROSSx] PIN 갱신 완료 (verify 모달 닫힘)"), n();
3130
+ this.deps.pinStore.set(u), l.log("[CROSSx] PIN 갱신 완료 (verify 모달 닫힘)"), n();
3104
3131
  } catch (u) {
3105
3132
  if (u instanceof h && (u.code === o.AUTH_NOT_AUTHENTICATED || u.code === o.AUTH_TOKEN_EXPIRED || u.code === o.SESSION_EXPIRED) && u.code !== o.SESSION_EXPIRED) {
3106
3133
  const _ = M(this.deps.getLocale() ?? "en"), p = this.deps.getUserEmail();
@@ -3128,7 +3155,7 @@ class J {
3128
3155
  throw r;
3129
3156
  }
3130
3157
  for (; ; ) {
3131
- c.warn("[CROSSx] PIN 불일치/잠금 — 재입력 요청:", s.errorMessage), this.deps.pinStore.clear(), await this.ensureVerifiedPin(
3158
+ l.warn("[CROSSx] PIN 불일치/잠금 — 재입력 요청:", s.errorMessage), this.deps.pinStore.clear(), await this.ensureVerifiedPin(
3132
3159
  s.errorMessage,
3133
3160
  s.lockExpiresAt,
3134
3161
  s.attemptCount,
@@ -3168,7 +3195,7 @@ class J {
3168
3195
  return { ok: !1, error: r, ...n };
3169
3196
  }
3170
3197
  }
3171
- class Kr {
3198
+ class jr {
3172
3199
  constructor(e) {
3173
3200
  this.deps = e, this.signingQueue = Promise.resolve();
3174
3201
  }
@@ -3207,10 +3234,10 @@ class Kr {
3207
3234
  }
3208
3235
  }
3209
3236
  }
3210
- function Vr(i) {
3237
+ function zr(i) {
3211
3238
  return i === "google" || i === "apple";
3212
3239
  }
3213
- class $r {
3240
+ class Jr {
3214
3241
  constructor(e) {
3215
3242
  this.deps = e;
3216
3243
  }
@@ -3221,7 +3248,7 @@ class $r {
3221
3248
  this.deps.setRecoveringSession(!0);
3222
3249
  try {
3223
3250
  this.deps.setAuthenticated(!1), this.deps.clearTokenStore();
3224
- const r = Vr(e.loginType) ? { provider: e.loginType } : void 0;
3251
+ const r = zr(e.loginType) ? { provider: e.loginType } : void 0;
3225
3252
  let n;
3226
3253
  try {
3227
3254
  n = await this.deps.executeSignIn(r);
@@ -3230,9 +3257,9 @@ class $r {
3230
3257
  }
3231
3258
  if (!n.success)
3232
3259
  return this.deps.clearAuthState(), n;
3233
- const a = ((t = n.user) == null ? void 0 : t.providerSub) ?? null, l = ((s = n.user) == null ? void 0 : s.id) ?? null;
3234
- if (!(e.providerSub ? !!a && a === e.providerSub : e.userId ? !!l && e.userId === l : !0)) {
3235
- c.warn(
3260
+ const a = ((t = n.user) == null ? void 0 : t.providerSub) ?? null, c = ((s = n.user) == null ? void 0 : s.id) ?? null;
3261
+ if (!(e.providerSub ? !!a && a === e.providerSub : e.userId ? !!c && e.userId === c : !0)) {
3262
+ l.warn(
3236
3263
  "[CROSSx] signInAgain: providerSub/userId 불일치 — 잘못된 계정으로 로그인됨"
3237
3264
  ), await this.deps.executeSignOut().catch(() => {
3238
3265
  });
@@ -3250,9 +3277,9 @@ class $r {
3250
3277
  try {
3251
3278
  await this.deps.loadWalletAfterAuth();
3252
3279
  } catch {
3253
- c.warn("[CROSSx] signInAgain: loadWalletAfterAuth 실패 (로그인은 유지)");
3280
+ l.warn("[CROSSx] signInAgain: loadWalletAfterAuth 실패 (로그인은 유지)");
3254
3281
  }
3255
- return c.log("[CROSSx] signInAgain: 세션 복구 성공"), n;
3282
+ return l.log("[CROSSx] signInAgain: 세션 복구 성공"), n;
3256
3283
  } finally {
3257
3284
  this.deps.setRecoveringSession(!1);
3258
3285
  }
@@ -3263,7 +3290,7 @@ class $r {
3263
3290
  } catch (t) {
3264
3291
  const s = M(this.deps.getLocale() ?? "en"), { userEmail: r } = this.deps.getSessionSnapshot(), n = r ? this.deps.maskEmail(r, s.session_alert_apple_account) : void 0;
3265
3292
  if (t instanceof h && t.code === o.WITHDRAW_FAILED) {
3266
- if (c.warn("[CROSSx] WITHDRAW_FAILED — 로컬 인증 초기화"), await this.deps.showSessionAlert({
3293
+ if (l.warn("[CROSSx] WITHDRAW_FAILED — 로컬 인증 초기화"), await this.deps.showSessionAlert({
3267
3294
  title: s.session_alert_title,
3268
3295
  message: s.alert_account_withdrawn,
3269
3296
  email: n
@@ -3272,7 +3299,7 @@ class $r {
3272
3299
  throw this.deps.clearAuthState(), t;
3273
3300
  }
3274
3301
  if (t instanceof h && t.code === o.WALLET_NOT_FOUND) {
3275
- if (c.warn("[CROSSx] WALLET_NOT_FOUND — 로컬 인증 초기화"), await this.deps.showSessionAlert({
3302
+ if (l.warn("[CROSSx] WALLET_NOT_FOUND — 로컬 인증 초기화"), await this.deps.showSessionAlert({
3276
3303
  title: s.session_alert_title,
3277
3304
  message: s.alert_wallet_not_found,
3278
3305
  email: n
@@ -3282,7 +3309,7 @@ class $r {
3282
3309
  }
3283
3310
  if (!(t instanceof h) || t.code !== o.SESSION_EXPIRED)
3284
3311
  throw t;
3285
- if (c.warn("[CROSSx] SESSION_EXPIRED 감지 — 자동 재인증 시도"), await this.deps.showSessionAlert({
3312
+ if (l.warn("[CROSSx] SESSION_EXPIRED 감지 — 자동 재인증 시도"), await this.deps.showSessionAlert({
3286
3313
  title: s.session_alert_title,
3287
3314
  message: s.alert_session_expired,
3288
3315
  email: n
@@ -3291,17 +3318,17 @@ class $r {
3291
3318
  o.SESSION_EXPIRED,
3292
3319
  "세션이 만료되었습니다. 다시 로그인해 주세요."
3293
3320
  );
3294
- const l = await this.signInAgain();
3295
- if (!l.success)
3321
+ const c = await this.signInAgain();
3322
+ if (!c.success)
3296
3323
  throw new h(
3297
3324
  o.SESSION_EXPIRED,
3298
- l.error ?? "세션이 만료되었습니다. 다시 로그인해 주세요."
3325
+ c.error ?? "세션이 만료되었습니다. 다시 로그인해 주세요."
3299
3326
  );
3300
3327
  return e();
3301
3328
  }
3302
3329
  }
3303
3330
  }
3304
- class Yr {
3331
+ class Xr {
3305
3332
  constructor(e) {
3306
3333
  this.deps = e;
3307
3334
  }
@@ -3310,7 +3337,7 @@ class Yr {
3310
3337
  try {
3311
3338
  return await this.deps.walletProvider.checkWallet();
3312
3339
  } catch (e) {
3313
- return c.warn("[CROSSx] checkWallet 실패 (폴백: not_found 처리):", e), "not_found";
3340
+ return l.warn("[CROSSx] checkWallet 실패 (폴백: not_found 처리):", e), "not_found";
3314
3341
  }
3315
3342
  return null;
3316
3343
  }
@@ -3318,7 +3345,7 @@ class Yr {
3318
3345
  const r = this.deps.getUserId();
3319
3346
  if (!r) return;
3320
3347
  const n = await this.fetchWalletStatus();
3321
- if (c.log("[CROSSx] loadWalletAfterAuth 지갑 상태:", n), n !== "exists") return;
3348
+ if (l.log("[CROSSx] loadWalletAfterAuth 지갑 상태:", n), n !== "exists") return;
3322
3349
  const a = await this.deps.walletProvider.getAddresses(r);
3323
3350
  if (a.length > 0) {
3324
3351
  let d, g = !1;
@@ -3328,10 +3355,10 @@ class Yr {
3328
3355
  );
3329
3356
  _ ? d = _ : (d = { address: t, index: 0 }, g = !0);
3330
3357
  } else e !== void 0 ? d = a.find((_) => _.index === e) ?? a[0] : d = a[0];
3331
- g ? c.log(
3358
+ g ? l.log(
3332
3359
  "[CROSSx] preferredWalletAddress 가 서버 캐시에 없음 — raw address 채택:",
3333
3360
  d.address
3334
- ) : c.log(
3361
+ ) : l.log(
3335
3362
  "[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):",
3336
3363
  d.address
3337
3364
  );
@@ -3343,28 +3370,28 @@ class Yr {
3343
3370
  );
3344
3371
  return;
3345
3372
  }
3346
- c.log("[CROSSx] 주소 캐시 없음 — 비밀번호 확인 후 address(0) 조회"), await this.deps.pinOrchestrator.ensureVerifiedPin();
3347
- const l = await this.deps.walletProvider.getAddress(r, 0);
3348
- c.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", l.address), this.deps.setActiveWallet(l.address, 0);
3373
+ l.log("[CROSSx] 주소 캐시 없음 — 비밀번호 확인 후 address(0) 조회"), await this.deps.pinOrchestrator.ensureVerifiedPin();
3374
+ const c = await this.deps.walletProvider.getAddress(r, 0);
3375
+ l.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", c.address), this.deps.setActiveWallet(c.address, 0);
3349
3376
  }
3350
3377
  }
3351
- class qr {
3378
+ class Zr {
3352
3379
  constructor(e) {
3353
3380
  this.deps = e;
3354
3381
  }
3355
3382
  async handleMigrationFlow(e) {
3356
3383
  var d, g;
3357
- c.log('[CROSSx][Migration Phase 3] "Wallet Found" 팝업 표시');
3384
+ l.log('[CROSSx][Migration Phase 3] "Wallet Found" 팝업 표시');
3358
3385
  const t = this.deps.getAllowSkip(), s = await this.deps.confirmation.showMigrationFoundPrompt({
3359
3386
  allowSkip: t
3360
3387
  });
3361
- if (c.log("[CROSSx][Migration Phase 3] 사용자 선택:", s), s === "skip")
3362
- return c.log(
3388
+ if (l.log("[CROSSx][Migration Phase 3] 사용자 선택:", s), s === "skip")
3389
+ return l.log(
3363
3390
  "[CROSSx][Migration Phase 3] 사용자가 마이그레이션을 건너뜀 → 종료"
3364
3391
  ), null;
3365
- let r, n = 0, a = 5, l = null;
3392
+ let r, n = 0, a = 5, c = null;
3366
3393
  for (; ; ) {
3367
- n++, c.log(
3394
+ n++, l.log(
3368
3395
  `[CROSSx][Migration Phase 4] PIN 입력 팝업 표시 (시도 #${n}/${a})`,
3369
3396
  r ? `— 이전 메시지: ${r}` : ""
3370
3397
  );
@@ -3374,8 +3401,8 @@ class qr {
3374
3401
  maxAttempts: a
3375
3402
  });
3376
3403
  if (u === null)
3377
- return c.log("[CROSSx][Migration Phase 4] 사용자가 PIN 입력을 취소함 → 종료"), null;
3378
- c.log(
3404
+ return l.log("[CROSSx][Migration Phase 4] 사용자가 PIN 입력을 취소함 → 종료"), null;
3405
+ l.log(
3379
3406
  "[CROSSx][Migration Phase 4] PIN 입력 완료 — verify-recovery-pin API 호출"
3380
3407
  ), r = void 0;
3381
3408
  try {
@@ -3385,44 +3412,44 @@ class qr {
3385
3412
  e
3386
3413
  ));
3387
3414
  if (!_) {
3388
- c.log(
3415
+ l.log(
3389
3416
  "[CROSSx][Migration Phase 4] verifyRecoveryPin 미지원 — PIN 검증 생략"
3390
- ), l = u;
3417
+ ), c = u;
3391
3418
  break;
3392
3419
  }
3393
3420
  if (_.valid) {
3394
- c.log("[CROSSx][Migration Phase 4] PIN 검증 성공"), l = u;
3421
+ l.log("[CROSSx][Migration Phase 4] PIN 검증 성공"), c = u;
3395
3422
  break;
3396
3423
  }
3397
3424
  const p = _.pinStatus;
3398
3425
  if (a = p.maxAttempts, n = a - p.remainingAttempts, p.remainingAttempts === 0 && p.lockExpiresAt) {
3399
- const I = p.lockExpiresAt * 1e3, S = Math.max(
3426
+ const A = p.lockExpiresAt * 1e3, S = Math.max(
3400
3427
  1,
3401
- Math.round((I - Date.now()) / 1e3)
3428
+ Math.round((A - Date.now()) / 1e3)
3402
3429
  ), w = S <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
3403
- c.warn(
3430
+ l.warn(
3404
3431
  `[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${S}초, 메시지: ${w}`
3405
3432
  ), await this.deps.confirmation.showRecoveryPinLockedPrompt(
3406
3433
  S,
3407
3434
  w
3408
3435
  ), n = 0, r = "Your account lock has been lifted. You may try again.";
3409
3436
  } else
3410
- c.warn(
3437
+ l.warn(
3411
3438
  `[CROSSx][Migration Phase 4] PIN 불일치 (시도 ${n}/${a})`
3412
3439
  ), r = "Incorrect PIN.";
3413
3440
  } catch (_) {
3414
3441
  if (!(_ instanceof h)) throw _;
3415
3442
  if (_.code === o.SESSION_EXPIRED) {
3416
- c.warn(
3443
+ l.warn(
3417
3444
  "[CROSSx][Migration Phase 4] 세션 만료 — 재로그인 후 PIN 입력 재시도"
3418
3445
  );
3419
- const p = M(this.deps.getLocale() ?? "en"), I = this.deps.getUserEmail();
3446
+ const p = M(this.deps.getLocale() ?? "en"), A = this.deps.getUserEmail();
3420
3447
  if (await this.deps.confirmation.showSessionAlert({
3421
3448
  title: p.session_alert_title,
3422
3449
  message: p.alert_session_expired,
3423
- email: I ? this.deps.maskEmail(I, p.session_alert_apple_account) : void 0
3450
+ email: A ? this.deps.maskEmail(A, p.session_alert_apple_account) : void 0
3424
3451
  }) === "signin-again" && (await this.deps.signInAgain()).success) {
3425
- c.log(
3452
+ l.log(
3426
3453
  "[CROSSx][Migration Phase 4] 재로그인 성공 — PIN 입력 루프 계속"
3427
3454
  ), n--;
3428
3455
  continue;
@@ -3432,46 +3459,46 @@ class qr {
3432
3459
  if (_.code === o.MIGRATION_PIN_LOCKED) {
3433
3460
  const p = _.details;
3434
3461
  if (a = (p == null ? void 0 : p.maxAttempts) ?? 5, (p == null ? void 0 : p.permanent) === !0)
3435
- return c.warn(
3462
+ return l.warn(
3436
3463
  "[CROSSx][Migration Phase 4] PIN 영구 잠금 (verify-recovery-pin)"
3437
3464
  ), await this.deps.confirmation.showRecoveryPinLockedPrompt(
3438
3465
  0,
3439
3466
  "Your account has been permanently locked due to too many failed attempts."
3440
3467
  ), null;
3441
- const I = ((p == null ? void 0 : p.lockExpiresAt) ?? 0) * 1e3, S = Math.max(
3468
+ const A = ((p == null ? void 0 : p.lockExpiresAt) ?? 0) * 1e3, S = Math.max(
3442
3469
  1,
3443
- Math.round((I - Date.now()) / 1e3)
3470
+ Math.round((A - Date.now()) / 1e3)
3444
3471
  ), w = S <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
3445
- c.warn(
3472
+ l.warn(
3446
3473
  `[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${S}초`
3447
3474
  ), await this.deps.confirmation.showRecoveryPinLockedPrompt(
3448
3475
  S,
3449
3476
  w
3450
3477
  ), n = 0, r = "Your account lock has been lifted. You may try again.";
3451
3478
  } else
3452
- throw c.error(
3479
+ throw l.error(
3453
3480
  "[CROSSx][Migration Phase 4] verify-recovery-pin 실패 (복구 불가):",
3454
3481
  _
3455
3482
  ), _;
3456
3483
  }
3457
3484
  }
3458
- c.log(
3485
+ l.log(
3459
3486
  "[CROSSx][Migration Phase 5] PIN 검증 완료 — 비밀번호 설정 및 마이그레이션 진행"
3460
3487
  );
3461
3488
  try {
3462
3489
  await this.deps.pinOrchestrator.ensurePinSetup();
3463
- const u = await this.deps.executeMigrate(l, e);
3464
- return c.log(
3490
+ const u = await this.deps.executeMigrate(c, e);
3491
+ return l.log(
3465
3492
  "[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:",
3466
3493
  u.address
3467
3494
  ), u;
3468
3495
  } catch (u) {
3469
3496
  if (u instanceof h && u.code === o.MIGRATION_FAILED)
3470
- return c.warn(
3497
+ return l.warn(
3471
3498
  "[CROSSx][Migration Phase 5] migrate PIN 불일치 (경합) — 처음부터 재시도"
3472
3499
  ), this.handleMigrationFlow(e);
3473
3500
  if (u instanceof h && u.code === o.SESSION_EXPIRED) {
3474
- c.warn(
3501
+ l.warn(
3475
3502
  "[CROSSx][Migration Phase 5] 세션 만료 — 재로그인 후 마이그레이션 재시도"
3476
3503
  );
3477
3504
  const _ = M(this.deps.getLocale() ?? "en"), p = this.deps.getUserEmail();
@@ -3480,20 +3507,20 @@ class qr {
3480
3507
  message: _.alert_session_expired,
3481
3508
  email: p ? this.deps.maskEmail(p, _.session_alert_apple_account) : void 0
3482
3509
  }) === "signin-again" && (await this.deps.signInAgain()).success) {
3483
- c.log(
3510
+ l.log(
3484
3511
  "[CROSSx][Migration Phase 5] 재로그인 성공 — 마이그레이션 재시도 (검증된 PIN 유지)"
3485
3512
  );
3486
3513
  try {
3487
3514
  const w = await this.deps.executeMigrate(
3488
- l,
3515
+ c,
3489
3516
  e
3490
3517
  );
3491
- return c.log(
3518
+ return l.log(
3492
3519
  "[CROSSx][Migration Phase 5] 마이그레이션 재시도 성공 — address:",
3493
3520
  w.address
3494
3521
  ), w;
3495
3522
  } catch (w) {
3496
- throw c.error(
3523
+ throw l.error(
3497
3524
  "[CROSSx][Migration Phase 5] 마이그레이션 재시도 실패:",
3498
3525
  w
3499
3526
  ), w;
@@ -3501,23 +3528,23 @@ class qr {
3501
3528
  }
3502
3529
  throw this.deps.clearAuthState(), u;
3503
3530
  }
3504
- throw c.error("[CROSSx][Migration Phase 5] 마이그레이션 실패 (복구 불가):", u), u;
3531
+ throw l.error("[CROSSx][Migration Phase 5] 마이그레이션 실패 (복구 불가):", u), u;
3505
3532
  }
3506
3533
  }
3507
3534
  }
3508
- class jr {
3535
+ class Qr {
3509
3536
  constructor(e) {
3510
3537
  this.deps = e;
3511
3538
  }
3512
3539
  async withResolvedGasAndFee(e, t) {
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
- if (!r && !n && !a && !l) return e;
3540
+ 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), c = !s(e.maxFeePerGas) && s(e.maxPriorityFeePerGas);
3541
+ if (!r && !n && !a && !c) return e;
3515
3542
  const d = { ...e }, g = r ? d.from ?? this.deps.getActiveAddress() ?? void 0 : void 0;
3516
- g && c.log(
3543
+ g && l.log(
3517
3544
  "[CROSSx] nonce 비어있음 → eth_getTransactionCount 호출 (from:",
3518
3545
  g,
3519
3546
  ")"
3520
- ), n && c.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), a && c.log(
3547
+ ), n && l.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), a && l.log(
3521
3548
  "[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별"
3522
3549
  );
3523
3550
  const [u, _, p] = await Promise.all([
@@ -3529,24 +3556,24 @@ class jr {
3529
3556
  n ? this.deps.estimateGas(e, t) : null,
3530
3557
  a ? this.deps.getBaseFeePerGas(t) : null
3531
3558
  ]);
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 I = p;
3534
- if (I) {
3559
+ if (g && (d.nonce = parseInt(u ?? "0x0", 16), l.log("[CROSSx] nonce 결과:", d.nonce)), n && (d.gasLimit = _, l.log("[CROSSx] estimateGas 결과:", d.gasLimit)), a) {
3560
+ const A = p;
3561
+ if (A) {
3535
3562
  const S = Je;
3536
- d.maxFeePerGas = `0x${(BigInt(I) + BigInt(S)).toString(16)}`, d.maxPriorityFeePerGas = S, c.log(
3563
+ d.maxFeePerGas = `0x${(BigInt(A) + BigInt(S)).toString(16)}`, d.maxPriorityFeePerGas = S, l.log(
3537
3564
  "[CROSSx] Dynamic 체인 감지 — baseFee:",
3538
- I,
3565
+ A,
3539
3566
  "maxFeePerGas:",
3540
3567
  d.maxFeePerGas,
3541
3568
  "maxPriorityFeePerGas: 1 Gwei"
3542
3569
  );
3543
3570
  } else
3544
- d.gasPrice = Qt, c.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
3571
+ d.gasPrice = Qt, l.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
3545
3572
  }
3546
- return !a && l && (d.maxPriorityFeePerGas = Je, c.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), d;
3573
+ return !a && c && (d.maxPriorityFeePerGas = Je, l.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), d;
3547
3574
  }
3548
3575
  }
3549
- class zr {
3576
+ class ei {
3550
3577
  constructor(e) {
3551
3578
  this.crypto = e;
3552
3579
  }
@@ -3558,24 +3585,24 @@ class zr {
3558
3585
  t
3559
3586
  );
3560
3587
  if (r.toLowerCase() !== s.toLowerCase())
3561
- throw c.error("[CROSSx] 서명 검증 실패: 서명자 주소 불일치", {
3588
+ throw l.error("[CROSSx] 서명 검증 실패: 서명자 주소 불일치", {
3562
3589
  expected: s,
3563
3590
  recovered: r
3564
3591
  }), new h(
3565
3592
  o.SIGNATURE_SIGNER_MISMATCH,
3566
3593
  `서명자 주소가 일치하지 않습니다: 예상 ${s}, 복원된 주소 ${r}`
3567
3594
  );
3568
- c.log("[CROSSx] 서명 ecrecover 검증 성공");
3595
+ l.log("[CROSSx] 서명 ecrecover 검증 성공");
3569
3596
  } catch (r) {
3570
3597
  if (r instanceof h) throw r;
3571
- c.warn("[CROSSx] ecrecover 검증 중 예외 (무시):", r);
3598
+ l.warn("[CROSSx] ecrecover 검증 중 예외 (무시):", r);
3572
3599
  }
3573
3600
  }
3574
3601
  }
3575
- function Jr(i) {
3602
+ function ti(i) {
3576
3603
  return i ? i.includes("google") ? "google" : i.includes("apple") ? "apple" : i : null;
3577
3604
  }
3578
- class Xr {
3605
+ class si {
3579
3606
  constructor(e) {
3580
3607
  this.deps = e;
3581
3608
  }
@@ -3589,7 +3616,7 @@ class Xr {
3589
3616
  });
3590
3617
  }
3591
3618
  applyAuthResult(e, t) {
3592
- var r, n, a, l, d;
3619
+ var r, n, a, c, d;
3593
3620
  const s = {
3594
3621
  authenticated: e.success,
3595
3622
  userId: ((r = e.user) == null ? void 0 : r.id) ?? null,
@@ -3597,8 +3624,8 @@ class Xr {
3597
3624
  activeWalletIndex: 0,
3598
3625
  userEmail: ((n = e.user) == null ? void 0 : n.email) ?? null,
3599
3626
  providerSub: ((a = e.user) == null ? void 0 : a.providerSub) ?? null,
3600
- loginType: Jr(
3601
- (l = e.user) == null ? void 0 : l.signInProvider
3627
+ loginType: ti(
3628
+ (c = e.user) == null ? void 0 : c.signInProvider
3602
3629
  ),
3603
3630
  tokenSignatureVerified: e.tokenSignatureVerified ?? !1
3604
3631
  };
@@ -3626,7 +3653,7 @@ class Xr {
3626
3653
  });
3627
3654
  }
3628
3655
  }
3629
- class Zr {
3656
+ class ri {
3630
3657
  constructor(e) {
3631
3658
  this.deps = e;
3632
3659
  }
@@ -3647,7 +3674,7 @@ class Zr {
3647
3674
  )).address, index: e };
3648
3675
  }
3649
3676
  }
3650
- class Qr {
3677
+ class ii {
3651
3678
  constructor(e) {
3652
3679
  this.deps = e;
3653
3680
  }
@@ -3666,7 +3693,7 @@ class Qr {
3666
3693
  );
3667
3694
  }
3668
3695
  }
3669
- class ei {
3696
+ class ni {
3670
3697
  constructor(e) {
3671
3698
  this.deps = e;
3672
3699
  }
@@ -3678,17 +3705,17 @@ class ei {
3678
3705
  o.AUTH_NOT_AUTHENTICATED,
3679
3706
  "사용자 ID를 찾을 수 없습니다"
3680
3707
  );
3681
- c.log("[CROSSx] createWallet 시작");
3708
+ l.log("[CROSSx] createWallet 시작");
3682
3709
  const t = await this.deps.walletLifecycleService.fetchWalletStatus();
3683
- if (c.log("[CROSSx] 지갑 상태:", t), t === "migration_required") {
3710
+ if (l.log("[CROSSx] 지갑 상태:", t), t === "migration_required") {
3684
3711
  const a = this.deps.getProviderSub() ?? e;
3685
- c.log(
3712
+ l.log(
3686
3713
  "[CROSSx] migration_required → 마이그레이션 UI 시작 — sub:",
3687
3714
  a
3688
3715
  );
3689
- const l = await this.deps.migrationOrchestrator.handleMigrationFlow(a);
3690
- if (l)
3691
- return this.deps.setActiveWallet(l.address, 0), { address: l.address };
3716
+ const c = await this.deps.migrationOrchestrator.handleMigrationFlow(a);
3717
+ if (c)
3718
+ return this.deps.setActiveWallet(c.address, 0), { address: c.address };
3692
3719
  throw new h(
3693
3720
  o.MIGRATION_FAILED,
3694
3721
  "사용자가 마이그레이션을 건너뛰었습니다"
@@ -3705,11 +3732,11 @@ class ei {
3705
3732
  const t = await this.deps.pinOrchestrator.withPinRetry(
3706
3733
  () => this.deps.walletProvider.getOrCreateWallet(e)
3707
3734
  );
3708
- return this.deps.setActiveWallet(t.address, 0), c.log("[CROSSx] 지갑 준비 완료:", t.address), { address: t.address, migrated: !1 };
3735
+ return this.deps.setActiveWallet(t.address, 0), l.log("[CROSSx] 지갑 준비 완료:", t.address), { address: t.address, migrated: !1 };
3709
3736
  } catch (t) {
3710
3737
  if (t instanceof h && t.code === o.MIGRATION_BACKUP_EXISTS) {
3711
3738
  const s = this.deps.getProviderSub() ?? e;
3712
- c.log(
3739
+ l.log(
3713
3740
  "[CROSSx] MIGRATION_BACKUP_EXISTS (폴백) → 마이그레이션 UI 시작"
3714
3741
  );
3715
3742
  const r = await this.deps.migrationOrchestrator.handleMigrationFlow(
@@ -3730,7 +3757,7 @@ function pt(i, e) {
3730
3757
  const t = i.replace(/\/$/, ""), s = e.startsWith("/") ? e : `/${e}`;
3731
3758
  return `${t}/cross-auth${s}`;
3732
3759
  }
3733
- class ti {
3760
+ class ai {
3734
3761
  constructor(e) {
3735
3762
  this.deps = e;
3736
3763
  }
@@ -3766,18 +3793,18 @@ class ti {
3766
3793
  o.TX_INVALID_PARAMS,
3767
3794
  "invalid param body"
3768
3795
  );
3769
- const n = this.deps.getApiBaseUrl(), a = pt(n, `/v2/token-historical/${e}/${r}`), l = { clientVersion: s };
3796
+ const n = this.deps.getApiBaseUrl(), a = pt(n, `/v2/token-historical/${e}/${r}`), c = { clientVersion: s };
3770
3797
  try {
3771
- c.log("[TokenHistory] Registering tx:", e, r);
3798
+ l.log("[TokenHistory] Registering tx:", e, r);
3772
3799
  const d = await this.deps.transport.request({
3773
3800
  url: a,
3774
3801
  method: "POST",
3775
3802
  headers: { "Content-Type": "application/json" },
3776
- body: l,
3803
+ body: c,
3777
3804
  retries: 0
3778
3805
  // POST는 재시도하지 않음
3779
3806
  });
3780
- d.status !== 200 && this.handleError(d.status, "register"), c.log("[TokenHistory] Successfully registered:", e, r);
3807
+ d.status !== 200 && this.handleError(d.status, "register"), l.log("[TokenHistory] Successfully registered:", e, r);
3781
3808
  } catch (d) {
3782
3809
  throw d instanceof h ? d : new h(
3783
3810
  o.UNKNOWN_ERROR,
@@ -3799,7 +3826,7 @@ class ti {
3799
3826
  const t = this.deps.getApiBaseUrl(), s = new URL(pt(t, "/v2/token-historical"));
3800
3827
  (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
3828
  try {
3802
- c.log("[TokenHistory] Fetching token history");
3829
+ l.log("[TokenHistory] Fetching token history");
3803
3830
  const n = await this.deps.transport.request({
3804
3831
  url: s.toString(),
3805
3832
  method: "GET",
@@ -3811,7 +3838,7 @@ class ti {
3811
3838
  o.UNKNOWN_ERROR,
3812
3839
  "Transaction not found (404) — please retry"
3813
3840
  );
3814
- return n.status !== 200 && this.handleError(n.status, "fetch"), c.log(
3841
+ return n.status !== 200 && this.handleError(n.status, "fetch"), l.log(
3815
3842
  "[TokenHistory] Successfully fetched history:",
3816
3843
  ((r = n.data.rows) == null ? void 0 : r.length) ?? 0,
3817
3844
  "items"
@@ -3836,14 +3863,14 @@ class ti {
3836
3863
  */
3837
3864
  async registerHistoryFireAndForget(e, t, s, r) {
3838
3865
  const n = (r == null ? void 0 : r.maxRetries) ?? 3, a = (r == null ? void 0 : r.retryDelayMs) ?? 2e3;
3839
- for (let l = 0; l < n; l++)
3866
+ for (let c = 0; c < n; c++)
3840
3867
  try {
3841
3868
  await this.registerTokenHistory(e, t, s);
3842
3869
  return;
3843
3870
  } catch (d) {
3844
- if (d instanceof h && d.message.includes("404") && l < n - 1) {
3845
- c.log(
3846
- `[TokenHistory] Retry ${l + 1}/${n} (404 - tx not yet indexed)`
3871
+ if (d instanceof h && d.message.includes("404") && c < n - 1) {
3872
+ l.log(
3873
+ `[TokenHistory] Retry ${c + 1}/${n} (404 - tx not yet indexed)`
3847
3874
  ), await new Promise((u) => setTimeout(u, a));
3848
3875
  continue;
3849
3876
  }
@@ -3878,10 +3905,19 @@ function ve(i, e = "Apple account") {
3878
3905
  const s = i.substring(0, t), r = i.substring(t);
3879
3906
  return s.length <= 1 ? `${s}${"*".repeat(Math.max(s.length, 1))}${r}` : `${s[0]}${"*".repeat(s.length - 1)}${r}`;
3880
3907
  }
3881
- const b = class b extends Cr {
3882
- constructor(e, t, s, r, n, a, l, d, g, u, _, p, I, S) {
3908
+ function oi(i) {
3909
+ const e = ce().oneWalletApiUrl;
3910
+ if (!e) return !1;
3911
+ try {
3912
+ return new URL(i).origin === new URL(e).origin;
3913
+ } catch {
3914
+ return !1;
3915
+ }
3916
+ }
3917
+ const U = class U extends Dr {
3918
+ constructor(e, t, s, r, n, a, c, d, g, u, _, p, A, S) {
3883
3919
  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({
3920
+ super(), this.storage = s, this.crypto = r, this.transport = n, this.oauth = a, this.walletProvider = c, this.tokenStore = d, this.pinEncryptor = p, this.oneIdAuth = A, this.oneIdSessionFactory = S, this._warnedUnknownNativeCurrency = /* @__PURE__ */ new Set(), this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._rnBridgeService = null, this._providers = /* @__PURE__ */ new Map(), this._isAuthenticatedViaRNBridge = !1, this._bridgeSessionRestorePromise = null, this._sdkDeprecationNotified = !1, this._sdkUnsupportedNotified = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = t, e.logger && st(e.logger), this.confirmation = g, this.pinStore = _ ?? new Ot(), this.stateManager = new si({
3885
3921
  setState: (f) => {
3886
3922
  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
3923
  },
@@ -3899,7 +3935,7 @@ const b = class b extends Cr {
3899
3935
  });
3900
3936
  },
3901
3937
  shouldPersistWalletPreference: () => this._config.persistWalletPreference !== !1,
3902
- walletPreferenceKey: b.WALLET_PREF_KEY,
3938
+ walletPreferenceKey: U.WALLET_PREF_KEY,
3903
3939
  storage: this.storage,
3904
3940
  pinStore: this.pinStore
3905
3941
  }), this.pinOrchestrator = new J({
@@ -3915,19 +3951,19 @@ const b = class b extends Cr {
3915
3951
  // WebView 안에서 embedded PIN 프롬프트가 뜨지 않도록 게이팅. SigningOrchestrator 와 동일 신호.
3916
3952
  isRNBridgeMode: () => this._isAuthenticatedViaRNBridge,
3917
3953
  getPinReusePolicy: () => this.internalConfig.pinReuse
3918
- }), this.signingOrchestrator = new Kr({
3954
+ }), this.signingOrchestrator = new jr({
3919
3955
  confirmation: this.confirmation,
3920
3956
  walletProvider: this.walletProvider,
3921
3957
  pinOrchestrator: this.pinOrchestrator,
3922
3958
  // §12 native sign delegation: 이 SDK 세션이 RN bridge 자동 로그인으로 인증된 경우만 활성.
3923
3959
  // 자동 로그인 거부 / OAuth 로 별도 로그인한 세션에서는 native SDK 가 미인증이라 우회한다.
3924
3960
  isRNBridgeMode: () => this._isAuthenticatedViaRNBridge
3925
- }), this.walletLifecycleService = new Yr({
3961
+ }), this.walletLifecycleService = new Xr({
3926
3962
  walletProvider: this.walletProvider,
3927
3963
  pinOrchestrator: this.pinOrchestrator,
3928
3964
  getUserId: () => this.userId,
3929
3965
  setActiveWallet: (f, E, T) => this.setActiveWallet(f, E, T)
3930
- }), this.migrationOrchestrator = new qr({
3966
+ }), this.migrationOrchestrator = new Zr({
3931
3967
  confirmation: this.confirmation,
3932
3968
  walletProvider: this.walletProvider,
3933
3969
  pinOrchestrator: this.pinOrchestrator,
@@ -3941,12 +3977,12 @@ const b = class b extends Cr {
3941
3977
  var f;
3942
3978
  return ((f = this._config.migration) == null ? void 0 : f.allowSkip) ?? !0;
3943
3979
  }
3944
- }), this.transactionLifecycleService = new jr({
3980
+ }), this.transactionLifecycleService = new Qr({
3945
3981
  getActiveAddress: () => this.address,
3946
3982
  estimateGas: (f, E) => this.estimateGas(f, E),
3947
3983
  getBaseFeePerGas: (f) => this.getBaseFeePerGas(f),
3948
3984
  jsonRpcCall: (f, E, T) => this.jsonRpc.call(f, E, T)
3949
- }), this.signatureVerifier = new zr(this.crypto), this.addressResolverService = new Zr({
3985
+ }), this.signatureVerifier = new ei(this.crypto), this.addressResolverService = new ri({
3950
3986
  walletProvider: this.walletProvider,
3951
3987
  pinOrchestrator: this.pinOrchestrator,
3952
3988
  getActiveAddress: () => this.address,
@@ -3954,10 +3990,10 @@ const b = class b extends Cr {
3954
3990
  getUserId: () => this.userId,
3955
3991
  // one-wallet: 지갑은 처음 쓸 때 만든다 (DEV2TF-2755)
3956
3992
  ensureWallet: this.usesOneWallet ? () => this.walletCreationService.createWallet().then((f) => f.address) : void 0
3957
- }), this.authGuardService = new Qr({
3993
+ }), this.authGuardService = new ii({
3958
3994
  isInitialized: () => this.initialized,
3959
3995
  isAuthenticated: () => this.authenticated
3960
- }), this.walletCreationService = new ei({
3996
+ }), this.walletCreationService = new ni({
3961
3997
  walletProvider: this.walletProvider,
3962
3998
  pinOrchestrator: this.pinOrchestrator,
3963
3999
  migrationOrchestrator: this.migrationOrchestrator,
@@ -3969,10 +4005,10 @@ const b = class b extends Cr {
3969
4005
  var f, E;
3970
4006
  return ((E = (f = this.confirmation).showWalletCreatedPrompt) == null ? void 0 : E.call(f)) ?? Promise.resolve();
3971
4007
  }
3972
- }), this.tokenHistoryService = new ti({
4008
+ }), this.tokenHistoryService = new ai({
3973
4009
  transport: n,
3974
4010
  getApiBaseUrl: () => this.internalConfig.authApiUrl
3975
- }), this.sessionOrchestrator = new $r({
4011
+ }), this.sessionOrchestrator = new Jr({
3976
4012
  ensureInitialized: () => this.ensureInitialized(),
3977
4013
  getSessionSnapshot: () => ({
3978
4014
  providerSub: this.providerSub,
@@ -3995,23 +4031,23 @@ const b = class b extends Cr {
3995
4031
  loadWalletAfterAuth: () => this.walletLifecycleService.loadWalletAfterAuth(),
3996
4032
  getLocale: () => this._config.locale,
3997
4033
  maskEmail: ve
3998
- }), this.chainRegistry = u, this.jsonRpc = new Pr(u, n), this.signInUseCase = new Ue(
4034
+ }), this.chainRegistry = u, this.jsonRpc = new Cr(u, n), this.signInUseCase = new Le(
3999
4035
  this.internalConfig,
4000
4036
  s,
4001
4037
  r,
4002
4038
  a,
4003
4039
  n,
4004
- l,
4040
+ c,
4005
4041
  d,
4006
4042
  void 0,
4007
4043
  () => this._config.locale
4008
- ), this.signOutUseCase = new Is(
4044
+ ), this.signOutUseCase = new As(
4009
4045
  this.internalConfig,
4010
4046
  s,
4011
4047
  d,
4012
- this._config.persistWalletPreference !== !1 ? [b.WALLET_PREF_KEY] : []
4013
- ), this.migrateWalletUseCase = new As(s, l), (w = l.setOnUnauthorized) == null || w.call(l, () => this.forceLogout()), (m = l.setTokenRefresher) == null || m.call(
4014
- l,
4048
+ this._config.persistWalletPreference !== !1 ? [U.WALLET_PREF_KEY] : []
4049
+ ), this.migrateWalletUseCase = new Is(s, c), (w = c.setOnUnauthorized) == null || w.call(c, () => this.forceLogout()), (m = c.setTokenRefresher) == null || m.call(
4050
+ c,
4015
4051
  () => this.signInUseCase.refreshAccessToken()
4016
4052
  ), e.autoDetectTheme && this._setupAutoDetectTheme();
4017
4053
  }
@@ -4022,7 +4058,7 @@ const b = class b extends Cr {
4022
4058
  handleSdkVersionDeprecation(e) {
4023
4059
  if (this._sdkDeprecationNotified) return;
4024
4060
  this._sdkDeprecationNotified = !0;
4025
- const t = _e;
4061
+ const t = fe;
4026
4062
  console.warn(
4027
4063
  `[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
4064
  ), this.emit("versionDeprecated", { version: t, sunset: e.sunset, infoUrl: e.infoUrl });
@@ -4034,9 +4070,9 @@ const b = class b extends Cr {
4034
4070
  */
4035
4071
  handleSdkVersionUnsupported(e) {
4036
4072
  this._sdkUnsupportedNotified || (this._sdkUnsupportedNotified = !0, console.error(
4037
- `[CROSSx] ${_e} is no longer supported by the wallet gateway. Update @nexus-cross/crossx-sdk-core.` + (e.message ? ` (${e.message})` : "")
4073
+ `[CROSSx] ${fe} is no longer supported by the wallet gateway. Update @nexus-cross/crossx-sdk-core.` + (e.message ? ` (${e.message})` : "")
4038
4074
  ), this.confirmation.showUpdateRequired().catch((t) => {
4039
- c.warn("[CROSSx] 업데이트 필요 모달 표시 실패:", t);
4075
+ l.warn("[CROSSx] 업데이트 필요 모달 표시 실패:", t);
4040
4076
  }));
4041
4077
  }
4042
4078
  /** @internal — adapter / orchestrator 가 native sign delegation 분기 시 참조 */
@@ -4059,11 +4095,11 @@ const b = class b extends Cr {
4059
4095
  */
4060
4096
  async clearRNBridgeDelegation(e) {
4061
4097
  if (this._isAuthenticatedViaRNBridge) {
4062
- this._isAuthenticatedViaRNBridge = !1, c.info("[CROSSx] RN Bridge native sign delegation 해제 —", e);
4098
+ this._isAuthenticatedViaRNBridge = !1, l.info("[CROSSx] RN Bridge native sign delegation 해제 —", e);
4063
4099
  try {
4064
4100
  await this.signInUseCase.clearStoredRNBridgeSession();
4065
4101
  } catch (t) {
4066
- c.warn("[CROSSx] 저장된 bridge 세션 마커 제거 실패", t);
4102
+ l.warn("[CROSSx] 저장된 bridge 세션 마커 제거 실패", t);
4067
4103
  }
4068
4104
  }
4069
4105
  }
@@ -4100,20 +4136,20 @@ const b = class b extends Cr {
4100
4136
  }
4101
4137
  async _doInitialize(e) {
4102
4138
  var t, s;
4103
- c.log("[CROSSx SDK] v3.0.0-beta.7 초기화 중..."), this.confirmation.setMessages(M(this._config.locale));
4139
+ l.log("[CROSSx SDK] v3.0.0-beta.8 초기화 중..."), this.confirmation.setMessages(M(this._config.locale));
4104
4140
  try {
4105
- const r = Se();
4141
+ const r = ce();
4106
4142
  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
4143
  const g = await this.restoreOneWalletSession();
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;
4144
+ return this.initialized = !0, l.info("[CROSSx SDK] v3.0.0-beta.8 초기화 완료 (one-wallet)"), this.emit("initialized", { restored: !!(g != null && g.success) }), g;
4109
4145
  }
4110
4146
  const n = this._config.persistWalletPreference !== !1 ? await this.storage.get(
4111
- b.WALLET_PREF_KEY
4147
+ U.WALLET_PREF_KEY
4112
4148
  ).catch(() => null) : null, a = (e == null ? void 0 : e.preferredWalletIndex) ?? (n == null ? void 0 : n.index);
4113
- let l = (e == null ? void 0 : e.preferredWalletAddress) ?? (n == null ? void 0 : n.address), d = await this.tryRNBridgeBootstrap();
4114
- if (this._rnBridgeWalletAddress && ((l == null ? void 0 : l.toLowerCase()) !== this._rnBridgeWalletAddress.toLowerCase() && c.log("[CROSSx] RN Bridge active wallet으로 preferredWalletAddress 갱신:", this._rnBridgeWalletAddress), l = this._rnBridgeWalletAddress), d || (d = await this.signInUseCase.restoreSession()), d != null && d.success) {
4149
+ let c = (e == null ? void 0 : e.preferredWalletAddress) ?? (n == null ? void 0 : n.address), d = await this.tryRNBridgeBootstrap();
4150
+ if (this._rnBridgeWalletAddress && ((c == null ? void 0 : c.toLowerCase()) !== this._rnBridgeWalletAddress.toLowerCase() && l.log("[CROSSx] RN Bridge active wallet으로 preferredWalletAddress 갱신:", this._rnBridgeWalletAddress), c = this._rnBridgeWalletAddress), d || (d = await this.signInUseCase.restoreSession()), d != null && d.success) {
4115
4151
  this.applyAuthResult(d);
4116
- const g = this.address && (!l || this.address.toLowerCase() === l.toLowerCase()), u = this._rnBridgeWalletName && l && this._rnBridgeWalletAddress && l.toLowerCase() === this._rnBridgeWalletAddress.toLowerCase() ? this._rnBridgeWalletName : void 0;
4152
+ const g = this.address && (!c || this.address.toLowerCase() === c.toLowerCase()), u = this._rnBridgeWalletName && c && this._rnBridgeWalletAddress && c.toLowerCase() === this._rnBridgeWalletAddress.toLowerCase() ? this._rnBridgeWalletName : void 0;
4117
4153
  if (g)
4118
4154
  this.address && this.setActiveWallet(
4119
4155
  this.address,
@@ -4123,14 +4159,14 @@ const b = class b extends Cr {
4123
4159
  else try {
4124
4160
  await this.loadWalletAfterAuth(
4125
4161
  a,
4126
- l,
4162
+ c,
4127
4163
  u
4128
4164
  );
4129
4165
  } catch (_) {
4130
4166
  if (_ instanceof h && _.code === o.PIN_CANCELLED)
4131
- c.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
4167
+ l.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
4132
4168
  else if (_ instanceof h && (_.code === o.SESSION_EXPIRED || _.code === o.AUTH_NOT_AUTHENTICATED || _.code === o.USER_NOT_FOUND))
4133
- c.warn(
4169
+ l.warn(
4134
4170
  "[CROSSx] initialize: 복원된 세션이 유효하지 않음 — 세션 정리 후 비로그인으로 계속",
4135
4171
  _.code
4136
4172
  ), this.clearAuthState(), await this.signOutUseCase.execute().catch(() => {
@@ -4139,7 +4175,7 @@ const b = class b extends Cr {
4139
4175
  throw _;
4140
4176
  }
4141
4177
  }
4142
- return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.7 초기화 완료"), this.emit("initialized", { restored: !!(d != null && d.success) }), d ?? null;
4178
+ return this.initialized = !0, l.info("[CROSSx SDK] v3.0.0-beta.8 초기화 완료"), this.emit("initialized", { restored: !!(d != null && d.success) }), d ?? null;
4143
4179
  } catch (r) {
4144
4180
  throw new h(o.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", r);
4145
4181
  }
@@ -4154,43 +4190,43 @@ const b = class b extends Cr {
4154
4190
  * → 사용자가 signIn() 을 호출할 때 bridge 로그인을 시도한다.
4155
4191
  */
4156
4192
  async tryRNBridgeBootstrap() {
4157
- if (!L.isAvailable()) return null;
4193
+ if (!b.isAvailable()) return null;
4158
4194
  try {
4159
- c.log("[CROSSx] RN Bridge 감지 — Handshake 시도"), c.info("[CROSSx][RNBridge trace] Bootstrap config", {
4195
+ l.log("[CROSSx] RN Bridge 감지 — Handshake 시도"), l.info("[CROSSx][RNBridge trace] Bootstrap config", {
4160
4196
  appId: this._config.projectId,
4161
4197
  appVersion: "1.0.0",
4162
- sdkVersion: "3.0.0-beta.7",
4198
+ sdkVersion: "3.0.0-beta.8",
4163
4199
  keyId: "key-id-1",
4164
4200
  userIdHash: "user-hash-placeholder",
4165
4201
  projectId: this._config.projectId
4166
4202
  });
4167
- const e = new L({
4203
+ const e = new b({
4168
4204
  appId: this._config.projectId,
4169
4205
  appVersion: "1.0.0",
4170
- sdkVersion: "3.0.0-beta.7",
4206
+ sdkVersion: "3.0.0-beta.8",
4171
4207
  keyId: "key-id-1",
4172
4208
  userIdHash: "user-hash-placeholder",
4173
4209
  projectId: this._config.projectId
4174
4210
  }), t = await e.initialize();
4175
- this._rnBridgeService = e, this._rnBridgeWalletAddress = t.walletAddress, this._rnBridgeWalletName = t.walletName, this._rnBridgeWalletProvider = t.walletProvider, this.subscribeBridgeWalletChanged(), c.info("[CROSSx] RN Bridge Handshake 성공", {
4211
+ this._rnBridgeService = e, this._rnBridgeWalletAddress = t.walletAddress, this._rnBridgeWalletName = t.walletName, this._rnBridgeWalletProvider = t.walletProvider, this.subscribeBridgeWalletChanged(), l.info("[CROSSx] RN Bridge Handshake 성공", {
4176
4212
  walletAddress: t.walletAddress ?? "(없음)",
4177
4213
  walletName: t.walletName ?? "(없음)"
4178
4214
  });
4179
4215
  const s = await this.signInUseCase.hasStoredRNBridgeSession();
4180
- if (s && (this._isAuthenticatedViaRNBridge = !0, c.log("[CROSSx] 저장된 RN Bridge 세션 마커 감지 — native sign delegation 활성")), await this.signInUseCase.hasValidStoredAccessToken())
4216
+ if (s && (this._isAuthenticatedViaRNBridge = !0, l.log("[CROSSx] 저장된 RN Bridge 세션 마커 감지 — native sign delegation 활성")), await this.signInUseCase.hasValidStoredAccessToken())
4181
4217
  return null;
4182
4218
  if (s) {
4183
4219
  const r = await this._tryBridgeSessionRestore();
4184
4220
  if (r != null && r.success) return r;
4185
4221
  }
4186
- return c.log("[CROSSx] RN Bridge 준비 완료 — 사용자 로그인 대기"), null;
4222
+ return l.log("[CROSSx] RN Bridge 준비 완료 — 사용자 로그인 대기"), null;
4187
4223
  } catch (e) {
4188
- return c.info("[CROSSx][RNBridge trace] Bootstrap failed detail", {
4224
+ return l.info("[CROSSx][RNBridge trace] Bootstrap failed detail", {
4189
4225
  name: e instanceof Error ? e.name : typeof e,
4190
4226
  message: e instanceof Error ? e.message : String(e),
4191
4227
  stack: e instanceof Error ? e.stack : void 0,
4192
4228
  cause: e instanceof Error ? e.cause : void 0
4193
- }), c.warn("[CROSSx] RN Bridge handshake 실패", e), null;
4229
+ }), l.warn("[CROSSx] RN Bridge handshake 실패", e), null;
4194
4230
  }
4195
4231
  }
4196
4232
  /**
@@ -4209,7 +4245,7 @@ const b = class b extends Cr {
4209
4245
  if (!this._rnBridgeService) return null;
4210
4246
  if (!this._rnBridgeService.isActive()) {
4211
4247
  const t = this._rnBridgeService.getContext(), s = Date.now();
4212
- c.info("[CROSSx] Bridge 세션 만료 감지 — 재핸드셰이크 시도", {
4248
+ l.info("[CROSSx] Bridge 세션 만료 감지 — 재핸드셰이크 시도", {
4213
4249
  elapsedSinceActivatedMs: t ? s - t.activatedAt : "(context 없음)",
4214
4250
  idleMs: t ? s - t.lastActivityAt : "(context 없음)",
4215
4251
  absoluteTtlMs: (t == null ? void 0 : t.absoluteTtlMs) ?? "(context 없음)",
@@ -4219,7 +4255,7 @@ const b = class b extends Cr {
4219
4255
  });
4220
4256
  try {
4221
4257
  const r = Date.now(), n = await this._rnBridgeService.initialize();
4222
- this._rnBridgeWalletAddress = n.walletAddress, this._rnBridgeWalletName = n.walletName, this._rnBridgeWalletProvider = n.walletProvider, c.info("[CROSSx] Bridge 재핸드셰이크 성공 — bridge 로그인 계속 진행", {
4258
+ this._rnBridgeWalletAddress = n.walletAddress, this._rnBridgeWalletName = n.walletName, this._rnBridgeWalletProvider = n.walletProvider, l.info("[CROSSx] Bridge 재핸드셰이크 성공 — bridge 로그인 계속 진행", {
4223
4259
  tookMs: Date.now() - r,
4224
4260
  walletAddress: n.walletAddress ?? "(없음)",
4225
4261
  walletName: n.walletName ?? "(없음)",
@@ -4227,20 +4263,20 @@ const b = class b extends Cr {
4227
4263
  idleTtlMs: n.idleTtlMs
4228
4264
  });
4229
4265
  } catch (r) {
4230
- return c.warn("[CROSSx] Bridge 재핸드셰이크 실패 — bridge 비활성화 후 OAuth fallback", r), this._rnBridgeService = null, null;
4266
+ return l.warn("[CROSSx] Bridge 재핸드셰이크 실패 — bridge 비활성화 후 OAuth fallback", r), this._rnBridgeService = null, null;
4231
4267
  }
4232
4268
  }
4233
4269
  try {
4234
4270
  const t = await this._rnBridgeService.requestFirebaseIdToken();
4235
- c.log("[CROSSx] Bridge 로그인 — Firebase token 수신");
4271
+ l.log("[CROSSx] Bridge 로그인 — Firebase token 수신");
4236
4272
  const s = await this.signInUseCase.executeWithNativeFirebaseIdToken(t);
4237
4273
  return s.success ? (this._isAuthenticatedViaRNBridge = !0, this.applyAuthResult(s), await this.loadWalletAfterAuth(
4238
4274
  void 0,
4239
4275
  this._rnBridgeWalletAddress,
4240
4276
  this._rnBridgeWalletName
4241
- ), c.log("[CROSSx] Bridge 로그인 성공", { userId: (e = s.user) == null ? void 0 : e.id }), s) : null;
4277
+ ), l.log("[CROSSx] Bridge 로그인 성공", { userId: (e = s.user) == null ? void 0 : e.id }), s) : null;
4242
4278
  } catch (t) {
4243
- return t instanceof h && t.code === o.USER_REJECTED ? (await this.clearRNBridgeDelegation("사용자가 자동 로그인을 취소"), c.log("[CROSSx] Bridge 로그인 거부 — OAuth fallback 진행 (bridge 유지)"), null) : t instanceof h && t.code === o.SESSION_EXPIRED ? (c.warn("[CROSSx] Bridge 세션 만료 — OAuth fallback 진행"), null) : (c.warn("[CROSSx] Bridge 로그인 타임아웃/실패", t), !1);
4279
+ return t instanceof h && t.code === o.USER_REJECTED ? (await this.clearRNBridgeDelegation("사용자가 자동 로그인을 취소"), l.log("[CROSSx] Bridge 로그인 거부 — OAuth fallback 진행 (bridge 유지)"), null) : t instanceof h && t.code === o.SESSION_EXPIRED ? (l.warn("[CROSSx] Bridge 세션 만료 — OAuth fallback 진행"), null) : (l.warn("[CROSSx] Bridge 로그인 타임아웃/실패", t), !1);
4244
4280
  }
4245
4281
  }
4246
4282
  /**
@@ -4257,11 +4293,11 @@ const b = class b extends Cr {
4257
4293
  if (!await this.signInUseCase.hasStoredRNBridgeSession()) return null;
4258
4294
  if (await this.signInUseCase.hasValidStoredAccessToken())
4259
4295
  return this._isAuthenticatedViaRNBridge = !0, null;
4260
- c.log("[CROSSx] RN Bridge 세션 복원 시도 — native Connect 승인 이력 확인");
4296
+ l.log("[CROSSx] RN Bridge 세션 복원 시도 — native Connect 승인 이력 확인");
4261
4297
  const t = await this._rnBridgeService.requestFirebaseIdTokenForSessionRestore(), s = await this.signInUseCase.executeWithNativeFirebaseIdToken(t);
4262
- return s.success ? (this._isAuthenticatedViaRNBridge = !0, c.log("[CROSSx] RN Bridge 세션 복원 성공", { userId: (e = s.user) == null ? void 0 : e.id }), s) : (this._isAuthenticatedViaRNBridge = !1, c.warn("[CROSSx] RN Bridge 세션 복원 실패:", s.error), null);
4298
+ return s.success ? (this._isAuthenticatedViaRNBridge = !0, l.log("[CROSSx] RN Bridge 세션 복원 성공", { userId: (e = s.user) == null ? void 0 : e.id }), s) : (this._isAuthenticatedViaRNBridge = !1, l.warn("[CROSSx] RN Bridge 세션 복원 실패:", s.error), null);
4263
4299
  } catch (t) {
4264
- return this._isAuthenticatedViaRNBridge = !1, c.warn("[CROSSx] RN Bridge 세션 복원 불가 — 비로그인 상태 유지", t), null;
4300
+ return this._isAuthenticatedViaRNBridge = !1, l.warn("[CROSSx] RN Bridge 세션 복원 불가 — 비로그인 상태 유지", t), null;
4265
4301
  } finally {
4266
4302
  this._bridgeSessionRestorePromise = null;
4267
4303
  }
@@ -4280,7 +4316,7 @@ const b = class b extends Cr {
4280
4316
  try {
4281
4317
  return await this._rnBridgeService.requestFirebaseIdTokenForSessionRestore();
4282
4318
  } catch (e) {
4283
- throw c.error("[CROSSx] Bridge session restore token request failed:", e), new h(
4319
+ throw l.error("[CROSSx] Bridge session restore token request failed:", e), new h(
4284
4320
  o.RN_NATIVE_SESSION_EXPIRED,
4285
4321
  "Native session expired. Please sign in again in the app.",
4286
4322
  e
@@ -4292,7 +4328,7 @@ const b = class b extends Cr {
4292
4328
  * @internal
4293
4329
  */
4294
4330
  getRNBridge() {
4295
- return L.getBridge();
4331
+ return b.getBridge();
4296
4332
  }
4297
4333
  async signIn(e) {
4298
4334
  if (this.ensureInitialized(), this.authenticated)
@@ -4302,7 +4338,7 @@ const b = class b extends Cr {
4302
4338
  );
4303
4339
  if (this.usesOneWallet) return this.signInWithOneIdSelector();
4304
4340
  const t = !!(e != null && e.provider) && !!this._rnBridgeWalletProvider && e.provider !== this._rnBridgeWalletProvider;
4305
- if (t && c.log(
4341
+ if (t && l.log(
4306
4342
  `[CROSSx] 선택한 provider(${e == null ? void 0 : e.provider})가 bridge 연결 provider(${this._rnBridgeWalletProvider})와 불일치 — bridge 건너뛰고 OAuth 진행`
4307
4343
  ), this._rnBridgeService && !t) {
4308
4344
  const r = await this._tryBridgeSignIn();
@@ -4358,19 +4394,19 @@ const b = class b extends Cr {
4358
4394
  try {
4359
4395
  return { ...r, addresses: await this.getAddresses() };
4360
4396
  } catch (n) {
4361
- return c.warn("[CROSSx] one-wallet signInWithCreate: 주소 목록 조회 실패 — 지갑 주소로 대신", n), { ...r, addresses: [{ address: r.address, index: 0 }] };
4397
+ return l.warn("[CROSSx] one-wallet signInWithCreate: 주소 목록 조회 실패 — 지갑 주소로 대신", n), { ...r, addresses: [{ address: r.address, index: 0 }] };
4362
4398
  }
4363
4399
  }
4364
4400
  try {
4365
4401
  if (r.needsMigration || !r.address) {
4366
- const { address: l } = await this.createWallet(), d = await this.getAddresses(), g = await this.selectWalletIfMultiple(d, t);
4367
- return { ...r, address: (g == null ? void 0 : g.address) ?? l, needsMigration: !1, addresses: d };
4402
+ const { address: c } = await this.createWallet(), d = await this.getAddresses(), g = await this.selectWalletIfMultiple(d, t);
4403
+ return { ...r, address: (g == null ? void 0 : g.address) ?? c, needsMigration: !1, addresses: d };
4368
4404
  }
4369
4405
  const n = await this.getAddresses(), a = await this.selectWalletIfMultiple(n, t);
4370
4406
  return { ...r, address: (a == null ? void 0 : a.address) ?? r.address, addresses: n };
4371
4407
  } catch (n) {
4372
- throw n instanceof h && (n.code === o.PIN_CANCELLED || n.code === o.UI_NOT_PROVIDED) && (c.log("[CROSSx] signInWithCreate: 비밀번호 설정 취소 또는 화면 없음 — 자동 로그아웃 진행"), await this.signOut().catch(
4373
- (a) => c.warn("[CROSSx] signInWithCreate: 자동 로그아웃 실패", a)
4408
+ throw n instanceof h && (n.code === o.PIN_CANCELLED || n.code === o.UI_NOT_PROVIDED) && (l.log("[CROSSx] signInWithCreate: 비밀번호 설정 취소 또는 화면 없음 — 자동 로그아웃 진행"), await this.signOut().catch(
4409
+ (a) => l.warn("[CROSSx] signInWithCreate: 자동 로그아웃 실패", a)
4374
4410
  )), n;
4375
4411
  }
4376
4412
  }
@@ -4416,14 +4452,14 @@ const b = class b extends Cr {
4416
4452
  if (!t.success) return { ...t, addresses: [] };
4417
4453
  try {
4418
4454
  if (t.needsMigration || !t.address) {
4419
- const { address: l } = await this.createWallet(), d = await this.getAddresses(), g = await this.selectWalletIfMultiple(d);
4420
- return { ...t, address: (g == null ? void 0 : g.address) ?? l, needsMigration: !1, addresses: d };
4455
+ const { address: c } = await this.createWallet(), d = await this.getAddresses(), g = await this.selectWalletIfMultiple(d);
4456
+ return { ...t, address: (g == null ? void 0 : g.address) ?? c, needsMigration: !1, addresses: d };
4421
4457
  }
4422
4458
  const n = await this.getAddresses(), a = await this.selectWalletIfMultiple(n);
4423
4459
  return { ...t, address: (a == null ? void 0 : a.address) ?? t.address, addresses: n };
4424
4460
  } catch (n) {
4425
- throw n instanceof h && (n.code === o.PIN_CANCELLED || n.code === o.UI_NOT_PROVIDED) && (c.log("[CROSSx] signInWithOAuthToken: 비밀번호 설정 취소 또는 화면 없음 — 자동 로그아웃 진행"), await this.signOut().catch(
4426
- (a) => c.warn("[CROSSx] signInWithOAuthToken: 자동 로그아웃 실패", a)
4461
+ throw n instanceof h && (n.code === o.PIN_CANCELLED || n.code === o.UI_NOT_PROVIDED) && (l.log("[CROSSx] signInWithOAuthToken: 비밀번호 설정 취소 또는 화면 없음 — 자동 로그아웃 진행"), await this.signOut().catch(
4462
+ (a) => l.warn("[CROSSx] signInWithOAuthToken: 자동 로그아웃 실패", a)
4427
4463
  )), n;
4428
4464
  }
4429
4465
  }
@@ -4479,7 +4515,7 @@ const b = class b extends Cr {
4479
4515
  * - `NETWORK_ERROR`
4480
4516
  */
4481
4517
  signInWithOneId(e) {
4482
- var a, l;
4518
+ var a, c;
4483
4519
  let t;
4484
4520
  try {
4485
4521
  t = this.oneIdContext();
@@ -4490,7 +4526,7 @@ const b = class b extends Cr {
4490
4526
  return s.authorize({
4491
4527
  ...r,
4492
4528
  mode: (e == null ? void 0 : e.mode) ?? ((a = this._config.oneId) == null ? void 0 : a.mode) ?? "auto",
4493
- redirectUri: (l = this._config.oneId) == null ? void 0 : l.redirectUri,
4529
+ redirectUri: (c = this._config.oneId) == null ? void 0 : c.redirectUri,
4494
4530
  returnTo: e == null ? void 0 : e.returnTo
4495
4531
  }).then(async (d) => {
4496
4532
  if (d.status === "redirecting") return d;
@@ -4508,8 +4544,8 @@ const b = class b extends Cr {
4508
4544
  * @throws `CROSSxError` — {@link signInWithOneId}와 같은 코드
4509
4545
  */
4510
4546
  async completeOneIdSignIn(e = window.location.href) {
4511
- const { port: t, config: s, sessions: r } = this.oneIdContext(), { tokens: n, returnTo: a } = await t.completeRedirect(s, e), l = r.save(n);
4512
- return this.usesOneWallet && await this.applyOneIdSession(l), { session: l, returnTo: a };
4547
+ const { port: t, config: s, sessions: r } = this.oneIdContext(), { tokens: n, returnTo: a } = await t.completeRedirect(s, e), c = r.save(n);
4548
+ return this.usesOneWallet && await this.applyOneIdSession(c), { session: c, returnTo: a };
4513
4549
  }
4514
4550
  /**
4515
4551
  * 보관한 ONE ID 세션을 돌려줍니다. access token이 끝나 가면 갱신합니다. 없으면 `null`.
@@ -4531,7 +4567,25 @@ const b = class b extends Cr {
4531
4567
  try {
4532
4568
  return await e.sessions.getAccessToken();
4533
4569
  } catch (t) {
4534
- throw this.usesOneWallet && he(t) && this.clearAuthState(), t;
4570
+ throw this.usesOneWallet && te(t) && this.clearAuthState(), t;
4571
+ }
4572
+ }
4573
+ /**
4574
+ * 리소스 서버(one-wallet-api) 요청에 붙일 ONE ID 인증 헤더를 돌려줍니다 (DEV2TF-2950). 민감값이므로 로그에 남기지 마세요.
4575
+ * 기본은 `Authorization: Bearer <access token>`, DPoP 에 묶인 세션이면 `Authorization: DPoP <access token>` + `DPoP` 증명입니다.
4576
+ * 지갑 서버(`oneWalletApiUrl`) origin 의 주소에만 만들어 줍니다 — 토큰 · 증명을 다른 곳에 내보내지 않게 (리뷰 F-4).
4577
+ * @internal 지갑 SDK 의 지갑 서버 클라이언트(factory)가 쓴다. 서비스 코드에서 부르지 마세요.
4578
+ * @throws `ORIGIN_NOT_ALLOWED` 지갑 서버가 아닌 주소, 그 밖은 {@link getOneIdAccessToken}과 같음
4579
+ */
4580
+ async getOneIdAuthorizationHeaders(e) {
4581
+ if (!oi(e.url))
4582
+ throw new h(o.ORIGIN_NOT_ALLOWED, "authorization headers are only issued for the one-wallet-api origin");
4583
+ const t = this.usesOneWallet && this._initPromise ? this.oneIdContextUnchecked() : this.oneIdContext();
4584
+ try {
4585
+ const { sessions: s } = t;
4586
+ return s.getAuthorizationHeaders ? await s.getAuthorizationHeaders(e) : { Authorization: `Bearer ${await s.getAccessToken()}` };
4587
+ } catch (s) {
4588
+ throw this.usesOneWallet && te(s) && this.clearAuthState(), s;
4535
4589
  }
4536
4590
  }
4537
4591
  /**
@@ -4539,7 +4593,7 @@ const b = class b extends Cr {
4539
4593
  */
4540
4594
  async signOutOneId() {
4541
4595
  const { sessions: e } = this.oneIdContext();
4542
- this.walletProvider instanceof Me && await this.walletProvider.signOut().catch((t) => c.warn("[CROSSx] B 키 폐기 실패 (로그아웃은 진행)", t));
4596
+ this.walletProvider instanceof Me && await this.walletProvider.signOut().catch((t) => l.warn("[CROSSx] B 키 폐기 실패 (로그아웃은 진행)", t));
4543
4597
  try {
4544
4598
  await e.signOut();
4545
4599
  } finally {
@@ -4576,12 +4630,12 @@ const b = class b extends Cr {
4576
4630
  * 보관한 ONE ID 세션이 있으면 그것으로 로그인 상태를 만든다.
4577
4631
  */
4578
4632
  async restoreOneWalletSession() {
4579
- await this.signOutUseCase.hasStoredSession().catch(() => !1) && (c.log("[CROSSx] one-wallet: 저장된 2.x 로그인 토큰을 무시하고 지운다"), await this.signOutUseCase.execute().catch((t) => c.warn("[CROSSx] 2.x 토큰 정리 실패", t)));
4633
+ await this.signOutUseCase.hasStoredSession().catch(() => !1) && (l.log("[CROSSx] one-wallet: 저장된 2.x 로그인 토큰을 무시하고 지운다"), await this.signOutUseCase.execute().catch((t) => l.warn("[CROSSx] 2.x 토큰 정리 실패", t)));
4580
4634
  let e;
4581
4635
  try {
4582
4636
  e = await this.oneIdContextUnchecked().sessions.get();
4583
4637
  } catch (t) {
4584
- return c.warn("[CROSSx] one-wallet: ONE ID 세션 복원 실패 — 로그아웃 상태로 시작", t), null;
4638
+ return l.warn("[CROSSx] one-wallet: ONE ID 세션 복원 실패 — 로그아웃 상태로 시작", t), null;
4585
4639
  }
4586
4640
  return e ? this.applyOneIdSession(e) : null;
4587
4641
  }
@@ -4591,9 +4645,9 @@ const b = class b extends Cr {
4591
4645
  let t;
4592
4646
  try {
4593
4647
  await ((a = (n = this.walletProvider).checkWallet) == null ? void 0 : a.call(n)) === "exists" && (t = (await this.walletProvider.getOrCreateWallet(e.subject)).address);
4594
- } catch (l) {
4595
- if (he(l)) throw l;
4596
- c.warn("[CROSSx] one-wallet: 지갑 조회 실패 — 주소 없이 로그인 상태로 둔다", l);
4648
+ } catch (c) {
4649
+ if (te(c)) throw c;
4650
+ l.warn("[CROSSx] one-wallet: 지갑 조회 실패 — 주소 없이 로그인 상태로 둔다", c);
4597
4651
  }
4598
4652
  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 } };
4599
4653
  return this.applyAuthResult(r), s && this.setActiveWallet(s.address, s.index), r;
@@ -4606,14 +4660,14 @@ const b = class b extends Cr {
4606
4660
  async preferredOneWallet(e, t) {
4607
4661
  const s = { address: t, index: 0 };
4608
4662
  if (this._config.persistWalletPreference === !1) return s;
4609
- const r = await this.storage.get(b.WALLET_PREF_KEY).catch(() => null);
4663
+ const r = await this.storage.get(U.WALLET_PREF_KEY).catch(() => null);
4610
4664
  if (typeof (r == null ? void 0 : r.address) != "string" || r.address.toLowerCase() === t.toLowerCase()) return s;
4611
4665
  try {
4612
- const a = (await this.walletProvider.getAddresses(e)).find((l) => l.address.toLowerCase() === r.address.toLowerCase());
4666
+ const a = (await this.walletProvider.getAddresses(e)).find((c) => c.address.toLowerCase() === r.address.toLowerCase());
4613
4667
  return a ? { address: a.address, index: a.index } : s;
4614
4668
  } catch (n) {
4615
- if (he(n)) throw n;
4616
- return c.warn("[CROSSx] one-wallet: 선호 지갑 확인 실패 — 첫 지갑을 쓴다", n), s;
4669
+ if (te(n)) throw n;
4670
+ return l.warn("[CROSSx] one-wallet: 선호 지갑 확인 실패 — 첫 지갑을 쓴다", n), s;
4617
4671
  }
4618
4672
  }
4619
4673
  oneIdContext() {
@@ -4627,7 +4681,7 @@ const b = class b extends Cr {
4627
4681
  o.NOT_IMPLEMENTED,
4628
4682
  "이 환경에서는 ONE ID 로그인을 사용할 수 없습니다 (SDKConfig.oneId 필요)"
4629
4683
  );
4630
- const t = e.issuer || Se().oneIdIssuer;
4684
+ const t = e.issuer || ce().oneIdIssuer;
4631
4685
  if (!t)
4632
4686
  throw new h(
4633
4687
  o.NOT_IMPLEMENTED,
@@ -4657,7 +4711,7 @@ const b = class b extends Cr {
4657
4711
  try {
4658
4712
  s = await t.get();
4659
4713
  } catch (r) {
4660
- throw he(r) && this.clearAuthState(), r;
4714
+ throw te(r) && this.clearAuthState(), r;
4661
4715
  }
4662
4716
  return !s || !s.subject ? (this.authenticated && this.clearAuthState(), null) : (this.authenticated && this.currentUserId !== s.subject && this.clearAuthState(), this.applyOneIdSession(s));
4663
4717
  }
@@ -4668,12 +4722,12 @@ const b = class b extends Cr {
4668
4722
  }
4669
4723
  try {
4670
4724
  await this.signOutUseCase.execute(), this.clearAuthState();
4671
- const e = L.getBridge();
4725
+ const e = b.getBridge();
4672
4726
  if (e != null && e.signOut)
4673
4727
  try {
4674
- await e.signOut(), c.log("[CROSSx] RN Bridge signOut 통보 완료 — native trust cache 무효화");
4728
+ await e.signOut(), l.log("[CROSSx] RN Bridge signOut 통보 완료 — native trust cache 무효화");
4675
4729
  } catch (t) {
4676
- c.warn("[CROSSx] RN Bridge signOut 통보 실패 (로그아웃 자체는 정상)", t);
4730
+ l.warn("[CROSSx] RN Bridge signOut 통보 실패 (로그아웃 자체는 정상)", t);
4677
4731
  }
4678
4732
  } catch (e) {
4679
4733
  throw new h(o.UNKNOWN_ERROR, "로그아웃에 실패했습니다", e);
@@ -4759,7 +4813,7 @@ const b = class b extends Cr {
4759
4813
  this._rnBridgeWalletName
4760
4814
  );
4761
4815
  } catch (s) {
4762
- s instanceof h && s.code === o.PIN_CANCELLED || c.warn("[CROSSx] ensureLoggedIn: bridge loadWalletAfterAuth 실패:", s);
4816
+ s instanceof h && s.code === o.PIN_CANCELLED || l.warn("[CROSSx] ensureLoggedIn: bridge loadWalletAfterAuth 실패:", s);
4763
4817
  }
4764
4818
  return !0;
4765
4819
  }
@@ -4769,7 +4823,7 @@ const b = class b extends Cr {
4769
4823
  try {
4770
4824
  await this.loadWalletAfterAuth();
4771
4825
  } catch (s) {
4772
- s instanceof h && s.code === o.PIN_CANCELLED || c.warn("[CROSSx] ensureLoggedIn: loadWalletAfterAuth 실패:", s);
4826
+ s instanceof h && s.code === o.PIN_CANCELLED || l.warn("[CROSSx] ensureLoggedIn: loadWalletAfterAuth 실패:", s);
4773
4827
  }
4774
4828
  return !0;
4775
4829
  }
@@ -4819,7 +4873,7 @@ const b = class b extends Cr {
4819
4873
  throw new h(o.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
4820
4874
  try {
4821
4875
  const t = await this.migrateWalletUseCase.execute(e, this.userId);
4822
- return this.setActiveWallet(t.address, 0), c.log("[CROSSx] migrateWallet 완료 — address:", t.address), t;
4876
+ return this.setActiveWallet(t.address, 0), l.log("[CROSSx] migrateWallet 완료 — address:", t.address), t;
4823
4877
  } catch (t) {
4824
4878
  throw t instanceof h ? t : new h(
4825
4879
  o.MIGRATION_FAILED,
@@ -4901,12 +4955,12 @@ const b = class b extends Cr {
4901
4955
  this.pinOrchestrator.prepareForSigning({ action: "sign-message", context: {} });
4902
4956
  try {
4903
4957
  await this.pinOrchestrator.ensurePinForSigning();
4904
- const n = s.length, l = { address: (await this.pinOrchestrator.withPinRetry(
4958
+ const n = s.length, c = { address: (await this.pinOrchestrator.withPinRetry(
4905
4959
  () => this.withSessionRecovery(
4906
4960
  () => this.walletProvider.getAddress(this.userId, n)
4907
4961
  )
4908
4962
  )).address, index: n };
4909
- return s.push(l), l;
4963
+ return s.push(c), c;
4910
4964
  } finally {
4911
4965
  this.pinOrchestrator.finishSigning();
4912
4966
  }
@@ -4933,6 +4987,32 @@ const b = class b extends Cr {
4933
4987
  throw new h(o.WALLET_NOT_FOUND, "이 계정의 지갑이 아닙니다");
4934
4988
  return (((r = this.address) == null ? void 0 : r.toLowerCase()) !== s.address.toLowerCase() || this.activeWalletIndex !== s.index) && this.setActiveWallet(s.address, s.index), s;
4935
4989
  }
4990
+ /**
4991
+ * 지갑(주소) 이름을 바꿉니다. PIN 은 필요 없습니다 (GASPQA-6803). 지금은 one-wallet 지갑 서버에서만 됩니다.
4992
+ * 바뀐 이름은 `getAddresses()` 의 `name` 으로 내려옵니다.
4993
+ *
4994
+ * @param address 이 계정의 지갑 주소 (대소문자 무시)
4995
+ * @param name 앞뒤 공백을 뺀 4~24자, 유니코드 문자 · 숫자 · 스페이스 · `_ - . , ( ) [ ] @ # % ^ * ~ / : + = ! ?`
4996
+ * @returns 바꾼 지갑 `{ address, index, name }`
4997
+ * @throws `WALLET_NAME_INVALID` 이름 규칙 위반 · `WALLET_NOT_FOUND` 목록에 없는 주소 ·
4998
+ * `WALLET_OPERATION_UNSUPPORTED` 이 지갑 서버는 이름 변경을 지원하지 않음
4999
+ */
5000
+ async renameWallet(e, t) {
5001
+ if (this.ensureAuthenticated(), !this.userId)
5002
+ throw new h(o.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
5003
+ const s = this.walletProvider;
5004
+ if (typeof s.setAddressNames != "function")
5005
+ throw new h(o.WALLET_OPERATION_UNSUPPORTED, "이 지갑 서버는 지갑 이름 변경을 지원하지 않습니다");
5006
+ const r = Hr(t);
5007
+ if (r === null)
5008
+ throw new h(o.WALLET_NAME_INVALID, "지갑 이름 규칙에 맞지 않습니다");
5009
+ const a = (await this.withSessionRecovery(() => s.getAddresses(this.userId))).find((c) => c.address.toLowerCase() === e.toLowerCase());
5010
+ if (!a)
5011
+ throw new h(o.WALLET_NOT_FOUND, "이 계정의 지갑이 아닙니다");
5012
+ return await this.withSessionRecovery(
5013
+ () => s.setAddressNames(this.userId, [{ address: a.address, name: r }])
5014
+ ), { address: a.address, index: a.index, name: r };
5015
+ }
4936
5016
  /**
4937
5017
  * 지갑이 2개 이상이면 selectWallet()을 호출합니다.
4938
5018
  * selectWallet() 내부에서 this.address 설정 및 addressChanged 이벤트를 처리합니다.
@@ -4947,14 +5027,14 @@ const b = class b extends Cr {
4947
5027
  */
4948
5028
  async selectWalletIfMultiple(e, t) {
4949
5029
  if (e.length < 2) return null;
4950
- const s = this._isAuthenticatedViaRNBridge ? this._rnBridgeWalletAddress ?? this.address ?? void 0 : void 0, r = !s && this._config.persistWalletPreference !== !1 ? await this.storage.get(b.WALLET_PREF_KEY).catch(() => null) : null, n = s ? [s, t] : [t, r == null ? void 0 : r.address];
5030
+ const s = this._isAuthenticatedViaRNBridge ? this._rnBridgeWalletAddress ?? this.address ?? void 0 : void 0, r = !s && this._config.persistWalletPreference !== !1 ? await this.storage.get(U.WALLET_PREF_KEY).catch(() => null) : null, n = s ? [s, t] : [t, r == null ? void 0 : r.address];
4951
5031
  for (const a of n) {
4952
5032
  if (typeof a != "string" || !a) continue;
4953
- const l = e.find(
5033
+ const c = e.find(
4954
5034
  (d) => d.address.toLowerCase() === a.toLowerCase()
4955
5035
  );
4956
- if (l)
4957
- return this.setActiveWallet(l.address, l.index), l;
5036
+ if (c)
5037
+ return this.setActiveWallet(c.address, c.index), c;
4958
5038
  }
4959
5039
  return this.selectWallet();
4960
5040
  }
@@ -5101,27 +5181,27 @@ const b = class b extends Cr {
5101
5181
  return this.withSessionRecovery(() => this._signMessage(e, t, s));
5102
5182
  }
5103
5183
  async _signMessage(e, t, s) {
5104
- const r = L.getBridge(), n = this._isAuthenticatedViaRNBridge || !this.authenticated;
5184
+ const r = b.getBridge(), n = this._isAuthenticatedViaRNBridge || !this.authenticated;
5105
5185
  if (r != null && r.signMessage && n)
5106
5186
  try {
5107
- const l = await r.signMessage({
5187
+ const c = await r.signMessage({
5108
5188
  chainId: e,
5109
5189
  message: t,
5110
5190
  from: this.address ?? "",
5111
5191
  index: (s == null ? void 0 : s.index) ?? 0,
5112
5192
  dappName: (s == null ? void 0 : s.dappName) ?? this._config.appName
5113
5193
  });
5114
- return { chainId: e, signature: l.signature, message: t, address: this.address ?? "" };
5115
- } catch (l) {
5116
- if (!yt(l))
5117
- throw j(l, o.SIGNATURE_FAILED);
5118
- await this.clearRNBridgeDelegation("native signMessage 가 ERR_BRIDGE_NOT_AUTHORIZED 로 거부"), c.warn("[CROSSx] Bridge 미인증 — 일반 서명 경로로 폴백 (signMessage)");
5194
+ return { chainId: e, signature: c.signature, message: t, address: this.address ?? "" };
5195
+ } catch (c) {
5196
+ if (!yt(c))
5197
+ throw j(c, o.SIGNATURE_FAILED);
5198
+ await this.clearRNBridgeDelegation("native signMessage 가 ERR_BRIDGE_NOT_AUTHORIZED 로 거부"), l.warn("[CROSSx] Bridge 미인증 — 일반 서명 경로로 폴백 (signMessage)");
5119
5199
  }
5120
5200
  if (this.ensureAuthenticated(), !this.userId)
5121
5201
  throw new h(o.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
5122
5202
  const a = await this.resolveAddress(s == null ? void 0 : s.index);
5123
5203
  try {
5124
- const l = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
5204
+ const c = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
5125
5205
  confirmation: {
5126
5206
  type: "sign-message",
5127
5207
  chainId: e,
@@ -5144,16 +5224,16 @@ const b = class b extends Cr {
5144
5224
  });
5145
5225
  return this.signatureVerifier.verifySignatureSigner(
5146
5226
  t,
5147
- l.signature,
5227
+ c.signature,
5148
5228
  a.address
5149
5229
  ), {
5150
5230
  chainId: e,
5151
- signature: l.signature,
5231
+ signature: c.signature,
5152
5232
  message: t,
5153
5233
  address: a.address
5154
5234
  };
5155
- } catch (l) {
5156
- throw l instanceof h ? l : new h(o.SIGNATURE_FAILED, `메시지 서명에 실패했습니다 (${e})`, l);
5235
+ } catch (c) {
5236
+ throw c instanceof h ? c : new h(o.SIGNATURE_FAILED, `메시지 서명에 실패했습니다 (${e})`, c);
5157
5237
  }
5158
5238
  }
5159
5239
  /**
@@ -5209,7 +5289,7 @@ const b = class b extends Cr {
5209
5289
  r.address
5210
5290
  )
5211
5291
  });
5212
- return kr(n.signature), {
5292
+ return Lr(n.signature), {
5213
5293
  chainId: e,
5214
5294
  signature: n.signature,
5215
5295
  address: r.address
@@ -5238,7 +5318,7 @@ const b = class b extends Cr {
5238
5318
  * });
5239
5319
  */
5240
5320
  async signTypedDataOffchain(e, t) {
5241
- return this.signTypedData(b.OFFCHAIN_CHAIN_ID, e, t);
5321
+ return this.signTypedData(U.OFFCHAIN_CHAIN_ID, e, t);
5242
5322
  }
5243
5323
  // ============================================================================
5244
5324
  // 트랜잭션
@@ -5279,12 +5359,12 @@ const b = class b extends Cr {
5279
5359
  rejectedMessage: "User rejected the transaction signing request",
5280
5360
  prepareAction: "sign",
5281
5361
  prepareContext: { tx: r },
5282
- execute: (l) => this.walletProvider.signTransaction(
5362
+ execute: (c) => this.walletProvider.signTransaction(
5283
5363
  this.userId,
5284
5364
  e,
5285
5365
  r,
5286
5366
  s == null ? void 0 : s.index,
5287
- l
5367
+ c
5288
5368
  )
5289
5369
  });
5290
5370
  return Ur(a.signature), {
@@ -5294,10 +5374,10 @@ const b = class b extends Cr {
5294
5374
  };
5295
5375
  } catch (a) {
5296
5376
  if (a instanceof h) throw a;
5297
- const l = a instanceof Error ? a.message : String(a);
5377
+ const c = a instanceof Error ? a.message : String(a);
5298
5378
  throw new h(
5299
5379
  o.SIGNATURE_FAILED,
5300
- `트랜잭션 서명에 실패했습니다 (${e}): ${l}`,
5380
+ `트랜잭션 서명에 실패했습니다 (${e}): ${c}`,
5301
5381
  a
5302
5382
  );
5303
5383
  }
@@ -5355,16 +5435,16 @@ const b = class b extends Cr {
5355
5435
  );
5356
5436
  return _.txHash ?? _.signature;
5357
5437
  }
5358
- }), l = (t.data ?? "").toLowerCase().replace(/^0x/, ""), d = l === "" || l === "00000000", g = l.startsWith("a9059cbb");
5359
- return (d || g) && this.tokenHistoryService.registerHistoryFireAndForget(e, a, _e).catch(
5360
- (u) => c.log("[TokenHistory] register failed (non-critical):", u)
5438
+ }), c = (t.data ?? "").toLowerCase().replace(/^0x/, ""), d = c === "" || c === "00000000", g = c.startsWith("a9059cbb");
5439
+ return (d || g) && this.tokenHistoryService.registerHistoryFireAndForget(e, a, fe).catch(
5440
+ (u) => l.log("[TokenHistory] register failed (non-critical):", u)
5361
5441
  ), { chainId: e, txHash: a, status: "pending" };
5362
5442
  } catch (a) {
5363
5443
  if (a instanceof h) throw a;
5364
- const l = a instanceof Error ? a.message : String(a);
5444
+ const c = a instanceof Error ? a.message : String(a);
5365
5445
  throw new h(
5366
5446
  o.TRANSACTION_FAILED,
5367
- `트랜잭션 전송에 실패했습니다 (${e}): ${l}`,
5447
+ `트랜잭션 전송에 실패했습니다 (${e}): ${c}`,
5368
5448
  a
5369
5449
  );
5370
5450
  }
@@ -5388,9 +5468,9 @@ const b = class b extends Cr {
5388
5468
  * @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
5389
5469
  */
5390
5470
  async waitForTxAndGetReceipt(e, t, s = {}) {
5391
- const r = s.intervalMs ?? Xt, n = Zt, a = s.timeoutMs ?? ze, l = Date.now() + a;
5471
+ const r = s.intervalMs ?? Xt, n = Zt, a = s.timeoutMs ?? ze, c = Date.now() + a;
5392
5472
  let d = r;
5393
- for (; Date.now() < l; ) {
5473
+ for (; Date.now() < c; ) {
5394
5474
  const g = await this.getTransactionReceipt(e, t);
5395
5475
  if (g) return g;
5396
5476
  await new Promise((u) => setTimeout(u, d)), d = Math.min(d * 2, n);
@@ -5418,18 +5498,18 @@ const b = class b extends Cr {
5418
5498
  async sendTransactionWithWaitForReceipt(e, t, s = {}) {
5419
5499
  var w, m;
5420
5500
  if (this._isAuthenticatedViaRNBridge) {
5421
- const f = L.getBridge();
5501
+ const f = b.getBridge();
5422
5502
  if (f != null && f.sendTransactionWithWaitForReceipt)
5423
5503
  return this.bridgeSendTransactionWithWaitForReceipt(f, e, t, s);
5424
5504
  }
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) => {
5505
+ const { intervalMs: r, timeoutMs: n, ...a } = s, { txHash: c } = await this.sendTransaction(e, t, a), d = r ?? ((w = this._config.receiptPolling) == null ? void 0 : w.intervalMs) ?? Jt, g = n ?? ((m = this._config.receiptPolling) == null ? void 0 : m.timeoutMs) ?? ze, u = this.resolveNativeCurrency(e), _ = t.from ?? "";
5506
+ let p, A;
5507
+ const S = this.waitForTxAndGetReceipt(c, e, { intervalMs: d, timeoutMs: g }).then((f) => {
5428
5508
  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);
5509
+ const E = BigInt(f.gasUsed) * BigInt(f.effectiveGasPrice), T = t.value ? BigInt(t.value) : 0n, y = ue(t.value, u.symbol, u.decimals, this._config.displayDecimals), R = ue("0x" + E.toString(16), u.symbol, u.decimals, this._config.displayDecimals), N = ue("0x" + (T + E).toString(16), u.symbol, u.decimals, this._config.displayDecimals);
5430
5510
  return {
5431
5511
  chainId: e,
5432
- txHash: l,
5512
+ txHash: c,
5433
5513
  from: f.from,
5434
5514
  to: f.to ?? t.to,
5435
5515
  amount: y,
@@ -5438,20 +5518,20 @@ const b = class b extends Cr {
5438
5518
  nativeSymbol: u.symbol,
5439
5519
  status: f.status === "0x1" ? "success" : "reverted"
5440
5520
  };
5441
- }).catch((f) => (I = f instanceof Error ? f : new Error(String(f)), {
5521
+ }).catch((f) => (A = f instanceof Error ? f : new Error(String(f)), {
5442
5522
  chainId: e,
5443
- txHash: l,
5523
+ txHash: c,
5444
5524
  from: _,
5445
5525
  to: t.to,
5446
- amount: de(t.value, u.symbol, u.decimals, this._config.displayDecimals),
5526
+ amount: ue(t.value, u.symbol, u.decimals, this._config.displayDecimals),
5447
5527
  nativeSymbol: u.symbol,
5448
5528
  status: "timeout"
5449
5529
  }));
5450
5530
  if (await this.confirmation.showTransactionProgress(
5451
- { chainId: e, txHash: l, from: _, to: t.to },
5531
+ { chainId: e, txHash: c, from: _, to: t.to },
5452
5532
  S
5453
- ), I) throw I;
5454
- return { chainId: e, txHash: l, receipt: p };
5533
+ ), A) throw A;
5534
+ return { chainId: e, txHash: c, receipt: p };
5455
5535
  }
5456
5536
  /**
5457
5537
  * RN Bridge §12 — sendTransactionWithWaitForReceipt 를 native 로 위임.
@@ -5563,7 +5643,7 @@ const b = class b extends Cr {
5563
5643
  throw new h(o.NOT_IMPLEMENTED, "changePin이 구현되어 있지 않습니다");
5564
5644
  this.pinStore.set(e);
5565
5645
  try {
5566
- await s.changePin(e, t), this.pinStore.set(t), c.log("[CROSSx] PIN 변경 완료");
5646
+ await s.changePin(e, t), this.pinStore.set(t), l.log("[CROSSx] PIN 변경 완료");
5567
5647
  } catch (r) {
5568
5648
  throw r instanceof h ? r : new h(o.UNKNOWN_ERROR, "PIN 변경에 실패했습니다", r);
5569
5649
  }
@@ -5683,7 +5763,7 @@ const b = class b extends Cr {
5683
5763
  return { wei: "0x0", formatted: "0", chainId: e };
5684
5764
  try {
5685
5765
  const r = await this.jsonRpc.call("eth_getBalance", [t, "latest"], e) ?? "0x0";
5686
- return { wei: r, formatted: vr(r, this._config.displayDecimals), chainId: e };
5766
+ return { wei: r, formatted: kr(r, this._config.displayDecimals), chainId: e };
5687
5767
  } catch (s) {
5688
5768
  if (s instanceof h) throw s;
5689
5769
  const r = s instanceof Error ? s.message : String(s);
@@ -5723,7 +5803,7 @@ const b = class b extends Cr {
5723
5803
  try {
5724
5804
  t.emit("accountsChanged", [e]);
5725
5805
  } catch (s) {
5726
- c.warn("[CROSSx] accountsChanged emit 중 listener 예외", s);
5806
+ l.warn("[CROSSx] accountsChanged emit 중 listener 예외", s);
5727
5807
  }
5728
5808
  });
5729
5809
  }
@@ -5771,36 +5851,36 @@ const b = class b extends Cr {
5771
5851
  * 보안: bridge.isActivated() 가 false 이거나 payload sanitize 실패 시 이벤트 무시.
5772
5852
  */
5773
5853
  subscribeBridgeWalletChanged() {
5774
- const e = L.getBridge();
5854
+ const e = b.getBridge();
5775
5855
  if (!(e != null && e.onEvent)) {
5776
- c.warn("[CROSSx] bridge.onEvent 미지원 — walletChanged 구독 불가");
5856
+ l.warn("[CROSSx] bridge.onEvent 미지원 — walletChanged 구독 불가");
5777
5857
  return;
5778
5858
  }
5779
5859
  e.onEvent("walletChanged", (t) => {
5780
5860
  if (!e.isInstalled) {
5781
- c.warn("[walletChanged] bridge 비활성 — 이벤트 무시");
5861
+ l.warn("[walletChanged] bridge 비활성 — 이벤트 무시");
5782
5862
  return;
5783
5863
  }
5784
5864
  if (!t || typeof t != "object") {
5785
- c.warn("[walletChanged] invalid payload — 이벤트 무시", t);
5865
+ l.warn("[walletChanged] invalid payload — 이벤트 무시", t);
5786
5866
  return;
5787
5867
  }
5788
5868
  const s = t, r = typeof s.address == "string" ? s.address.trim() : "";
5789
5869
  if (!/^0x[a-fA-F0-9]{40}$/.test(r)) {
5790
- c.warn("[walletChanged] invalid address — 이벤트 무시", s);
5870
+ l.warn("[walletChanged] invalid address — 이벤트 무시", s);
5791
5871
  return;
5792
5872
  }
5793
5873
  if (s.source !== "rn-native-bridge") {
5794
- c.warn("[walletChanged] invalid source — 이벤트 무시", s);
5874
+ l.warn("[walletChanged] invalid source — 이벤트 무시", s);
5795
5875
  return;
5796
5876
  }
5797
5877
  if (!this.authenticated && !this._isAuthenticatedViaRNBridge) {
5798
- c.warn("[walletChanged] not authenticated — 이벤트 무시", s);
5878
+ l.warn("[walletChanged] not authenticated — 이벤트 무시", s);
5799
5879
  return;
5800
5880
  }
5801
5881
  const n = typeof s.walletName == "string" ? s.walletName.trim() : "", a = n.length > 0 && n.length <= 64 ? n : void 0;
5802
- this.address && this.address.toLowerCase() === r.toLowerCase() || (c.log("[CROSSx] Native walletChanged 수신", { address: r, walletId: s.walletId, source: s.source, walletName: a }), this.setActiveWallet(r, 0, { walletName: a }), this._rnBridgeWalletAddress = r, this._rnBridgeWalletName = a);
5803
- }), c.log("[CROSSx] bridge.onEvent walletChanged 구독 완료");
5882
+ this.address && this.address.toLowerCase() === r.toLowerCase() || (l.log("[CROSSx] Native walletChanged 수신", { address: r, walletId: s.walletId, source: s.source, walletName: a }), this.setActiveWallet(r, 0, { walletName: a }), this._rnBridgeWalletAddress = r, this._rnBridgeWalletName = a);
5883
+ }), l.log("[CROSSx] bridge.onEvent walletChanged 구독 완료");
5804
5884
  }
5805
5885
  /**
5806
5886
  * AuthResult를 내부 상태에 반영합니다.
@@ -5822,7 +5902,7 @@ const b = class b extends Cr {
5822
5902
  * (서버 세션 종료 API를 호출하면 또 다시 에러가 날 수 있으므로 스킵)
5823
5903
  */
5824
5904
  forceLogout() {
5825
- this.authenticated && (c.warn("[CROSSx] 강제 로그아웃 (Gateway -10002/-10033)"), this.clearAuthState());
5905
+ this.authenticated && (l.warn("[CROSSx] 강제 로그아웃 (Gateway -10002/-10033)"), this.clearAuthState());
5826
5906
  }
5827
5907
  /**
5828
5908
  * 세션 만료 시 동일 계정으로 재인증합니다.
@@ -5935,9 +6015,9 @@ const b = class b extends Cr {
5935
6015
  (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);
5936
6016
  }
5937
6017
  };
5938
- b.WALLET_PREF_KEY = "wallet_preference", b.OFFCHAIN_CHAIN_ID = "0";
5939
- let Fe = b;
5940
- class si {
6018
+ U.WALLET_PREF_KEY = "wallet_preference", U.OFFCHAIN_CHAIN_ID = "0";
6019
+ let Fe = U;
6020
+ class ci {
5941
6021
  constructor() {
5942
6022
  this.prefix = "crossx_";
5943
6023
  }
@@ -5946,7 +6026,7 @@ class si {
5946
6026
  const s = JSON.stringify(t);
5947
6027
  localStorage.setItem(this.prefix + e, s);
5948
6028
  } catch (s) {
5949
- throw c.error("Storage set error:", s), s;
6029
+ throw l.error("Storage set error:", s), s;
5950
6030
  }
5951
6031
  }
5952
6032
  async get(e) {
@@ -5954,14 +6034,14 @@ class si {
5954
6034
  const t = localStorage.getItem(this.prefix + e);
5955
6035
  return t ? JSON.parse(t) : null;
5956
6036
  } catch (t) {
5957
- return c.error("Storage get error:", t), null;
6037
+ return l.error("Storage get error:", t), null;
5958
6038
  }
5959
6039
  }
5960
6040
  async remove(e) {
5961
6041
  try {
5962
6042
  localStorage.removeItem(this.prefix + e);
5963
6043
  } catch (t) {
5964
- throw c.error("Storage remove error:", t), t;
6044
+ throw l.error("Storage remove error:", t), t;
5965
6045
  }
5966
6046
  }
5967
6047
  async clear() {
@@ -5970,11 +6050,11 @@ class si {
5970
6050
  t.startsWith(this.prefix) && localStorage.removeItem(t);
5971
6051
  });
5972
6052
  } catch (e) {
5973
- throw c.error("Storage clear error:", e), e;
6053
+ throw l.error("Storage clear error:", e), e;
5974
6054
  }
5975
6055
  }
5976
6056
  }
5977
- const ue = "crossx-sdk", wt = 1, v = "data", B = "keys", ge = "aes-primary", ri = 12;
6057
+ const ge = "crossx-sdk", wt = 1, v = "data", B = "keys", _e = "aes-primary", li = 12;
5978
6058
  class St {
5979
6059
  constructor(e) {
5980
6060
  this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
@@ -6002,13 +6082,13 @@ class St {
6002
6082
  openLegacyIfExists() {
6003
6083
  return new Promise((e, t) => {
6004
6084
  let s = !1;
6005
- const r = indexedDB.open(ue, wt);
6085
+ const r = indexedDB.open(ge, wt);
6006
6086
  r.onupgradeneeded = () => {
6007
6087
  s = !0;
6008
6088
  }, r.onsuccess = () => {
6009
6089
  const n = r.result;
6010
6090
  if (s) {
6011
- n.close(), this.deleteDB(ue).then(() => e(null));
6091
+ n.close(), this.deleteDB(ge).then(() => e(null));
6012
6092
  return;
6013
6093
  }
6014
6094
  if (!n.objectStoreNames.contains(B) || !n.objectStoreNames.contains(v)) {
@@ -6027,9 +6107,9 @@ class St {
6027
6107
  return new Promise((t) => {
6028
6108
  const s = indexedDB.deleteDatabase(e);
6029
6109
  s.onsuccess = () => t(), s.onerror = () => {
6030
- c.warn("[CROSSx] IndexedDB 삭제 실패:", e, s.error), t();
6110
+ l.warn("[CROSSx] IndexedDB 삭제 실패:", e, s.error), t();
6031
6111
  }, s.onblocked = () => {
6032
- c.warn(
6112
+ l.warn(
6033
6113
  "[CROSSx] IndexedDB 삭제 보류 — 다른 탭이 DB 를 열고 있습니다:",
6034
6114
  e
6035
6115
  ), t();
@@ -6044,8 +6124,8 @@ class St {
6044
6124
  }
6045
6125
  idbPut(e, t, s) {
6046
6126
  return new Promise((r, n) => {
6047
- const l = this.db.transaction(e, "readwrite").objectStore(e).put(s, t);
6048
- l.onsuccess = () => r(), l.onerror = () => n(l.error);
6127
+ const c = this.db.transaction(e, "readwrite").objectStore(e).put(s, t);
6128
+ c.onsuccess = () => r(), c.onerror = () => n(c.error);
6049
6129
  });
6050
6130
  }
6051
6131
  idbDelete(e, t) {
@@ -6062,7 +6142,7 @@ class St {
6062
6142
  }
6063
6143
  async init() {
6064
6144
  this.db = await this.openDB();
6065
- const e = await this.idbGet(B, ge);
6145
+ const e = await this.idbGet(B, _e);
6066
6146
  if (e) {
6067
6147
  this.cryptoKey = e;
6068
6148
  return;
@@ -6076,23 +6156,23 @@ class St {
6076
6156
  { name: "AES-GCM", length: 256 },
6077
6157
  !1,
6078
6158
  ["encrypt", "decrypt"]
6079
- ), await this.idbPut(B, ge, this.cryptoKey);
6159
+ ), await this.idbPut(B, _e, this.cryptoKey);
6080
6160
  }
6081
6161
  /**
6082
6162
  * 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
6083
6163
  * 마이그레이션 성공 시 레거시 DB 삭제.
6084
6164
  */
6085
6165
  async migrateFromLegacyDB() {
6086
- if (this.dbName === ue) return null;
6166
+ if (this.dbName === ge) return null;
6087
6167
  try {
6088
6168
  const e = await this.openLegacyIfExists();
6089
6169
  if (!e) return null;
6090
- const t = e.transaction([B, v], "readonly"), s = t.objectStore(B).get(ge), r = await new Promise((g, u) => {
6170
+ const t = e.transaction([B, v], "readonly"), s = t.objectStore(B).get(_e), r = await new Promise((g, u) => {
6091
6171
  s.onsuccess = () => g(s.result), s.onerror = () => u(s.error);
6092
6172
  });
6093
6173
  if (!r)
6094
6174
  return e.close(), null;
6095
- const n = t.objectStore(v).getAll(), a = t.objectStore(v).getAllKeys(), [l, d] = await Promise.all([
6175
+ const n = t.objectStore(v).getAll(), a = t.objectStore(v).getAllKeys(), [c, d] = await Promise.all([
6096
6176
  new Promise((g, u) => {
6097
6177
  n.onsuccess = () => g(n.result), n.onerror = () => u(n.error);
6098
6178
  }),
@@ -6100,16 +6180,16 @@ class St {
6100
6180
  a.onsuccess = () => g(a.result), a.onerror = () => u(a.error);
6101
6181
  })
6102
6182
  ]);
6103
- e.close(), await this.idbPut(B, ge, r);
6183
+ e.close(), await this.idbPut(B, _e, r);
6104
6184
  for (let g = 0; g < d.length; g++)
6105
- await this.idbPut(v, String(d[g]), l[g]);
6106
- return await this.deleteDB(ue), c.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), r;
6185
+ await this.idbPut(v, String(d[g]), c[g]);
6186
+ return await this.deleteDB(ge), l.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), r;
6107
6187
  } catch (e) {
6108
- return c.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
6188
+ return l.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
6109
6189
  }
6110
6190
  }
6111
6191
  async encrypt(e) {
6112
- const t = new Uint8Array(ri);
6192
+ const t = new Uint8Array(li);
6113
6193
  crypto.getRandomValues(t);
6114
6194
  const s = new TextEncoder().encode(e), r = await crypto.subtle.encrypt(
6115
6195
  { name: "AES-GCM", iv: t },
@@ -6132,7 +6212,7 @@ class St {
6132
6212
  const s = JSON.stringify(t), r = await this.encrypt(s);
6133
6213
  await this.idbPut(v, e, r);
6134
6214
  } catch (s) {
6135
- throw c.error("[CROSSx] IndexedDB set error:", s), s;
6215
+ throw l.error("[CROSSx] IndexedDB set error:", s), s;
6136
6216
  }
6137
6217
  }
6138
6218
  async get(e) {
@@ -6143,21 +6223,21 @@ class St {
6143
6223
  const s = await this.decrypt(t);
6144
6224
  return JSON.parse(s);
6145
6225
  } catch (t) {
6146
- return c.error("[CROSSx] IndexedDB get error:", t), null;
6226
+ return l.error("[CROSSx] IndexedDB get error:", t), null;
6147
6227
  }
6148
6228
  }
6149
6229
  async remove(e) {
6150
6230
  try {
6151
6231
  await this.ensureReady(), await this.idbDelete(v, e);
6152
6232
  } catch (t) {
6153
- throw c.error("[CROSSx] IndexedDB remove error:", t), t;
6233
+ throw l.error("[CROSSx] IndexedDB remove error:", t), t;
6154
6234
  }
6155
6235
  }
6156
6236
  async clear() {
6157
6237
  try {
6158
6238
  await this.ensureReady(), await this.idbClear(v);
6159
6239
  } catch (e) {
6160
- throw c.error("[CROSSx] IndexedDB clear error:", e), e;
6240
+ throw l.error("[CROSSx] IndexedDB clear error:", e), e;
6161
6241
  }
6162
6242
  }
6163
6243
  /**
@@ -6167,53 +6247,53 @@ class St {
6167
6247
  return typeof indexedDB < "u" && typeof crypto < "u" && typeof crypto.subtle < "u";
6168
6248
  }
6169
6249
  }
6170
- const ii = 60;
6171
- class ni {
6250
+ const hi = 60;
6251
+ class di {
6172
6252
  constructor() {
6173
6253
  this.jwks = null;
6174
6254
  }
6175
6255
  setJWKSEndpoint(e) {
6176
6256
  try {
6177
- this.jwks = $t(new URL(e)), c.log("[CROSSx] JWKS 엔드포인트 설정:", e);
6257
+ this.jwks = $t(new URL(e)), l.log("[CROSSx] JWKS 엔드포인트 설정:", e);
6178
6258
  } catch (t) {
6179
- c.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", t);
6259
+ l.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", t);
6180
6260
  }
6181
6261
  }
6182
6262
  async verifyJWT(e, t) {
6183
6263
  try {
6184
6264
  const s = this.decodeJWT(e);
6185
- c.log("[CROSSx] JWT 디코딩 성공:", {
6265
+ l.log("[CROSSx] JWT 디코딩 성공:", {
6186
6266
  sub: s.sub,
6187
6267
  exp: s.exp,
6188
6268
  iat: s.iat
6189
6269
  });
6190
6270
  const r = Math.floor(Date.now() / 1e3);
6191
- if (s.exp && s.exp + ii < r)
6192
- return c.warn("[CROSSx] 토큰 만료:", {
6271
+ if (s.exp && s.exp + hi < r)
6272
+ return l.warn("[CROSSx] 토큰 만료:", {
6193
6273
  exp: s.exp,
6194
6274
  now: r,
6195
6275
  만료시간: new Date(s.exp * 1e3).toISOString()
6196
6276
  }), { payload: s, valid: !1, signatureVerified: !1 };
6197
6277
  if (!s.sub)
6198
- return c.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: s, valid: !1, signatureVerified: !1 };
6278
+ return l.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: s, valid: !1, signatureVerified: !1 };
6199
6279
  if (this.jwks)
6200
6280
  try {
6201
6281
  const { payload: n } = await Yt(e, this.jwks, {
6202
6282
  algorithms: ["RS256", "ES256"]
6203
6283
  });
6204
- return c.log("[CROSSx] JWT 서명 검증 성공"), {
6284
+ return l.log("[CROSSx] JWT 서명 검증 성공"), {
6205
6285
  payload: n,
6206
6286
  valid: !0,
6207
6287
  signatureVerified: !0
6208
6288
  };
6209
6289
  } catch (n) {
6210
6290
  if (n instanceof Error && (n.name === "JWSSignatureVerificationFailed" || n.name === "JWTClaimValidationFailed"))
6211
- return c.error("[CROSSx] JWT 서명 검증 실패:", n), { payload: s, valid: !1, signatureVerified: !1 };
6212
- c.warn("[CROSSx] JWKS 엔드포인트 접근 불가 — 서명 미검증 모드로 전환");
6291
+ return l.error("[CROSSx] JWT 서명 검증 실패:", n), { payload: s, valid: !1, signatureVerified: !1 };
6292
+ l.warn("[CROSSx] JWKS 엔드포인트 접근 불가 — 서명 미검증 모드로 전환");
6213
6293
  }
6214
- return c.log("[CROSSx] JWT 검증 성공 (서명 미검증 — JWKS 미설정 또는 접근 불가)"), { payload: s, valid: !0, signatureVerified: !1 };
6294
+ return l.log("[CROSSx] JWT 검증 성공 (서명 미검증 — JWKS 미설정 또는 접근 불가)"), { payload: s, valid: !0, signatureVerified: !1 };
6215
6295
  } catch (s) {
6216
- throw c.error("[CROSSx] JWT 검증 중 에러:", s), s;
6296
+ throw l.error("[CROSSx] JWT 검증 중 에러:", s), s;
6217
6297
  }
6218
6298
  }
6219
6299
  decodeJWT(e) {
@@ -6232,17 +6312,17 @@ class ni {
6232
6312
  ${s.length}`
6233
6313
  ), n = new Uint8Array(r.length + s.length);
6234
6314
  n.set(r, 0), n.set(s, r.length);
6235
- const a = je(n), l = t.startsWith("0x") ? t.slice(2) : t;
6236
- if (l.length !== 130)
6237
- throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${l.length}`);
6238
- const d = ai(l), g = d.slice(0, 32), u = d.slice(32, 64), _ = d[64], p = _ >= 27 ? _ - 27 : _, w = new jt.Signature(
6315
+ const a = je(n), c = t.startsWith("0x") ? t.slice(2) : t;
6316
+ if (c.length !== 130)
6317
+ throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${c.length}`);
6318
+ const d = ui(c), g = d.slice(0, 32), u = d.slice(32, 64), _ = d[64], p = _ >= 27 ? _ - 27 : _, w = new jt.Signature(
6239
6319
  Et(g),
6240
6320
  Et(u)
6241
6321
  ).addRecoveryBit(p).recoverPublicKey(a).toBytes(!1).slice(1), m = je(w);
6242
6322
  return "0x" + zt(m.slice(12));
6243
6323
  }
6244
6324
  }
6245
- function ai(i) {
6325
+ function ui(i) {
6246
6326
  const e = new Uint8Array(i.length / 2);
6247
6327
  for (let t = 0; t < e.length; t++)
6248
6328
  e[t] = parseInt(i.substring(t * 2, t * 2 + 2), 16);
@@ -6253,8 +6333,8 @@ function Et(i) {
6253
6333
  for (const t of i) e += t.toString(16).padStart(2, "0");
6254
6334
  return BigInt(e);
6255
6335
  }
6256
- const oi = 5e3;
6257
- class ci {
6336
+ const gi = 5e3;
6337
+ class _i {
6258
6338
  constructor(e, t) {
6259
6339
  this.cachedKey = null, this.cachedVersion = null, this.cachedAt = 0, this.keyInFlight = null, this.keyFailedAt = 0, this.required = !1, this.adapterConfig = e, this.transport = t;
6260
6340
  }
@@ -6267,8 +6347,8 @@ class ci {
6267
6347
  const t = this.required;
6268
6348
  if (!t && this.hasFreshFailure()) return e;
6269
6349
  try {
6270
- const { version: s, key: r } = await this.currentKey(), n = await li(r, e);
6271
- return `${s}.${hi(n)}`;
6350
+ const { version: s, key: r } = await this.currentKey(), n = await fi(r, e);
6351
+ return `${s}.${pi(n)}`;
6272
6352
  } catch (s) {
6273
6353
  if (t)
6274
6354
  throw this.keyFailedAt = Date.now(), s instanceof h ? s : new h(
@@ -6276,17 +6356,17 @@ class ci {
6276
6356
  "PIN 암호화에 실패했습니다. 잠시 후 다시 시도해 주세요.",
6277
6357
  { cause: String(s) }
6278
6358
  );
6279
- return this.keyFailedAt = Date.now(), c.warn(
6359
+ return this.keyFailedAt = Date.now(), l.warn(
6280
6360
  "[CROSSx] pin-key 조회 실패 — PIN 평문 전송을 유지합니다",
6281
6361
  `(${Math.round(tt / 1e3)}초 후 재확인)`
6282
6362
  ), e;
6283
6363
  }
6284
6364
  }
6285
6365
  invalidate() {
6286
- c.log("[CROSSx] PIN 공개키 캐시 무효화"), this.cachedKey = null, this.cachedVersion = null, this.cachedAt = 0, this.keyFailedAt = 0, this.keyInFlight = null;
6366
+ l.log("[CROSSx] PIN 공개키 캐시 무효화"), this.cachedKey = null, this.cachedVersion = null, this.cachedAt = 0, this.keyFailedAt = 0, this.keyInFlight = null;
6287
6367
  }
6288
6368
  requireEncryption() {
6289
- this.required || (c.warn("[CROSSx] 게이트웨이가 PIN 암호화를 요구함 — 이후 요청은 항상 암호화합니다"), this.required = !0);
6369
+ this.required || (l.warn("[CROSSx] 게이트웨이가 PIN 암호화를 요구함 — 이후 요청은 항상 암호화합니다"), this.required = !0);
6290
6370
  }
6291
6371
  /**
6292
6372
  * 공개키를 미리 받아 둡니다 (fire-and-forget).
@@ -6308,12 +6388,12 @@ class ci {
6308
6388
  return this.keyFailedAt !== 0 && Date.now() - this.keyFailedAt < tt;
6309
6389
  }
6310
6390
  async currentKey() {
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(() => {
6391
+ 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, l.log("[CROSSx] PIN 공개키 캐시 완료 (keyVersion:", e.version, ")"), e)).finally(() => {
6312
6392
  this.keyInFlight = null;
6313
6393
  }), this.keyInFlight);
6314
6394
  }
6315
6395
  async fetchAndImportKey() {
6316
- const e = Gt();
6396
+ const e = Ht();
6317
6397
  if (!e)
6318
6398
  throw new h(
6319
6399
  o.PIN_ENCRYPTION_FAILED,
@@ -6323,16 +6403,16 @@ class ci {
6323
6403
  url: `${this.baseUrl}/pin-key`,
6324
6404
  method: "GET",
6325
6405
  headers: { "X-Project-Id": this.adapterConfig.projectId },
6326
- timeoutMs: oi
6327
- }), s = _i(t.data);
6406
+ timeoutMs: gi
6407
+ }), s = Ai(t.data);
6328
6408
  if (!(s != null && s.keyVersion) || !(s != null && s.publicKey))
6329
6409
  throw new h(
6330
6410
  o.PIN_ENCRYPTION_FAILED,
6331
6411
  "pin-key 응답을 해석할 수 없습니다."
6332
6412
  );
6333
- const r = ui(s.publicKey), n = await e.importKey(
6413
+ const r = Si(s.publicKey), n = await e.importKey(
6334
6414
  "spki",
6335
- gi(r),
6415
+ Ei(r),
6336
6416
  { name: "RSA-OAEP", hash: "SHA-256" },
6337
6417
  !1,
6338
6418
  ["encrypt"]
@@ -6340,8 +6420,8 @@ class ci {
6340
6420
  return { version: s.keyVersion, key: n };
6341
6421
  }
6342
6422
  }
6343
- async function li(i, e) {
6344
- const t = Gt();
6423
+ async function fi(i, e) {
6424
+ const t = Ht();
6345
6425
  if (!t)
6346
6426
  throw new h(
6347
6427
  o.PIN_ENCRYPTION_FAILED,
@@ -6354,29 +6434,29 @@ async function li(i, e) {
6354
6434
  );
6355
6435
  return new Uint8Array(s);
6356
6436
  }
6357
- function Gt() {
6437
+ function Ht() {
6358
6438
  const i = globalThis.crypto;
6359
6439
  return (i == null ? void 0 : i.subtle) ?? null;
6360
6440
  }
6361
- function hi(i) {
6362
- return di(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
6441
+ function pi(i) {
6442
+ return wi(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
6363
6443
  }
6364
- const re = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6365
- function di(i) {
6444
+ const ie = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6445
+ function wi(i) {
6366
6446
  let e = "";
6367
6447
  for (let t = 0; t < i.length; t += 3) {
6368
6448
  const s = i[t], r = i[t + 1], n = i[t + 2];
6369
- e += re[s >> 2], e += re[(s & 3) << 4 | (r ?? 0) >> 4], e += r === void 0 ? "=" : re[(r & 15) << 2 | (n ?? 0) >> 6], e += n === void 0 ? "=" : re[n & 63];
6449
+ e += ie[s >> 2], e += ie[(s & 3) << 4 | (r ?? 0) >> 4], e += r === void 0 ? "=" : ie[(r & 15) << 2 | (n ?? 0) >> 6], e += n === void 0 ? "=" : ie[n & 63];
6370
6450
  }
6371
6451
  return e;
6372
6452
  }
6373
- function ui(i) {
6453
+ function Si(i) {
6374
6454
  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 = [];
6375
6455
  for (let r = 0; r < t.length; r += 4) {
6376
6456
  const n = [0, 1, 2, 3].map((a) => {
6377
- const l = t[r + a];
6378
- if (l === "=" || l === void 0) return -1;
6379
- const d = re.indexOf(l);
6457
+ const c = t[r + a];
6458
+ if (c === "=" || c === void 0) return -1;
6459
+ const d = ie.indexOf(c);
6380
6460
  if (d === -1)
6381
6461
  throw new h(
6382
6462
  o.PIN_ENCRYPTION_FAILED,
@@ -6388,11 +6468,11 @@ function ui(i) {
6388
6468
  }
6389
6469
  return new Uint8Array(s);
6390
6470
  }
6391
- function gi(i) {
6471
+ function Ei(i) {
6392
6472
  const e = new Uint8Array(i.length);
6393
6473
  return e.set(i), e.buffer;
6394
6474
  }
6395
- function _i(i) {
6475
+ function Ai(i) {
6396
6476
  if (!i || typeof i != "object") return null;
6397
6477
  const e = i;
6398
6478
  if (typeof e.code == "number") {
@@ -6406,8 +6486,8 @@ function _i(i) {
6406
6486
  }
6407
6487
  return typeof e.keyVersion == "string" && typeof e.publicKey == "string" ? e : null;
6408
6488
  }
6409
- const fi = 3e4, pi = 1e3;
6410
- class wi {
6489
+ const Ii = 3e4, mi = 1e3;
6490
+ class Ti {
6411
6491
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6412
6492
  async request(e) {
6413
6493
  const t = e.retries ?? 0;
@@ -6418,7 +6498,7 @@ class wi {
6418
6498
  } catch (r) {
6419
6499
  if (s === t) throw r;
6420
6500
  }
6421
- await new Promise((r) => setTimeout(r, pi * 2 ** s));
6501
+ await new Promise((r) => setTimeout(r, mi * 2 ** s));
6422
6502
  }
6423
6503
  throw new Error("Unexpected: retry loop exited without result");
6424
6504
  }
@@ -6426,7 +6506,7 @@ class wi {
6426
6506
  async _doRequest(e) {
6427
6507
  const t = new AbortController(), s = setTimeout(
6428
6508
  () => t.abort(),
6429
- e.timeoutMs ?? fi
6509
+ e.timeoutMs ?? Ii
6430
6510
  );
6431
6511
  try {
6432
6512
  const r = await fetch(e.url, {
@@ -6453,7 +6533,7 @@ class wi {
6453
6533
  }
6454
6534
  }
6455
6535
  }
6456
- function Si(i) {
6536
+ function yi(i) {
6457
6537
  const e = { raw: i }, t = i.search(/(^|;)\s*info=/i), s = t >= 0 ? i.slice(0, t) : i;
6458
6538
  if (t >= 0) {
6459
6539
  const r = i.slice(t).replace(/^;?\s*info=/i, "").trim();
@@ -6462,20 +6542,20 @@ function Si(i) {
6462
6542
  for (const r of s.split(";")) {
6463
6543
  const [n, ...a] = r.split("=");
6464
6544
  if ((n == null ? void 0 : n.trim().toLowerCase()) === "sunset") {
6465
- const l = a.join("=").trim();
6466
- l && (e.sunset = l);
6545
+ const c = a.join("=").trim();
6546
+ c && (e.sunset = c);
6467
6547
  }
6468
6548
  }
6469
6549
  return e;
6470
6550
  }
6471
- function It(i) {
6551
+ function At(i) {
6472
6552
  try {
6473
6553
  return new URL(i).origin;
6474
6554
  } catch {
6475
6555
  return null;
6476
6556
  }
6477
6557
  }
6478
- class Ei {
6558
+ class Ri {
6479
6559
  constructor(e, t) {
6480
6560
  this.inner = e, this.options = t;
6481
6561
  }
@@ -6489,28 +6569,28 @@ class Ei {
6489
6569
  return this.inspect(t), t;
6490
6570
  }
6491
6571
  isGateway(e) {
6492
- const t = It(e);
6493
- return t === null ? !1 : this.options.getGatewayBaseUrls().some((s) => It(s) === t);
6572
+ const t = At(e);
6573
+ return t === null ? !1 : this.options.getGatewayBaseUrls().some((s) => At(s) === t);
6494
6574
  }
6495
6575
  inspect(e) {
6496
- var r, n, a, l;
6497
- const t = Ai(e.headers, ns);
6498
- t && ((n = (r = this.options).onDeprecation) == null || n.call(r, Si(t)));
6576
+ var r, n, a, c;
6577
+ const t = Oi(e.headers, ns);
6578
+ t && ((n = (r = this.options).onDeprecation) == null || n.call(r, yi(t)));
6499
6579
  const s = e.data;
6500
- s && s.code === pe && ((l = (a = this.options).onUnsupported) == null || l.call(a, { message: Ii(s) }));
6580
+ s && s.code === we && ((c = (a = this.options).onUnsupported) == null || c.call(a, { message: Ni(s) }));
6501
6581
  }
6502
6582
  }
6503
- function Ii(i) {
6583
+ function Ni(i) {
6504
6584
  for (const e of [i.data, i.message])
6505
6585
  if (typeof e == "string" && e.trim()) return e;
6506
6586
  }
6507
- function Ai(i, e) {
6587
+ function Oi(i, e) {
6508
6588
  if (!i) return;
6509
6589
  const t = e.toLowerCase();
6510
6590
  for (const [s, r] of Object.entries(i))
6511
6591
  if (s.toLowerCase() === t && r) return r;
6512
6592
  }
6513
- const mi = [
6593
+ const Pi = [
6514
6594
  /CROSSx\/([\d.]+)/i,
6515
6595
  /ONE\s?wallet[^\s/]*\/([\d.]+)/i,
6516
6596
  /ONE\s?pocket[^\s/]*\/([\d.]+)/i
@@ -6518,59 +6598,59 @@ const mi = [
6518
6598
  function Ke() {
6519
6599
  return typeof window > "u" ? void 0 : window;
6520
6600
  }
6521
- function Ti() {
6601
+ function Ci() {
6522
6602
  const i = Ke();
6523
6603
  return i == null ? void 0 : i.__crossx;
6524
6604
  }
6525
- function yi(i) {
6605
+ function Di(i) {
6526
6606
  return i === "ios" || i === "android" ? i : null;
6527
6607
  }
6528
6608
  function ke() {
6529
6609
  const i = typeof navigator > "u" ? "" : navigator.userAgent;
6530
6610
  return /Android/i.test(i) ? "android" : /iPhone|iPad|iPod|Macintosh/i.test(i) ? "ios" : null;
6531
6611
  }
6532
- function Ri(i, e) {
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);
6612
+ function xi(i, e) {
6613
+ const t = (a) => a.split(/[^\d]+/).filter((c) => c !== "").map((c) => Number.parseInt(c, 10)), s = t(i), r = t(e), n = Math.max(s.length, r.length);
6534
6614
  for (let a = 0; a < n; a += 1) {
6535
- const l = (s[a] ?? 0) - (r[a] ?? 0);
6536
- if (l !== 0) return l;
6615
+ const c = (s[a] ?? 0) - (r[a] ?? 0);
6616
+ if (c !== 0) return c;
6537
6617
  }
6538
6618
  return 0;
6539
6619
  }
6540
- function Ni() {
6620
+ function vi() {
6541
6621
  const i = Ke();
6542
6622
  if (!i) return !1;
6543
6623
  const e = i.__crossxRNBridge;
6544
6624
  return e != null && e.isInstalled ? !0 : i.__CROSSX_BRIDGE_INITIALIZED__ === !0 || i.__CROSSX_RN_BRIDGE_READY__ === !0;
6545
6625
  }
6546
- function At() {
6626
+ function It() {
6547
6627
  const i = typeof navigator > "u" ? "" : navigator.userAgent;
6548
- for (const e of mi) {
6628
+ for (const e of Pi) {
6549
6629
  const t = e.exec(i);
6550
6630
  if (t) return t[1] ?? null;
6551
6631
  }
6552
6632
  }
6553
6633
  function Ee() {
6554
- const i = Ti();
6634
+ const i = Ci();
6555
6635
  if (i != null && i.browser)
6556
6636
  return {
6557
6637
  version: i.version ?? null,
6558
- platform: yi(i.platform) ?? ke(),
6638
+ platform: Di(i.platform) ?? ke(),
6559
6639
  detectedBy: "marker"
6560
6640
  };
6561
- if (Ni())
6641
+ if (vi())
6562
6642
  return {
6563
- version: At() ?? null,
6643
+ version: It() ?? null,
6564
6644
  platform: ke(),
6565
6645
  detectedBy: "bridge"
6566
6646
  };
6567
- const e = At();
6647
+ const e = It();
6568
6648
  return e !== void 0 ? { version: e, platform: ke(), detectedBy: "user-agent" } : null;
6569
6649
  }
6570
- function qi() {
6650
+ function Qi() {
6571
6651
  return Ee() !== null;
6572
6652
  }
6573
- function ji(i = 3e3) {
6653
+ function en(i = 3e3) {
6574
6654
  const e = Ee();
6575
6655
  return e ? Promise.resolve(e) : Ke() ? new Promise((t) => {
6576
6656
  const s = Date.now(), r = setInterval(() => {
@@ -6583,16 +6663,16 @@ function ji(i = 3e3) {
6583
6663
  }, 50);
6584
6664
  }) : Promise.resolve(null);
6585
6665
  }
6586
- const Oi = /* @__PURE__ */ new Set([
6666
+ const ki = /* @__PURE__ */ new Set([
6587
6667
  "https://cross-wallet-oauth.crosstoken.io",
6588
6668
  "https://stg-cross-wallet-oauth.crosstoken.io",
6589
6669
  "https://dev-cross-wallet-oauth.crosstoken.io",
6590
6670
  "https://one-wallet-oauth.onechain.nexus",
6591
6671
  "https://stg-one-wallet-oauth.onechain.nexus",
6592
6672
  "https://dev-one-wallet-oauth.onechain.nexus"
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;
6673
+ ]), Li = "crossx://oauth-callback", Ui = "2.3.2";
6674
+ function bi(i) {
6675
+ return i.platform !== "ios" ? !1 : i.version ? xi(i.version, Ui) <= 0 : !0;
6596
6676
  }
6597
6677
  class K {
6598
6678
  constructor() {
@@ -6604,7 +6684,7 @@ class K {
6604
6684
  */
6605
6685
  cancelPending(e = "외부 경로 인증으로 OAuth 대기를 중단했습니다") {
6606
6686
  const t = this.abortPending;
6607
- t && (c.log("[CROSSx] OAuth 대기 중단 —", e), t(e));
6687
+ t && (l.log("[CROSSx] OAuth 대기 중단 —", e), t(e));
6608
6688
  }
6609
6689
  static generateRandom16Hex() {
6610
6690
  const e = new Uint8Array(16);
@@ -6630,21 +6710,21 @@ class K {
6630
6710
  */
6631
6711
  static async verifyIdTokenNonce(e, t) {
6632
6712
  const s = K.parseJwtPayload(e), r = s.nonce, n = typeof s.iss == "string" ? s.iss : "(unknown)";
6633
- if (c.log("[CROSSx] nonce 검증 시작 —", {
6713
+ if (l.log("[CROSSx] nonce 검증 시작 —", {
6634
6714
  iss: n,
6635
6715
  nonceClaimType: typeof r,
6636
6716
  nonceClaimPresent: typeof r == "string" && r !== "",
6637
6717
  // Apple의 nonce_supported 플래그 확인 (false면 서버가 nonce를 전달하지 않은 것)
6638
6718
  appleNonceSupported: s.nonce_supported ?? "(field absent)"
6639
6719
  }), n.includes("securetoken.google.com")) {
6640
- c.log(
6720
+ l.log(
6641
6721
  "[CROSSx] Firebase ID Token 감지 — nonce 검증 skip.",
6642
6722
  "서버 측에서 Google/Apple nonce 검증이 완료된 것으로 간주합니다."
6643
6723
  );
6644
6724
  return;
6645
6725
  }
6646
6726
  if (typeof r != "string" || r === "") {
6647
- c.warn("[CROSSx] nonce claim 누락 — nonce 검증 skip.", {
6727
+ l.warn("[CROSSx] nonce claim 누락 — nonce 검증 skip.", {
6648
6728
  iss: n,
6649
6729
  keys: Object.keys(s)
6650
6730
  });
@@ -6652,36 +6732,36 @@ class K {
6652
6732
  }
6653
6733
  if (n.includes("appleid.apple.com")) {
6654
6734
  const a = await K.sha256Hex(t);
6655
- if (c.log("[CROSSx] Apple nonce 검증 —", {
6735
+ if (l.log("[CROSSx] Apple nonce 검증 —", {
6656
6736
  expectedHashLength: a.length,
6657
6737
  receivedHashLength: r.length,
6658
6738
  match: r === a
6659
6739
  }), r !== a)
6660
6740
  throw new Error("ID Token nonce 불일치 — replay attack 가능성이 있습니다");
6661
- } else if (c.log("[CROSSx] Google nonce 검증 —", {
6741
+ } else if (l.log("[CROSSx] Google nonce 검증 —", {
6662
6742
  expectedLength: t.length,
6663
6743
  receivedLength: r.length,
6664
6744
  match: r === t
6665
6745
  }), r !== t)
6666
6746
  throw new Error("ID Token nonce 불일치 — replay attack 가능성이 있습니다");
6667
- c.log("[CROSSx] nonce 검증 성공 —", { iss: n });
6747
+ l.log("[CROSSx] nonce 검증 성공 —", { iss: n });
6668
6748
  }
6669
6749
  openAuth(e) {
6670
6750
  return new Promise((t, s) => {
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();
6751
+ const r = Math.max(e.width ?? 500, 500), n = Math.max(e.height ?? 700, 700), a = window.screenX + (window.outerWidth - r) / 2, c = window.screenY + (window.outerHeight - n) / 2, d = K.generateRandom16Hex(), g = K.generateRandom16Hex(), u = Ee();
6672
6752
  let _ = e.authUrl;
6673
- u && e.legacyAuthUrl && Di(u) && (_ = e.legacyAuthUrl, c.info("[CROSSx] 구버전 iOS 지갑 감지 — 이관 전 OAuth 호스트 사용", {
6753
+ u && e.legacyAuthUrl && bi(u) && (_ = e.legacyAuthUrl, l.info("[CROSSx] 구버전 iOS 지갑 감지 — 이관 전 OAuth 호스트 사용", {
6674
6754
  appVersion: u.version ?? "(unknown)",
6675
6755
  detectedBy: u.detectedBy,
6676
6756
  authUrlBase: e.legacyAuthUrl
6677
6757
  }));
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 콜백 자동 부착", {
6758
+ const p = _.includes("?") ? "&" : "?", A = encodeURIComponent(window.location.origin);
6759
+ let S = `${_}${p}state=${d}&nonce=${g}&origin=${A}`;
6760
+ u && !S.includes("redirectUrl=") && (S += `&redirectUrl=${encodeURIComponent(Li)}`, l.info("[CROSSx] 지갑 인앱 브라우저 감지 — redirectUrl 콜백 자동 부착", {
6681
6761
  detectedBy: u.detectedBy,
6682
6762
  appVersion: u.version ?? "(unknown)",
6683
6763
  platform: u.platform ?? "(unknown)"
6684
- })), c.log("[CROSSx] OAuth 팝업 열기 — state, nonce 생성 완료:", {
6764
+ })), l.log("[CROSSx] OAuth 팝업 열기 — state, nonce 생성 완료:", {
6685
6765
  stateLength: d.length,
6686
6766
  nonceLength: g.length,
6687
6767
  authUrlBase: _
@@ -6689,18 +6769,18 @@ class K {
6689
6769
  const w = window.open(
6690
6770
  S,
6691
6771
  u ? "_blank" : "CROSSx OAuth",
6692
- `width=${r},height=${n},left=${a},top=${l}`
6772
+ `width=${r},height=${n},left=${a},top=${c}`
6693
6773
  );
6694
6774
  if (!w) {
6695
6775
  s(new Error("팝업 창을 열 수 없습니다. 팝업 차단을 해제해 주세요."));
6696
6776
  return;
6697
6777
  }
6698
6778
  const m = setTimeout(() => {
6699
- c.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), O(), s(new Error("Authentication timeout"));
6779
+ l.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), O(), s(new Error("Authentication timeout"));
6700
6780
  }, 300 * 1e3), f = 10, E = 30;
6701
6781
  let T = 0, y = null;
6702
6782
  const R = () => {
6703
- clearInterval(N), c.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + E + "초간 대기합니다"), y = setTimeout(() => {
6783
+ clearInterval(N), l.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + E + "초간 대기합니다"), y = setTimeout(() => {
6704
6784
  O(), s(new Error(
6705
6785
  "OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
6706
6786
  ));
@@ -6713,49 +6793,49 @@ class K {
6713
6793
  O(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다"));
6714
6794
  return;
6715
6795
  }
6716
- const U = typeof document < "u" && document.hasFocus();
6717
- T <= f && !U ? R() : (O(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다")));
6796
+ const L = typeof document < "u" && document.hasFocus();
6797
+ T <= f && !L ? R() : (O(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다")));
6718
6798
  } catch {
6719
6799
  R();
6720
6800
  }
6721
6801
  }, 1e3), O = () => {
6722
6802
  this.abortPending = null, clearTimeout(m), clearInterval(N), y && clearTimeout(y), window.removeEventListener("message", P);
6723
6803
  }, P = (D) => {
6724
- if (!Oi.has(D.origin)) return;
6804
+ if (!ki.has(D.origin)) return;
6725
6805
  O();
6726
- const U = typeof D.data.status == "string", A = U ? D.data.data ?? {} : D.data;
6727
- c.log("[CROSSx] OAuth postMessage 수신 —", {
6728
- format: U ? "wrapped" : "flat",
6729
- status: U ? D.data.status : "(flat)"
6806
+ const L = typeof D.data.status == "string", I = L ? D.data.data ?? {} : D.data;
6807
+ l.log("[CROSSx] OAuth postMessage 수신 —", {
6808
+ format: L ? "wrapped" : "flat",
6809
+ status: L ? D.data.status : "(flat)"
6730
6810
  });
6731
- const Q = (A == null ? void 0 : A.state) ?? D.data.state;
6811
+ const Q = (I == null ? void 0 : I.state) ?? D.data.state;
6732
6812
  if (!Q || Q !== d) {
6733
6813
  s(new Error("OAuth state mismatch — possible CSRF attack"));
6734
6814
  return;
6735
6815
  }
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"));
6816
+ if (L && D.data.status !== "success") {
6817
+ l.error("[CROSSx] OAuth 실패:", I == null ? void 0 : I.error), s(new Error((I == null ? void 0 : I.error) || "Authentication failed"));
6738
6818
  return;
6739
6819
  }
6740
- if (!U && (A != null && A.error)) {
6741
- c.error("[CROSSx] OAuth 실패:", A.error), s(new Error(A.error || "Authentication failed"));
6820
+ if (!L && (I != null && I.error)) {
6821
+ l.error("[CROSSx] OAuth 실패:", I.error), s(new Error(I.error || "Authentication failed"));
6742
6822
  return;
6743
6823
  }
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;
6745
- if (c.log("[CROSSx] OAuth 토큰 수신:", {
6824
+ const $ = I == null ? void 0 : I.idToken, ee = I == null ? void 0 : I.accessToken, Ve = ee ?? $, $e = (I == null ? void 0 : I.email) || void 0;
6825
+ if (l.log("[CROSSx] OAuth 토큰 수신:", {
6746
6826
  hasAccessToken: !!ee,
6747
6827
  hasIdToken: !!$,
6748
6828
  hasEmail: !!$e
6749
6829
  }), !Ve) {
6750
- c.error("[CROSSx] 토큰을 찾을 수 없음:", D.data), s(new Error("Token not found in response"));
6830
+ l.error("[CROSSx] 토큰을 찾을 수 없음:", D.data), s(new Error("Token not found in response"));
6751
6831
  return;
6752
6832
  }
6753
6833
  const Ye = { token: Ve, email: $e }, Te = (qe) => {
6754
6834
  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"));
6835
+ l.error("[CROSSx] nonce 검증 실패:", ye), s(ye instanceof Error ? ye : new Error("nonce verification failed"));
6756
6836
  });
6757
6837
  };
6758
- ee ? ee.split(".").length === 3 ? Te(ee) : $ ? Te($) : (c.warn(
6838
+ ee ? ee.split(".").length === 3 ? Te(ee) : $ ? Te($) : (l.warn(
6759
6839
  "[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
6760
6840
  "서버 측 nonce 검증이 필요합니다."
6761
6841
  ), t(Ye)) : $ ? Te($) : s(new Error("Token not found in response"));
@@ -6766,8 +6846,8 @@ class K {
6766
6846
  });
6767
6847
  }
6768
6848
  }
6769
- const se = "crossx_wallet_data", q = "crossx_mock_pin_hash";
6770
- class xi {
6849
+ const re = "crossx_wallet_data", q = "crossx_mock_pin_hash";
6850
+ class Wi {
6771
6851
  constructor(e, t) {
6772
6852
  this.storage = e, this.pinStore = t ?? null;
6773
6853
  }
@@ -6779,14 +6859,14 @@ class xi {
6779
6859
  */
6780
6860
  async checkWallet() {
6781
6861
  if (this.migrateScenario !== void 0)
6782
- return c.log("[Mock] checkWallet → migration_required"), "migration_required";
6783
- const t = await this.storage.get(se) ? "exists" : "not_found";
6784
- return c.log(`[Mock] checkWallet → ${t}`), t;
6862
+ return l.log("[Mock] checkWallet → migration_required"), "migration_required";
6863
+ const t = await this.storage.get(re) ? "exists" : "not_found";
6864
+ return l.log(`[Mock] checkWallet → ${t}`), t;
6785
6865
  }
6786
6866
  async getOrCreateWallet(e) {
6787
6867
  var t;
6788
6868
  try {
6789
- const s = await this.storage.get(se);
6869
+ const s = await this.storage.get(re);
6790
6870
  if (s) return s;
6791
6871
  const r = {
6792
6872
  id: e,
@@ -6794,16 +6874,16 @@ class xi {
6794
6874
  derivationPath: "m/44'/60'/0'/0/0",
6795
6875
  createdAt: Date.now()
6796
6876
  };
6797
- await this.storage.set(se, r);
6877
+ await this.storage.set(re, r);
6798
6878
  const n = (t = this.pinStore) == null ? void 0 : t.get();
6799
- return n && (await this.storage.set(q, n), c.log("[Mock] 지갑 생성 — PIN 저장됨")), r;
6879
+ return n && (await this.storage.set(q, n), l.log("[Mock] 지갑 생성 — PIN 저장됨")), r;
6800
6880
  } catch (s) {
6801
6881
  throw new h(o.WALLET_CREATION_FAILED, "지갑 생성에 실패했습니다", s);
6802
6882
  }
6803
6883
  }
6804
6884
  /** GET /mnemonic/addresses 모킹 — PIN 불필요, 캐시된 주소 반환 */
6805
6885
  async getAddresses(e) {
6806
- const t = await this.storage.get(se);
6886
+ const t = await this.storage.get(re);
6807
6887
  return t ? [{ address: t.address, index: 0 }] : [];
6808
6888
  }
6809
6889
  async getAddress(e, t) {
@@ -6814,21 +6894,21 @@ class xi {
6814
6894
  }
6815
6895
  async prepare(e, t) {
6816
6896
  const s = "mock-" + crypto.randomUUID();
6817
- return c.log(`[Mock] prepare action=${e} → uuid=${s}`), { uuid: s, expiresAt: new Date(Date.now() + 5 * 6e4).toISOString() };
6897
+ return l.log(`[Mock] prepare action=${e} → uuid=${s}`), { uuid: s, expiresAt: new Date(Date.now() + 5 * 6e4).toISOString() };
6818
6898
  }
6819
6899
  async signMessage(e, t, s, r = 0, n, a) {
6820
- return c.log(`[Mock] signMessage chainId=${t} index=${r} uuid=${n} from=${a}: "${s}"`), { chainId: t, signature: this.generateMockSignature(), format: "hex" };
6900
+ return l.log(`[Mock] signMessage chainId=${t} index=${r} uuid=${n} from=${a}: "${s}"`), { chainId: t, signature: this.generateMockSignature(), format: "hex" };
6821
6901
  }
6822
6902
  async signTypedData(e, t, s, r = 0, n, a) {
6823
- return c.log(`[Mock] signTypedData chainId=${t} index=${r} uuid=${n} from=${a}`), { chainId: t, signature: this.generateMockSignature(), format: "hex" };
6903
+ return l.log(`[Mock] signTypedData chainId=${t} index=${r} uuid=${n} from=${a}`), { chainId: t, signature: this.generateMockSignature(), format: "hex" };
6824
6904
  }
6825
6905
  async signTransaction(e, t, s, r = 0, n) {
6826
- c.log(`[Mock] signTransaction chainId=${t} index=${r} uuid=${n}:`, s);
6906
+ l.log(`[Mock] signTransaction chainId=${t} index=${r} uuid=${n}:`, s);
6827
6907
  const a = "0x" + Array(64).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join("");
6828
6908
  return { chainId: t, signature: this.generateMockSignature(), txHash: a, format: "hex" };
6829
6909
  }
6830
6910
  async sendTransaction(e, t, s, r) {
6831
- return c.log(`[Mock] sendTransaction chainId=${t} uuid=${r}:`, s), { txHash: "0x" + Array(64).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join("") };
6911
+ return l.log(`[Mock] sendTransaction chainId=${t} uuid=${r}:`, s), { txHash: "0x" + Array(64).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join("") };
6832
6912
  }
6833
6913
  /**
6834
6914
  * POST /mnemonic/verify-password 모킹
@@ -6836,10 +6916,10 @@ class xi {
6836
6916
  */
6837
6917
  async verifyPin(e) {
6838
6918
  var s;
6839
- if (c.log("[Mock] verifyPin"), this.pinScenario === "wrong")
6919
+ if (l.log("[Mock] verifyPin"), this.pinScenario === "wrong")
6840
6920
  return !1;
6841
6921
  const t = await this.storage.get(q);
6842
- return t && t !== e ? !1 : (t || await this.storage.set(q, e), (s = this.pinStore) == null || s.set(e), c.log("[Mock] verifyPin → 성공"), !0);
6922
+ return t && t !== e ? !1 : (t || await this.storage.set(q, e), (s = this.pinStore) == null || s.set(e), l.log("[Mock] verifyPin → 성공"), !0);
6843
6923
  }
6844
6924
  /**
6845
6925
  * POST /mnemonic/change-password 모킹
@@ -6847,16 +6927,16 @@ class xi {
6847
6927
  */
6848
6928
  async changePin(e, t) {
6849
6929
  var n;
6850
- if (c.log("[Mock] changePin"), this.pinScenario === "wrong")
6930
+ if (l.log("[Mock] changePin"), this.pinScenario === "wrong")
6851
6931
  throw new h(o.PIN_WRONG, "Incorrect PIN.");
6852
6932
  const s = (n = this.pinStore) == null ? void 0 : n.get(), r = await this.storage.get(q);
6853
6933
  if (r && s && r !== s)
6854
6934
  throw new h(o.PIN_WRONG, "Incorrect PIN.");
6855
- await this.storage.set(q, t), c.log("[Mock] changePin 완료");
6935
+ await this.storage.set(q, t), l.log("[Mock] changePin 완료");
6856
6936
  }
6857
6937
  async migrateWallet(e, t) {
6858
6938
  var n;
6859
- if (c.log(`[Mock] migrateWallet pin=${e} sub=${t}`), this.migrateScenario === "wrong_pin")
6939
+ if (l.log(`[Mock] migrateWallet pin=${e} sub=${t}`), this.migrateScenario === "wrong_pin")
6860
6940
  throw new h(o.MIGRATION_FAILED, "Incorrect PIN.", {
6861
6941
  permanent: !1,
6862
6942
  lockExpiresAt: 0,
@@ -6864,7 +6944,7 @@ class xi {
6864
6944
  maxAttempts: 5
6865
6945
  });
6866
6946
  if (this.migrateScenario !== void 0 && typeof this.migrateScenario == "object" && "locked" in this.migrateScenario) {
6867
- const l = {
6947
+ const c = {
6868
6948
  permanent: !1,
6869
6949
  lockExpiresAt: Math.floor(Date.now() / 1e3) + 1800,
6870
6950
  remainingAttempts: 0,
@@ -6874,7 +6954,7 @@ class xi {
6874
6954
  throw new h(
6875
6955
  o.MIGRATION_PIN_LOCKED,
6876
6956
  "Too many incorrect PIN attempts. Your account has been temporarily locked.",
6877
- l
6957
+ c
6878
6958
  );
6879
6959
  }
6880
6960
  const s = {
@@ -6883,23 +6963,23 @@ class xi {
6883
6963
  derivationPath: "m/44'/60'/0'/0/0",
6884
6964
  createdAt: Date.now()
6885
6965
  };
6886
- await this.storage.set(se, s);
6966
+ await this.storage.set(re, s);
6887
6967
  const r = (n = this.pinStore) == null ? void 0 : n.get();
6888
- return r && (await this.storage.set(q, r), c.log("[Mock] 마이그레이션 — PIN 저장됨")), s;
6968
+ return r && (await this.storage.set(q, r), l.log("[Mock] 마이그레이션 — PIN 저장됨")), s;
6889
6969
  }
6890
6970
  /**
6891
6971
  * POST /mnemonic/share-c 모킹
6892
6972
  * 새로운 Share-C 문자열을 반환합니다.
6893
6973
  */
6894
6974
  async getShareC() {
6895
- return c.log("[Mock] getShareC"), "mock-share-c-" + crypto.randomUUID();
6975
+ return l.log("[Mock] getShareC"), "mock-share-c-" + crypto.randomUUID();
6896
6976
  }
6897
6977
  /**
6898
6978
  * POST /mnemonic/verify-recovery-pin 모킹
6899
6979
  * CROSSx 4자리 복구 PIN 검증
6900
6980
  */
6901
6981
  async verifyRecoveryPin(e, t) {
6902
- return c.log("[Mock] verifyRecoveryPin"), { valid: !0 };
6982
+ return l.log("[Mock] verifyRecoveryPin"), { valid: !0 };
6903
6983
  }
6904
6984
  generateMockEvmAddress() {
6905
6985
  return "0x" + Array(40).fill(0).map(
@@ -6912,7 +6992,7 @@ class xi {
6912
6992
  ).join("");
6913
6993
  }
6914
6994
  }
6915
- const vi = ["password", "newPassword", "recoveryPin"];
6995
+ const Mi = ["password", "newPassword", "recoveryPin"];
6916
6996
  class V {
6917
6997
  constructor(e, t, s, r, n, a) {
6918
6998
  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;
@@ -6955,7 +7035,7 @@ class V {
6955
7035
  );
6956
7036
  }
6957
7037
  if (e)
6958
- return c.warn("[CROSSx] 토큰 갱신 실패 — 기존 토큰으로 요청 시도"), e;
7038
+ return l.warn("[CROSSx] 토큰 갱신 실패 — 기존 토큰으로 요청 시도"), e;
6959
7039
  throw new h(
6960
7040
  o.SESSION_EXPIRED,
6961
7041
  "인증 세션이 만료되었습니다. 다시 로그인해 주세요."
@@ -6963,7 +7043,7 @@ class V {
6963
7043
  }
6964
7044
  /** 동시 갱신 요청을 단일 Promise로 합칩니다. */
6965
7045
  deduplicatedRefresh() {
6966
- return this._refreshPromise ? this._refreshPromise : (c.log("[CROSSx] 토큰 만료 임박/만료 — 자동 갱신 시도"), this._refreshPromise = this._onTokenRefresh().finally(() => {
7046
+ return this._refreshPromise ? this._refreshPromise : (l.log("[CROSSx] 토큰 만료 임박/만료 — 자동 갱신 시도"), this._refreshPromise = this._onTokenRefresh().finally(() => {
6967
7047
  this._refreshPromise = null;
6968
7048
  }), this._refreshPromise);
6969
7049
  }
@@ -6978,7 +7058,7 @@ class V {
6978
7058
  async sealPinFields(e) {
6979
7059
  if (!this.pinEncryptor || !e || typeof e != "object") return e;
6980
7060
  let t = null;
6981
- for (const s of vi) {
7061
+ for (const s of Mi) {
6982
7062
  const r = e[s];
6983
7063
  if (typeof r != "string" || r === "") continue;
6984
7064
  const n = await this.pinEncryptor.seal(r);
@@ -6987,15 +7067,15 @@ class V {
6987
7067
  return t ?? e;
6988
7068
  }
6989
7069
  async request(e, t, s, r = !1, n = !1) {
6990
- var u, _, p, I;
6991
- const a = await this.ensureValidToken(), l = `${this.baseUrl}${t}`, d = {
7070
+ var u, _, p, A;
7071
+ const a = await this.ensureValidToken(), c = `${this.baseUrl}${t}`, d = {
6992
7072
  Authorization: `Bearer ${a}`,
6993
7073
  "Content-Type": "application/json",
6994
7074
  "X-Project-Id": this.projectId
6995
7075
  }, g = await this.sealPinFields(s);
6996
7076
  try {
6997
7077
  const w = (await this.transport.request({
6998
- url: l,
7078
+ url: c,
6999
7079
  method: e,
7000
7080
  headers: d,
7001
7081
  body: g ?? void 0
@@ -7003,22 +7083,22 @@ class V {
7003
7083
  if (w && typeof w.code == "number") {
7004
7084
  if (w.code < 0 || w.code >= 400) {
7005
7085
  const m = w.message || w.data || "API 요청에 실패했습니다";
7006
- c.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
7086
+ l.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
7007
7087
  code: w.code,
7008
7088
  message: m,
7009
- url: l,
7089
+ url: c,
7010
7090
  method: e
7011
7091
  });
7012
7092
  const f = V.mapGatewayError(w.code, w.data);
7013
7093
  if (f === o.PIN_ENCRYPTION_INVALID && this.pinEncryptor && (this.pinEncryptor.requireEncryption(), this.pinEncryptor.invalidate(), !n))
7014
- return c.warn("[CROSSx] Gateway -10045 감지 — pin-key 재조회 후 재시도"), this.request(e, t, s, r, !0);
7094
+ return l.warn("[CROSSx] Gateway -10045 감지 — pin-key 재조회 후 재시도"), this.request(e, t, s, r, !0);
7015
7095
  if (f === o.AUTH_NOT_AUTHENTICATED && !r && this._onTokenRefresh) {
7016
- if (c.warn("[CROSSx] Gateway -10002 감지 — 토큰 갱신 후 재시도"), await this.deduplicatedRefresh())
7096
+ if (l.warn("[CROSSx] Gateway -10002 감지 — 토큰 갱신 후 재시도"), await this.deduplicatedRefresh())
7017
7097
  return this.request(e, t, s, !0, n);
7018
7098
  throw new h(o.SESSION_EXPIRED, "인증 세션이 만료되었습니다. 다시 로그인해 주세요.");
7019
7099
  }
7020
7100
  if (f === o.USER_NOT_FOUND)
7021
- throw c.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (u = this._onUnauthorized) == null || u.call(this), new h(
7101
+ throw l.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (u = this._onUnauthorized) == null || u.call(this), new h(
7022
7102
  o.USER_NOT_FOUND,
7023
7103
  V.getGatewayErrorMessage(w.code, m)
7024
7104
  );
@@ -7026,14 +7106,14 @@ class V {
7026
7106
  let R;
7027
7107
  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);
7028
7108
  }
7029
- return c.log("[CROSSx] Wallet Gateway API 성공:", { code: w.code, url: l, method: e }), w.data ?? w;
7109
+ return l.log("[CROSSx] Wallet Gateway API 성공:", { code: w.code, url: c, method: e }), w.data ?? w;
7030
7110
  }
7031
7111
  return w;
7032
7112
  } catch (S) {
7033
7113
  if (S instanceof h) throw S;
7034
7114
  const w = ((_ = S.response) == null ? void 0 : _.status) ?? S.status;
7035
7115
  if ((w === 401 || w === 403) && !r && this._onTokenRefresh) {
7036
- if (c.warn(`[CROSSx] HTTP ${w} 감지 — 토큰 갱신 후 재시도`), await this.deduplicatedRefresh())
7116
+ if (l.warn(`[CROSSx] HTTP ${w} 감지 — 토큰 갱신 후 재시도`), await this.deduplicatedRefresh())
7037
7117
  return this.request(e, t, s, !0, n);
7038
7118
  throw new h(
7039
7119
  o.SESSION_EXPIRED,
@@ -7042,12 +7122,12 @@ class V {
7042
7122
  }
7043
7123
  if ((p = S.response) != null && p.data) {
7044
7124
  const m = S.response.data, f = m.message || m.data || "API 요청에 실패했습니다", E = m.code || "UNKNOWN";
7045
- throw c.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
7125
+ throw l.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
7046
7126
  code: E,
7047
7127
  message: f,
7048
- url: l,
7128
+ url: c,
7049
7129
  method: e,
7050
- status: (I = S.response) == null ? void 0 : I.status
7130
+ status: (A = S.response) == null ? void 0 : A.status
7051
7131
  }), new h(
7052
7132
  o.UNKNOWN_ERROR,
7053
7133
  `Wallet Gateway 오류 (${E}): ${f}`
@@ -7062,9 +7142,9 @@ class V {
7062
7142
  */
7063
7143
  async checkWallet() {
7064
7144
  var t, s;
7065
- c.log("[CROSSx] GET /mnemonic/check"), (s = (t = this.pinEncryptor) == null ? void 0 : t.prewarm) == null || s.call(t);
7145
+ l.log("[CROSSx] GET /mnemonic/check"), (s = (t = this.pinEncryptor) == null ? void 0 : t.prewarm) == null || s.call(t);
7066
7146
  const e = await this.request("GET", "/mnemonic/check");
7067
- return c.log("[CROSSx] /mnemonic/check 결과:", e.result), this._walletStatusCache = e.result, e.result;
7147
+ return l.log("[CROSSx] /mnemonic/check 결과:", e.result), this._walletStatusCache = e.result, e.result;
7068
7148
  }
7069
7149
  /**
7070
7150
  * 지갑 생성 또는 로드
@@ -7075,24 +7155,24 @@ class V {
7075
7155
  */
7076
7156
  async getOrCreateWallet(e) {
7077
7157
  let t;
7078
- if (this._walletStatusCache !== null ? (t = this._walletStatusCache, this._walletStatusCache = null, c.log("[CROSSx] getOrCreateWallet — 캐시된 상태 사용:", t)) : (c.log("[CROSSx] GET /mnemonic/check — 지갑 상태 확인"), t = await this.checkWallet(), this._walletStatusCache = null), t === "migration_required")
7079
- throw c.log("[CROSSx] migration_required → MIGRATION_BACKUP_EXISTS throw"), new h(
7158
+ if (this._walletStatusCache !== null ? (t = this._walletStatusCache, this._walletStatusCache = null, l.log("[CROSSx] getOrCreateWallet — 캐시된 상태 사용:", t)) : (l.log("[CROSSx] GET /mnemonic/check — 지갑 상태 확인"), t = await this.checkWallet(), this._walletStatusCache = null), t === "migration_required")
7159
+ throw l.log("[CROSSx] migration_required → MIGRATION_BACKUP_EXISTS throw"), new h(
7080
7160
  o.MIGRATION_BACKUP_EXISTS,
7081
7161
  "기존 지갑 백업이 존재합니다. 마이그레이션을 진행해 주세요."
7082
7162
  );
7083
7163
  if (t === "exists") {
7084
- c.log("[CROSSx] 기존 지갑 발견 — POST /mnemonic/address(0)로 주소 조회");
7164
+ l.log("[CROSSx] 기존 지갑 발견 — POST /mnemonic/address(0)로 주소 조회");
7085
7165
  const n = await this.getAddress(e, 0);
7086
- return c.log("[CROSSx] 주소 조회 완료 — address:", n.address), {
7166
+ return l.log("[CROSSx] 주소 조회 완료 — address:", n.address), {
7087
7167
  id: e,
7088
7168
  address: n.address,
7089
7169
  derivationPath: "m/44'/60'/0'/0/0",
7090
7170
  createdAt: Date.now()
7091
7171
  };
7092
7172
  }
7093
- c.log("[CROSSx] POST /mnemonic/create — 신규 지갑 생성");
7173
+ l.log("[CROSSx] POST /mnemonic/create — 신규 지갑 생성");
7094
7174
  const s = { ignoreBackup: !1, password: this.requirePin() }, r = await this.request("POST", "/mnemonic/create", s);
7095
- return c.log("[CROSSx] /mnemonic/create 완료 — address:", r.address), {
7175
+ return l.log("[CROSSx] /mnemonic/create 완료 — address:", r.address), {
7096
7176
  id: e,
7097
7177
  address: r.address,
7098
7178
  derivationPath: "m/44'/60'/0'/0/0",
@@ -7135,18 +7215,18 @@ class V {
7135
7215
  return { uuid: n.uuid, expiresAt: n.expiresAt };
7136
7216
  }
7137
7217
  async signMessage(e, t, s, r, n, a) {
7138
- const l = { message: s, password: this.requirePin() };
7139
- n && (l.uuid = n), a && (l.from = a);
7140
- const d = await this.request("POST", "/mnemonic/sign-message", l);
7218
+ const c = { message: s, password: this.requirePin() };
7219
+ n && (c.uuid = n), a && (c.from = a);
7220
+ const d = await this.request("POST", "/mnemonic/sign-message", c);
7141
7221
  return { chainId: t, signature: d.signature, format: "hex" };
7142
7222
  }
7143
7223
  async signTypedData(e, t, s, r, n, a) {
7144
- const l = { typedData: s, password: this.requirePin() };
7145
- n && (l.uuid = n), a && (l.from = a);
7224
+ const c = { typedData: s, password: this.requirePin() };
7225
+ n && (c.uuid = n), a && (c.from = a);
7146
7226
  const d = await this.request(
7147
7227
  "POST",
7148
7228
  `/mnemonic/sign-typed-data/${encodeURIComponent(t)}`,
7149
- l
7229
+ c
7150
7230
  );
7151
7231
  return { chainId: t, signature: d.signature, format: "hex" };
7152
7232
  }
@@ -7167,12 +7247,12 @@ class V {
7167
7247
  async signTransaction(e, t, s, r, n) {
7168
7248
  const a = { unsignedTx: this.buildUnsignedTx(s), password: this.requirePin() };
7169
7249
  n && (a.uuid = n);
7170
- const l = await this.request(
7250
+ const c = await this.request(
7171
7251
  "POST",
7172
7252
  `/mnemonic/sign/${encodeURIComponent(t)}`,
7173
7253
  a
7174
7254
  );
7175
- return { chainId: t, signature: l.signedTx, txHash: l.txHash, format: "hex" };
7255
+ return { chainId: t, signature: c.signedTx, txHash: c.txHash, format: "hex" };
7176
7256
  }
7177
7257
  async sendTransaction(e, t, s, r) {
7178
7258
  const n = {
@@ -7186,13 +7266,13 @@ class V {
7186
7266
  )).txHash };
7187
7267
  }
7188
7268
  async migrateWallet(e, t) {
7189
- c.log("[CROSSx][Migration Phase 4] POST /mnemonic/migrate 호출");
7269
+ l.log("[CROSSx][Migration Phase 4] POST /mnemonic/migrate 호출");
7190
7270
  const s = { recoveryPin: e, sub: t, password: this.requirePin() }, r = await this.request(
7191
7271
  "POST",
7192
7272
  "/mnemonic/migrate",
7193
7273
  s
7194
7274
  );
7195
- return c.log("[CROSSx][Migration Phase 4] /mnemonic/migrate 완료 — address:", r.address), {
7275
+ return l.log("[CROSSx][Migration Phase 4] /mnemonic/migrate 완료 — address:", r.address), {
7196
7276
  id: t,
7197
7277
  address: r.address,
7198
7278
  derivationPath: "m/44'/60'/0'/0/0",
@@ -7347,7 +7427,7 @@ class V {
7347
7427
  return o.ORIGIN_NOT_ALLOWED;
7348
7428
  case -10025:
7349
7429
  return o.INVALID_APP_TYPE;
7350
- case pe:
7430
+ case we:
7351
7431
  return o.SDK_VERSION_UNSUPPORTED;
7352
7432
  // PIN 관련
7353
7433
  case -10028:
@@ -7416,7 +7496,7 @@ class V {
7416
7496
  return "Origin or App ID is required. Register the current domain or set X-App-Id header.";
7417
7497
  case -10025:
7418
7498
  return "Invalid app type. X-App-Type must be android, ios, or windows.";
7419
- case pe:
7499
+ case we:
7420
7500
  return `This SDK version is no longer supported. Update @nexus-cross/crossx-sdk-core.${t ? ` (${t})` : ""}`;
7421
7501
  case -10026:
7422
7502
  return "Domain chainId mismatch: the chainId in typedData.domain does not match the request chainId.";
@@ -7449,12 +7529,12 @@ class V {
7449
7529
  }
7450
7530
  }
7451
7531
  }
7452
- class ki {
7532
+ class Fi {
7453
7533
  constructor(e, t, s, r = () => {
7454
7534
  }, n = () => {
7455
7535
  }, a = () => {
7456
7536
  }) {
7457
- this.inner = e, this.getBridge = t, this.isAuthenticatedViaRNBridge = s, this.assertBridgeSessionActive = r, this.getAppName = n, this.onBridgeUnauthorized = a, e.checkWallet && (this.checkWallet = () => e.checkWallet()), e.prepare && (this.prepare = (l, d) => e.prepare(l, d)), e.migrateWallet && (this.migrateWallet = (l, d) => e.migrateWallet(l, d)), e.verifyPin && (this.verifyPin = (l) => e.verifyPin(l)), e.getShareC && (this.getShareC = () => e.getShareC()), e.verifyRecoveryPin && (this.verifyRecoveryPin = (l, d) => e.verifyRecoveryPin(l, d));
7537
+ this.inner = e, this.getBridge = t, this.isAuthenticatedViaRNBridge = s, this.assertBridgeSessionActive = r, this.getAppName = n, this.onBridgeUnauthorized = a, e.checkWallet && (this.checkWallet = () => e.checkWallet()), e.prepare && (this.prepare = (c, d) => e.prepare(c, d)), e.migrateWallet && (this.migrateWallet = (c, d) => e.migrateWallet(c, d)), e.verifyPin && (this.verifyPin = (c) => e.verifyPin(c)), e.getShareC && (this.getShareC = () => e.getShareC()), e.verifyRecoveryPin && (this.verifyRecoveryPin = (c, d) => e.verifyRecoveryPin(c, d));
7458
7538
  }
7459
7539
  /** native delegation 가능 여부 (인증 + bridge 메서드 존재) 한 번에 판정 */
7460
7540
  shouldUseBridge() {
@@ -7488,11 +7568,11 @@ class ki {
7488
7568
  }
7489
7569
  // ─── §12 native sign delegation ────────────────────────────────────────
7490
7570
  async signMessage(e, t, s, r, n, a) {
7491
- const l = this.shouldUseBridge();
7492
- if (l != null && l.signMessage) {
7571
+ const c = this.shouldUseBridge();
7572
+ if (c != null && c.signMessage) {
7493
7573
  this.assertBridgeSessionActive();
7494
7574
  try {
7495
- const d = await l.signMessage({
7575
+ const d = await c.signMessage({
7496
7576
  chainId: t,
7497
7577
  message: s,
7498
7578
  from: a,
@@ -7512,11 +7592,11 @@ class ki {
7512
7592
  return this.inner.signMessage(e, t, s, r, n, a);
7513
7593
  }
7514
7594
  async signTypedData(e, t, s, r, n, a) {
7515
- const l = this.shouldUseBridge();
7516
- if (l != null && l.signTypedData) {
7595
+ const c = this.shouldUseBridge();
7596
+ if (c != null && c.signTypedData) {
7517
7597
  this.assertBridgeSessionActive();
7518
7598
  try {
7519
- const d = await l.signTypedData({
7599
+ const d = await c.signTypedData({
7520
7600
  chainId: t,
7521
7601
  typedData: s,
7522
7602
  from: a,
@@ -7542,7 +7622,7 @@ class ki {
7542
7622
  if (a != null && a.signTransaction) {
7543
7623
  this.assertBridgeSessionActive();
7544
7624
  try {
7545
- const l = await a.signTransaction({
7625
+ const c = await a.signTransaction({
7546
7626
  chainId: t,
7547
7627
  tx: this.toBridgeTx(s),
7548
7628
  from: s.from,
@@ -7551,12 +7631,12 @@ class ki {
7551
7631
  });
7552
7632
  return {
7553
7633
  chainId: t,
7554
- signature: l.signedTx,
7634
+ signature: c.signedTx,
7555
7635
  format: "hex"
7556
7636
  };
7557
- } catch (l) {
7558
- if (!await this.recoverFromUnauthorized(l, e, s.from, "signTransaction"))
7559
- throw j(l, o.SIGNATURE_FAILED);
7637
+ } catch (c) {
7638
+ if (!await this.recoverFromUnauthorized(c, e, s.from, "signTransaction"))
7639
+ throw j(c, o.SIGNATURE_FAILED);
7560
7640
  }
7561
7641
  }
7562
7642
  return this.inner.signTransaction(e, t, s, r, n);
@@ -7612,7 +7692,7 @@ class ki {
7612
7692
  (s = (t = this.inner).setTokenRefresher) == null || s.call(t, e);
7613
7693
  }
7614
7694
  }
7615
- class ne {
7695
+ class ae {
7616
7696
  constructor(e, t) {
7617
7697
  this.cache = /* @__PURE__ */ new Map(), this.loadedAt = 0, this.usingFallback = !1, this._fetchPromise = null, this.adapterConfig = e, this.projectId = e.projectId, this.transport = t;
7618
7698
  }
@@ -7633,7 +7713,7 @@ class ne {
7633
7713
  const t = e.data.chains;
7634
7714
  return this.populateCache(t, !1), t;
7635
7715
  } catch {
7636
- const e = ne.fallbackChains();
7716
+ const e = ae.fallbackChains();
7637
7717
  return this.populateCache(e, !0), e;
7638
7718
  }
7639
7719
  }
@@ -7669,13 +7749,13 @@ class ne {
7669
7749
  if (e.code < 0) {
7670
7750
  const t = typeof e.data == "string" ? e.data : e.message ?? "체인 레지스트리 요청에 실패했습니다";
7671
7751
  throw new h(
7672
- ne.mapErrorCode(e.code),
7752
+ ae.mapErrorCode(e.code),
7673
7753
  t
7674
7754
  );
7675
7755
  }
7676
7756
  }
7677
7757
  fallbackOrThrow(e) {
7678
- const t = ne.fallbackChains().find(
7758
+ const t = ae.fallbackChains().find(
7679
7759
  (s) => s.chainId === e
7680
7760
  );
7681
7761
  if (t) return t;
@@ -7685,7 +7765,7 @@ class ne {
7685
7765
  );
7686
7766
  }
7687
7767
  static fallbackChains() {
7688
- return Object.values(Ae).map((e) => ({
7768
+ return Object.values(Ie).map((e) => ({
7689
7769
  chainId: e.caipId,
7690
7770
  rpcUrl: e.rpcUrl
7691
7771
  }));
@@ -7704,14 +7784,14 @@ class ne {
7704
7784
  return o.APP_IDENTIFIER_MISSING;
7705
7785
  case -10025:
7706
7786
  return o.INVALID_APP_TYPE;
7707
- case pe:
7787
+ case we:
7708
7788
  return o.SDK_VERSION_UNSUPPORTED;
7709
7789
  default:
7710
7790
  return o.UNKNOWN_ERROR;
7711
7791
  }
7712
7792
  }
7713
7793
  }
7714
- function G(i) {
7794
+ function H(i) {
7715
7795
  return Promise.reject(
7716
7796
  new h(
7717
7797
  o.UI_NOT_PROVIDED,
@@ -7719,28 +7799,28 @@ function G(i) {
7719
7799
  )
7720
7800
  );
7721
7801
  }
7722
- class Ui {
7802
+ class Bi {
7723
7803
  // ─── 사용자 입력이 필요한 화면 → UI_NOT_PROVIDED ───
7724
7804
  requestConfirmation(e) {
7725
- return G("requestConfirmation");
7805
+ return H("requestConfirmation");
7726
7806
  }
7727
7807
  showLoginSelector() {
7728
- return G("showLoginSelector");
7808
+ return H("showLoginSelector");
7729
7809
  }
7730
7810
  showMigrationFoundPrompt() {
7731
- return G("showMigrationFoundPrompt");
7811
+ return H("showMigrationFoundPrompt");
7732
7812
  }
7733
7813
  showRecoveryPinInputPrompt() {
7734
- return G("showRecoveryPinInputPrompt");
7814
+ return H("showRecoveryPinInputPrompt");
7735
7815
  }
7736
7816
  showWalletSelector() {
7737
- return G("showWalletSelector");
7817
+ return H("showWalletSelector");
7738
7818
  }
7739
7819
  showPinSetupPrompt() {
7740
- return G("showPinSetupPrompt");
7820
+ return H("showPinSetupPrompt");
7741
7821
  }
7742
7822
  showPinInputPrompt() {
7743
- return G("showPinInputPrompt");
7823
+ return H("showPinInputPrompt");
7744
7824
  }
7745
7825
  // ─── 세션 알림 → 다시 로그인할 화면이 없으므로 로그아웃으로 처리 ───
7746
7826
  async showSessionAlert() {
@@ -7768,7 +7848,7 @@ class Ui {
7768
7848
  setPinKeyboard() {
7769
7849
  }
7770
7850
  }
7771
- class bi {
7851
+ class Hi {
7772
7852
  constructor(e, t, s, r = () => !1) {
7773
7853
  this.browserConfirmation = e, this.getBridge = t, this.getOrigin = s, this.isAuthenticatedViaRNBridge = r;
7774
7854
  }
@@ -7900,13 +7980,13 @@ class bi {
7900
7980
  const n = this.getBridge();
7901
7981
  if (this.shouldDelegateToBridge() && (n != null && n.showWalletSelector))
7902
7982
  try {
7903
- const a = await n.showWalletSelector({ requiredAddress: s }), l = e.find(
7983
+ const a = await n.showWalletSelector({ requiredAddress: s }), c = e.find(
7904
7984
  (d) => d.address.toLowerCase() === a.address.toLowerCase()
7905
7985
  );
7906
7986
  return {
7907
7987
  address: a.address,
7908
- index: (l == null ? void 0 : l.index) ?? a.index,
7909
- name: l == null ? void 0 : l.name
7988
+ index: (c == null ? void 0 : c.index) ?? a.index,
7989
+ name: c == null ? void 0 : c.name
7910
7990
  };
7911
7991
  } catch {
7912
7992
  return null;
@@ -7941,7 +8021,7 @@ class bi {
7941
8021
  (s = (t = this.browserConfirmation).setPinKeyboard) == null || s.call(t, e);
7942
8022
  }
7943
8023
  }
7944
- class Li {
8024
+ class Gi {
7945
8025
  constructor() {
7946
8026
  this._accessToken = null, this._expiresAt = 0;
7947
8027
  }
@@ -7973,12 +8053,12 @@ class Li {
7973
8053
  return !this._accessToken || this._expiresAt <= 0 ? !0 : Date.now() >= this._expiresAt - e;
7974
8054
  }
7975
8055
  }
7976
- const Ht = /* @__PURE__ */ new WeakMap();
7977
- function Wi(i, e) {
7978
- Ht.set(i, e);
8056
+ const Gt = /* @__PURE__ */ new WeakMap();
8057
+ function Ki(i, e) {
8058
+ Gt.set(i, e);
7979
8059
  }
7980
- function zi(i) {
7981
- const e = Ht.get(i);
8060
+ function tn(i) {
8061
+ const e = Gt.get(i);
7982
8062
  if (!e)
7983
8063
  throw new Error(
7984
8064
  "[CROSSx] Internal context not found — create the SDK with the core factory, and import the root and /internal entries in the same module format (ESM or CJS)."
@@ -7986,28 +8066,28 @@ function zi(i) {
7986
8066
  return e;
7987
8067
  }
7988
8068
  const Kt = /* @__PURE__ */ new WeakMap();
7989
- function Mi(i, e) {
8069
+ function Vi(i, e) {
7990
8070
  Kt.set(i, e);
7991
8071
  }
7992
- function Ji(i, e) {
8072
+ function sn(i, e) {
7993
8073
  const t = Kt.get(i);
7994
8074
  return t ? t(e) : Promise.reject(new Error("[CROSSx] reloadOneIdSession: create the SDK with the core factory"));
7995
8075
  }
7996
- function Fi(i) {
8076
+ function $i(i) {
7997
8077
  return Vt(i);
7998
8078
  }
7999
- function Xi(i, e) {
8079
+ function rn(i, e) {
8000
8080
  return Vt(i, e);
8001
8081
  }
8002
8082
  function Vt(i, e) {
8003
- var U;
8083
+ var L;
8004
8084
  if (!i.projectId)
8005
8085
  throw new Error(
8006
8086
  `[CROSSx] Fatal: projectId is required but was not provided.
8007
8087
  Set the projectId field in SDKConfig when calling createCROSSxSDK().
8008
8088
  Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
8009
8089
  );
8010
- if (i.walletServer === "one-wallet" && !((U = i.oneId) != null && U.clientId))
8090
+ if (i.walletServer === "one-wallet" && !((L = i.oneId) != null && L.clientId))
8011
8091
  throw new Error(
8012
8092
  "[CROSSx] Fatal: walletServer 'one-wallet' requires SDKConfig.oneId (ONE ID login) — DEV2TF-2755"
8013
8093
  );
@@ -8024,56 +8104,58 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
8024
8104
  gatewayUrl: t.walletGatewayUrl,
8025
8105
  projectId: i.projectId
8026
8106
  }, n = s.authMode !== "cookie" && St.isAvailable();
8027
- !n && s.authMode !== "cookie" && c.warn(
8107
+ !n && s.authMode !== "cookie" && l.warn(
8028
8108
  "[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
8029
8109
  "refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
8030
8110
  "IndexedDB를 지원하는 브라우저 사용을 권장합니다."
8031
8111
  ), s.secureStorageAvailable = n;
8032
- const a = n ? new St(i.projectId) : new si(), l = new ni();
8112
+ const a = n ? new St(i.projectId) : new ci(), c = new di();
8033
8113
  let d = null;
8034
- const g = new Ei(new wi(), {
8035
- version: _e,
8114
+ const g = new Ri(new Ti(), {
8115
+ version: fe,
8036
8116
  sendVersionHeader: is,
8037
8117
  getGatewayBaseUrls: () => [r.gatewayUrl],
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);
8118
+ onDeprecation: (I) => d == null ? void 0 : d.handleSdkVersionDeprecation(I),
8119
+ onUnsupported: (I) => d == null ? void 0 : d.handleSdkVersionUnsupported(I)
8120
+ }), u = new K(), _ = new Gi(), p = e == null ? void 0 : e.pinReuse, A = new Ot({ ttlMs: (p == null ? void 0 : p.mode) === "memory" ? p.ttlMs : void 0 }), S = new _i(r, g);
8041
8121
  let w;
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,
8122
+ i.useMockWallet ? (l.log("[CROSSx] Mock Wallet Provider 사용"), w = new Wi(a, A)) : i.walletServer === "one-wallet" ? (l.log("[CROSSx] one-wallet-api Wallet Provider 사용"), w = new Me({
8123
+ baseUrl: () => ce().oneWalletApiUrl,
8044
8124
  transport: g,
8045
- pinStore: I,
8046
- getAccessToken: () => d ? d.getOneIdAccessToken() : Promise.reject(new h(o.AUTH_NOT_INITIALIZED, "SDK가 아직 만들어지지 않았습니다"))
8047
- })) : (c.log("[CROSSx] Remote Wallet Provider 사용"), w = new V(
8125
+ pinStore: A,
8126
+ getAccessToken: () => d ? d.getOneIdAccessToken() : Promise.reject(new h(o.AUTH_NOT_INITIALIZED, "SDK가 아직 만들어지지 않았습니다")),
8127
+ // DPoP 에 묶인 세션(OSG 웹뷰)은 세션 통로가 DPoP 헤더 · 증명을 만든다 (DEV2TF-2950)
8128
+ getAuthorizationHeaders: (I) => d ? d.getOneIdAuthorizationHeaders(I) : Promise.reject(new h(o.AUTH_NOT_INITIALIZED, "SDK가 아직 만들어지지 않았습니다"))
8129
+ })) : (l.log("[CROSSx] Remote Wallet Provider 사용"), w = new V(
8048
8130
  r,
8049
8131
  a,
8050
8132
  g,
8051
8133
  _,
8052
- I,
8134
+ A,
8053
8135
  S
8054
8136
  ));
8055
8137
  const m = () => {
8056
- var A;
8057
- return ((A = d == null ? void 0 : d.isAuthenticatedViaRNBridge) == null ? void 0 : A.call(d)) ?? !1;
8138
+ var I;
8139
+ return ((I = d == null ? void 0 : d.isAuthenticatedViaRNBridge) == null ? void 0 : I.call(d)) ?? !1;
8058
8140
  }, f = () => {
8059
- var A;
8060
- return (A = d == null ? void 0 : d.assertRNBridgeSessionActive) == null ? void 0 : A.call(d);
8061
- }, E = (A) => {
8141
+ var I;
8142
+ return (I = d == null ? void 0 : d.assertRNBridgeSessionActive) == null ? void 0 : I.call(d);
8143
+ }, E = (I) => {
8062
8144
  var Q;
8063
- (Q = d == null ? void 0 : d.clearRNBridgeDelegation) == null || Q.call(d, A);
8145
+ (Q = d == null ? void 0 : d.clearRNBridgeDelegation) == null || Q.call(d, I);
8064
8146
  };
8065
- i.walletServer !== "one-wallet" && (w = new ki(
8147
+ i.walletServer !== "one-wallet" && (w = new Fi(
8066
8148
  w,
8067
8149
  () => {
8068
- var A;
8069
- return (A = d == null ? void 0 : d.getRNBridge) == null ? void 0 : A.call(d);
8150
+ var I;
8151
+ return (I = d == null ? void 0 : d.getRNBridge) == null ? void 0 : I.call(d);
8070
8152
  },
8071
8153
  m,
8072
8154
  f,
8073
8155
  () => i.appName,
8074
8156
  E
8075
8157
  ));
8076
- const T = new ne(r, g), y = Se(), R = e != null && e.ui ? e.ui({
8158
+ const T = new ae(r, g), y = ce(), R = e != null && e.ui ? e.ui({
8077
8159
  theme: i.theme ?? "light",
8078
8160
  themeTokens: i.themeTokens,
8079
8161
  displayDecimals: i.displayDecimals,
@@ -8082,11 +8164,11 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
8082
8164
  contentsBaseUrl: y.contentsBaseUrl,
8083
8165
  portraitBaseUrl: y.portraitBaseUrl
8084
8166
  }
8085
- }) : new Ui(), N = new bi(
8167
+ }) : new Bi(), N = new Hi(
8086
8168
  R,
8087
8169
  () => {
8088
- var A;
8089
- return (A = d == null ? void 0 : d.getRNBridge) == null ? void 0 : A.call(d);
8170
+ var I;
8171
+ return (I = d == null ? void 0 : d.getRNBridge) == null ? void 0 : I.call(d);
8090
8172
  },
8091
8173
  () => typeof window < "u" ? window.location.origin : "http://localhost",
8092
8174
  m
@@ -8094,61 +8176,61 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
8094
8176
  s,
8095
8177
  r,
8096
8178
  a,
8097
- l,
8179
+ c,
8098
8180
  g,
8099
8181
  u,
8100
8182
  w,
8101
8183
  _,
8102
8184
  O,
8103
8185
  T,
8104
- I,
8186
+ A,
8105
8187
  S,
8106
- new Hs(),
8188
+ new Gs(),
8107
8189
  e == null ? void 0 : e.oneIdSessions
8108
8190
  );
8109
- d = P, Wi(P, {
8191
+ d = P, Ki(P, {
8110
8192
  transport: g,
8111
8193
  storage: a,
8112
8194
  walletProvider: w,
8113
8195
  confirmation: O,
8114
8196
  tokenStore: _,
8115
- pinStore: I,
8197
+ pinStore: A,
8116
8198
  adapterConfig: r,
8117
8199
  pinEncryptor: S
8118
- }), Mi(P, (A) => P.reloadOneIdSession(A));
8200
+ }), Vi(P, (I) => P.reloadOneIdSession(I));
8119
8201
  const D = P.signInUseCase;
8120
8202
  return D && typeof D.setFreshTokenCallback == "function" && D.setFreshTokenCallback(() => P.requestFreshFirebaseIdTokenFromBridge()), typeof window < "u" && (window.__crossxSDK = P), P;
8121
8203
  }
8122
- const Zi = Fi;
8204
+ const nn = $i;
8123
8205
  export {
8124
8206
  cs as C,
8125
- Yi as D,
8207
+ Zi as D,
8126
8208
  o as E,
8127
8209
  Nt as M,
8128
8210
  Ce as O,
8129
8211
  Ot as P,
8130
- Li as T,
8212
+ Gi as T,
8131
8213
  Tt as W,
8132
8214
  $s as a,
8133
8215
  h as b,
8134
- Xi as c,
8135
- be as d,
8216
+ rn as c,
8217
+ Ue as d,
8136
8218
  ps as e,
8137
8219
  Fe as f,
8138
- zi as g,
8139
- $i as h,
8140
- he as i,
8220
+ tn as g,
8221
+ Xi as h,
8222
+ te as i,
8141
8223
  as as j,
8142
8224
  ws as k,
8143
8225
  et as l,
8144
- bs as m,
8226
+ Us as m,
8145
8227
  z as n,
8146
8228
  mt as o,
8147
- Fi as p,
8148
- Zi as q,
8149
- Ji as r,
8150
- Vi as s,
8229
+ $i as p,
8230
+ nn as q,
8231
+ sn as r,
8232
+ Ji as s,
8151
8233
  Ee as t,
8152
- qi as u,
8153
- ji as w
8234
+ Qi as u,
8235
+ en as w
8154
8236
  };