@nexus-cross/crossx-sdk-core 1.2.3 → 1.2.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/oauth/BrowserOAuthAdapter.d.ts.map +1 -1
- package/dist/adapters/wallet/RemoteWalletProviderAdapter.d.ts.map +1 -1
- package/dist/adapters/wallet/types.d.ts +0 -2
- package/dist/adapters/wallet/types.d.ts.map +1 -1
- package/dist/crossx.global +6 -6
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +221 -237
- package/dist/sdk/CROSSxSDK.d.ts +1 -1
- package/dist/sdk/factory.d.ts +11 -1
- package/dist/sdk/factory.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -167,26 +167,26 @@ class $s {
|
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
let
|
|
170
|
+
let ye = null;
|
|
171
171
|
function vt(r) {
|
|
172
|
-
|
|
172
|
+
ye = r;
|
|
173
173
|
}
|
|
174
174
|
const u = {
|
|
175
175
|
log(...r) {
|
|
176
|
-
if (
|
|
177
|
-
|
|
176
|
+
if (ye) {
|
|
177
|
+
ye.log(...r);
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
181
|
warn(...r) {
|
|
182
|
-
if (
|
|
183
|
-
|
|
182
|
+
if (ye) {
|
|
183
|
+
ye.warn(...r);
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
186
|
},
|
|
187
187
|
error(...r) {
|
|
188
|
-
if (
|
|
189
|
-
|
|
188
|
+
if (ye) {
|
|
189
|
+
ye.error(...r);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
@@ -375,18 +375,18 @@ class Hs {
|
|
|
375
375
|
try {
|
|
376
376
|
const B = this.crypto.decodeJWT(x);
|
|
377
377
|
S = (n = B.firebase) == null ? void 0 : n.sign_in_provider;
|
|
378
|
-
const
|
|
379
|
-
S === "google.com" ? y = (i =
|
|
378
|
+
const b = ((o = B.firebase) == null ? void 0 : o.identities) ?? {};
|
|
379
|
+
S === "google.com" ? y = (i = b["google.com"]) == null ? void 0 : i[0] : S === "apple.com" && (y = (a = b["apple.com"]) == null ? void 0 : a[0]), u.log("[CROSSx] OAuth provider sub 추출 — provider:", S, "hasProviderSub:", !!y);
|
|
380
380
|
} catch {
|
|
381
381
|
u.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
|
|
382
382
|
}
|
|
383
383
|
if (w) {
|
|
384
384
|
const B = this.crypto.decodeJWT(w);
|
|
385
385
|
u.log("[CROSSx] access_token 디코딩 — sub:", B.sub, "exp:", B.exp);
|
|
386
|
-
const
|
|
387
|
-
if (t =
|
|
386
|
+
const b = await this.crypto.verifyJWT(w);
|
|
387
|
+
if (t = b.signatureVerified ?? !1, !b.valid)
|
|
388
388
|
throw u.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
|
|
389
|
-
const P =
|
|
389
|
+
const P = b.payload;
|
|
390
390
|
s = {
|
|
391
391
|
id: P.sub,
|
|
392
392
|
email: P.email,
|
|
@@ -836,7 +836,7 @@ const Js = 2e3, It = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", Et = "0x3B9ACA0
|
|
|
836
836
|
}), this._initPromise);
|
|
837
837
|
}
|
|
838
838
|
async _doInitialize(e) {
|
|
839
|
-
console.log("[CROSSx SDK] v1.2.
|
|
839
|
+
console.log("[CROSSx SDK] v1.2.4 초기화 중..."), this.confirmation.setMessages(St(this._config.locale));
|
|
840
840
|
try {
|
|
841
841
|
const s = Ys();
|
|
842
842
|
this.internalConfig.oauthServiceUrl = s.oauthServiceUrl, this.internalConfig.authApiUrl = s.authApiUrl, this.internalConfig.walletGatewayUrl = s.walletGatewayUrl, this.adapterConfig.gatewayUrl = s.walletGatewayUrl;
|
|
@@ -1023,7 +1023,7 @@ const Js = 2e3, It = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", Et = "0x3B9ACA0
|
|
|
1023
1023
|
* create 시 -10012 에러(기존 백업 발견)가 발생하면 자동으로 호출됩니다.
|
|
1024
1024
|
*
|
|
1025
1025
|
* @param pin 4자리 PIN (클라우드 백업 복호화용)
|
|
1026
|
-
* @returns 마이그레이션 결과 (address
|
|
1026
|
+
* @returns 마이그레이션 결과 (address)
|
|
1027
1027
|
*/
|
|
1028
1028
|
async migrateWallet(e) {
|
|
1029
1029
|
if (this.ensureAuthenticated(), !this.userId)
|
|
@@ -1557,15 +1557,15 @@ const Js = 2e3, It = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", Et = "0x3B9ACA0
|
|
|
1557
1557
|
let m, x;
|
|
1558
1558
|
const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((S) => {
|
|
1559
1559
|
m = S;
|
|
1560
|
-
const O = BigInt(S.gasUsed) * BigInt(S.effectiveGasPrice), B = s.value ? BigInt(s.value) : 0n,
|
|
1560
|
+
const O = BigInt(S.gasUsed) * BigInt(S.effectiveGasPrice), B = s.value ? BigInt(s.value) : 0n, b = re.formatTxAmount(s.value, d.symbol, d.decimals), P = re.formatTxAmount("0x" + O.toString(16), d.symbol, d.decimals), N = re.formatTxAmount("0x" + (B + O).toString(16), d.symbol, d.decimals);
|
|
1561
1561
|
return {
|
|
1562
1562
|
chainId: e,
|
|
1563
1563
|
txHash: a,
|
|
1564
1564
|
from: S.from,
|
|
1565
1565
|
to: S.to ?? s.to,
|
|
1566
|
-
amount:
|
|
1566
|
+
amount: b,
|
|
1567
1567
|
fees: P,
|
|
1568
|
-
total:
|
|
1568
|
+
total: N,
|
|
1569
1569
|
nativeSymbol: d.symbol,
|
|
1570
1570
|
status: S.status === "0x1" ? "success" : "reverted"
|
|
1571
1571
|
};
|
|
@@ -1855,7 +1855,7 @@ const Js = 2e3, It = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", Et = "0x3B9ACA0
|
|
|
1855
1855
|
});
|
|
1856
1856
|
if (l === null)
|
|
1857
1857
|
return u.log("[CROSSx][Migration Phase 4] 사용자가 PIN 입력을 취소함 → 종료"), null;
|
|
1858
|
-
u.log(
|
|
1858
|
+
u.log("[CROSSx][Migration Phase 4] PIN 입력 완료 — verify-recovery-pin API 호출"), t = void 0;
|
|
1859
1859
|
try {
|
|
1860
1860
|
const d = await ((c = (a = this.walletProvider).verifyRecoveryPin) == null ? void 0 : c.call(a, l, e));
|
|
1861
1861
|
if (!d) {
|
|
@@ -2499,7 +2499,7 @@ function qe(r) {
|
|
|
2499
2499
|
}
|
|
2500
2500
|
return t;
|
|
2501
2501
|
}
|
|
2502
|
-
function
|
|
2502
|
+
function we(...r) {
|
|
2503
2503
|
let e = 0;
|
|
2504
2504
|
for (let t = 0; t < r.length; t++) {
|
|
2505
2505
|
const n = r[t];
|
|
@@ -2800,7 +2800,7 @@ function Pr(r, e, s) {
|
|
|
2800
2800
|
let c = t(r), l = t(r), d = 0;
|
|
2801
2801
|
const h = () => {
|
|
2802
2802
|
c.fill(1), l.fill(0), d = 0;
|
|
2803
|
-
}, m = (...y) => s(l,
|
|
2803
|
+
}, m = (...y) => s(l, we(c, ...y)), x = (y = n) => {
|
|
2804
2804
|
l = m(o, y), c = m(), y.length !== 0 && (l = m(i, y), c = m());
|
|
2805
2805
|
}, w = () => {
|
|
2806
2806
|
if (d++ >= a)
|
|
@@ -2812,7 +2812,7 @@ function Pr(r, e, s) {
|
|
|
2812
2812
|
const O = c.slice();
|
|
2813
2813
|
S.push(O), y += c.length;
|
|
2814
2814
|
}
|
|
2815
|
-
return
|
|
2815
|
+
return we(...S);
|
|
2816
2816
|
};
|
|
2817
2817
|
return (y, S) => {
|
|
2818
2818
|
h(), x(y);
|
|
@@ -3460,19 +3460,19 @@ function jr(r, e = {}) {
|
|
|
3460
3460
|
if (!t.isOdd)
|
|
3461
3461
|
throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
3462
3462
|
}
|
|
3463
|
-
function h(
|
|
3464
|
-
const { x:
|
|
3463
|
+
function h(R, f, _) {
|
|
3464
|
+
const { x: v, y: A } = f.toAffine(), L = t.toBytes(v);
|
|
3465
3465
|
if (Ve(_, "isCompressed"), _) {
|
|
3466
3466
|
d();
|
|
3467
3467
|
const C = !t.isOdd(A);
|
|
3468
|
-
return
|
|
3468
|
+
return we(Ss(C), L);
|
|
3469
3469
|
} else
|
|
3470
|
-
return
|
|
3470
|
+
return we(Uint8Array.of(4), L, t.toBytes(A));
|
|
3471
3471
|
}
|
|
3472
|
-
function m(
|
|
3473
|
-
z(
|
|
3474
|
-
const { publicKey: f, publicKeyUncompressed: _ } = l,
|
|
3475
|
-
if (
|
|
3472
|
+
function m(R) {
|
|
3473
|
+
z(R, void 0, "Point");
|
|
3474
|
+
const { publicKey: f, publicKeyUncompressed: _ } = l, v = R.length, A = R[0], L = R.subarray(1);
|
|
3475
|
+
if (v === f && (A === 2 || A === 3)) {
|
|
3476
3476
|
const C = t.fromBytes(L);
|
|
3477
3477
|
if (!t.isValid(C))
|
|
3478
3478
|
throw new Error("bad point: is not on curve, wrong x");
|
|
@@ -3487,91 +3487,91 @@ function jr(r, e = {}) {
|
|
|
3487
3487
|
d();
|
|
3488
3488
|
const $ = t.isOdd(T);
|
|
3489
3489
|
return (A & 1) === 1 !== $ && (T = t.neg(T)), { x: C, y: T };
|
|
3490
|
-
} else if (
|
|
3490
|
+
} else if (v === _ && A === 4) {
|
|
3491
3491
|
const C = t.BYTES, M = t.fromBytes(L.subarray(0, C)), T = t.fromBytes(L.subarray(C, C * 2));
|
|
3492
3492
|
if (!y(M, T))
|
|
3493
3493
|
throw new Error("bad point: is not on curve");
|
|
3494
3494
|
return { x: M, y: T };
|
|
3495
3495
|
} else
|
|
3496
|
-
throw new Error(`bad point: got length ${
|
|
3496
|
+
throw new Error(`bad point: got length ${v}, expected compressed=${f} or uncompressed=${_}`);
|
|
3497
3497
|
}
|
|
3498
3498
|
const x = e.toBytes || h, w = e.fromBytes || m;
|
|
3499
|
-
function E(
|
|
3500
|
-
const f = t.sqr(
|
|
3501
|
-
return t.add(t.add(_, t.mul(
|
|
3499
|
+
function E(R) {
|
|
3500
|
+
const f = t.sqr(R), _ = t.mul(f, R);
|
|
3501
|
+
return t.add(t.add(_, t.mul(R, o.a)), o.b);
|
|
3502
3502
|
}
|
|
3503
|
-
function y(
|
|
3504
|
-
const _ = t.sqr(f),
|
|
3505
|
-
return t.eql(_,
|
|
3503
|
+
function y(R, f) {
|
|
3504
|
+
const _ = t.sqr(f), v = E(R);
|
|
3505
|
+
return t.eql(_, v);
|
|
3506
3506
|
}
|
|
3507
3507
|
if (!y(o.Gx, o.Gy))
|
|
3508
3508
|
throw new Error("bad curve params: generator point");
|
|
3509
3509
|
const S = t.mul(t.pow(o.a, Fe), Kr), O = t.mul(t.sqr(o.b), BigInt(27));
|
|
3510
3510
|
if (t.is0(t.add(S, O)))
|
|
3511
3511
|
throw new Error("bad curve params: a or b");
|
|
3512
|
-
function B(
|
|
3512
|
+
function B(R, f, _ = !1) {
|
|
3513
3513
|
if (!t.isValid(f) || _ && t.is0(f))
|
|
3514
|
-
throw new Error(`bad point coordinate ${
|
|
3514
|
+
throw new Error(`bad point coordinate ${R}`);
|
|
3515
3515
|
return f;
|
|
3516
3516
|
}
|
|
3517
|
-
function
|
|
3518
|
-
if (!(
|
|
3517
|
+
function b(R) {
|
|
3518
|
+
if (!(R instanceof W))
|
|
3519
3519
|
throw new Error("Weierstrass Point expected");
|
|
3520
3520
|
}
|
|
3521
|
-
function P(
|
|
3521
|
+
function P(R) {
|
|
3522
3522
|
if (!c || !c.basises)
|
|
3523
3523
|
throw new Error("no endo");
|
|
3524
|
-
return Vr(
|
|
3524
|
+
return Vr(R, c.basises, n.ORDER);
|
|
3525
3525
|
}
|
|
3526
|
-
const
|
|
3527
|
-
const { X: _, Y:
|
|
3526
|
+
const N = Lt((R, f) => {
|
|
3527
|
+
const { X: _, Y: v, Z: A } = R;
|
|
3528
3528
|
if (t.eql(A, t.ONE))
|
|
3529
|
-
return { x: _, y:
|
|
3530
|
-
const L =
|
|
3529
|
+
return { x: _, y: v };
|
|
3530
|
+
const L = R.is0();
|
|
3531
3531
|
f == null && (f = L ? t.ONE : t.inv(A));
|
|
3532
|
-
const C = t.mul(_, f), M = t.mul(
|
|
3532
|
+
const C = t.mul(_, f), M = t.mul(v, f), T = t.mul(A, f);
|
|
3533
3533
|
if (L)
|
|
3534
3534
|
return { x: t.ZERO, y: t.ZERO };
|
|
3535
3535
|
if (!t.eql(T, t.ONE))
|
|
3536
3536
|
throw new Error("invZ was invalid");
|
|
3537
3537
|
return { x: C, y: M };
|
|
3538
|
-
}), G = Lt((
|
|
3539
|
-
if (
|
|
3540
|
-
if (e.allowInfinityPoint && !t.is0(
|
|
3538
|
+
}), G = Lt((R) => {
|
|
3539
|
+
if (R.is0()) {
|
|
3540
|
+
if (e.allowInfinityPoint && !t.is0(R.Y))
|
|
3541
3541
|
return;
|
|
3542
3542
|
throw new Error("bad point: ZERO");
|
|
3543
3543
|
}
|
|
3544
|
-
const { x: f, y: _ } =
|
|
3544
|
+
const { x: f, y: _ } = R.toAffine();
|
|
3545
3545
|
if (!t.isValid(f) || !t.isValid(_))
|
|
3546
3546
|
throw new Error("bad point: x or y not field elements");
|
|
3547
3547
|
if (!y(f, _))
|
|
3548
3548
|
throw new Error("bad point: equation left != right");
|
|
3549
|
-
if (!
|
|
3549
|
+
if (!R.isTorsionFree())
|
|
3550
3550
|
throw new Error("bad point: not in prime-order subgroup");
|
|
3551
3551
|
return !0;
|
|
3552
3552
|
});
|
|
3553
|
-
function K(
|
|
3554
|
-
return _ = new W(t.mul(_.X,
|
|
3553
|
+
function K(R, f, _, v, A) {
|
|
3554
|
+
return _ = new W(t.mul(_.X, R), _.Y, _.Z), f = ze(v, f), _ = ze(A, _), f.add(_);
|
|
3555
3555
|
}
|
|
3556
3556
|
const k = class k {
|
|
3557
3557
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
3558
|
-
constructor(f, _,
|
|
3558
|
+
constructor(f, _, v) {
|
|
3559
3559
|
I(this, "X");
|
|
3560
3560
|
I(this, "Y");
|
|
3561
3561
|
I(this, "Z");
|
|
3562
|
-
this.X = B("x", f), this.Y = B("y", _, !0), this.Z = B("z",
|
|
3562
|
+
this.X = B("x", f), this.Y = B("y", _, !0), this.Z = B("z", v), Object.freeze(this);
|
|
3563
3563
|
}
|
|
3564
3564
|
static CURVE() {
|
|
3565
3565
|
return o;
|
|
3566
3566
|
}
|
|
3567
3567
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
3568
3568
|
static fromAffine(f) {
|
|
3569
|
-
const { x: _, y:
|
|
3570
|
-
if (!f || !t.isValid(_) || !t.isValid(
|
|
3569
|
+
const { x: _, y: v } = f || {};
|
|
3570
|
+
if (!f || !t.isValid(_) || !t.isValid(v))
|
|
3571
3571
|
throw new Error("invalid affine point");
|
|
3572
3572
|
if (f instanceof k)
|
|
3573
3573
|
throw new Error("projective point not allowed");
|
|
3574
|
-
return t.is0(_) && t.is0(
|
|
3574
|
+
return t.is0(_) && t.is0(v) ? k.ZERO : new k(_, v, t.ONE);
|
|
3575
3575
|
}
|
|
3576
3576
|
static fromBytes(f) {
|
|
3577
3577
|
const _ = k.fromAffine(w(z(f, void 0, "point")));
|
|
@@ -3608,8 +3608,8 @@ function jr(r, e = {}) {
|
|
|
3608
3608
|
}
|
|
3609
3609
|
/** Compare one point to another. */
|
|
3610
3610
|
equals(f) {
|
|
3611
|
-
|
|
3612
|
-
const { X: _, Y:
|
|
3611
|
+
b(f);
|
|
3612
|
+
const { X: _, Y: v, Z: A } = this, { X: L, Y: C, Z: M } = f, T = t.eql(t.mul(_, M), t.mul(L, A)), $ = t.eql(t.mul(v, M), t.mul(C, A));
|
|
3613
3613
|
return T && $;
|
|
3614
3614
|
}
|
|
3615
3615
|
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
@@ -3621,23 +3621,23 @@ function jr(r, e = {}) {
|
|
|
3621
3621
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
3622
3622
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
3623
3623
|
double() {
|
|
3624
|
-
const { a: f, b: _ } = o,
|
|
3624
|
+
const { a: f, b: _ } = o, v = t.mul(_, Fe), { X: A, Y: L, Z: C } = this;
|
|
3625
3625
|
let M = t.ZERO, T = t.ZERO, $ = t.ZERO, F = t.mul(A, A), J = t.mul(L, L), V = t.mul(C, C), H = t.mul(A, L);
|
|
3626
|
-
return H = t.add(H, H), $ = t.mul(A, C), $ = t.add($, $), M = t.mul(f, $), T = t.mul(
|
|
3626
|
+
return H = t.add(H, H), $ = t.mul(A, C), $ = t.add($, $), M = t.mul(f, $), T = t.mul(v, V), T = t.add(M, T), M = t.sub(J, T), T = t.add(J, T), T = t.mul(M, T), M = t.mul(H, M), $ = t.mul(v, $), V = t.mul(f, V), H = t.sub(F, V), H = t.mul(f, H), H = t.add(H, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, V), F = t.mul(F, H), T = t.add(T, F), V = t.mul(L, C), V = t.add(V, V), F = t.mul(V, H), M = t.sub(M, F), $ = t.mul(V, J), $ = t.add($, $), $ = t.add($, $), new k(M, T, $);
|
|
3627
3627
|
}
|
|
3628
3628
|
// Renes-Costello-Batina exception-free addition formula.
|
|
3629
3629
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
3630
3630
|
// https://eprint.iacr.org/2015/1060, algorithm 1
|
|
3631
3631
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
3632
3632
|
add(f) {
|
|
3633
|
-
|
|
3634
|
-
const { X: _, Y:
|
|
3633
|
+
b(f);
|
|
3634
|
+
const { X: _, Y: v, Z: A } = this, { X: L, Y: C, Z: M } = f;
|
|
3635
3635
|
let T = t.ZERO, $ = t.ZERO, F = t.ZERO;
|
|
3636
3636
|
const J = o.a, V = t.mul(o.b, Fe);
|
|
3637
|
-
let H = t.mul(_, L), Z = t.mul(
|
|
3637
|
+
let H = t.mul(_, L), Z = t.mul(v, C), X = t.mul(A, M), oe = t.add(_, v), j = t.add(L, C);
|
|
3638
3638
|
oe = t.mul(oe, j), j = t.add(H, Z), oe = t.sub(oe, j), j = t.add(_, A);
|
|
3639
3639
|
let Q = t.add(L, M);
|
|
3640
|
-
return j = t.mul(j, Q), Q = t.add(H, X), j = t.sub(j, Q), Q = t.add(
|
|
3640
|
+
return j = t.mul(j, Q), Q = t.add(H, X), j = t.sub(j, Q), Q = t.add(v, A), T = t.add(C, M), Q = t.mul(Q, T), T = t.add(Z, X), Q = t.sub(Q, T), F = t.mul(J, j), T = t.mul(V, X), F = t.add(T, F), T = t.sub(Z, F), F = t.add(Z, F), $ = t.mul(T, F), Z = t.add(H, H), Z = t.add(Z, H), X = t.mul(J, X), j = t.mul(V, j), Z = t.add(Z, X), X = t.sub(H, X), X = t.mul(J, X), j = t.add(j, X), H = t.mul(Z, j), $ = t.add($, H), H = t.mul(Q, j), T = t.mul(oe, T), T = t.sub(T, H), H = t.mul(oe, Z), F = t.mul(Q, F), F = t.add(F, H), new k(T, $, F);
|
|
3641
3641
|
}
|
|
3642
3642
|
subtract(f) {
|
|
3643
3643
|
return this.add(f.negate());
|
|
@@ -3658,16 +3658,16 @@ function jr(r, e = {}) {
|
|
|
3658
3658
|
const { endo: _ } = e;
|
|
3659
3659
|
if (!n.isValidNot0(f))
|
|
3660
3660
|
throw new Error("invalid scalar: out of range");
|
|
3661
|
-
let
|
|
3661
|
+
let v, A;
|
|
3662
3662
|
const L = (C) => D.cached(this, C, (M) => $t(k, M));
|
|
3663
3663
|
if (_) {
|
|
3664
3664
|
const { k1neg: C, k1: M, k2neg: T, k2: $ } = P(f), { p: F, f: J } = L(M), { p: V, f: H } = L($);
|
|
3665
|
-
A = J.add(H),
|
|
3665
|
+
A = J.add(H), v = K(_.beta, F, V, C, T);
|
|
3666
3666
|
} else {
|
|
3667
3667
|
const { p: C, f: M } = L(f);
|
|
3668
|
-
|
|
3668
|
+
v = C, A = M;
|
|
3669
3669
|
}
|
|
3670
|
-
return $t(k, [
|
|
3670
|
+
return $t(k, [v, A])[0];
|
|
3671
3671
|
}
|
|
3672
3672
|
/**
|
|
3673
3673
|
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
@@ -3675,27 +3675,27 @@ function jr(r, e = {}) {
|
|
|
3675
3675
|
* an exposed secret key e.g. sig verification, which works over *public* keys.
|
|
3676
3676
|
*/
|
|
3677
3677
|
multiplyUnsafe(f) {
|
|
3678
|
-
const { endo: _ } = e,
|
|
3678
|
+
const { endo: _ } = e, v = this;
|
|
3679
3679
|
if (!n.isValid(f))
|
|
3680
3680
|
throw new Error("invalid scalar: out of range");
|
|
3681
|
-
if (f === pe ||
|
|
3681
|
+
if (f === pe || v.is0())
|
|
3682
3682
|
return k.ZERO;
|
|
3683
3683
|
if (f === Te)
|
|
3684
|
-
return
|
|
3684
|
+
return v;
|
|
3685
3685
|
if (D.hasCache(this))
|
|
3686
3686
|
return this.multiply(f);
|
|
3687
3687
|
if (_) {
|
|
3688
|
-
const { k1neg: A, k1: L, k2neg: C, k2: M } = P(f), { p1: T, p2: $ } = Gr(k,
|
|
3688
|
+
const { k1neg: A, k1: L, k2neg: C, k2: M } = P(f), { p1: T, p2: $ } = Gr(k, v, L, M);
|
|
3689
3689
|
return K(_.beta, T, $, A, C);
|
|
3690
3690
|
} else
|
|
3691
|
-
return D.unsafe(
|
|
3691
|
+
return D.unsafe(v, f);
|
|
3692
3692
|
}
|
|
3693
3693
|
/**
|
|
3694
3694
|
* Converts Projective point to affine (x, y) coordinates.
|
|
3695
3695
|
* @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
|
|
3696
3696
|
*/
|
|
3697
3697
|
toAffine(f) {
|
|
3698
|
-
return
|
|
3698
|
+
return N(this, f);
|
|
3699
3699
|
}
|
|
3700
3700
|
/**
|
|
3701
3701
|
* Checks whether Point is free of torsion elements (is in prime subgroup).
|
|
@@ -3820,34 +3820,34 @@ function Jr(r, e, s = {}) {
|
|
|
3820
3820
|
}
|
|
3821
3821
|
function B(f, _) {
|
|
3822
3822
|
ct(_);
|
|
3823
|
-
const
|
|
3823
|
+
const v = x.signature, A = _ === "compact" ? v : _ === "recovered" ? v + 1 : void 0;
|
|
3824
3824
|
return z(f, A);
|
|
3825
3825
|
}
|
|
3826
|
-
class
|
|
3827
|
-
constructor(_,
|
|
3826
|
+
class b {
|
|
3827
|
+
constructor(_, v, A) {
|
|
3828
3828
|
I(this, "r");
|
|
3829
3829
|
I(this, "s");
|
|
3830
3830
|
I(this, "recovery");
|
|
3831
|
-
if (this.r = S("r", _), this.s = S("s",
|
|
3831
|
+
if (this.r = S("r", _), this.s = S("s", v), A != null) {
|
|
3832
3832
|
if (O(), ![0, 1, 2, 3].includes(A))
|
|
3833
3833
|
throw new Error("invalid recovery id");
|
|
3834
3834
|
this.recovery = A;
|
|
3835
3835
|
}
|
|
3836
3836
|
Object.freeze(this);
|
|
3837
3837
|
}
|
|
3838
|
-
static fromBytes(_,
|
|
3839
|
-
B(_,
|
|
3838
|
+
static fromBytes(_, v = w.format) {
|
|
3839
|
+
B(_, v);
|
|
3840
3840
|
let A;
|
|
3841
|
-
if (
|
|
3841
|
+
if (v === "der") {
|
|
3842
3842
|
const { r: T, s: $ } = me.toSig(z(_));
|
|
3843
|
-
return new
|
|
3843
|
+
return new b(T, $);
|
|
3844
3844
|
}
|
|
3845
|
-
|
|
3845
|
+
v === "recovered" && (A = _[0], v = "compact", _ = _.subarray(1));
|
|
3846
3846
|
const L = x.signature / 2, C = _.subarray(0, L), M = _.subarray(L, L * 2);
|
|
3847
|
-
return new
|
|
3847
|
+
return new b(i.fromBytes(C), i.fromBytes(M), A);
|
|
3848
3848
|
}
|
|
3849
|
-
static fromHex(_,
|
|
3850
|
-
return this.fromBytes(qe(_),
|
|
3849
|
+
static fromHex(_, v) {
|
|
3850
|
+
return this.fromBytes(qe(_), v);
|
|
3851
3851
|
}
|
|
3852
3852
|
assertRecovery() {
|
|
3853
3853
|
const { recovery: _ } = this;
|
|
@@ -3856,13 +3856,13 @@ function Jr(r, e, s = {}) {
|
|
|
3856
3856
|
return _;
|
|
3857
3857
|
}
|
|
3858
3858
|
addRecoveryBit(_) {
|
|
3859
|
-
return new
|
|
3859
|
+
return new b(this.r, this.s, _);
|
|
3860
3860
|
}
|
|
3861
3861
|
recoverPublicKey(_) {
|
|
3862
|
-
const { r:
|
|
3862
|
+
const { r: v, s: A } = this, L = this.assertRecovery(), C = L === 2 || L === 3 ? v + a : v;
|
|
3863
3863
|
if (!o.isValid(C))
|
|
3864
3864
|
throw new Error("invalid recovery id: sig.r+curve.n != R.x");
|
|
3865
|
-
const M = o.toBytes(C), T = r.fromBytes(
|
|
3865
|
+
const M = o.toBytes(C), T = r.fromBytes(we(Ss((L & 1) === 0), M)), $ = i.inv(C), F = N(z(_, void 0, "msgHash")), J = i.create(-F * $), V = i.create(A * $), H = r.BASE.multiplyUnsafe(J).add(T.multiplyUnsafe(V));
|
|
3866
3866
|
if (H.is0())
|
|
3867
3867
|
throw new Error("invalid recovery: point at infinify");
|
|
3868
3868
|
return H.assertValidity(), H;
|
|
@@ -3874,8 +3874,8 @@ function Jr(r, e, s = {}) {
|
|
|
3874
3874
|
toBytes(_ = w.format) {
|
|
3875
3875
|
if (ct(_), _ === "der")
|
|
3876
3876
|
return qe(me.hexFromSig(this));
|
|
3877
|
-
const { r:
|
|
3878
|
-
return _ === "recovered" ? (O(),
|
|
3877
|
+
const { r: v, s: A } = this, L = i.toBytes(v), C = i.toBytes(A);
|
|
3878
|
+
return _ === "recovered" ? (O(), we(Uint8Array.of(this.assertRecovery()), L, C)) : we(L, C);
|
|
3879
3879
|
}
|
|
3880
3880
|
toHex(_) {
|
|
3881
3881
|
return Me(this.toBytes(_));
|
|
@@ -3884,9 +3884,9 @@ function Jr(r, e, s = {}) {
|
|
|
3884
3884
|
const P = s.bits2int || function(_) {
|
|
3885
3885
|
if (_.length > 8192)
|
|
3886
3886
|
throw new Error("input is too large");
|
|
3887
|
-
const
|
|
3888
|
-
return A > 0 ?
|
|
3889
|
-
},
|
|
3887
|
+
const v = je(_), A = _.length * 8 - c;
|
|
3888
|
+
return A > 0 ? v >> BigInt(A) : v;
|
|
3889
|
+
}, N = s.bits2int_modN || function(_) {
|
|
3890
3890
|
return i.create(P(_));
|
|
3891
3891
|
}, G = ft(c);
|
|
3892
3892
|
function K(f) {
|
|
@@ -3895,10 +3895,10 @@ function Jr(r, e, s = {}) {
|
|
|
3895
3895
|
function W(f, _) {
|
|
3896
3896
|
return z(f, void 0, "message"), _ ? z(e(f), void 0, "prehashed message") : f;
|
|
3897
3897
|
}
|
|
3898
|
-
function q(f, _,
|
|
3899
|
-
const { lowS: A, prehash: L, extraEntropy: C } = st(
|
|
3898
|
+
function q(f, _, v) {
|
|
3899
|
+
const { lowS: A, prehash: L, extraEntropy: C } = st(v, w);
|
|
3900
3900
|
f = W(f, L);
|
|
3901
|
-
const M =
|
|
3901
|
+
const M = N(f), T = i.fromBytes(_);
|
|
3902
3902
|
if (!i.isValidNot0(T))
|
|
3903
3903
|
throw new Error("invalid private key");
|
|
3904
3904
|
const $ = [K(T), K(M)];
|
|
@@ -3906,7 +3906,7 @@ function Jr(r, e, s = {}) {
|
|
|
3906
3906
|
const H = C === !0 ? t(x.secretKey) : C;
|
|
3907
3907
|
$.push(z(H, void 0, "extraEntropy"));
|
|
3908
3908
|
}
|
|
3909
|
-
const F =
|
|
3909
|
+
const F = we(...$), J = M;
|
|
3910
3910
|
function V(H) {
|
|
3911
3911
|
const Z = P(H);
|
|
3912
3912
|
if (!i.isValidNot0(Z))
|
|
@@ -3918,34 +3918,34 @@ function Jr(r, e, s = {}) {
|
|
|
3918
3918
|
if (Q === pe)
|
|
3919
3919
|
return;
|
|
3920
3920
|
let yt = (oe.x === j ? 0 : 2) | Number(oe.y & Te), bt = Q;
|
|
3921
|
-
return A && y(Q) && (bt = i.neg(Q), yt ^= 1), new
|
|
3921
|
+
return A && y(Q) && (bt = i.neg(Q), yt ^= 1), new b(j, bt, E ? void 0 : yt);
|
|
3922
3922
|
}
|
|
3923
3923
|
return { seed: F, k2sig: V };
|
|
3924
3924
|
}
|
|
3925
|
-
function D(f, _,
|
|
3926
|
-
const { seed: A, k2sig: L } = q(f, _,
|
|
3927
|
-
return Pr(e.outputLen, i.BYTES, n)(A, L).toBytes(
|
|
3925
|
+
function D(f, _, v = {}) {
|
|
3926
|
+
const { seed: A, k2sig: L } = q(f, _, v);
|
|
3927
|
+
return Pr(e.outputLen, i.BYTES, n)(A, L).toBytes(v.format);
|
|
3928
3928
|
}
|
|
3929
|
-
function k(f, _,
|
|
3929
|
+
function k(f, _, v, A = {}) {
|
|
3930
3930
|
const { lowS: L, prehash: C, format: M } = st(A, w);
|
|
3931
|
-
if (
|
|
3932
|
-
const T = f instanceof
|
|
3931
|
+
if (v = z(v, void 0, "publicKey"), _ = W(_, C), !ut(f)) {
|
|
3932
|
+
const T = f instanceof b ? ", use sig.toBytes()" : "";
|
|
3933
3933
|
throw new Error("verify expects Uint8Array signature" + T);
|
|
3934
3934
|
}
|
|
3935
3935
|
B(f, M);
|
|
3936
3936
|
try {
|
|
3937
|
-
const T =
|
|
3937
|
+
const T = b.fromBytes(f, M), $ = r.fromBytes(v);
|
|
3938
3938
|
if (L && T.hasHighS())
|
|
3939
3939
|
return !1;
|
|
3940
|
-
const { r: F, s: J } = T, V =
|
|
3940
|
+
const { r: F, s: J } = T, V = N(_), H = i.inv(J), Z = i.create(V * H), X = i.create(F * H), oe = r.BASE.multiplyUnsafe(Z).add($.multiplyUnsafe(X));
|
|
3941
3941
|
return oe.is0() ? !1 : i.create(oe.x) === F;
|
|
3942
3942
|
} catch {
|
|
3943
3943
|
return !1;
|
|
3944
3944
|
}
|
|
3945
3945
|
}
|
|
3946
|
-
function
|
|
3947
|
-
const { prehash: A } = st(
|
|
3948
|
-
return _ = W(_, A),
|
|
3946
|
+
function R(f, _, v = {}) {
|
|
3947
|
+
const { prehash: A } = st(v, w);
|
|
3948
|
+
return _ = W(_, A), b.fromBytes(f, "recovered").recoverPublicKey(_).toBytes();
|
|
3949
3949
|
}
|
|
3950
3950
|
return Object.freeze({
|
|
3951
3951
|
keygen: l,
|
|
@@ -3956,8 +3956,8 @@ function Jr(r, e, s = {}) {
|
|
|
3956
3956
|
Point: r,
|
|
3957
3957
|
sign: D,
|
|
3958
3958
|
verify: k,
|
|
3959
|
-
recoverPublicKey:
|
|
3960
|
-
Signature:
|
|
3959
|
+
recoverPublicKey: R,
|
|
3960
|
+
Signature: b,
|
|
3961
3961
|
hash: e
|
|
3962
3962
|
});
|
|
3963
3963
|
}
|
|
@@ -3978,10 +3978,10 @@ const gt = {
|
|
|
3978
3978
|
]
|
|
3979
3979
|
}, Gt = /* @__PURE__ */ BigInt(2);
|
|
3980
3980
|
function Xr(r) {
|
|
3981
|
-
const e = gt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, d = l * l * r % e, h = ae(d, s, e) * d % e, m = ae(h, s, e) * d % e, x = ae(m, Gt, e) * l % e, w = ae(x, n, e) * x % e, E = ae(w, o, e) * w % e, y = ae(E, a, e) * E % e, S = ae(y, c, e) * y % e, O = ae(S, a, e) * E % e, B = ae(O, s, e) * d % e,
|
|
3982
|
-
if (!lt.eql(lt.sqr(
|
|
3981
|
+
const e = gt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, d = l * l * r % e, h = ae(d, s, e) * d % e, m = ae(h, s, e) * d % e, x = ae(m, Gt, e) * l % e, w = ae(x, n, e) * x % e, E = ae(w, o, e) * w % e, y = ae(E, a, e) * E % e, S = ae(y, c, e) * y % e, O = ae(S, a, e) * E % e, B = ae(O, s, e) * d % e, b = ae(B, i, e) * w % e, P = ae(b, t, e) * l % e, N = ae(P, Gt, e);
|
|
3982
|
+
if (!lt.eql(lt.sqr(N), r))
|
|
3983
3983
|
throw new Error("Cannot find square root");
|
|
3984
|
-
return
|
|
3984
|
+
return N;
|
|
3985
3985
|
}
|
|
3986
3986
|
const lt = Ye(gt.p, { sqrt: Xr }), Qr = /* @__PURE__ */ jr(gt, {
|
|
3987
3987
|
Fp: lt,
|
|
@@ -4187,7 +4187,7 @@ class fn {
|
|
|
4187
4187
|
}
|
|
4188
4188
|
}
|
|
4189
4189
|
}
|
|
4190
|
-
class
|
|
4190
|
+
class be {
|
|
4191
4191
|
static generateRandom16Hex() {
|
|
4192
4192
|
const e = new Uint8Array(16);
|
|
4193
4193
|
return crypto.getRandomValues(e), Array.from(e, (s) => s.toString(16).padStart(2, "0")).join("");
|
|
@@ -4211,7 +4211,7 @@ class we {
|
|
|
4211
4211
|
* - Google 및 기타: originalNonce === jwt.nonce
|
|
4212
4212
|
*/
|
|
4213
4213
|
static async verifyIdTokenNonce(e, s) {
|
|
4214
|
-
const t =
|
|
4214
|
+
const t = be.parseJwtPayload(e), n = t.nonce, o = typeof t.iss == "string" ? t.iss : "(unknown)";
|
|
4215
4215
|
if (u.log("[CROSSx] nonce 검증 시작 —", {
|
|
4216
4216
|
iss: o,
|
|
4217
4217
|
nonceClaimType: typeof n,
|
|
@@ -4233,7 +4233,7 @@ class we {
|
|
|
4233
4233
|
"ID Token에 nonce claim이 없습니다 — OAuth 서버 설정을 확인해 주세요"
|
|
4234
4234
|
);
|
|
4235
4235
|
if (o.includes("appleid.apple.com")) {
|
|
4236
|
-
const i = await
|
|
4236
|
+
const i = await be.sha256Hex(s);
|
|
4237
4237
|
if (u.log("[CROSSx] Apple nonce 검증 —", {
|
|
4238
4238
|
expectedHashLength: i.length,
|
|
4239
4239
|
receivedHashLength: n.length,
|
|
@@ -4250,7 +4250,7 @@ class we {
|
|
|
4250
4250
|
}
|
|
4251
4251
|
openAuth(e) {
|
|
4252
4252
|
return new Promise((s, t) => {
|
|
4253
|
-
const n = Math.max(e.width ?? 500, 500), o = Math.max(e.height ?? 700, 700), i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c =
|
|
4253
|
+
const n = Math.max(e.width ?? 500, 500), o = Math.max(e.height ?? 700, 700), i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c = be.generateRandom16Hex(), l = be.generateRandom16Hex(), d = e.authUrl.includes("?") ? "&" : "?", h = `${e.authUrl}${d}state=${c}&nonce=${l}`;
|
|
4254
4254
|
u.log("[CROSSx] OAuth 팝업 열기 — state, nonce 생성 완료:", {
|
|
4255
4255
|
stateLength: c.length,
|
|
4256
4256
|
nonceLength: l.length,
|
|
@@ -4266,62 +4266,47 @@ class we {
|
|
|
4266
4266
|
return;
|
|
4267
4267
|
}
|
|
4268
4268
|
const x = setTimeout(() => {
|
|
4269
|
-
u.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"),
|
|
4269
|
+
u.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), b(), t(new Error("Authentication timeout"));
|
|
4270
4270
|
}, 5 * 60 * 1e3), w = 10, E = 30;
|
|
4271
4271
|
let y = 0, S = null;
|
|
4272
4272
|
const O = () => {
|
|
4273
4273
|
clearInterval(B), u.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + E + "초간 대기합니다"), S = setTimeout(() => {
|
|
4274
|
-
|
|
4274
|
+
b(), t(new Error(
|
|
4275
4275
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
4276
4276
|
));
|
|
4277
4277
|
}, E * 1e3);
|
|
4278
4278
|
}, B = setInterval(() => {
|
|
4279
4279
|
y++;
|
|
4280
4280
|
try {
|
|
4281
|
-
m.closed && (y <= w ? O() : (
|
|
4281
|
+
m.closed && (y <= w ? O() : (b(), t(new Error("로그인이 취소되었습니다"))));
|
|
4282
4282
|
} catch {
|
|
4283
4283
|
O();
|
|
4284
4284
|
}
|
|
4285
|
-
}, 1e3),
|
|
4285
|
+
}, 1e3), b = () => {
|
|
4286
4286
|
clearTimeout(x), clearInterval(B), S && clearTimeout(S), window.removeEventListener("message", P);
|
|
4287
|
-
}, P = (
|
|
4287
|
+
}, P = (N) => {
|
|
4288
4288
|
var K, W, q, D, k;
|
|
4289
|
-
if (
|
|
4290
|
-
|
|
4291
|
-
const G =
|
|
4289
|
+
if (N.origin !== e.expectedOrigin) return;
|
|
4290
|
+
b(), u.log("[CROSSx] OAuth postMessage 수신 — status:", N.data.status);
|
|
4291
|
+
const G = N.data.state ?? ((K = N.data.data) == null ? void 0 : K.state);
|
|
4292
4292
|
if (!G || G !== c) {
|
|
4293
4293
|
t(new Error("OAuth state mismatch — possible CSRF attack"));
|
|
4294
4294
|
return;
|
|
4295
4295
|
}
|
|
4296
|
-
if (
|
|
4297
|
-
const
|
|
4296
|
+
if (N.data.status === "success") {
|
|
4297
|
+
const R = (W = N.data.data) == null ? void 0 : W.idToken, f = (q = N.data.data) == null ? void 0 : q.accessToken, _ = f ?? R;
|
|
4298
4298
|
if (u.log("[CROSSx] OAuth 토큰 수신:", {
|
|
4299
4299
|
hasAccessToken: !!f,
|
|
4300
|
-
hasIdToken: !!
|
|
4300
|
+
hasIdToken: !!R
|
|
4301
4301
|
}), !_) {
|
|
4302
|
-
u.error("[CROSSx] 토큰을 찾을 수 없음:",
|
|
4302
|
+
u.error("[CROSSx] 토큰을 찾을 수 없음:", N.data), t(new Error("Token not found in response"));
|
|
4303
4303
|
return;
|
|
4304
4304
|
}
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
u.log("[CROSSx] idToken JWT payload 요약:", {
|
|
4309
|
-
iss: b.iss,
|
|
4310
|
-
sub: typeof b.sub == "string" ? `${b.sub.slice(0, 6)}...` : "(absent)",
|
|
4311
|
-
hasNonceClaim: "nonce" in b,
|
|
4312
|
-
nonceClaimType: typeof b.nonce,
|
|
4313
|
-
appleNonceSupported: b.nonce_supported ?? "(field absent)"
|
|
4314
|
-
});
|
|
4315
|
-
} catch {
|
|
4316
|
-
u.warn("[CROSSx] idToken JWT payload 파싱 실패 — 토큰 형식을 확인하세요");
|
|
4317
|
-
}
|
|
4318
|
-
we.verifyIdTokenNonce(N, l).then(() => s(_)).catch((b) => {
|
|
4319
|
-
u.error("[CROSSx] nonce 검증 실패:", b), t(b instanceof Error ? b : new Error("nonce verification failed"));
|
|
4320
|
-
});
|
|
4321
|
-
} else
|
|
4322
|
-
s(_);
|
|
4305
|
+
R ? be.verifyIdTokenNonce(R, l).then(() => s(_)).catch((v) => {
|
|
4306
|
+
u.error("[CROSSx] nonce 검증 실패:", v), t(v instanceof Error ? v : new Error("nonce verification failed"));
|
|
4307
|
+
}) : s(_);
|
|
4323
4308
|
} else
|
|
4324
|
-
u.error("[CROSSx] OAuth 실패:", (D =
|
|
4309
|
+
u.error("[CROSSx] OAuth 실패:", (D = N.data.data) == null ? void 0 : D.error), t(new Error(((k = N.data.data) == null ? void 0 : k.error) || "Authentication failed"));
|
|
4325
4310
|
};
|
|
4326
4311
|
window.addEventListener("message", P);
|
|
4327
4312
|
});
|
|
@@ -4517,8 +4502,7 @@ class Le {
|
|
|
4517
4502
|
code: d.code,
|
|
4518
4503
|
message: h,
|
|
4519
4504
|
url: o,
|
|
4520
|
-
method: e
|
|
4521
|
-
fullResponse: d
|
|
4505
|
+
method: e
|
|
4522
4506
|
});
|
|
4523
4507
|
const m = Le.mapGatewayError(d.code, d.data), x = Le.getGatewayErrorMessage(d.code, h), w = d.data, E = m === p.PIN_LOCKED ? Le.extractLockDetails(w) : w ?? void 0, y = new g(m, x, E);
|
|
4524
4508
|
throw y.gatewayCode = d.code, y.gatewayMessage = h, m === p.AUTH_NOT_AUTHENTICATED && this._onUnauthorized && (u.warn("[CROSSx] Gateway -10002 감지 — 강제 로그아웃 실행"), this._onUnauthorized()), y;
|
|
@@ -4673,7 +4657,7 @@ class Le {
|
|
|
4673
4657
|
)).txHash };
|
|
4674
4658
|
}
|
|
4675
4659
|
async migrateWallet(e, s) {
|
|
4676
|
-
u.log("[CROSSx][Migration Phase 4] POST /mnemonic/migrate 호출
|
|
4660
|
+
u.log("[CROSSx][Migration Phase 4] POST /mnemonic/migrate 호출");
|
|
4677
4661
|
const t = { recoveryPin: e, sub: s, password: this.requirePin() }, n = await this.request(
|
|
4678
4662
|
"POST",
|
|
4679
4663
|
"/mnemonic/migrate",
|
|
@@ -7331,24 +7315,24 @@ function qn(r) {
|
|
|
7331
7315
|
}
|
|
7332
7316
|
function ot(r, e, s, t, n, o) {
|
|
7333
7317
|
let i = !!(o && o > Date.now()), a = !1;
|
|
7334
|
-
const c = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), l = () => r.querySelector("#__crossx-pin6-boxes"), d = () => r.querySelector("#__crossx-pin6-error"), h = () => r.querySelector("#__crossx-pin6-lock-msg"), m = () => r.querySelector("#__crossx-pin6-lock-countdown"), x = () => r.querySelector(".__crossx-pin6-body"), w = () => c().map((
|
|
7335
|
-
i =
|
|
7336
|
-
P.disabled =
|
|
7318
|
+
const c = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), l = () => r.querySelector("#__crossx-pin6-boxes"), d = () => r.querySelector("#__crossx-pin6-error"), h = () => r.querySelector("#__crossx-pin6-lock-msg"), m = () => r.querySelector("#__crossx-pin6-lock-countdown"), x = () => r.querySelector(".__crossx-pin6-body"), w = () => c().map((b) => b.value).join(""), E = (b) => {
|
|
7319
|
+
i = b, c().forEach((P) => {
|
|
7320
|
+
P.disabled = b, P.classList.toggle("--locked", b);
|
|
7337
7321
|
});
|
|
7338
7322
|
}, y = () => {
|
|
7339
|
-
const
|
|
7340
|
-
|
|
7341
|
-
}, S = (
|
|
7323
|
+
const b = d();
|
|
7324
|
+
b && (b.textContent = "");
|
|
7325
|
+
}, S = (b) => {
|
|
7342
7326
|
const P = d();
|
|
7343
|
-
P && (P.textContent =
|
|
7344
|
-
const
|
|
7345
|
-
|
|
7327
|
+
P && (P.textContent = b);
|
|
7328
|
+
const N = l();
|
|
7329
|
+
N == null || N.classList.add("--shake"), setTimeout(() => N == null ? void 0 : N.classList.remove("--shake"), 500), c().forEach((G) => {
|
|
7346
7330
|
G.value = "";
|
|
7347
7331
|
}), setTimeout(() => {
|
|
7348
7332
|
var G;
|
|
7349
7333
|
return (G = c()[0]) == null ? void 0 : G.focus();
|
|
7350
7334
|
}, 50);
|
|
7351
|
-
}, O = (
|
|
7335
|
+
}, O = (b) => {
|
|
7352
7336
|
var W;
|
|
7353
7337
|
E(!0), c().forEach((q) => {
|
|
7354
7338
|
q.value = "";
|
|
@@ -7360,32 +7344,32 @@ function ot(r, e, s, t, n, o) {
|
|
|
7360
7344
|
const D = d();
|
|
7361
7345
|
D ? D.insertAdjacentElement("afterend", q) : (W = x()) == null || W.appendChild(q);
|
|
7362
7346
|
}
|
|
7363
|
-
const
|
|
7347
|
+
const N = () => {
|
|
7364
7348
|
var k;
|
|
7365
|
-
const q =
|
|
7349
|
+
const q = b - Date.now(), D = m();
|
|
7366
7350
|
q <= 0 ? (clearInterval(G), E(!1), (k = h()) == null || k.remove(), P && (P.textContent = ""), setTimeout(() => {
|
|
7367
|
-
var
|
|
7368
|
-
return (
|
|
7351
|
+
var R;
|
|
7352
|
+
return (R = c()[0]) == null ? void 0 : R.focus();
|
|
7369
7353
|
}, 50)) : D && (D.textContent = ` ${qn(q)}`);
|
|
7370
|
-
}, G = setInterval(
|
|
7371
|
-
|
|
7354
|
+
}, G = setInterval(N, 1e3);
|
|
7355
|
+
N();
|
|
7372
7356
|
const K = new MutationObserver(() => {
|
|
7373
7357
|
document.contains(r) || (clearInterval(G), K.disconnect());
|
|
7374
7358
|
});
|
|
7375
7359
|
K.observe(document.body, { childList: !0, subtree: !1 });
|
|
7376
7360
|
}, B = async () => {
|
|
7377
7361
|
if (i || a) return;
|
|
7378
|
-
const
|
|
7379
|
-
if (
|
|
7362
|
+
const b = w();
|
|
7363
|
+
if (b.length === 6) {
|
|
7380
7364
|
a = !0, c().forEach((P) => {
|
|
7381
7365
|
P.disabled = !0;
|
|
7382
7366
|
});
|
|
7383
7367
|
try {
|
|
7384
7368
|
if (n) {
|
|
7385
|
-
const P = await n(
|
|
7386
|
-
P.ok ? e(
|
|
7369
|
+
const P = await n(b);
|
|
7370
|
+
P.ok ? e(b) : P.lockExpiresAt ? O(P.lockExpiresAt) : S(P.error ?? "Incorrect PIN. Please try again.");
|
|
7387
7371
|
} else
|
|
7388
|
-
e(
|
|
7372
|
+
e(b);
|
|
7389
7373
|
} catch (P) {
|
|
7390
7374
|
t && t(P);
|
|
7391
7375
|
} finally {
|
|
@@ -7396,33 +7380,33 @@ function ot(r, e, s, t, n, o) {
|
|
|
7396
7380
|
}
|
|
7397
7381
|
};
|
|
7398
7382
|
o && o > Date.now() ? O(o) : setTimeout(() => {
|
|
7399
|
-
var
|
|
7400
|
-
return (
|
|
7401
|
-
}, 100), c().forEach((
|
|
7402
|
-
|
|
7383
|
+
var b;
|
|
7384
|
+
return (b = c()[0]) == null ? void 0 : b.focus();
|
|
7385
|
+
}, 100), c().forEach((b, P) => {
|
|
7386
|
+
b.addEventListener("input", () => {
|
|
7403
7387
|
var G;
|
|
7404
|
-
const
|
|
7405
|
-
|
|
7406
|
-
}),
|
|
7388
|
+
const N = b.value.replace(/\D/g, "").slice(-1);
|
|
7389
|
+
b.value = N, y(), N && P < 5 && ((G = c()[P + 1]) == null || G.focus()), w().length === 6 && setTimeout(B, 80);
|
|
7390
|
+
}), b.addEventListener("keydown", (N) => {
|
|
7407
7391
|
var G, K;
|
|
7408
|
-
if (
|
|
7409
|
-
if (
|
|
7410
|
-
|
|
7392
|
+
if (N.key === "Backspace") {
|
|
7393
|
+
if (N.preventDefault(), b.value)
|
|
7394
|
+
b.value = "";
|
|
7411
7395
|
else if (P > 0) {
|
|
7412
7396
|
const W = c()[P - 1];
|
|
7413
7397
|
W.value = "", W.focus();
|
|
7414
7398
|
}
|
|
7415
|
-
} else
|
|
7416
|
-
}),
|
|
7399
|
+
} else N.key === "ArrowLeft" && P > 0 ? (N.preventDefault(), (G = c()[P - 1]) == null || G.focus()) : N.key === "ArrowRight" && P < 5 ? (N.preventDefault(), (K = c()[P + 1]) == null || K.focus()) : N.key === "Escape" && s();
|
|
7400
|
+
}), b.addEventListener("paste", (N) => {
|
|
7417
7401
|
var W, q;
|
|
7418
|
-
|
|
7419
|
-
const G = (((W =
|
|
7402
|
+
N.preventDefault();
|
|
7403
|
+
const G = (((W = N.clipboardData) == null ? void 0 : W.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
|
|
7420
7404
|
if (!G) return;
|
|
7421
7405
|
const K = c();
|
|
7422
7406
|
G.split("").forEach((D, k) => {
|
|
7423
7407
|
K[k] && (K[k].value = D);
|
|
7424
7408
|
}), (q = K[Math.min(G.length - 1, 5)]) == null || q.focus(), y(), w().length === 6 && setTimeout(B, 80);
|
|
7425
|
-
}),
|
|
7409
|
+
}), b.addEventListener("focus", () => b.select());
|
|
7426
7410
|
});
|
|
7427
7411
|
}
|
|
7428
7412
|
const Rs = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -7620,8 +7604,8 @@ class jn {
|
|
|
7620
7604
|
x.innerHTML = nt({
|
|
7621
7605
|
title: i.title,
|
|
7622
7606
|
headerSubtitle: i.headerSubtitle
|
|
7623
|
-
}), (B = x.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), ot(x, (
|
|
7624
|
-
|
|
7607
|
+
}), (B = x.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), ot(x, (b) => {
|
|
7608
|
+
b === O ? h(O) : y(o.mismatchError);
|
|
7625
7609
|
}, m);
|
|
7626
7610
|
}, y = (O) => {
|
|
7627
7611
|
var B;
|
|
@@ -7630,42 +7614,42 @@ class jn {
|
|
|
7630
7614
|
headerSubtitle: o.headerSubtitle,
|
|
7631
7615
|
subtitle: o.subtitle,
|
|
7632
7616
|
errorMessage: O
|
|
7633
|
-
}), (B = x.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), ot(x, (
|
|
7634
|
-
const P = Wn(
|
|
7635
|
-
P ? y(P) : E(
|
|
7617
|
+
}), (B = x.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), ot(x, (b) => {
|
|
7618
|
+
const P = Wn(b, w);
|
|
7619
|
+
P ? y(P) : E(b);
|
|
7636
7620
|
}, m);
|
|
7637
7621
|
};
|
|
7638
7622
|
(() => {
|
|
7639
7623
|
var q;
|
|
7640
|
-
const O = Array.from(x.querySelectorAll(".__crossx-pw-notice-item")), B = x.querySelector("#__crossx-pin-notice-next"),
|
|
7624
|
+
const O = Array.from(x.querySelectorAll(".__crossx-pw-notice-item")), B = x.querySelector("#__crossx-pin-notice-next"), b = /* @__PURE__ */ new Set();
|
|
7641
7625
|
B.removeAttribute("disabled");
|
|
7642
|
-
const P = B.dataset.nextLabel ?? "Next",
|
|
7643
|
-
const D =
|
|
7644
|
-
B.classList.toggle("--disabled", !D), B.textContent = D ?
|
|
7626
|
+
const P = B.dataset.nextLabel ?? "Next", N = B.dataset.submitLabel ?? "I Understand", G = () => {
|
|
7627
|
+
const D = b.size === O.length;
|
|
7628
|
+
B.classList.toggle("--disabled", !D), B.textContent = D ? N : P;
|
|
7645
7629
|
}, K = (D, k) => {
|
|
7646
|
-
if (
|
|
7647
|
-
const
|
|
7648
|
-
|
|
7630
|
+
if (b.has(k)) return;
|
|
7631
|
+
const R = D.querySelector(`#__crossx-notice-check-${k}`);
|
|
7632
|
+
b.add(k), R.classList.add("--checked"), D.setAttribute("aria-checked", "true"), G();
|
|
7649
7633
|
}, W = (D, k) => {
|
|
7650
|
-
if (!
|
|
7651
|
-
const
|
|
7652
|
-
|
|
7634
|
+
if (!b.has(k)) return;
|
|
7635
|
+
const R = D.querySelector(`#__crossx-notice-check-${k}`);
|
|
7636
|
+
b.delete(k), R.classList.remove("--checked"), D.setAttribute("aria-checked", "false"), G();
|
|
7653
7637
|
};
|
|
7654
7638
|
O.forEach((D) => {
|
|
7655
7639
|
const k = parseInt(D.dataset.checkIndex ?? "0", 10);
|
|
7656
7640
|
D.addEventListener("click", () => {
|
|
7657
|
-
|
|
7658
|
-
}), D.addEventListener("keydown", (
|
|
7659
|
-
(
|
|
7641
|
+
b.has(k) ? W(D, k) : K(D, k);
|
|
7642
|
+
}), D.addEventListener("keydown", (R) => {
|
|
7643
|
+
(R.key === " " || R.key === "Enter") && (R.preventDefault(), b.has(k) ? W(D, k) : K(D, k));
|
|
7660
7644
|
});
|
|
7661
7645
|
}), B.addEventListener("click", () => {
|
|
7662
|
-
if (
|
|
7646
|
+
if (b.size === O.length) {
|
|
7663
7647
|
y(e == null ? void 0 : e.errorMessage);
|
|
7664
7648
|
return;
|
|
7665
7649
|
}
|
|
7666
|
-
const D = O.find((
|
|
7667
|
-
const f = parseInt(
|
|
7668
|
-
return !
|
|
7650
|
+
const D = O.find((R) => {
|
|
7651
|
+
const f = parseInt(R.dataset.checkIndex ?? "0", 10);
|
|
7652
|
+
return !b.has(f);
|
|
7669
7653
|
});
|
|
7670
7654
|
if (!D) return;
|
|
7671
7655
|
const k = parseInt(D.dataset.checkIndex ?? "0", 10);
|
|
@@ -7861,38 +7845,38 @@ class Yn {
|
|
|
7861
7845
|
return this._accessToken !== null;
|
|
7862
7846
|
}
|
|
7863
7847
|
}
|
|
7864
|
-
function Qn(r) {
|
|
7848
|
+
function Qn(r, e) {
|
|
7865
7849
|
r.debug;
|
|
7866
|
-
const
|
|
7850
|
+
const s = We.production, t = {
|
|
7867
7851
|
...r,
|
|
7868
|
-
oauthServiceUrl:
|
|
7869
|
-
authApiUrl:
|
|
7870
|
-
walletGatewayUrl:
|
|
7871
|
-
},
|
|
7872
|
-
gatewayUrl:
|
|
7852
|
+
oauthServiceUrl: s.oauthServiceUrl,
|
|
7853
|
+
authApiUrl: s.authApiUrl,
|
|
7854
|
+
walletGatewayUrl: s.walletGatewayUrl
|
|
7855
|
+
}, n = {
|
|
7856
|
+
gatewayUrl: s.walletGatewayUrl,
|
|
7873
7857
|
projectId: r.projectId
|
|
7874
|
-
},
|
|
7875
|
-
let
|
|
7876
|
-
r.useMockWallet ? (u.log("[CROSSx] Mock Wallet Provider 사용"),
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7858
|
+
}, i = t.authMode !== "cookie" && Nt.isAvailable() ? new Nt() : new sr(), a = new un(), c = new fn(), l = new be(), d = new Yn(), h = new Xt();
|
|
7859
|
+
let m;
|
|
7860
|
+
r.useMockWallet ? (u.log("[CROSSx] Mock Wallet Provider 사용"), m = new _n(i, h)) : (u.log("[CROSSx] Remote Wallet Provider 사용"), m = new Le(
|
|
7861
|
+
n,
|
|
7862
|
+
i,
|
|
7863
|
+
c,
|
|
7864
|
+
d,
|
|
7865
|
+
h
|
|
7882
7866
|
));
|
|
7883
|
-
const
|
|
7867
|
+
const x = new De(n, c), w = new jn(r.theme ?? "light", r.themeTokens), E = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w;
|
|
7884
7868
|
return new it(
|
|
7885
|
-
s,
|
|
7886
7869
|
t,
|
|
7887
|
-
|
|
7870
|
+
n,
|
|
7888
7871
|
i,
|
|
7889
7872
|
a,
|
|
7890
7873
|
c,
|
|
7891
|
-
h,
|
|
7892
7874
|
l,
|
|
7893
|
-
x,
|
|
7894
7875
|
m,
|
|
7895
|
-
d
|
|
7876
|
+
d,
|
|
7877
|
+
E,
|
|
7878
|
+
x,
|
|
7879
|
+
h
|
|
7896
7880
|
);
|
|
7897
7881
|
}
|
|
7898
7882
|
export {
|