@nexus-cross/crossx-sdk-core 3.0.0-beta.3 → 3.0.0-beta.5

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.
@@ -16,7 +16,7 @@ class h extends Error {
16
16
  };
17
17
  }
18
18
  }
19
- const Ft = 2e3, Fe = 6e4, Bt = 1e3, Gt = 1e4, Kt = "0x77359400", Be = "0x3B9ACA00", Ge = 130, ut = 6, Ke = 18, He = 3e4, Ht = 300 * 1e3, Vt = 30 * 1e3, Ve = 100, $t = 300 * 1e3, $e = 60 * 1e3, le = "crossx-sdk-js/3.0.0-beta.3", Yt = "X-SDK-Version", qt = !1, jt = "x-sdk-deprecation", de = -10050, gt = "ONEpocket";
19
+ const Ft = 2e3, Fe = 6e4, Bt = 1e3, Gt = 1e4, Kt = "0x77359400", Be = "0x3B9ACA00", Ge = 130, ut = 6, Ke = 18, He = 3e4, Ht = 300 * 1e3, Vt = 30 * 1e3, Ve = 100, $t = 300 * 1e3, $e = 60 * 1e3, le = "crossx-sdk-js/3.0.0-beta.5", Yt = "X-SDK-Version", qt = !1, jt = "x-sdk-deprecation", de = -10050, gt = "ONEpocket";
20
20
  var Xt = /* @__PURE__ */ ((i) => (i.MetaMask = "io.metamask", i.Binance = "com.binance.wallet", i.CROSSx = "crossx", i))(Xt || {});
21
21
  const zt = {
22
22
  "io.metamask": "MetaMask",
@@ -28,7 +28,7 @@ const zt = {
28
28
  "com.binance.wallet"
29
29
  /* Binance */
30
30
  ];
31
- function Ii(i) {
31
+ function Ai(i) {
32
32
  return zt[i] ?? i;
33
33
  }
34
34
  function Zt(i) {
@@ -107,7 +107,7 @@ const fe = {
107
107
  rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
108
108
  testnet: !0
109
109
  }
110
- }, mi = Object.fromEntries(
110
+ }, Ii = Object.fromEntries(
111
111
  Object.entries(fe).map(([i, e]) => [i, e.caipId])
112
112
  ), ss = new Map(
113
113
  Object.values(fe).map((i) => [i.caipId, i])
@@ -1213,7 +1213,7 @@ function ie(i = 16) {
1213
1213
  const e = new Uint8Array(i);
1214
1214
  return crypto.getRandomValues(e), De(e);
1215
1215
  }
1216
- const fs = 300 * 1e3, ps = 600 * 1e3, Ee = "crossx.oneid.pending", Ss = 1e3, ws = 10;
1216
+ const fs = 300 * 1e3, ps = 600 * 1e3, Ee = "crossx.oneid.pending", Ss = 1e3;
1217
1217
  function Ze(i) {
1218
1218
  switch (i) {
1219
1219
  case "access_denied":
@@ -1228,7 +1228,7 @@ function Ze(i) {
1228
1228
  return o.ONEID_AUTHORIZATION_FAILED;
1229
1229
  }
1230
1230
  }
1231
- function Es(i) {
1231
+ function ws(i) {
1232
1232
  switch (i) {
1233
1233
  case "session_evicted":
1234
1234
  return o.ONEID_SESSION_EVICTED;
@@ -1265,7 +1265,7 @@ function Et(i) {
1265
1265
  return null;
1266
1266
  }
1267
1267
  }
1268
- function As(i) {
1268
+ function Es(i) {
1269
1269
  if (typeof i != "object" || i === null) return !1;
1270
1270
  const e = i.type;
1271
1271
  return e === us || e === wt;
@@ -1283,7 +1283,7 @@ function Qe(i, e) {
1283
1283
  scope: typeof i.scope == "string" ? i.scope : void 0
1284
1284
  };
1285
1285
  }
1286
- class Is {
1286
+ class As {
1287
1287
  constructor() {
1288
1288
  this.reason = null, this.onAbort = null;
1289
1289
  }
@@ -1296,7 +1296,7 @@ class Is {
1296
1296
  throw new h(o.USER_REJECTED, this.reason);
1297
1297
  }
1298
1298
  }
1299
- class ms {
1299
+ class Is {
1300
1300
  constructor(e = {}) {
1301
1301
  this.abortPending = null, this.popupSeq = 0, this.options = e;
1302
1302
  }
@@ -1326,7 +1326,7 @@ class ms {
1326
1326
  if (!e.clientId)
1327
1327
  throw new h(o.INVALID_CONFIG, "ONE ID clientId가 비어 있습니다");
1328
1328
  this.cancelPending("새 ONE ID 로그인 요청으로 이전 대기를 중단했습니다");
1329
- const r = new Is(), n = (a) => r.abort(a);
1329
+ const r = new As(), n = (a) => r.abort(a);
1330
1330
  this.abortPending = n;
1331
1331
  try {
1332
1332
  return t ? await this.authorizeWithPopup(t, { ...e, issuer: s }, r) : await this.authorizeWithRedirect({ ...e, issuer: s }, r);
@@ -1394,7 +1394,7 @@ class ms {
1394
1394
  if (!n.ok) {
1395
1395
  if (n.status === 400 && a.error === "invalid_grant") {
1396
1396
  const d = typeof a.error_reason == "string" ? a.error_reason : void 0;
1397
- throw new h(Es(d), "ONE ID 세션이 끝났습니다. 다시 로그인해 주세요.", {
1397
+ throw new h(ws(d), "ONE ID 세션이 끝났습니다. 다시 로그인해 주세요.", {
1398
1398
  error: "invalid_grant",
1399
1399
  error_reason: d
1400
1400
  });
@@ -1505,7 +1505,7 @@ class ms {
1505
1505
  const r = new URL(t.issuer).origin, n = `${t.issuer}${ds}`, a = ie(), l = ie(), d = ze(), g = await Je(d), u = await this.pushAuthorizationRequest(t, n, a, l, g);
1506
1506
  s.throwIfAborted(), c.log("[CROSSx] ONE ID 로그인 팝업 이동", { issuer: t.issuer, clientId: t.clientId }), e.location.href = this.authorizeUrl(t, u);
1507
1507
  const _ = await new Promise((A, E) => {
1508
- let w = 0, f = !0;
1508
+ let w = 0, f = 0;
1509
1509
  const S = () => {
1510
1510
  s.onAbort = null, clearTimeout(R), clearInterval(O), window.removeEventListener("message", C);
1511
1511
  }, I = (N) => {
@@ -1513,26 +1513,24 @@ class ms {
1513
1513
  }, R = setTimeout(() => {
1514
1514
  I(new h(o.ONEID_TIMEOUT, "ONE ID 로그인 응답 시간이 지났습니다"));
1515
1515
  }, fs), O = setInterval(() => {
1516
- if (!f) return;
1517
- w++;
1516
+ f++;
1518
1517
  let N;
1519
1518
  try {
1520
1519
  N = e.closed;
1521
1520
  } catch {
1522
- f = !1;
1523
1521
  return;
1524
1522
  }
1525
- if (!N) return;
1526
- const m = typeof document < "u" && document.hasFocus();
1527
- if (w <= ws && !m) {
1528
- c.warn("[CROSSx] ONE ID 팝업 closed 오탐 가능성(COOP) — 결과 대기 유지"), f = !1;
1529
- return;
1523
+ if (N) {
1524
+ if (w === 0) {
1525
+ w = f;
1526
+ return;
1527
+ }
1528
+ c.warn("[CROSSx] ONE ID 팝업이 닫혔거나 연결이 끊겼습니다(COOP) — 로그인을 취소합니다"), I(new h(o.USER_REJECTED, "ONE ID 로그인이 취소되었습니다", { reason: "popup_closed_or_detached" }));
1530
1529
  }
1531
- I(new h(o.USER_REJECTED, "ONE ID 로그인이 취소되었습니다"));
1532
1530
  }, Ss), C = (N) => {
1533
- if (N.origin !== r || N.source !== e || !As(N.data)) return;
1534
- const m = N.data;
1535
- if (m.state !== a) {
1531
+ if (N.origin !== r || N.source !== e || !Es(N.data)) return;
1532
+ const y = N.data;
1533
+ if (y.state !== a) {
1536
1534
  c.warn("[CROSSx] ONE ID 결과 state가 현재 요청과 달라 무시합니다");
1537
1535
  return;
1538
1536
  }
@@ -1540,25 +1538,25 @@ class ms {
1540
1538
  e.postMessage({ type: gs, state: a }, r);
1541
1539
  } catch {
1542
1540
  }
1543
- if (m.iss !== t.issuer) {
1541
+ if (y.iss !== t.issuer) {
1544
1542
  I(new h(o.ONEID_ISSUER_MISMATCH, "ONE ID 로그인 결과의 발급자가 다릅니다"));
1545
1543
  return;
1546
1544
  }
1547
- if (m.type === wt || m.error) {
1548
- const v = m.error ?? "unknown_error";
1545
+ if (y.type === wt || y.error) {
1546
+ const v = y.error ?? "unknown_error";
1549
1547
  c.warn("[CROSSx] ONE ID 인가 오류:", v), I(
1550
- new h(Ze(v), m.error_description || `ONE ID 인가 오류: ${v}`, {
1548
+ new h(Ze(v), y.error_description || `ONE ID 인가 오류: ${v}`, {
1551
1549
  error: v,
1552
- error_description: m.error_description
1550
+ error_description: y.error_description
1553
1551
  })
1554
1552
  );
1555
1553
  return;
1556
1554
  }
1557
- if (!m.code) {
1555
+ if (!y.code) {
1558
1556
  I(new h(o.ONEID_AUTHORIZATION_FAILED, "ONE ID 로그인 결과에 code가 없습니다"));
1559
1557
  return;
1560
1558
  }
1561
- S(), A(m.code);
1559
+ S(), A(y.code);
1562
1560
  };
1563
1561
  s.onAbort = (N) => {
1564
1562
  I(new h(o.USER_REJECTED, N));
@@ -1615,7 +1613,7 @@ const ne = "crossx.oneid.session", et = 60 * 1e3, Oe = /* @__PURE__ */ new Set([
1615
1613
  function tt(i) {
1616
1614
  return i instanceof h && Oe.has(i.code);
1617
1615
  }
1618
- class Ts {
1616
+ class ms {
1619
1617
  constructor(e, t, s, r = () => Date.now()) {
1620
1618
  this.port = e, this.config = t, this.storage = s, this.now = r, this.refreshing = null, this.generation = 0;
1621
1619
  }
@@ -1716,12 +1714,12 @@ function st(i) {
1716
1714
  expiresAt: i.tokens.expiresAt
1717
1715
  };
1718
1716
  }
1719
- function ys(i) {
1717
+ function Ts(i) {
1720
1718
  return i === "local" ? window.localStorage : window.sessionStorage;
1721
1719
  }
1722
- const Rs = new TextEncoder();
1720
+ const ys = new TextEncoder();
1723
1721
  function P(i) {
1724
- return Rs.encode(i);
1722
+ return ys.encode(i);
1725
1723
  }
1726
1724
  function F(...i) {
1727
1725
  const e = new Uint8Array(i.reduce((s, r) => s + r.length, 0));
@@ -1730,7 +1728,7 @@ function F(...i) {
1730
1728
  e.set(s, t), t += s.length;
1731
1729
  return e;
1732
1730
  }
1733
- function Ns(i) {
1731
+ function Rs(i) {
1734
1732
  return new Uint8Array([i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, i & 255]);
1735
1733
  }
1736
1734
  function U(i) {
@@ -1746,18 +1744,18 @@ function J(i) {
1746
1744
  function me(i) {
1747
1745
  return U(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1748
1746
  }
1749
- function Os(i) {
1747
+ function Ns(i) {
1750
1748
  let e = i.replace(/-/g, "+").replace(/_/g, "/");
1751
1749
  for (; e.length % 4; ) e += "=";
1752
1750
  return J(e);
1753
1751
  }
1754
- function Ps(i) {
1752
+ function Os(i) {
1755
1753
  return globalThis.crypto.getRandomValues(new Uint8Array(i));
1756
1754
  }
1757
1755
  async function At(i) {
1758
1756
  return new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", i));
1759
1757
  }
1760
- const x = globalThis.crypto.subtle, xe = { name: "ECDH", namedCurve: "P-256" }, Cs = 32, Ds = 12, xs = 32;
1758
+ const x = globalThis.crypto.subtle, xe = { name: "ECDH", namedCurve: "P-256" }, Ps = 32, Cs = 12, Ds = 32;
1761
1759
  function se(i) {
1762
1760
  return new Uint8Array([i >>> 8 & 255, i & 255]);
1763
1761
  }
@@ -1766,7 +1764,7 @@ async function It(i, e) {
1766
1764
  const t = i.length === 0 ? new Uint8Array(32) : i, s = await x.importKey("raw", t, { name: "HMAC", hash: "SHA-256" }, !1, ["sign"]);
1767
1765
  return new Uint8Array(await x.sign("HMAC", s, e));
1768
1766
  }
1769
- async function vs(i, e, t) {
1767
+ async function xs(i, e, t) {
1770
1768
  const s = new Uint8Array(t);
1771
1769
  let r = K;
1772
1770
  for (let n = 1, a = 0; a < t; n++)
@@ -1777,7 +1775,7 @@ function he(i, e, t, s) {
1777
1775
  return It(i, F(P("HPKE-v1"), s, P(e), t));
1778
1776
  }
1779
1777
  function Pe(i, e, t, s, r) {
1780
- return vs(i, F(se(s), P("HPKE-v1"), r, P(e), t), s);
1778
+ return xs(i, F(se(s), P("HPKE-v1"), r, P(e), t), s);
1781
1779
  }
1782
1780
  async function mt(i, e) {
1783
1781
  const t = await x.importKey("raw", e, xe, !1, []);
@@ -1785,10 +1783,10 @@ async function mt(i, e) {
1785
1783
  }
1786
1784
  async function Tt(i, e, t) {
1787
1785
  const s = await he(K, "eae_prk", i, rt);
1788
- return Pe(s, "shared_secret", F(e, t), xs, rt);
1786
+ return Pe(s, "shared_secret", F(e, t), Ds, rt);
1789
1787
  }
1790
1788
  async function yt(i) {
1791
- const e = await he(K, "psk_id_hash", K, Q), t = await he(K, "info_hash", K, Q), s = F(new Uint8Array([0]), e, t), r = await he(i, "secret", K, Q), n = await Pe(r, "key", s, Cs, Q), a = await Pe(r, "base_nonce", s, Ds, Q);
1789
+ const e = await he(K, "psk_id_hash", K, Q), t = await he(K, "info_hash", K, Q), s = F(new Uint8Array([0]), e, t), r = await he(i, "secret", K, Q), n = await Pe(r, "key", s, Ps, Q), a = await Pe(r, "base_nonce", s, Cs, Q);
1792
1790
  return { key: n, baseNonce: a };
1793
1791
  }
1794
1792
  function pe(i, e) {
@@ -1799,21 +1797,21 @@ async function Rt() {
1799
1797
  const i = await x.generateKey(xe, !1, ["deriveBits"]), e = new Uint8Array(await x.exportKey("raw", i.publicKey));
1800
1798
  return { privateKey: i.privateKey, publicKey: e };
1801
1799
  }
1802
- async function ks(i, e, t) {
1800
+ async function vs(i, e, t) {
1803
1801
  pe(i, "recipient public key");
1804
1802
  const s = await x.generateKey(xe, !0, ["deriveBits"]), r = new Uint8Array(await x.exportKey("raw", s.publicKey)), n = await Tt(await mt(s.privateKey, i), r, i), { key: a, baseNonce: l } = await yt(n), d = await x.importKey("raw", a, "AES-GCM", !1, ["encrypt"]), g = new Uint8Array(
1805
1803
  await x.encrypt({ name: "AES-GCM", iv: l, additionalData: t }, d, e)
1806
1804
  );
1807
1805
  return { enc: r, ciphertext: g };
1808
1806
  }
1809
- async function Us(i, e, t, s) {
1807
+ async function ks(i, e, t, s) {
1810
1808
  pe(e, "enc");
1811
1809
  const r = await Tt(await mt(i.privateKey, e), e, i.publicKey), { key: n, baseNonce: a } = await yt(r), l = await x.importKey("raw", n, "AES-GCM", !1, ["decrypt"]);
1812
1810
  return new Uint8Array(
1813
1811
  await x.decrypt({ name: "AES-GCM", iv: a, additionalData: s }, l, t)
1814
1812
  );
1815
1813
  }
1816
- const Nt = globalThis.crypto.subtle, bs = { name: "ECDSA", namedCurve: "P-256" }, Ls = "one-wallet/authz-sig/v1", Ws = "one-wallet/seal-aad/v1", Ms = 60, Fs = 32, Bs = {
1814
+ const Nt = globalThis.crypto.subtle, Us = { name: "ECDSA", namedCurve: "P-256" }, bs = "one-wallet/authz-sig/v1", Ls = "one-wallet/seal-aad/v1", Ws = 60, Ms = 32, Fs = {
1817
1815
  generate: 1,
1818
1816
  recover: 3,
1819
1817
  verify_pin: 4,
@@ -1827,33 +1825,33 @@ const Nt = globalThis.crypto.subtle, bs = { name: "ECDSA", namedCurve: "P-256" }
1827
1825
  sign_typed_data: 21,
1828
1826
  sign_message: 22
1829
1827
  };
1830
- function Gs(i) {
1831
- return F(Ns(i.length), i);
1828
+ function Bs(i) {
1829
+ return F(Rs(i.length), i);
1832
1830
  }
1833
1831
  function Ot(i, e, t) {
1834
- return F(P(i), ...e.map(Gs), new Uint8Array([t]));
1832
+ return F(P(i), ...e.map(Bs), new Uint8Array([t]));
1835
1833
  }
1836
- function Ks(i, e, t) {
1834
+ function Gs(i, e, t) {
1837
1835
  return Ot(
1838
- Ws,
1836
+ Ls,
1839
1837
  [i.nonce, P(i.expiresAt), i.intentHash, P(e), P(i.authzKeyId)],
1840
1838
  t
1841
1839
  );
1842
1840
  }
1843
- function Hs(i, e, t) {
1841
+ function Ks(i, e, t) {
1844
1842
  return Ot(
1845
- Ls,
1843
+ bs,
1846
1844
  [i.enc, i.ciphertext, i.nonce, P(i.expiresAt), i.intentHash, P(e), P(i.authzKeyId)],
1847
1845
  t
1848
1846
  );
1849
1847
  }
1850
- function Vs(i, e, t) {
1851
- return At(Ks(i, e, t));
1848
+ function Hs(i, e, t) {
1849
+ return At(Gs(i, e, t));
1852
1850
  }
1853
- function $s(i) {
1851
+ function Vs(i) {
1854
1852
  return i.toISOString().replace(/\.\d+Z$/, "Z");
1855
1853
  }
1856
- async function Ys(i, e) {
1854
+ async function $s(i, e) {
1857
1855
  if (i.length !== 32) throw new Error("authz private key must be a 32B P-256 scalar");
1858
1856
  return pe(e, "authz public key"), Nt.importKey(
1859
1857
  "jwk",
@@ -1865,22 +1863,22 @@ async function Ys(i, e) {
1865
1863
  d: me(i),
1866
1864
  ext: !1
1867
1865
  },
1868
- bs,
1866
+ Us,
1869
1867
  !1,
1870
1868
  ["sign"]
1871
1869
  );
1872
1870
  }
1873
- async function qs(i) {
1871
+ async function Ys(i) {
1874
1872
  if (i.intent.command !== i.command) throw new Error("intent.command must match command");
1875
- const e = Bs[i.command], t = P(JSON.stringify(i.intent)), s = {
1876
- nonce: Ps(Fs),
1877
- expiresAt: $s(new Date((i.now ?? /* @__PURE__ */ new Date()).getTime() + (i.ttlSec ?? Ms) * 1e3)),
1873
+ const e = Fs[i.command], t = P(JSON.stringify(i.intent)), s = {
1874
+ nonce: Os(Ms),
1875
+ expiresAt: Vs(new Date((i.now ?? /* @__PURE__ */ new Date()).getTime() + (i.ttlSec ?? Ws) * 1e3)),
1878
1876
  intentHash: await At(t),
1879
1877
  authzKeyId: i.authz.keyId
1880
- }, r = await Vs(s, i.bindingId, e), n = { pin: i.plaintext.pin };
1878
+ }, r = await Hs(s, i.bindingId, e), n = { pin: i.plaintext.pin };
1881
1879
  i.plaintext.new_pin != null && (n.new_pin = i.plaintext.new_pin), i.plaintext.share_c && (n.share_c = U(i.plaintext.share_c)), i.plaintext.response_key && (n.response_key = U(i.plaintext.response_key));
1882
- const { enc: a, ciphertext: l } = await ks(i.recipientPub, P(JSON.stringify(n)), r), d = new Uint8Array(
1883
- await Nt.sign({ name: "ECDSA", hash: "SHA-256" }, i.authz.signingKey, Hs({ ...s, enc: a, ciphertext: l }, i.bindingId, e))
1880
+ const { enc: a, ciphertext: l } = await vs(i.recipientPub, P(JSON.stringify(n)), r), d = new Uint8Array(
1881
+ await Nt.sign({ name: "ECDSA", hash: "SHA-256" }, i.authz.signingKey, Ks({ ...s, enc: a, ciphertext: l }, i.bindingId, e))
1884
1882
  );
1885
1883
  return {
1886
1884
  envelope: {
@@ -1898,17 +1896,17 @@ async function qs(i) {
1898
1896
  };
1899
1897
  }
1900
1898
  function Pt(i, e, t) {
1901
- return Us(i, J(e.enc), J(e.ciphertext), t);
1899
+ return ks(i, J(e.enc), J(e.ciphertext), t);
1902
1900
  }
1903
- const js = 90 * 1e3;
1904
- class Xs {
1901
+ const qs = 90 * 1e3;
1902
+ class js {
1905
1903
  constructor(e) {
1906
1904
  this.opts = e, this.current = null, this.pending = null, this.generation = 0, this.now = e.now ?? Date.now;
1907
1905
  }
1908
1906
  /** 쓸 수 있는 B 키. 없거나 만료가 가까우면 발급한다 */
1909
1907
  async get() {
1910
1908
  const e = this.current;
1911
- return e && e.expiresAtMs - this.now() > js ? e : (this.pending ?? (this.pending = this.issue().finally(() => {
1909
+ return e && e.expiresAtMs - this.now() > qs ? e : (this.pending ?? (this.pending = this.issue().finally(() => {
1912
1910
  this.pending = null;
1913
1911
  })), this.pending);
1914
1912
  }
@@ -1939,7 +1937,7 @@ class Xs {
1939
1937
  } catch (u) {
1940
1938
  throw new h(o.AUTH_FAILED, "failed to open sealed authz key", { cause: u });
1941
1939
  }
1942
- const a = await Ys(n, J(r.key_cert.pubkey));
1940
+ const a = await $s(n, J(r.key_cert.pubkey));
1943
1941
  n.fill(0);
1944
1942
  const l = Date.parse(r.key_cert.expires_at);
1945
1943
  if (Number.isNaN(l))
@@ -1955,7 +1953,7 @@ class Xs {
1955
1953
  return this.current = d, d;
1956
1954
  }
1957
1955
  }
1958
- const zs = 600 * 1e3, Js = {
1956
+ const Xs = 600 * 1e3, zs = {
1959
1957
  UNAUTHORIZED: o.AUTH_TOKEN_INVALID,
1960
1958
  AUTHZ_TOKEN_INVALID: o.AUTH_TOKEN_INVALID,
1961
1959
  FORBIDDEN: o.AUTH_FAILED,
@@ -1991,11 +1989,11 @@ const zs = 600 * 1e3, Js = {
1991
1989
  ENVELOPE_INVALID: o.SIGNATURE_FAILED,
1992
1990
  REPLAY: o.SIGNATURE_FAILED
1993
1991
  };
1994
- function Zs(i, e) {
1995
- const t = (e == null ? void 0 : e.code) ?? "", s = Js[t] ?? (i === 401 ? o.AUTH_TOKEN_INVALID : i >= 500 ? o.GATEWAY_INTERNAL_ERROR : o.UNKNOWN_ERROR), r = { status: i, serverCode: t };
1992
+ function Js(i, e) {
1993
+ const t = (e == null ? void 0 : e.code) ?? "", s = zs[t] ?? (i === 401 ? o.AUTH_TOKEN_INVALID : i >= 500 ? o.GATEWAY_INTERNAL_ERROR : o.UNKNOWN_ERROR), r = { status: i, serverCode: t };
1996
1994
  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);
1997
1995
  }
1998
- class Qs {
1996
+ class Zs {
1999
1997
  constructor(e) {
2000
1998
  this.opts = e, this.recipient = null, this.now = e.now ?? Date.now;
2001
1999
  }
@@ -2010,7 +2008,7 @@ class Qs {
2010
2008
  }
2011
2009
  /** enclave 수신 공개키(SEC1 65B) */
2012
2010
  async getRecipientKey() {
2013
- if (this.recipient && this.now() - this.recipient.fetchedAt < zs)
2011
+ if (this.recipient && this.now() - this.recipient.fetchedAt < Xs)
2014
2012
  return this.recipient.key;
2015
2013
  const e = await this.callPublic("GET", "/attestation");
2016
2014
  if (!(e != null && e.recipient_public_key))
@@ -2038,21 +2036,21 @@ class Qs {
2038
2036
  throw new h(o.NETWORK_ERROR, "one-wallet-api request failed", { cause: l });
2039
2037
  }
2040
2038
  if (a.status < 200 || a.status >= 300)
2041
- throw Zs(a.status, a.data);
2039
+ throw Js(a.status, a.data);
2042
2040
  return a.data;
2043
2041
  }
2044
2042
  }
2045
- const Te = (i) => `m/44'/60'/0'/0/${i}`, er = /^0x(?:[0-9a-fA-F]{2})*$/;
2046
- function tr(i) {
2043
+ const Te = (i) => `m/44'/60'/0'/0/${i}`, Qs = /^0x(?:[0-9a-fA-F]{2})*$/;
2044
+ function er(i) {
2047
2045
  try {
2048
- const e = JSON.parse(new TextDecoder().decode(Os(i.split(".")[1] ?? "")));
2046
+ const e = JSON.parse(new TextDecoder().decode(Ns(i.split(".")[1] ?? "")));
2049
2047
  if (typeof (e == null ? void 0 : e.sub) == "string" && e.sub) return e.sub;
2050
2048
  } catch {
2051
2049
  }
2052
2050
  throw new h(o.AUTH_TOKEN_INVALID, "access token has no sub");
2053
2051
  }
2054
- function sr(i) {
2055
- if (er.test(i)) {
2052
+ function tr(i) {
2053
+ if (Qs.test(i)) {
2056
2054
  const e = i.slice(2);
2057
2055
  return Uint8Array.from({ length: e.length / 2 }, (t, s) => parseInt(e.slice(s * 2, s * 2 + 2), 16));
2058
2056
  }
@@ -2080,12 +2078,12 @@ function nt(i, e) {
2080
2078
  }
2081
2079
  class Ct {
2082
2080
  constructor(e) {
2083
- this.opts = e, this.walletAddress = null, this.client = new Qs({
2081
+ this.opts = e, this.walletAddress = null, this.client = new Zs({
2084
2082
  baseUrl: e.baseUrl,
2085
2083
  transport: e.transport,
2086
2084
  getAccessToken: e.getAccessToken,
2087
2085
  now: e.now
2088
- }), this.authzKeys = new Xs({ client: this.client, getIssuanceJwt: e.getAccessToken, now: e.now });
2086
+ }), this.authzKeys = new js({ client: this.client, getIssuanceJwt: e.getAccessToken, now: e.now });
2089
2087
  }
2090
2088
  async checkWallet() {
2091
2089
  return await this.findWallet() ? "exists" : "not_found";
@@ -2094,7 +2092,7 @@ class Ct {
2094
2092
  if (this.walletAddress) return this.walletData(this.walletAddress);
2095
2093
  const t = await this.findWallet();
2096
2094
  if (t) return this.walletData(t.address);
2097
- const s = this.requirePin(), r = tr(await this.opts.getAccessToken()), n = await Rt(), { result: a, aad: l } = await this.withEnvelope(
2095
+ const s = this.requirePin(), r = er(await this.opts.getAccessToken()), n = await Rt(), { result: a, aad: l } = await this.withEnvelope(
2098
2096
  "generate",
2099
2097
  r,
2100
2098
  { command: "generate" },
@@ -2134,7 +2132,7 @@ class Ct {
2134
2132
  const l = await this.resolveTarget(r, a), { result: d } = await this.withEnvelope(
2135
2133
  "sign_message",
2136
2134
  l.address,
2137
- { command: "sign_message", index: l.index, message: U(sr(s)) },
2135
+ { command: "sign_message", index: l.index, message: U(tr(s)) },
2138
2136
  { pin: this.requirePin() },
2139
2137
  (g, u) => this.client.call("POST", `/wallets/${l.address}/signatures`, { type: "message", envelope: g, intent: u })
2140
2138
  );
@@ -2224,7 +2222,7 @@ class Ct {
2224
2222
  async withEnvelope(e, t, s, r, n) {
2225
2223
  var a;
2226
2224
  for (let l = 0; ; l++) {
2227
- const d = await qs({
2225
+ const d = await Ys({
2228
2226
  recipientPub: await this.client.getRecipientKey(),
2229
2227
  bindingId: t,
2230
2228
  command: e,
@@ -2245,11 +2243,11 @@ class Ct {
2245
2243
  }
2246
2244
  }
2247
2245
  }
2248
- const rr = 3, ir = /^0x(?:[0-9a-fA-F]{2}){4,}$/;
2249
- function nr(i) {
2250
- return i.code === rr || /execution reverted/i.test(i.message ?? "");
2246
+ const sr = 3, rr = /^0x(?:[0-9a-fA-F]{2}){4,}$/;
2247
+ function ir(i) {
2248
+ return i.code === sr || /execution reverted/i.test(i.message ?? "");
2251
2249
  }
2252
- class ar {
2250
+ class nr {
2253
2251
  constructor(e, t) {
2254
2252
  this.chainRegistry = e, this.transport = t, this._nextId = 1;
2255
2253
  }
@@ -2274,8 +2272,8 @@ class ar {
2274
2272
  body: n
2275
2273
  })).data;
2276
2274
  if (l != null && l.error) {
2277
- const { code: d, message: g } = l.error, u = { method: e, chainId: s, code: d, message: g, data: l.error.data }, _ = nr(l.error);
2278
- throw _ && typeof u.data == "string" && ir.test(u.data) && (u.revertData = u.data, u.selector = u.data.slice(0, 10).toLowerCase()), new h(
2275
+ const { code: d, message: g } = l.error, u = { method: e, chainId: s, code: d, message: g, data: l.error.data }, _ = ir(l.error);
2276
+ throw _ && typeof u.data == "string" && rr.test(u.data) && (u.revertData = u.data, u.selector = u.data.slice(0, 10).toLowerCase()), new h(
2279
2277
  _ ? o.EXECUTION_REVERTED : o.UNKNOWN_ERROR,
2280
2278
  `RPC 오류 [${e}] (${s}): ${g} (코드: ${d})`,
2281
2279
  u
@@ -2284,7 +2282,7 @@ class ar {
2284
2282
  return l == null ? void 0 : l.result;
2285
2283
  }
2286
2284
  }
2287
- class or {
2285
+ class ar {
2288
2286
  constructor() {
2289
2287
  this.listeners = /* @__PURE__ */ new Map();
2290
2288
  }
@@ -2307,7 +2305,7 @@ class or {
2307
2305
  this.listeners.clear();
2308
2306
  }
2309
2307
  }
2310
- function cr() {
2308
+ function or() {
2311
2309
  var e;
2312
2310
  if (typeof globalThis < "u" && ((e = globalThis.crypto) != null && e.getRandomValues)) {
2313
2311
  const t = new Uint8Array(16);
@@ -2377,7 +2375,7 @@ class b {
2377
2375
  async handshake() {
2378
2376
  if (!this.bridge)
2379
2377
  throw new h(o.AUTH_NOT_INITIALIZED, "Bridge not initialized");
2380
- const e = cr(), t = Date.now(), s = {
2378
+ const e = or(), t = Date.now(), s = {
2381
2379
  version: 1,
2382
2380
  appId: this.config.appId,
2383
2381
  appVersion: this.config.appVersion,
@@ -2574,7 +2572,7 @@ const z = {
2574
2572
  oneWalletApiUrl: "https://dev-one-pocket-api.onechain.nexus/embed/v1"
2575
2573
  }
2576
2574
  };
2577
- function lr(i) {
2575
+ function cr(i) {
2578
2576
  const e = i.environment, t = e && e in z ? z[e] : null;
2579
2577
  if (!t)
2580
2578
  return null;
@@ -2589,7 +2587,7 @@ function lr(i) {
2589
2587
  function ue() {
2590
2588
  try {
2591
2589
  if (typeof __CROSSX_CONFIG__ < "u") {
2592
- const i = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = lr(i);
2590
+ const i = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = cr(i);
2593
2591
  if (e) return e;
2594
2592
  }
2595
2593
  } catch {
@@ -2607,7 +2605,7 @@ function Dt(i) {
2607
2605
  for (; e > 0 && i.charCodeAt(e - 1) === 48; ) e--;
2608
2606
  return i.slice(0, e);
2609
2607
  }
2610
- function hr(i, e = ut) {
2608
+ function lr(i, e = ut) {
2611
2609
  if (!i || i === "0x0" || i === "0x") return "0";
2612
2610
  try {
2613
2611
  const t = BigInt(i);
@@ -2629,7 +2627,7 @@ function ae(i, e, t, s = ut) {
2629
2627
  return;
2630
2628
  }
2631
2629
  }
2632
- function dr(i) {
2630
+ function hr(i) {
2633
2631
  const e = i.startsWith("0x") ? i.slice(2) : i;
2634
2632
  if (!/^[0-9a-fA-F]+$/.test(e))
2635
2633
  throw new h(
@@ -2642,7 +2640,7 @@ function dr(i) {
2642
2640
  `서명 길이가 유효하지 않습니다: ${Ge} hex 문자(65 바이트) 예상, 현재 ${e.length}`
2643
2641
  );
2644
2642
  }
2645
- function ur(i) {
2643
+ function dr(i) {
2646
2644
  const e = i.startsWith("0x") ? i.slice(2) : i;
2647
2645
  if (!/^[0-9a-fA-F]+$/.test(e))
2648
2646
  throw new h(
@@ -2655,8 +2653,8 @@ function ur(i) {
2655
2653
  "유효하지 않은 서명된 트랜잭션: 너무 짧습니다"
2656
2654
  );
2657
2655
  }
2658
- function gr(i, e) {
2659
- const t = _r(e);
2656
+ function ur(i, e) {
2657
+ const t = gr(e);
2660
2658
  if (i === "0") {
2661
2659
  if (t !== void 0 && t !== 0)
2662
2660
  throw new h(
@@ -2680,7 +2678,7 @@ function gr(i, e) {
2680
2678
  );
2681
2679
  }
2682
2680
  }
2683
- function _r(i) {
2681
+ function gr(i) {
2684
2682
  if (i == null || typeof i != "object") return;
2685
2683
  const e = i.domain;
2686
2684
  if (e == null || typeof e != "object") return;
@@ -2689,7 +2687,7 @@ function _r(i) {
2689
2687
  const s = Number(t);
2690
2688
  return Number.isFinite(s) ? s : void 0;
2691
2689
  }
2692
- const Ti = 900 * 1e3, fr = /* @__PURE__ */ new Set([
2690
+ const mi = 900 * 1e3, _r = /* @__PURE__ */ new Set([
2693
2691
  "095ea7b3",
2694
2692
  // approve(address,uint256)
2695
2693
  "a22cb465",
@@ -2700,7 +2698,7 @@ const Ti = 900 * 1e3, fr = /* @__PURE__ */ new Set([
2700
2698
  // increaseApproval(address,uint256) — 예전 OpenZeppelin
2701
2699
  "87517c45"
2702
2700
  // Permit2 approve(address,address,uint160,uint48)
2703
- ]), pr = /* @__PURE__ */ new Set([
2701
+ ]), fr = /* @__PURE__ */ new Set([
2704
2702
  "Permit",
2705
2703
  "PermitSingle",
2706
2704
  "PermitBatch",
@@ -2709,22 +2707,22 @@ const Ti = 900 * 1e3, fr = /* @__PURE__ */ new Set([
2709
2707
  "PermitWitnessTransferFrom",
2710
2708
  "PermitBatchWitnessTransferFrom"
2711
2709
  ]);
2712
- function Sr(i) {
2710
+ function pr(i) {
2713
2711
  var s;
2714
2712
  const { action: e, context: t } = i;
2715
2713
  if (e === "sign" || e === "send") {
2716
2714
  const r = (s = t.tx) == null ? void 0 : s.data;
2717
2715
  if (typeof r != "string") return !1;
2718
2716
  const n = r.trim().toLowerCase().replace(/^0x/, "");
2719
- return n.length >= 8 && fr.has(n.slice(0, 8));
2717
+ return n.length >= 8 && _r.has(n.slice(0, 8));
2720
2718
  }
2721
2719
  if (e === "sign-typed-data") {
2722
- const r = wr(t.typedData);
2723
- return r === null || pr.has(r);
2720
+ const r = Sr(t.typedData);
2721
+ return r === null || fr.has(r);
2724
2722
  }
2725
2723
  return !1;
2726
2724
  }
2727
- function wr(i) {
2725
+ function Sr(i) {
2728
2726
  let e = i;
2729
2727
  if (typeof e == "string")
2730
2728
  try {
@@ -2738,13 +2736,13 @@ function wr(i) {
2738
2736
  }
2739
2737
  return null;
2740
2738
  }
2741
- function Er(i, e, t, s) {
2739
+ function wr(i, e, t, s) {
2742
2740
  if (!i) return !0;
2743
2741
  if (i.mode === "off" || e === null) return !1;
2744
2742
  const r = t - e;
2745
- return r < 0 || r >= i.ttlMs ? !1 : !Sr(s);
2743
+ return r < 0 || r >= i.ttlMs ? !1 : !pr(s);
2746
2744
  }
2747
- function Ar(i) {
2745
+ function Er(i) {
2748
2746
  return (i == null ? void 0 : i.mode) === "off";
2749
2747
  }
2750
2748
  class X {
@@ -2759,12 +2757,12 @@ class X {
2759
2757
  var s, r;
2760
2758
  if (!this.deps.pinStore.has()) return;
2761
2759
  const t = (r = (s = this.deps).getPinReusePolicy) == null ? void 0 : r.call(s);
2762
- Er(t, this.deps.pinStore.getSetAt(), Date.now(), e) || this.deps.pinStore.clear();
2760
+ wr(t, this.deps.pinStore.getSetAt(), Date.now(), e) || this.deps.pinStore.clear();
2763
2761
  }
2764
2762
  /** 서명이 끝난 뒤 — 서명마다 PIN 을 받는 정책이면 PIN 을 메모리에 남기지 않는다. */
2765
2763
  finishSigning() {
2766
2764
  var e, t;
2767
- Ar((t = (e = this.deps).getPinReusePolicy) == null ? void 0 : t.call(e)) && this.deps.pinStore.clear();
2765
+ Er((t = (e = this.deps).getPinReusePolicy) == null ? void 0 : t.call(e)) && this.deps.pinStore.clear();
2768
2766
  }
2769
2767
  /** PIN 재사용 정책이 있으면 true — 서명을 하나씩 처리해야 한다 (SigningOrchestrator). */
2770
2768
  hasReusePolicy() {
@@ -2922,7 +2920,7 @@ class X {
2922
2920
  return { ok: !1, error: r, ...n };
2923
2921
  }
2924
2922
  }
2925
- class Ir {
2923
+ class Ar {
2926
2924
  constructor(e) {
2927
2925
  this.deps = e, this.signingQueue = Promise.resolve();
2928
2926
  }
@@ -2961,10 +2959,10 @@ class Ir {
2961
2959
  }
2962
2960
  }
2963
2961
  }
2964
- function mr(i) {
2962
+ function Ir(i) {
2965
2963
  return i === "google" || i === "apple";
2966
2964
  }
2967
- class Tr {
2965
+ class mr {
2968
2966
  constructor(e) {
2969
2967
  this.deps = e;
2970
2968
  }
@@ -2975,7 +2973,7 @@ class Tr {
2975
2973
  this.deps.setRecoveringSession(!0);
2976
2974
  try {
2977
2975
  this.deps.setAuthenticated(!1), this.deps.clearTokenStore();
2978
- const r = mr(e.loginType) ? { provider: e.loginType } : void 0;
2976
+ const r = Ir(e.loginType) ? { provider: e.loginType } : void 0;
2979
2977
  let n;
2980
2978
  try {
2981
2979
  n = await this.deps.executeSignIn(r);
@@ -3055,7 +3053,7 @@ class Tr {
3055
3053
  }
3056
3054
  }
3057
3055
  }
3058
- class yr {
3056
+ class Tr {
3059
3057
  constructor(e) {
3060
3058
  this.deps = e;
3061
3059
  }
@@ -3102,7 +3100,7 @@ class yr {
3102
3100
  c.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", l.address), this.deps.setActiveWallet(l.address, 0);
3103
3101
  }
3104
3102
  }
3105
- class Rr {
3103
+ class yr {
3106
3104
  constructor(e) {
3107
3105
  this.deps = e;
3108
3106
  }
@@ -3259,7 +3257,7 @@ class Rr {
3259
3257
  }
3260
3258
  }
3261
3259
  }
3262
- class Nr {
3260
+ class Rr {
3263
3261
  constructor(e) {
3264
3262
  this.deps = e;
3265
3263
  }
@@ -3300,7 +3298,7 @@ class Nr {
3300
3298
  return !a && l && (d.maxPriorityFeePerGas = Be, c.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), d;
3301
3299
  }
3302
3300
  }
3303
- class Or {
3301
+ class Nr {
3304
3302
  constructor(e) {
3305
3303
  this.crypto = e;
3306
3304
  }
@@ -3326,10 +3324,10 @@ class Or {
3326
3324
  }
3327
3325
  }
3328
3326
  }
3329
- function Pr(i) {
3327
+ function Or(i) {
3330
3328
  return i ? i.includes("google") ? "google" : i.includes("apple") ? "apple" : i : null;
3331
3329
  }
3332
- class Cr {
3330
+ class Pr {
3333
3331
  constructor(e) {
3334
3332
  this.deps = e;
3335
3333
  }
@@ -3351,7 +3349,7 @@ class Cr {
3351
3349
  activeWalletIndex: 0,
3352
3350
  userEmail: ((n = e.user) == null ? void 0 : n.email) ?? null,
3353
3351
  providerSub: ((a = e.user) == null ? void 0 : a.providerSub) ?? null,
3354
- loginType: Pr(
3352
+ loginType: Or(
3355
3353
  (l = e.user) == null ? void 0 : l.signInProvider
3356
3354
  ),
3357
3355
  tokenSignatureVerified: e.tokenSignatureVerified ?? !1
@@ -3380,7 +3378,7 @@ class Cr {
3380
3378
  });
3381
3379
  }
3382
3380
  }
3383
- class Dr {
3381
+ class Cr {
3384
3382
  constructor(e) {
3385
3383
  this.deps = e;
3386
3384
  }
@@ -3401,7 +3399,7 @@ class Dr {
3401
3399
  )).address, index: e };
3402
3400
  }
3403
3401
  }
3404
- class xr {
3402
+ class Dr {
3405
3403
  constructor(e) {
3406
3404
  this.deps = e;
3407
3405
  }
@@ -3420,7 +3418,7 @@ class xr {
3420
3418
  );
3421
3419
  }
3422
3420
  }
3423
- class vr {
3421
+ class xr {
3424
3422
  constructor(e) {
3425
3423
  this.deps = e;
3426
3424
  }
@@ -3484,7 +3482,7 @@ function at(i, e) {
3484
3482
  const t = i.replace(/\/$/, ""), s = e.startsWith("/") ? e : `/${e}`;
3485
3483
  return `${t}/cross-auth${s}`;
3486
3484
  }
3487
- class kr {
3485
+ class vr {
3488
3486
  constructor(e) {
3489
3487
  this.deps = e;
3490
3488
  }
@@ -3632,10 +3630,10 @@ function ye(i, e = "Apple account") {
3632
3630
  const s = i.substring(0, t), r = i.substring(t);
3633
3631
  return s.length <= 1 ? `${s}${"*".repeat(Math.max(s.length, 1))}${r}` : `${s[0]}${"*".repeat(s.length - 1)}${r}`;
3634
3632
  }
3635
- const W = class W extends or {
3633
+ const W = class W extends ar {
3636
3634
  constructor(e, t, s, r, n, a, l, d, g, u, _, p, A) {
3637
3635
  var E, w;
3638
- super(), this.storage = s, this.crypto = r, this.transport = n, this.oauth = a, this.walletProvider = l, this.tokenStore = d, this.pinEncryptor = p, this.oneIdAuth = A, this._warnedUnknownNativeCurrency = /* @__PURE__ */ new Set(), this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._rnBridgeService = null, this._providers = /* @__PURE__ */ new Map(), this._isAuthenticatedViaRNBridge = !1, this._bridgeSessionRestorePromise = null, this._sdkDeprecationNotified = !1, this._sdkUnsupportedNotified = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = t, e.logger && Ye(e.logger), this.confirmation = g, this.pinStore = _ ?? new St(), this.stateManager = new Cr({
3636
+ super(), this.storage = s, this.crypto = r, this.transport = n, this.oauth = a, this.walletProvider = l, this.tokenStore = d, this.pinEncryptor = p, this.oneIdAuth = A, this._warnedUnknownNativeCurrency = /* @__PURE__ */ new Set(), this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._rnBridgeService = null, this._providers = /* @__PURE__ */ new Map(), this._isAuthenticatedViaRNBridge = !1, this._bridgeSessionRestorePromise = null, this._sdkDeprecationNotified = !1, this._sdkUnsupportedNotified = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = t, e.logger && Ye(e.logger), this.confirmation = g, this.pinStore = _ ?? new St(), this.stateManager = new Pr({
3639
3637
  setState: (f) => {
3640
3638
  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);
3641
3639
  },
@@ -3669,19 +3667,19 @@ const W = class W extends or {
3669
3667
  // WebView 안에서 embedded PIN 프롬프트가 뜨지 않도록 게이팅. SigningOrchestrator 와 동일 신호.
3670
3668
  isRNBridgeMode: () => this._isAuthenticatedViaRNBridge,
3671
3669
  getPinReusePolicy: () => this.internalConfig.pinReuse
3672
- }), this.signingOrchestrator = new Ir({
3670
+ }), this.signingOrchestrator = new Ar({
3673
3671
  confirmation: this.confirmation,
3674
3672
  walletProvider: this.walletProvider,
3675
3673
  pinOrchestrator: this.pinOrchestrator,
3676
3674
  // §12 native sign delegation: 이 SDK 세션이 RN bridge 자동 로그인으로 인증된 경우만 활성.
3677
3675
  // 자동 로그인 거부 / OAuth 로 별도 로그인한 세션에서는 native SDK 가 미인증이라 우회한다.
3678
3676
  isRNBridgeMode: () => this._isAuthenticatedViaRNBridge
3679
- }), this.walletLifecycleService = new yr({
3677
+ }), this.walletLifecycleService = new Tr({
3680
3678
  walletProvider: this.walletProvider,
3681
3679
  pinOrchestrator: this.pinOrchestrator,
3682
3680
  getUserId: () => this.userId,
3683
3681
  setActiveWallet: (f, S, I) => this.setActiveWallet(f, S, I)
3684
- }), this.migrationOrchestrator = new Rr({
3682
+ }), this.migrationOrchestrator = new yr({
3685
3683
  confirmation: this.confirmation,
3686
3684
  walletProvider: this.walletProvider,
3687
3685
  pinOrchestrator: this.pinOrchestrator,
@@ -3695,12 +3693,12 @@ const W = class W extends or {
3695
3693
  var f;
3696
3694
  return ((f = this._config.migration) == null ? void 0 : f.allowSkip) ?? !0;
3697
3695
  }
3698
- }), this.transactionLifecycleService = new Nr({
3696
+ }), this.transactionLifecycleService = new Rr({
3699
3697
  getActiveAddress: () => this.address,
3700
3698
  estimateGas: (f, S) => this.estimateGas(f, S),
3701
3699
  getBaseFeePerGas: (f) => this.getBaseFeePerGas(f),
3702
3700
  jsonRpcCall: (f, S, I) => this.jsonRpc.call(f, S, I)
3703
- }), this.signatureVerifier = new Or(this.crypto), this.addressResolverService = new Dr({
3701
+ }), this.signatureVerifier = new Nr(this.crypto), this.addressResolverService = new Cr({
3704
3702
  walletProvider: this.walletProvider,
3705
3703
  pinOrchestrator: this.pinOrchestrator,
3706
3704
  getActiveAddress: () => this.address,
@@ -3708,10 +3706,10 @@ const W = class W extends or {
3708
3706
  getUserId: () => this.userId,
3709
3707
  // one-wallet: 지갑은 처음 쓸 때 만든다 (DEV2TF-2755)
3710
3708
  ensureWallet: this.usesOneWallet ? () => this.walletCreationService.createWallet().then((f) => f.address) : void 0
3711
- }), this.authGuardService = new xr({
3709
+ }), this.authGuardService = new Dr({
3712
3710
  isInitialized: () => this.initialized,
3713
3711
  isAuthenticated: () => this.authenticated
3714
- }), this.walletCreationService = new vr({
3712
+ }), this.walletCreationService = new xr({
3715
3713
  walletProvider: this.walletProvider,
3716
3714
  pinOrchestrator: this.pinOrchestrator,
3717
3715
  migrationOrchestrator: this.migrationOrchestrator,
@@ -3723,10 +3721,10 @@ const W = class W extends or {
3723
3721
  var f, S;
3724
3722
  return ((S = (f = this.confirmation).showWalletCreatedPrompt) == null ? void 0 : S.call(f)) ?? Promise.resolve();
3725
3723
  }
3726
- }), this.tokenHistoryService = new kr({
3724
+ }), this.tokenHistoryService = new vr({
3727
3725
  transport: n,
3728
3726
  getApiBaseUrl: () => this.internalConfig.authApiUrl
3729
- }), this.sessionOrchestrator = new Tr({
3727
+ }), this.sessionOrchestrator = new mr({
3730
3728
  ensureInitialized: () => this.ensureInitialized(),
3731
3729
  getSessionSnapshot: () => ({
3732
3730
  providerSub: this.providerSub,
@@ -3749,7 +3747,7 @@ const W = class W extends or {
3749
3747
  loadWalletAfterAuth: () => this.walletLifecycleService.loadWalletAfterAuth(),
3750
3748
  getLocale: () => this._config.locale,
3751
3749
  maskEmail: ye
3752
- }), this.chainRegistry = u, this.jsonRpc = new ar(u, n), this.signInUseCase = new Ne(
3750
+ }), this.chainRegistry = u, this.jsonRpc = new nr(u, n), this.signInUseCase = new Ne(
3753
3751
  this.internalConfig,
3754
3752
  s,
3755
3753
  r,
@@ -3854,12 +3852,12 @@ const W = class W extends or {
3854
3852
  }
3855
3853
  async _doInitialize(e) {
3856
3854
  var t, s;
3857
- c.log("[CROSSx SDK] v3.0.0-beta.3 초기화 중..."), this.confirmation.setMessages(M(this._config.locale));
3855
+ c.log("[CROSSx SDK] v3.0.0-beta.5 초기화 중..."), this.confirmation.setMessages(M(this._config.locale));
3858
3856
  try {
3859
3857
  const r = ue();
3860
3858
  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) {
3861
3859
  const g = await this.restoreOneWalletSession();
3862
- return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.3 초기화 완료 (one-wallet)"), this.emit("initialized", { restored: !!(g != null && g.success) }), g;
3860
+ return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.5 초기화 완료 (one-wallet)"), this.emit("initialized", { restored: !!(g != null && g.success) }), g;
3863
3861
  }
3864
3862
  const n = this._config.persistWalletPreference !== !1 ? await this.storage.get(
3865
3863
  W.WALLET_PREF_KEY
@@ -3893,7 +3891,7 @@ const W = class W extends or {
3893
3891
  throw _;
3894
3892
  }
3895
3893
  }
3896
- return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.3 초기화 완료"), this.emit("initialized", { restored: !!(d != null && d.success) }), d ?? null;
3894
+ return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.5 초기화 완료"), this.emit("initialized", { restored: !!(d != null && d.success) }), d ?? null;
3897
3895
  } catch (r) {
3898
3896
  throw new h(o.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", r);
3899
3897
  }
@@ -3913,7 +3911,7 @@ const W = class W extends or {
3913
3911
  c.log("[CROSSx] RN Bridge 감지 — Handshake 시도"), c.info("[CROSSx][RNBridge trace] Bootstrap config", {
3914
3912
  appId: this._config.projectId,
3915
3913
  appVersion: "1.0.0",
3916
- sdkVersion: "3.0.0-beta.3",
3914
+ sdkVersion: "3.0.0-beta.5",
3917
3915
  keyId: "key-id-1",
3918
3916
  userIdHash: "user-hash-placeholder",
3919
3917
  projectId: this._config.projectId
@@ -3921,7 +3919,7 @@ const W = class W extends or {
3921
3919
  const e = new b({
3922
3920
  appId: this._config.projectId,
3923
3921
  appVersion: "1.0.0",
3924
- sdkVersion: "3.0.0-beta.3",
3922
+ sdkVersion: "3.0.0-beta.5",
3925
3923
  keyId: "key-id-1",
3926
3924
  userIdHash: "user-hash-placeholder",
3927
3925
  projectId: this._config.projectId
@@ -4370,10 +4368,10 @@ const W = class W extends or {
4370
4368
  "ONE ID issuer가 정해지지 않았습니다. SDKConfig.oneId.issuer를 지정하세요"
4371
4369
  );
4372
4370
  const s = { issuer: t, clientId: e.clientId, scope: e.scope };
4373
- return this._oneIdSessions ?? (this._oneIdSessions = new Ts(
4371
+ return this._oneIdSessions ?? (this._oneIdSessions = new ms(
4374
4372
  this.oneIdAuth,
4375
4373
  s,
4376
- ys(e.storage)
4374
+ Ts(e.storage)
4377
4375
  )), { port: this.oneIdAuth, config: s, sessions: this._oneIdSessions };
4378
4376
  }
4379
4377
  async signOut() {
@@ -4878,7 +4876,7 @@ const W = class W extends or {
4878
4876
  throw new h(o.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
4879
4877
  if (!this.walletProvider.signTypedData)
4880
4878
  throw new h(o.NOT_IMPLEMENTED, "signTypedData가 구현되어 있지 않습니다");
4881
- gr(e, t);
4879
+ ur(e, t);
4882
4880
  const r = await this.resolveAddress(s == null ? void 0 : s.index);
4883
4881
  try {
4884
4882
  const n = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
@@ -4902,7 +4900,7 @@ const W = class W extends or {
4902
4900
  r.address
4903
4901
  )
4904
4902
  });
4905
- return dr(n.signature), {
4903
+ return hr(n.signature), {
4906
4904
  chainId: e,
4907
4905
  signature: n.signature,
4908
4906
  address: r.address
@@ -4980,7 +4978,7 @@ const W = class W extends or {
4980
4978
  l
4981
4979
  )
4982
4980
  });
4983
- return ur(a.signature), {
4981
+ return dr(a.signature), {
4984
4982
  chainId: e,
4985
4983
  signedTx: a.signature,
4986
4984
  txHash: a.txHash ?? ""
@@ -5376,7 +5374,7 @@ const W = class W extends or {
5376
5374
  return { wei: "0x0", formatted: "0", chainId: e };
5377
5375
  try {
5378
5376
  const r = await this.jsonRpc.call("eth_getBalance", [t, "latest"], e) ?? "0x0";
5379
- return { wei: r, formatted: hr(r, this._config.displayDecimals), chainId: e };
5377
+ return { wei: r, formatted: lr(r, this._config.displayDecimals), chainId: e };
5380
5378
  } catch (s) {
5381
5379
  if (s instanceof h) throw s;
5382
5380
  const r = s instanceof Error ? s.message : String(s);
@@ -5630,7 +5628,7 @@ const W = class W extends or {
5630
5628
  };
5631
5629
  W.WALLET_PREF_KEY = "wallet_preference", W.OFFCHAIN_CHAIN_ID = "0";
5632
5630
  let Ce = W;
5633
- class Ur {
5631
+ class kr {
5634
5632
  constructor() {
5635
5633
  this.prefix = "crossx_";
5636
5634
  }
@@ -5667,7 +5665,7 @@ class Ur {
5667
5665
  }
5668
5666
  }
5669
5667
  }
5670
- const oe = "crossx-sdk", ot = 1, k = "data", B = "keys", ce = "aes-primary", br = 12;
5668
+ const oe = "crossx-sdk", ot = 1, k = "data", B = "keys", ce = "aes-primary", Ur = 12;
5671
5669
  class ct {
5672
5670
  constructor(e) {
5673
5671
  this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
@@ -5802,7 +5800,7 @@ class ct {
5802
5800
  }
5803
5801
  }
5804
5802
  async encrypt(e) {
5805
- const t = new Uint8Array(br);
5803
+ const t = new Uint8Array(Ur);
5806
5804
  crypto.getRandomValues(t);
5807
5805
  const s = new TextEncoder().encode(e), r = await crypto.subtle.encrypt(
5808
5806
  { name: "AES-GCM", iv: t },
@@ -5860,8 +5858,8 @@ class ct {
5860
5858
  return typeof indexedDB < "u" && typeof crypto < "u" && typeof crypto.subtle < "u";
5861
5859
  }
5862
5860
  }
5863
- const Lr = 60;
5864
- class Wr {
5861
+ const br = 60;
5862
+ class Lr {
5865
5863
  constructor() {
5866
5864
  this.jwks = null;
5867
5865
  }
@@ -5881,7 +5879,7 @@ class Wr {
5881
5879
  iat: s.iat
5882
5880
  });
5883
5881
  const r = Math.floor(Date.now() / 1e3);
5884
- if (s.exp && s.exp + Lr < r)
5882
+ if (s.exp && s.exp + br < r)
5885
5883
  return c.warn("[CROSSx] 토큰 만료:", {
5886
5884
  exp: s.exp,
5887
5885
  now: r,
@@ -5928,14 +5926,14 @@ ${s.length}`
5928
5926
  const a = Me(n), l = t.startsWith("0x") ? t.slice(2) : t;
5929
5927
  if (l.length !== 130)
5930
5928
  throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${l.length}`);
5931
- const d = Mr(l), g = d.slice(0, 32), u = d.slice(32, 64), _ = d[64], p = _ >= 27 ? _ - 27 : _, w = new Wt.Signature(
5929
+ const d = Wr(l), g = d.slice(0, 32), u = d.slice(32, 64), _ = d[64], p = _ >= 27 ? _ - 27 : _, w = new Wt.Signature(
5932
5930
  lt(g),
5933
5931
  lt(u)
5934
5932
  ).addRecoveryBit(p).recoverPublicKey(a).toBytes(!1).slice(1), f = Me(w);
5935
5933
  return "0x" + Mt(f.slice(12));
5936
5934
  }
5937
5935
  }
5938
- function Mr(i) {
5936
+ function Wr(i) {
5939
5937
  const e = new Uint8Array(i.length / 2);
5940
5938
  for (let t = 0; t < e.length; t++)
5941
5939
  e[t] = parseInt(i.substring(t * 2, t * 2 + 2), 16);
@@ -5946,8 +5944,8 @@ function lt(i) {
5946
5944
  for (const t of i) e += t.toString(16).padStart(2, "0");
5947
5945
  return BigInt(e);
5948
5946
  }
5949
- const Fr = 5e3;
5950
- class Br {
5947
+ const Mr = 5e3;
5948
+ class Fr {
5951
5949
  constructor(e, t) {
5952
5950
  this.cachedKey = null, this.cachedVersion = null, this.cachedAt = 0, this.keyInFlight = null, this.keyFailedAt = 0, this.required = !1, this.adapterConfig = e, this.transport = t;
5953
5951
  }
@@ -5960,8 +5958,8 @@ class Br {
5960
5958
  const t = this.required;
5961
5959
  if (!t && this.hasFreshFailure()) return e;
5962
5960
  try {
5963
- const { version: s, key: r } = await this.currentKey(), n = await Gr(r, e);
5964
- return `${s}.${Kr(n)}`;
5961
+ const { version: s, key: r } = await this.currentKey(), n = await Br(r, e);
5962
+ return `${s}.${Gr(n)}`;
5965
5963
  } catch (s) {
5966
5964
  if (t)
5967
5965
  throw this.keyFailedAt = Date.now(), s instanceof h ? s : new h(
@@ -6016,16 +6014,16 @@ class Br {
6016
6014
  url: `${this.baseUrl}/pin-key`,
6017
6015
  method: "GET",
6018
6016
  headers: { "X-Project-Id": this.adapterConfig.projectId },
6019
- timeoutMs: Fr
6020
- }), s = Yr(t.data);
6017
+ timeoutMs: Mr
6018
+ }), s = $r(t.data);
6021
6019
  if (!(s != null && s.keyVersion) || !(s != null && s.publicKey))
6022
6020
  throw new h(
6023
6021
  o.PIN_ENCRYPTION_FAILED,
6024
6022
  "pin-key 응답을 해석할 수 없습니다."
6025
6023
  );
6026
- const r = Vr(s.publicKey), n = await e.importKey(
6024
+ const r = Hr(s.publicKey), n = await e.importKey(
6027
6025
  "spki",
6028
- $r(r),
6026
+ Vr(r),
6029
6027
  { name: "RSA-OAEP", hash: "SHA-256" },
6030
6028
  !1,
6031
6029
  ["encrypt"]
@@ -6033,7 +6031,7 @@ class Br {
6033
6031
  return { version: s.keyVersion, key: n };
6034
6032
  }
6035
6033
  }
6036
- async function Gr(i, e) {
6034
+ async function Br(i, e) {
6037
6035
  const t = xt();
6038
6036
  if (!t)
6039
6037
  throw new h(
@@ -6051,11 +6049,11 @@ function xt() {
6051
6049
  const i = globalThis.crypto;
6052
6050
  return (i == null ? void 0 : i.subtle) ?? null;
6053
6051
  }
6054
- function Kr(i) {
6055
- return Hr(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
6052
+ function Gr(i) {
6053
+ return Kr(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
6056
6054
  }
6057
6055
  const te = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6058
- function Hr(i) {
6056
+ function Kr(i) {
6059
6057
  let e = "";
6060
6058
  for (let t = 0; t < i.length; t += 3) {
6061
6059
  const s = i[t], r = i[t + 1], n = i[t + 2];
@@ -6063,7 +6061,7 @@ function Hr(i) {
6063
6061
  }
6064
6062
  return e;
6065
6063
  }
6066
- function Vr(i) {
6064
+ function Hr(i) {
6067
6065
  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 = [];
6068
6066
  for (let r = 0; r < t.length; r += 4) {
6069
6067
  const n = [0, 1, 2, 3].map((a) => {
@@ -6081,11 +6079,11 @@ function Vr(i) {
6081
6079
  }
6082
6080
  return new Uint8Array(s);
6083
6081
  }
6084
- function $r(i) {
6082
+ function Vr(i) {
6085
6083
  const e = new Uint8Array(i.length);
6086
6084
  return e.set(i), e.buffer;
6087
6085
  }
6088
- function Yr(i) {
6086
+ function $r(i) {
6089
6087
  if (!i || typeof i != "object") return null;
6090
6088
  const e = i;
6091
6089
  if (typeof e.code == "number") {
@@ -6099,8 +6097,8 @@ function Yr(i) {
6099
6097
  }
6100
6098
  return typeof e.keyVersion == "string" && typeof e.publicKey == "string" ? e : null;
6101
6099
  }
6102
- const qr = 3e4, jr = 1e3;
6103
- class Xr {
6100
+ const Yr = 3e4, qr = 1e3;
6101
+ class jr {
6104
6102
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6105
6103
  async request(e) {
6106
6104
  const t = e.retries ?? 0;
@@ -6111,7 +6109,7 @@ class Xr {
6111
6109
  } catch (r) {
6112
6110
  if (s === t) throw r;
6113
6111
  }
6114
- await new Promise((r) => setTimeout(r, jr * 2 ** s));
6112
+ await new Promise((r) => setTimeout(r, qr * 2 ** s));
6115
6113
  }
6116
6114
  throw new Error("Unexpected: retry loop exited without result");
6117
6115
  }
@@ -6119,7 +6117,7 @@ class Xr {
6119
6117
  async _doRequest(e) {
6120
6118
  const t = new AbortController(), s = setTimeout(
6121
6119
  () => t.abort(),
6122
- e.timeoutMs ?? qr
6120
+ e.timeoutMs ?? Yr
6123
6121
  );
6124
6122
  try {
6125
6123
  const r = await fetch(e.url, {
@@ -6146,7 +6144,7 @@ class Xr {
6146
6144
  }
6147
6145
  }
6148
6146
  }
6149
- function zr(i) {
6147
+ function Xr(i) {
6150
6148
  const e = { raw: i }, t = i.search(/(^|;)\s*info=/i), s = t >= 0 ? i.slice(0, t) : i;
6151
6149
  if (t >= 0) {
6152
6150
  const r = i.slice(t).replace(/^;?\s*info=/i, "").trim();
@@ -6168,7 +6166,7 @@ function ht(i) {
6168
6166
  return null;
6169
6167
  }
6170
6168
  }
6171
- class Jr {
6169
+ class zr {
6172
6170
  constructor(e, t) {
6173
6171
  this.inner = e, this.options = t;
6174
6172
  }
@@ -6187,23 +6185,23 @@ class Jr {
6187
6185
  }
6188
6186
  inspect(e) {
6189
6187
  var r, n, a, l;
6190
- const t = Qr(e.headers, jt);
6191
- t && ((n = (r = this.options).onDeprecation) == null || n.call(r, zr(t)));
6188
+ const t = Zr(e.headers, jt);
6189
+ t && ((n = (r = this.options).onDeprecation) == null || n.call(r, Xr(t)));
6192
6190
  const s = e.data;
6193
- s && s.code === de && ((l = (a = this.options).onUnsupported) == null || l.call(a, { message: Zr(s) }));
6191
+ s && s.code === de && ((l = (a = this.options).onUnsupported) == null || l.call(a, { message: Jr(s) }));
6194
6192
  }
6195
6193
  }
6196
- function Zr(i) {
6194
+ function Jr(i) {
6197
6195
  for (const e of [i.data, i.message])
6198
6196
  if (typeof e == "string" && e.trim()) return e;
6199
6197
  }
6200
- function Qr(i, e) {
6198
+ function Zr(i, e) {
6201
6199
  if (!i) return;
6202
6200
  const t = e.toLowerCase();
6203
6201
  for (const [s, r] of Object.entries(i))
6204
6202
  if (s.toLowerCase() === t && r) return r;
6205
6203
  }
6206
- const ei = [
6204
+ const Qr = [
6207
6205
  /CROSSx\/([\d.]+)/i,
6208
6206
  /ONE\s?wallet[^\s/]*\/([\d.]+)/i,
6209
6207
  /ONE\s?pocket[^\s/]*\/([\d.]+)/i
@@ -6211,18 +6209,18 @@ const ei = [
6211
6209
  function ve() {
6212
6210
  return typeof window > "u" ? void 0 : window;
6213
6211
  }
6214
- function ti() {
6212
+ function ei() {
6215
6213
  const i = ve();
6216
6214
  return i == null ? void 0 : i.__crossx;
6217
6215
  }
6218
- function si(i) {
6216
+ function ti(i) {
6219
6217
  return i === "ios" || i === "android" ? i : null;
6220
6218
  }
6221
6219
  function Re() {
6222
6220
  const i = typeof navigator > "u" ? "" : navigator.userAgent;
6223
6221
  return /Android/i.test(i) ? "android" : /iPhone|iPad|iPod|Macintosh/i.test(i) ? "ios" : null;
6224
6222
  }
6225
- function ri(i, e) {
6223
+ function si(i, e) {
6226
6224
  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);
6227
6225
  for (let a = 0; a < n; a += 1) {
6228
6226
  const l = (s[a] ?? 0) - (r[a] ?? 0);
@@ -6230,7 +6228,7 @@ function ri(i, e) {
6230
6228
  }
6231
6229
  return 0;
6232
6230
  }
6233
- function ii() {
6231
+ function ri() {
6234
6232
  const i = ve();
6235
6233
  if (!i) return !1;
6236
6234
  const e = i.__crossxRNBridge;
@@ -6238,20 +6236,20 @@ function ii() {
6238
6236
  }
6239
6237
  function dt() {
6240
6238
  const i = typeof navigator > "u" ? "" : navigator.userAgent;
6241
- for (const e of ei) {
6239
+ for (const e of Qr) {
6242
6240
  const t = e.exec(i);
6243
6241
  if (t) return t[1] ?? null;
6244
6242
  }
6245
6243
  }
6246
6244
  function ge() {
6247
- const i = ti();
6245
+ const i = ei();
6248
6246
  if (i != null && i.browser)
6249
6247
  return {
6250
6248
  version: i.version ?? null,
6251
- platform: si(i.platform) ?? Re(),
6249
+ platform: ti(i.platform) ?? Re(),
6252
6250
  detectedBy: "marker"
6253
6251
  };
6254
- if (ii())
6252
+ if (ri())
6255
6253
  return {
6256
6254
  version: dt() ?? null,
6257
6255
  platform: Re(),
@@ -6260,10 +6258,10 @@ function ge() {
6260
6258
  const e = dt();
6261
6259
  return e !== void 0 ? { version: e, platform: Re(), detectedBy: "user-agent" } : null;
6262
6260
  }
6263
- function yi() {
6261
+ function Ti() {
6264
6262
  return ge() !== null;
6265
6263
  }
6266
- function Ri(i = 3e3) {
6264
+ function yi(i = 3e3) {
6267
6265
  const e = ge();
6268
6266
  return e ? Promise.resolve(e) : ve() ? new Promise((t) => {
6269
6267
  const s = Date.now(), r = setInterval(() => {
@@ -6276,16 +6274,16 @@ function Ri(i = 3e3) {
6276
6274
  }, 50);
6277
6275
  }) : Promise.resolve(null);
6278
6276
  }
6279
- const ni = /* @__PURE__ */ new Set([
6277
+ const ii = /* @__PURE__ */ new Set([
6280
6278
  "https://cross-wallet-oauth.crosstoken.io",
6281
6279
  "https://stg-cross-wallet-oauth.crosstoken.io",
6282
6280
  "https://dev-cross-wallet-oauth.crosstoken.io",
6283
6281
  "https://one-wallet-oauth.onechain.nexus",
6284
6282
  "https://stg-one-wallet-oauth.onechain.nexus",
6285
6283
  "https://dev-one-wallet-oauth.onechain.nexus"
6286
- ]), ai = "crossx://oauth-callback", oi = "2.3.2";
6287
- function ci(i) {
6288
- return i.platform !== "ios" ? !1 : i.version ? ri(i.version, oi) <= 0 : !0;
6284
+ ]), ni = "crossx://oauth-callback", ai = "2.3.2";
6285
+ function oi(i) {
6286
+ return i.platform !== "ios" ? !1 : i.version ? si(i.version, ai) <= 0 : !0;
6289
6287
  }
6290
6288
  class H {
6291
6289
  constructor() {
@@ -6363,14 +6361,14 @@ class H {
6363
6361
  return new Promise((t, s) => {
6364
6362
  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 = H.generateRandom16Hex(), g = H.generateRandom16Hex(), u = ge();
6365
6363
  let _ = e.authUrl;
6366
- u && e.legacyAuthUrl && ci(u) && (_ = e.legacyAuthUrl, c.info("[CROSSx] 구버전 iOS 지갑 감지 — 이관 전 OAuth 호스트 사용", {
6364
+ u && e.legacyAuthUrl && oi(u) && (_ = e.legacyAuthUrl, c.info("[CROSSx] 구버전 iOS 지갑 감지 — 이관 전 OAuth 호스트 사용", {
6367
6365
  appVersion: u.version ?? "(unknown)",
6368
6366
  detectedBy: u.detectedBy,
6369
6367
  authUrlBase: e.legacyAuthUrl
6370
6368
  }));
6371
6369
  const p = _.includes("?") ? "&" : "?", A = encodeURIComponent(window.location.origin);
6372
6370
  let E = `${_}${p}state=${d}&nonce=${g}&origin=${A}`;
6373
- u && !E.includes("redirectUrl=") && (E += `&redirectUrl=${encodeURIComponent(ai)}`, c.info("[CROSSx] 지갑 인앱 브라우저 감지 — redirectUrl 콜백 자동 부착", {
6371
+ u && !E.includes("redirectUrl=") && (E += `&redirectUrl=${encodeURIComponent(ni)}`, c.info("[CROSSx] 지갑 인앱 브라우저 감지 — redirectUrl 콜백 자동 부착", {
6374
6372
  detectedBy: u.detectedBy,
6375
6373
  appVersion: u.version ?? "(unknown)",
6376
6374
  platform: u.platform ?? "(unknown)"
@@ -6389,12 +6387,12 @@ class H {
6389
6387
  return;
6390
6388
  }
6391
6389
  const f = setTimeout(() => {
6392
- c.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), m(), s(new Error("Authentication timeout"));
6390
+ c.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), y(), s(new Error("Authentication timeout"));
6393
6391
  }, 300 * 1e3), S = 10, I = 30;
6394
6392
  let R = 0, O = null;
6395
6393
  const C = () => {
6396
6394
  clearInterval(N), c.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + I + "초간 대기합니다"), O = setTimeout(() => {
6397
- m(), s(new Error(
6395
+ y(), s(new Error(
6398
6396
  "OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
6399
6397
  ));
6400
6398
  }, I * 1e3);
@@ -6403,38 +6401,38 @@ class H {
6403
6401
  try {
6404
6402
  if (!w.closed) return;
6405
6403
  if (!!u) {
6406
- m(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다"));
6404
+ y(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다"));
6407
6405
  return;
6408
6406
  }
6409
- const y = typeof document < "u" && document.hasFocus();
6410
- R <= S && !y ? C() : (m(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다")));
6407
+ const T = typeof document < "u" && document.hasFocus();
6408
+ R <= S && !T ? C() : (y(), s(new h(o.USER_REJECTED, "로그인이 취소되었습니다")));
6411
6409
  } catch {
6412
6410
  C();
6413
6411
  }
6414
- }, 1e3), m = () => {
6412
+ }, 1e3), y = () => {
6415
6413
  this.abortPending = null, clearTimeout(f), clearInterval(N), O && clearTimeout(O), window.removeEventListener("message", v);
6416
6414
  }, v = (D) => {
6417
- if (!ni.has(D.origin)) return;
6418
- m();
6419
- const y = typeof D.data.status == "string", T = y ? D.data.data ?? {} : D.data;
6415
+ if (!ii.has(D.origin)) return;
6416
+ y();
6417
+ const T = typeof D.data.status == "string", m = T ? D.data.data ?? {} : D.data;
6420
6418
  c.log("[CROSSx] OAuth postMessage 수신 —", {
6421
- format: y ? "wrapped" : "flat",
6422
- status: y ? D.data.status : "(flat)"
6419
+ format: T ? "wrapped" : "flat",
6420
+ status: T ? D.data.status : "(flat)"
6423
6421
  });
6424
- const ke = (T == null ? void 0 : T.state) ?? D.data.state;
6422
+ const ke = (m == null ? void 0 : m.state) ?? D.data.state;
6425
6423
  if (!ke || ke !== d) {
6426
6424
  s(new Error("OAuth state mismatch — possible CSRF attack"));
6427
6425
  return;
6428
6426
  }
6429
- if (y && D.data.status !== "success") {
6430
- c.error("[CROSSx] OAuth 실패:", T == null ? void 0 : T.error), s(new Error((T == null ? void 0 : T.error) || "Authentication failed"));
6427
+ if (T && D.data.status !== "success") {
6428
+ c.error("[CROSSx] OAuth 실패:", m == null ? void 0 : m.error), s(new Error((m == null ? void 0 : m.error) || "Authentication failed"));
6431
6429
  return;
6432
6430
  }
6433
- if (!y && (T != null && T.error)) {
6434
- c.error("[CROSSx] OAuth 실패:", T.error), s(new Error(T.error || "Authentication failed"));
6431
+ if (!T && (m != null && m.error)) {
6432
+ c.error("[CROSSx] OAuth 실패:", m.error), s(new Error(m.error || "Authentication failed"));
6435
6433
  return;
6436
6434
  }
6437
- const $ = T == null ? void 0 : T.idToken, Z = T == null ? void 0 : T.accessToken, Ue = Z ?? $, be = (T == null ? void 0 : T.email) || void 0;
6435
+ const $ = m == null ? void 0 : m.idToken, Z = m == null ? void 0 : m.accessToken, Ue = Z ?? $, be = (m == null ? void 0 : m.email) || void 0;
6438
6436
  if (c.log("[CROSSx] OAuth 토큰 수신:", {
6439
6437
  hasAccessToken: !!Z,
6440
6438
  hasIdToken: !!$,
@@ -6454,13 +6452,13 @@ class H {
6454
6452
  ), t(Le)) : $ ? Se($) : s(new Error("Token not found in response"));
6455
6453
  };
6456
6454
  this.abortPending = (D) => {
6457
- m(), s(new Error(D));
6455
+ y(), s(new Error(D));
6458
6456
  }, window.addEventListener("message", v);
6459
6457
  });
6460
6458
  }
6461
6459
  }
6462
6460
  const ee = "crossx_wallet_data", Y = "crossx_mock_pin_hash";
6463
- class li {
6461
+ class ci {
6464
6462
  constructor(e, t) {
6465
6463
  this.storage = e, this.pinStore = t ?? null;
6466
6464
  }
@@ -6605,7 +6603,7 @@ class li {
6605
6603
  ).join("");
6606
6604
  }
6607
6605
  }
6608
- const hi = ["password", "newPassword", "recoveryPin"];
6606
+ const li = ["password", "newPassword", "recoveryPin"];
6609
6607
  class V {
6610
6608
  constructor(e, t, s, r, n, a) {
6611
6609
  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;
@@ -6671,7 +6669,7 @@ class V {
6671
6669
  async sealPinFields(e) {
6672
6670
  if (!this.pinEncryptor || !e || typeof e != "object") return e;
6673
6671
  let t = null;
6674
- for (const s of hi) {
6672
+ for (const s of li) {
6675
6673
  const r = e[s];
6676
6674
  if (typeof r != "string" || r === "") continue;
6677
6675
  const n = await this.pinEncryptor.seal(r);
@@ -7142,7 +7140,7 @@ class V {
7142
7140
  }
7143
7141
  }
7144
7142
  }
7145
- class di {
7143
+ class hi {
7146
7144
  constructor(e, t, s, r = () => {
7147
7145
  }, n = () => {
7148
7146
  }, a = () => {
@@ -7412,7 +7410,7 @@ function G(i) {
7412
7410
  )
7413
7411
  );
7414
7412
  }
7415
- class ui {
7413
+ class di {
7416
7414
  // ─── 사용자 입력이 필요한 화면 → UI_NOT_PROVIDED ───
7417
7415
  requestConfirmation(e) {
7418
7416
  return G("requestConfirmation");
@@ -7461,7 +7459,7 @@ class ui {
7461
7459
  setPinKeyboard() {
7462
7460
  }
7463
7461
  }
7464
- class gi {
7462
+ class ui {
7465
7463
  constructor(e, t, s, r = () => !1) {
7466
7464
  this.browserConfirmation = e, this.getBridge = t, this.getOrigin = s, this.isAuthenticatedViaRNBridge = r;
7467
7465
  }
@@ -7634,7 +7632,7 @@ class gi {
7634
7632
  (s = (t = this.browserConfirmation).setPinKeyboard) == null || s.call(t, e);
7635
7633
  }
7636
7634
  }
7637
- class _i {
7635
+ class gi {
7638
7636
  constructor() {
7639
7637
  this._accessToken = null, this._expiresAt = 0;
7640
7638
  }
@@ -7667,10 +7665,10 @@ class _i {
7667
7665
  }
7668
7666
  }
7669
7667
  const vt = /* @__PURE__ */ new WeakMap();
7670
- function fi(i, e) {
7668
+ function _i(i, e) {
7671
7669
  vt.set(i, e);
7672
7670
  }
7673
- function Ni(i) {
7671
+ function Ri(i) {
7674
7672
  const e = vt.get(i);
7675
7673
  if (!e)
7676
7674
  throw new Error(
@@ -7678,10 +7676,10 @@ function Ni(i) {
7678
7676
  );
7679
7677
  return e;
7680
7678
  }
7681
- function pi(i) {
7679
+ function fi(i) {
7682
7680
  return kt(i);
7683
7681
  }
7684
- function Oi(i, e) {
7682
+ function Ni(i, e) {
7685
7683
  return kt(i, e);
7686
7684
  }
7687
7685
  function kt(i, e) {
@@ -7714,17 +7712,17 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
7714
7712
  "refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
7715
7713
  "IndexedDB를 지원하는 브라우저 사용을 권장합니다."
7716
7714
  ), s.secureStorageAvailable = n;
7717
- const a = n ? new ct(i.projectId) : new Ur(), l = new Wr();
7715
+ const a = n ? new ct(i.projectId) : new kr(), l = new Lr();
7718
7716
  let d = null;
7719
- const g = new Jr(new Xr(), {
7717
+ const g = new zr(new jr(), {
7720
7718
  version: le,
7721
7719
  sendVersionHeader: qt,
7722
7720
  getGatewayBaseUrls: () => [r.gatewayUrl],
7723
- onDeprecation: (y) => d == null ? void 0 : d.handleSdkVersionDeprecation(y),
7724
- onUnsupported: (y) => d == null ? void 0 : d.handleSdkVersionUnsupported(y)
7725
- }), u = new H(), _ = new _i(), p = new St(), A = new Br(r, g);
7721
+ onDeprecation: (T) => d == null ? void 0 : d.handleSdkVersionDeprecation(T),
7722
+ onUnsupported: (T) => d == null ? void 0 : d.handleSdkVersionUnsupported(T)
7723
+ }), u = new H(), _ = new gi(), p = new St(), A = new Fr(r, g);
7726
7724
  let E;
7727
- i.useMockWallet ? (c.log("[CROSSx] Mock Wallet Provider 사용"), E = new li(a, p)) : i.walletServer === "one-wallet" ? (c.log("[CROSSx] one-wallet-api Wallet Provider 사용"), E = new Ct({
7725
+ i.useMockWallet ? (c.log("[CROSSx] Mock Wallet Provider 사용"), E = new ci(a, p)) : i.walletServer === "one-wallet" ? (c.log("[CROSSx] one-wallet-api Wallet Provider 사용"), E = new Ct({
7728
7726
  baseUrl: () => ue().oneWalletApiUrl,
7729
7727
  transport: g,
7730
7728
  pinStore: p,
@@ -7738,20 +7736,20 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
7738
7736
  A
7739
7737
  ));
7740
7738
  const w = () => {
7741
- var y;
7742
- return ((y = d == null ? void 0 : d.isAuthenticatedViaRNBridge) == null ? void 0 : y.call(d)) ?? !1;
7739
+ var T;
7740
+ return ((T = d == null ? void 0 : d.isAuthenticatedViaRNBridge) == null ? void 0 : T.call(d)) ?? !1;
7743
7741
  }, f = () => {
7744
- var y;
7745
- return (y = d == null ? void 0 : d.assertRNBridgeSessionActive) == null ? void 0 : y.call(d);
7746
- }, S = (y) => {
7747
7742
  var T;
7748
- (T = d == null ? void 0 : d.clearRNBridgeDelegation) == null || T.call(d, y);
7743
+ return (T = d == null ? void 0 : d.assertRNBridgeSessionActive) == null ? void 0 : T.call(d);
7744
+ }, S = (T) => {
7745
+ var m;
7746
+ (m = d == null ? void 0 : d.clearRNBridgeDelegation) == null || m.call(d, T);
7749
7747
  };
7750
- i.walletServer !== "one-wallet" && (E = new di(
7748
+ i.walletServer !== "one-wallet" && (E = new hi(
7751
7749
  E,
7752
7750
  () => {
7753
- var y;
7754
- return (y = d == null ? void 0 : d.getRNBridge) == null ? void 0 : y.call(d);
7751
+ var T;
7752
+ return (T = d == null ? void 0 : d.getRNBridge) == null ? void 0 : T.call(d);
7755
7753
  },
7756
7754
  w,
7757
7755
  f,
@@ -7767,15 +7765,15 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
7767
7765
  contentsBaseUrl: R.contentsBaseUrl,
7768
7766
  portraitBaseUrl: R.portraitBaseUrl
7769
7767
  }
7770
- }) : new ui(), C = new gi(
7768
+ }) : new di(), C = new ui(
7771
7769
  O,
7772
7770
  () => {
7773
- var y;
7774
- return (y = d == null ? void 0 : d.getRNBridge) == null ? void 0 : y.call(d);
7771
+ var T;
7772
+ return (T = d == null ? void 0 : d.getRNBridge) == null ? void 0 : T.call(d);
7775
7773
  },
7776
7774
  () => typeof window < "u" ? window.location.origin : "http://localhost",
7777
7775
  w
7778
- ), N = e != null && e.wrapConfirmation ? e.wrapConfirmation(C) : C, m = new Ce(
7776
+ ), N = e != null && e.wrapConfirmation ? e.wrapConfirmation(C) : C, y = new Ce(
7779
7777
  s,
7780
7778
  r,
7781
7779
  a,
@@ -7788,9 +7786,9 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
7788
7786
  I,
7789
7787
  p,
7790
7788
  A,
7791
- new ms()
7789
+ new Is()
7792
7790
  );
7793
- d = m, fi(m, {
7791
+ d = y, _i(y, {
7794
7792
  transport: g,
7795
7793
  storage: a,
7796
7794
  walletProvider: E,
@@ -7800,32 +7798,32 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
7800
7798
  adapterConfig: r,
7801
7799
  pinEncryptor: A
7802
7800
  });
7803
- const v = m.signInUseCase;
7804
- return v && typeof v.setFreshTokenCallback == "function" && v.setFreshTokenCallback(() => m.requestFreshFirebaseIdTokenFromBridge()), typeof window < "u" && (window.__crossxSDK = m), m;
7801
+ const v = y.signInUseCase;
7802
+ return v && typeof v.setFreshTokenCallback == "function" && v.setFreshTokenCallback(() => y.requestFreshFirebaseIdTokenFromBridge()), typeof window < "u" && (window.__crossxSDK = y), y;
7805
7803
  }
7806
- const Pi = pi;
7804
+ const Oi = fi;
7807
7805
  export {
7808
7806
  Jt as C,
7809
- Ti as D,
7807
+ mi as D,
7810
7808
  o as E,
7811
7809
  pt as M,
7812
7810
  St as P,
7813
- _i as T,
7811
+ gi as T,
7814
7812
  gt as W,
7815
7813
  h as a,
7816
7814
  ns as b,
7817
- Oi as c,
7815
+ Ni as c,
7818
7816
  Ce as d,
7819
- mi as e,
7817
+ Ii as e,
7820
7818
  Xt as f,
7821
- Ni as g,
7819
+ Ri as g,
7822
7820
  as as h,
7823
7821
  Ve as i,
7824
7822
  ut as j,
7825
- pi as k,
7826
- Pi as l,
7827
- Ii as m,
7823
+ fi as k,
7824
+ Oi as l,
7825
+ Ai as m,
7828
7826
  ge as n,
7829
- yi as o,
7830
- Ri as w
7827
+ Ti as o,
7828
+ yi as w
7831
7829
  };