@cedros/login-react 0.0.45 → 0.0.47
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/README.md +32 -2
- package/dist/{AuthenticationSettings-bNQiNQ9g.cjs → AuthenticationSettings-BBOjHR6j.cjs} +1 -1
- package/dist/{AuthenticationSettings-bNQiNQ9g.cjs.map → AuthenticationSettings-BBOjHR6j.cjs.map} +1 -1
- package/dist/{AuthenticationSettings-BlYOmaEG.cjs → AuthenticationSettings-BXZRBZqc.cjs} +1 -1
- package/dist/{AuthenticationSettings-BlYOmaEG.cjs.map → AuthenticationSettings-BXZRBZqc.cjs.map} +1 -1
- package/dist/{AuthenticationSettings-BsuwWKbT.js → AuthenticationSettings-Bc_qT4nV.js} +1 -1
- package/dist/{AuthenticationSettings-BsuwWKbT.js.map → AuthenticationSettings-Bc_qT4nV.js.map} +1 -1
- package/dist/{AuthenticationSettings-DrHqtD7p.js → AuthenticationSettings-DXWCVZxS.js} +1 -1
- package/dist/{AuthenticationSettings-DrHqtD7p.js.map → AuthenticationSettings-DXWCVZxS.js.map} +1 -1
- package/dist/{AutosaveStatus-CZSwtgrL.cjs → AutosaveStatus-DfMPudTQ.cjs} +1 -1
- package/dist/AutosaveStatus-DfMPudTQ.cjs.map +1 -0
- package/dist/{AutosaveStatus-D-roPsRx.js → AutosaveStatus-DhGM3UUx.js} +103 -36
- package/dist/AutosaveStatus-DhGM3UUx.js.map +1 -0
- package/dist/{CreditSystemSettings-BTqZFn4K.js → CreditSystemSettings-B59-gOQT.js} +1 -1
- package/dist/{CreditSystemSettings-BTqZFn4K.js.map → CreditSystemSettings-B59-gOQT.js.map} +1 -1
- package/dist/{CreditSystemSettings-3R6crxvW.cjs → CreditSystemSettings-Badz4iAc.cjs} +1 -1
- package/dist/{CreditSystemSettings-3R6crxvW.cjs.map → CreditSystemSettings-Badz4iAc.cjs.map} +1 -1
- package/dist/{CreditSystemSettings-BskW_NKx.cjs → CreditSystemSettings-BxSoDwEi.cjs} +1 -1
- package/dist/{CreditSystemSettings-BskW_NKx.cjs.map → CreditSystemSettings-BxSoDwEi.cjs.map} +1 -1
- package/dist/{CreditSystemSettings-SL45GRH3.js → CreditSystemSettings-DxFpOeBW.js} +1 -1
- package/dist/{CreditSystemSettings-SL45GRH3.js.map → CreditSystemSettings-DxFpOeBW.js.map} +1 -1
- package/dist/EmailRegisterForm-ByYQ43yL.cjs +1 -0
- package/dist/EmailRegisterForm-ByYQ43yL.cjs.map +1 -0
- package/dist/EmailRegisterForm-DMUcNQT-.js +781 -0
- package/dist/EmailRegisterForm-DMUcNQT-.js.map +1 -0
- package/dist/{EmailSettings-XETM8FdS.js → EmailSettings-0y8D1QzF.js} +1 -1
- package/dist/{EmailSettings-XETM8FdS.js.map → EmailSettings-0y8D1QzF.js.map} +1 -1
- package/dist/{EmailSettings-BUAQji4I.js → EmailSettings-BA722mhf.js} +1 -1
- package/dist/{EmailSettings-BUAQji4I.js.map → EmailSettings-BA722mhf.js.map} +1 -1
- package/dist/{EmailSettings-CihElRkc.cjs → EmailSettings-BwZvdOYB.cjs} +1 -1
- package/dist/{EmailSettings-CihElRkc.cjs.map → EmailSettings-BwZvdOYB.cjs.map} +1 -1
- package/dist/{EmailSettings-CEC1rhrm.cjs → EmailSettings-DIjo3aJo.cjs} +1 -1
- package/dist/{EmailSettings-CEC1rhrm.cjs.map → EmailSettings-DIjo3aJo.cjs.map} +1 -1
- package/dist/{EmbeddedWalletSettings-CCT9DwmL.js → EmbeddedWalletSettings-BDbPpqWD.js} +1 -1
- package/dist/{EmbeddedWalletSettings-CCT9DwmL.js.map → EmbeddedWalletSettings-BDbPpqWD.js.map} +1 -1
- package/dist/{EmbeddedWalletSettings-MtwR81WH.cjs → EmbeddedWalletSettings-Db9a0D5l.cjs} +1 -1
- package/dist/{EmbeddedWalletSettings-MtwR81WH.cjs.map → EmbeddedWalletSettings-Db9a0D5l.cjs.map} +1 -1
- package/dist/{EmbeddedWalletSettings-B-083zu6.js → EmbeddedWalletSettings-MH4A6e6S.js} +1 -1
- package/dist/{EmbeddedWalletSettings-B-083zu6.js.map → EmbeddedWalletSettings-MH4A6e6S.js.map} +1 -1
- package/dist/{EmbeddedWalletSettings-DXIjansC.cjs → EmbeddedWalletSettings-T7LwbGok.cjs} +1 -1
- package/dist/{EmbeddedWalletSettings-DXIjansC.cjs.map → EmbeddedWalletSettings-T7LwbGok.cjs.map} +1 -1
- package/dist/GoogleLoginButton-DEwtBp56.cjs +1 -0
- package/dist/GoogleLoginButton-DEwtBp56.cjs.map +1 -0
- package/dist/{GoogleLoginButton-C1WNu7W3.js → GoogleLoginButton-DwyxvhnL.js} +82 -80
- package/dist/GoogleLoginButton-DwyxvhnL.js.map +1 -0
- package/dist/{PermissionsSection-mm9hfp-u.js → PermissionsSection-0oNHPZzL.js} +383 -415
- package/dist/PermissionsSection-0oNHPZzL.js.map +1 -0
- package/dist/PermissionsSection-CZsJuxo4.cjs +1 -0
- package/dist/PermissionsSection-CZsJuxo4.cjs.map +1 -0
- package/dist/{ServerSettings-DBpbRihl.js → ServerSettings-CwCkkU50.js} +1 -1
- package/dist/{ServerSettings-DBpbRihl.js.map → ServerSettings-CwCkkU50.js.map} +1 -1
- package/dist/{ServerSettings-24DA_BOI.js → ServerSettings-DKzWaqjC.js} +1 -1
- package/dist/{ServerSettings-24DA_BOI.js.map → ServerSettings-DKzWaqjC.js.map} +1 -1
- package/dist/{ServerSettings-BTEuzdrf.cjs → ServerSettings-DptlzQAu.cjs} +1 -1
- package/dist/{ServerSettings-BTEuzdrf.cjs.map → ServerSettings-DptlzQAu.cjs.map} +1 -1
- package/dist/{ServerSettings-BNc4LEs4.cjs → ServerSettings-j5Lu5D-R.cjs} +1 -1
- package/dist/{ServerSettings-BNc4LEs4.cjs.map → ServerSettings-j5Lu5D-R.cjs.map} +1 -1
- package/dist/SolanaLoginButton-2504p6cr.cjs +1 -0
- package/dist/SolanaLoginButton-2504p6cr.cjs.map +1 -0
- package/dist/SolanaLoginButton-C7Kc_m6n.js +234 -0
- package/dist/SolanaLoginButton-C7Kc_m6n.js.map +1 -0
- package/dist/{TeamSection-Km7EwLWD.cjs → TeamSection-DN8PEHH3.cjs} +1 -1
- package/dist/{TeamSection-Km7EwLWD.cjs.map → TeamSection-DN8PEHH3.cjs.map} +1 -1
- package/dist/{TeamSection-C_eODdLU.js → TeamSection-gUyP4YDM.js} +1 -1
- package/dist/{TeamSection-C_eODdLU.js.map → TeamSection-gUyP4YDM.js.map} +1 -1
- package/dist/{UsersSection-C1Tt0ePx.cjs → UsersSection-8wLuD0fr.cjs} +1 -1
- package/dist/{UsersSection-C1Tt0ePx.cjs.map → UsersSection-8wLuD0fr.cjs.map} +1 -1
- package/dist/{UsersSection-Ct_E-MBF.js → UsersSection-CnsFrG-6.js} +1 -1
- package/dist/{UsersSection-Ct_E-MBF.js.map → UsersSection-CnsFrG-6.js.map} +1 -1
- package/dist/{WebhookSettings-D9IsXZJN.js → WebhookSettings-2hlLLyGd.js} +1 -1
- package/dist/{WebhookSettings-D9IsXZJN.js.map → WebhookSettings-2hlLLyGd.js.map} +1 -1
- package/dist/{WebhookSettings-C6X_JJcD.cjs → WebhookSettings-CoEoVRRO.cjs} +1 -1
- package/dist/{WebhookSettings-C6X_JJcD.cjs.map → WebhookSettings-CoEoVRRO.cjs.map} +1 -1
- package/dist/{WebhookSettings-H1x6IKOj.cjs → WebhookSettings-DOaydSWQ.cjs} +1 -1
- package/dist/{WebhookSettings-H1x6IKOj.cjs.map → WebhookSettings-DOaydSWQ.cjs.map} +1 -1
- package/dist/{WebhookSettings-BhIwucKb.js → WebhookSettings-LS_wUimF.js} +1 -1
- package/dist/{WebhookSettings-BhIwucKb.js.map → WebhookSettings-LS_wUimF.js.map} +1 -1
- package/dist/admin-only.cjs +1 -1
- package/dist/admin-only.js +1 -1
- package/dist/email-only.cjs +1 -1
- package/dist/email-only.d.ts +10 -2
- package/dist/email-only.js +2 -2
- package/dist/google-only.cjs +1 -1
- package/dist/google-only.d.ts +7 -2
- package/dist/google-only.js +2 -2
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +182 -11
- package/dist/index.js +5221 -4657
- package/dist/index.js.map +1 -1
- package/dist/login-react.css +1 -1
- package/dist/{plugin-BwwJh2cY.cjs → plugin-DNFjEfYp.cjs} +1 -1
- package/dist/{plugin-BwwJh2cY.cjs.map → plugin-DNFjEfYp.cjs.map} +1 -1
- package/dist/{plugin-CetHtdLq.js → plugin-WYMrRNbz.js} +1 -1
- package/dist/{plugin-CetHtdLq.js.map → plugin-WYMrRNbz.js.map} +1 -1
- package/dist/solana-only.cjs +1 -1
- package/dist/solana-only.d.ts +6 -1
- package/dist/solana-only.js +2 -2
- package/dist/useAuth-2vgrAH-M.cjs +1 -0
- package/dist/useAuth-2vgrAH-M.cjs.map +1 -0
- package/dist/{useAuth-l-itM5am.js → useAuth-CNflw856.js} +465 -469
- package/dist/useAuth-CNflw856.js.map +1 -0
- package/dist/useServerFeatures-9_aNPaa6.cjs +1 -0
- package/dist/useServerFeatures-9_aNPaa6.cjs.map +1 -0
- package/dist/useServerFeatures-DSkYdan-.js +82 -0
- package/dist/useServerFeatures-DSkYdan-.js.map +1 -0
- package/dist/{useUsersStatsSummary-BGeh3RnI.js → useUsersStatsSummary-B4_RBEYy.js} +504 -442
- package/dist/useUsersStatsSummary-B4_RBEYy.js.map +1 -0
- package/dist/useUsersStatsSummary-CHRMrlk4.cjs +1 -0
- package/dist/useUsersStatsSummary-CHRMrlk4.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/AutosaveStatus-CZSwtgrL.cjs.map +0 -1
- package/dist/AutosaveStatus-D-roPsRx.js.map +0 -1
- package/dist/EmailRegisterForm-p2X5QP58.js +0 -750
- package/dist/EmailRegisterForm-p2X5QP58.js.map +0 -1
- package/dist/EmailRegisterForm-xFb6MaVA.cjs +0 -1
- package/dist/EmailRegisterForm-xFb6MaVA.cjs.map +0 -1
- package/dist/GoogleLoginButton-2zNTIKMm.cjs +0 -1
- package/dist/GoogleLoginButton-2zNTIKMm.cjs.map +0 -1
- package/dist/GoogleLoginButton-C1WNu7W3.js.map +0 -1
- package/dist/PermissionsSection-4zcE9Zs9.cjs +0 -1
- package/dist/PermissionsSection-4zcE9Zs9.cjs.map +0 -1
- package/dist/PermissionsSection-mm9hfp-u.js.map +0 -1
- package/dist/SolanaLoginButton-CqdzSSeJ.cjs +0 -1
- package/dist/SolanaLoginButton-CqdzSSeJ.cjs.map +0 -1
- package/dist/SolanaLoginButton-CyeX35eU.js +0 -232
- package/dist/SolanaLoginButton-CyeX35eU.js.map +0 -1
- package/dist/sanitization-Bo_tn-L2.cjs +0 -1
- package/dist/sanitization-Bo_tn-L2.cjs.map +0 -1
- package/dist/sanitization-CQ-H1MSg.js +0 -39
- package/dist/sanitization-CQ-H1MSg.js.map +0 -1
- package/dist/useAuth-B1yS_YiD.cjs +0 -1
- package/dist/useAuth-B1yS_YiD.cjs.map +0 -1
- package/dist/useAuth-l-itM5am.js.map +0 -1
- package/dist/useUsersStatsSummary-BGeh3RnI.js.map +0 -1
- package/dist/useUsersStatsSummary-DnsYtFGX.cjs +0 -1
- package/dist/useUsersStatsSummary-DnsYtFGX.cjs.map +0 -1
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useEffect as
|
|
1
|
+
import { jsx as $, jsxs as Ke } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as M, useEffect as P, useState as F, useRef as N, useCallback as E } from "react";
|
|
3
3
|
import { A as He, a as Je, C as Me } from "./LoadingSpinner-6vml-zwr.js";
|
|
4
|
-
import { A as
|
|
5
|
-
let
|
|
4
|
+
import { A as ye, g as oe, a as ke, h as V, u as Se } from "./useCedrosLogin-CFfID-0i.js";
|
|
5
|
+
let z = 0;
|
|
6
6
|
function Ve({ theme: e, themeOverrides: A }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
i ? (q++, r = !0, t.classList.add("cedros-dark")) : q === 0 && t.classList.remove("cedros-dark");
|
|
15
|
-
const n = /* @__PURE__ */ new Map();
|
|
16
|
-
return A && Object.entries(A).forEach(([o, a]) => {
|
|
17
|
-
if (a) {
|
|
18
|
-
const C = t.style.getPropertyValue(o);
|
|
19
|
-
n.set(o, C), t.style.setProperty(o, a);
|
|
20
|
-
}
|
|
21
|
-
}), () => {
|
|
22
|
-
r && (q--, q === 0 && t.classList.remove("cedros-dark")), n.forEach((o, a) => {
|
|
23
|
-
o ? t.style.setProperty(a, o) : t.style.removeProperty(a);
|
|
24
|
-
});
|
|
7
|
+
const t = M(() => typeof window > "u" ? !1 : e === "dark" ? !0 : e === "light" ? !1 : window.matchMedia("(prefers-color-scheme: dark)").matches, [e]);
|
|
8
|
+
P(() => {
|
|
9
|
+
if (typeof document > "u") return;
|
|
10
|
+
const n = document.documentElement;
|
|
11
|
+
let s = !1;
|
|
12
|
+
return t ? (z++, s = !0, n.classList.add("cedros-dark")) : z === 0 && n.classList.remove("cedros-dark"), () => {
|
|
13
|
+
s && (z--, z === 0 && n.classList.remove("cedros-dark"));
|
|
25
14
|
};
|
|
26
|
-
}, [
|
|
15
|
+
}, [t]);
|
|
16
|
+
const i = t ? "cedros-dark" : "", r = M(() => {
|
|
17
|
+
if (!A) return {};
|
|
18
|
+
const n = {};
|
|
19
|
+
for (const [s, l] of Object.entries(A))
|
|
20
|
+
l && (n[s] = l);
|
|
21
|
+
return n;
|
|
22
|
+
}, [A]);
|
|
23
|
+
return { className: i, style: r };
|
|
27
24
|
}
|
|
28
|
-
const
|
|
25
|
+
const Ne = {
|
|
29
26
|
email: !0,
|
|
30
27
|
google: !0,
|
|
31
28
|
apple: !0,
|
|
@@ -33,32 +30,32 @@ const Pe = {
|
|
|
33
30
|
webauthn: !0,
|
|
34
31
|
instantLink: !0
|
|
35
32
|
};
|
|
36
|
-
function
|
|
37
|
-
const [i, r] = F(null), [n,
|
|
38
|
-
return
|
|
33
|
+
function Ye(e, A, t) {
|
|
34
|
+
const [i, r] = F(null), [n, s] = F(), [l, h] = F(), [o, p] = F(), [y, Q] = F(), [m, U] = F(), [c, B] = F(), [u, b] = F(A), k = N(!1);
|
|
35
|
+
return P(() => {
|
|
39
36
|
if (!A || k.current) return;
|
|
40
|
-
k.current = !0, new
|
|
37
|
+
k.current = !0, new ye({
|
|
41
38
|
baseUrl: e,
|
|
42
39
|
timeoutMs: t ?? 5e3,
|
|
43
40
|
retryAttempts: 1
|
|
44
|
-
}).get("/features", { credentials: "omit" }).then((
|
|
41
|
+
}).get("/features", { credentials: "omit" }).then((C) => {
|
|
45
42
|
r({
|
|
46
|
-
email:
|
|
47
|
-
google:
|
|
48
|
-
apple:
|
|
49
|
-
solana:
|
|
50
|
-
webauthn:
|
|
51
|
-
instantLink:
|
|
52
|
-
}),
|
|
43
|
+
email: C.email,
|
|
44
|
+
google: C.google,
|
|
45
|
+
apple: C.apple,
|
|
46
|
+
solana: C.solana,
|
|
47
|
+
webauthn: C.webauthn,
|
|
48
|
+
instantLink: C.instantLink
|
|
49
|
+
}), s(C.googleClientId), h(C.appleClientId), p(C.usernameEnabled), Q(C.walletEnrollEnabled), U(C.showRecoveryEnabled), B(C.socialButtonOrder);
|
|
53
50
|
}).catch(() => {
|
|
54
|
-
r(
|
|
51
|
+
r(Ne);
|
|
55
52
|
}).finally(() => {
|
|
56
53
|
b(!1);
|
|
57
54
|
});
|
|
58
|
-
}, [A, e, t]), { features: i, googleClientId: n, appleClientId:
|
|
55
|
+
}, [A, e, t]), { features: i, googleClientId: n, appleClientId: l, usernameEnabled: o, walletEnrollEnabled: y, showRecoveryEnabled: m, socialButtonOrder: c, isLoading: u };
|
|
59
56
|
}
|
|
60
|
-
const
|
|
61
|
-
class
|
|
57
|
+
const Oe = "cedros_tokens", Pe = 6e4;
|
|
58
|
+
class ve {
|
|
62
59
|
storage;
|
|
63
60
|
requestedStorage;
|
|
64
61
|
storageKey;
|
|
@@ -73,7 +70,7 @@ class xe {
|
|
|
73
70
|
// S-13: Prevent onSessionExpired from firing multiple times
|
|
74
71
|
sessionExpiredFired = !1;
|
|
75
72
|
allowWebStorage;
|
|
76
|
-
constructor(A = "cookie", t =
|
|
73
|
+
constructor(A = "cookie", t = Oe, i = {}) {
|
|
77
74
|
this.requestedStorage = A, this.storage = A, this.storageKey = t, this.allowWebStorage = i.allowWebStorage ?? !1, this.warnIfLocalStorage(), !this.allowWebStorage && (this.requestedStorage === "localStorage" || this.requestedStorage === "sessionStorage") && (this.storage = "memory"), this.loadFromStorage();
|
|
78
75
|
}
|
|
79
76
|
/**
|
|
@@ -165,7 +162,7 @@ class xe {
|
|
|
165
162
|
}
|
|
166
163
|
scheduleRefresh() {
|
|
167
164
|
if (this.cancelRefresh(), !this.tokens || !this.onRefreshNeeded) return;
|
|
168
|
-
const A = this.getTimeUntilExpiry(), t = Math.max(0, A -
|
|
165
|
+
const A = this.getTimeUntilExpiry(), t = Math.max(0, A - Pe);
|
|
169
166
|
if (t <= 0) {
|
|
170
167
|
if (this.isDestroyed) return;
|
|
171
168
|
this.onRefreshNeeded().catch((i) => {
|
|
@@ -237,13 +234,13 @@ class xe {
|
|
|
237
234
|
}
|
|
238
235
|
}
|
|
239
236
|
}
|
|
240
|
-
const
|
|
237
|
+
const xe = "cedros_auth_sync";
|
|
241
238
|
class Te {
|
|
242
239
|
channel = null;
|
|
243
240
|
callback = null;
|
|
244
241
|
boundHandler = null;
|
|
245
242
|
constructor() {
|
|
246
|
-
typeof window < "u" && "BroadcastChannel" in window && (this.channel = new BroadcastChannel(
|
|
243
|
+
typeof window < "u" && "BroadcastChannel" in window && (this.channel = new BroadcastChannel(xe), this.boundHandler = this.handleMessage.bind(this), this.channel.addEventListener("message", this.boundHandler));
|
|
247
244
|
}
|
|
248
245
|
/**
|
|
249
246
|
* Handle incoming sync messages.
|
|
@@ -292,7 +289,7 @@ class Te {
|
|
|
292
289
|
this.channel && (this.boundHandler && (this.channel.removeEventListener("message", this.boundHandler), this.boundHandler = null), this.channel.close(), this.channel = null), this.callback = null;
|
|
293
290
|
}
|
|
294
291
|
}
|
|
295
|
-
function
|
|
292
|
+
function ee(e) {
|
|
296
293
|
if (typeof e != "object" || e === null) return !1;
|
|
297
294
|
const A = e;
|
|
298
295
|
if (typeof A.user != "object" || A.user === null) return !1;
|
|
@@ -310,18 +307,18 @@ function Le({
|
|
|
310
307
|
callbacks: t,
|
|
311
308
|
requestTimeoutMs: i
|
|
312
309
|
}) {
|
|
313
|
-
const [r, n] = F(null), [
|
|
310
|
+
const [r, n] = F(null), [s, l] = F("idle"), h = N(null), o = N(null), p = N(t), y = N(!0), Q = N(null), m = N(() => Promise.resolve()), U = N(() => {
|
|
314
311
|
});
|
|
315
|
-
|
|
312
|
+
P(() => {
|
|
316
313
|
p.current = t;
|
|
317
|
-
}, [t]),
|
|
314
|
+
}, [t]), P(() => (y.current = !0, () => {
|
|
318
315
|
y.current = !1;
|
|
319
316
|
}), []);
|
|
320
|
-
const c =
|
|
317
|
+
const c = E((f) => {
|
|
321
318
|
y.current && n(f);
|
|
322
|
-
}, []), B =
|
|
323
|
-
y.current &&
|
|
324
|
-
}, []), u =
|
|
319
|
+
}, []), B = E((f) => {
|
|
320
|
+
y.current && l(f);
|
|
321
|
+
}, []), u = M(
|
|
325
322
|
() => ({
|
|
326
323
|
storage: A?.storage ?? "cookie",
|
|
327
324
|
autoRefresh: A?.autoRefresh ?? !0,
|
|
@@ -337,12 +334,12 @@ function Le({
|
|
|
337
334
|
A?.allowWebStorage
|
|
338
335
|
]
|
|
339
336
|
);
|
|
340
|
-
|
|
341
|
-
const f = new
|
|
337
|
+
P(() => {
|
|
338
|
+
const f = new ve(u.storage, u.persistKey, {
|
|
342
339
|
allowWebStorage: u.allowWebStorage
|
|
343
340
|
});
|
|
344
|
-
return
|
|
345
|
-
f.destroy(),
|
|
341
|
+
return h.current = f, u.autoRefresh && f.setRefreshCallback(() => m.current()), f.setSessionExpiredCallback(() => U.current()), u.syncTabs && (o.current = new Te()), () => {
|
|
342
|
+
f.destroy(), h.current = null, o.current?.close();
|
|
346
343
|
};
|
|
347
344
|
}, [
|
|
348
345
|
u.storage,
|
|
@@ -351,62 +348,62 @@ function Le({
|
|
|
351
348
|
u.allowWebStorage,
|
|
352
349
|
u.autoRefresh
|
|
353
350
|
]);
|
|
354
|
-
const b =
|
|
351
|
+
const b = E(async () => {
|
|
355
352
|
if (Q.current)
|
|
356
353
|
return Q.current;
|
|
357
|
-
const f =
|
|
354
|
+
const f = h.current?.getRefreshToken(), S = !!f, G = oe(), H = {};
|
|
358
355
|
S && (H["Content-Type"] = "application/json"), G && (H["X-CSRF-Token"] = G);
|
|
359
356
|
let K, J;
|
|
360
|
-
const
|
|
361
|
-
K =
|
|
357
|
+
const Y = new Promise((R, j) => {
|
|
358
|
+
K = R, J = j;
|
|
362
359
|
});
|
|
363
|
-
Q.current =
|
|
364
|
-
const
|
|
360
|
+
Q.current = Y, (async () => {
|
|
361
|
+
const R = new AbortController(), j = i ?? 1e4, v = window.setTimeout(() => R.abort(), j);
|
|
365
362
|
try {
|
|
366
|
-
const
|
|
363
|
+
const L = await fetch(`${e}/refresh`, {
|
|
367
364
|
method: "POST",
|
|
368
365
|
headers: Object.keys(H).length > 0 ? H : void 0,
|
|
369
366
|
credentials: "include",
|
|
370
367
|
body: S ? JSON.stringify({ refreshToken: f }) : void 0,
|
|
371
|
-
signal:
|
|
368
|
+
signal: R.signal
|
|
372
369
|
});
|
|
373
|
-
if (!
|
|
370
|
+
if (!L.ok)
|
|
374
371
|
throw new Error("Token refresh failed");
|
|
375
|
-
const
|
|
376
|
-
if (
|
|
377
|
-
if (!Re(
|
|
372
|
+
const ne = await L.json();
|
|
373
|
+
if (ne.tokens) {
|
|
374
|
+
if (!Re(ne.tokens))
|
|
378
375
|
throw new Error("Invalid token response structure");
|
|
379
|
-
|
|
376
|
+
h.current?.setTokens(ne.tokens);
|
|
380
377
|
} else if (u.storage !== "cookie")
|
|
381
378
|
throw new Error("Token refresh failed");
|
|
382
|
-
|
|
383
|
-
} catch (
|
|
384
|
-
throw J(
|
|
379
|
+
o.current?.broadcastRefresh(), K();
|
|
380
|
+
} catch (L) {
|
|
381
|
+
throw J(L), L;
|
|
385
382
|
} finally {
|
|
386
|
-
window.clearTimeout(
|
|
383
|
+
window.clearTimeout(v);
|
|
387
384
|
}
|
|
388
385
|
})().catch(() => {
|
|
389
386
|
});
|
|
390
387
|
try {
|
|
391
|
-
await
|
|
388
|
+
await Y;
|
|
392
389
|
} finally {
|
|
393
390
|
Q.current = null;
|
|
394
391
|
}
|
|
395
|
-
}, [e, u.storage, i]), k =
|
|
392
|
+
}, [e, u.storage, i]), k = E(() => {
|
|
396
393
|
if (u.storage === "cookie") return;
|
|
397
|
-
const f =
|
|
394
|
+
const f = h.current?.getAccessToken();
|
|
398
395
|
if (f)
|
|
399
396
|
return { Authorization: `Bearer ${f}` };
|
|
400
|
-
}, [u.storage]),
|
|
401
|
-
|
|
397
|
+
}, [u.storage]), d = E(() => {
|
|
398
|
+
h.current?.clear(), c(null), B("unauthenticated"), p.current?.onSessionExpired?.();
|
|
402
399
|
}, [B, c]);
|
|
403
|
-
m.current = b, U.current =
|
|
404
|
-
const
|
|
400
|
+
m.current = b, U.current = d;
|
|
401
|
+
const C = E(
|
|
405
402
|
(f) => {
|
|
406
403
|
const S = new AbortController(), G = i ?? 1e4, H = window.setTimeout(() => S.abort(), G), K = {}, J = k();
|
|
407
404
|
J && Object.assign(K, J);
|
|
408
|
-
const
|
|
409
|
-
return
|
|
405
|
+
const Y = oe();
|
|
406
|
+
return Y && (K["X-CSRF-Token"] = Y), {
|
|
410
407
|
promise: fetch(f, {
|
|
411
408
|
credentials: "include",
|
|
412
409
|
headers: Object.keys(K).length > 0 ? K : void 0,
|
|
@@ -416,13 +413,13 @@ function Le({
|
|
|
416
413
|
};
|
|
417
414
|
},
|
|
418
415
|
[k, i]
|
|
419
|
-
),
|
|
420
|
-
const f =
|
|
416
|
+
), a = E(async () => {
|
|
417
|
+
const f = C(`${e}/user`);
|
|
421
418
|
try {
|
|
422
419
|
const S = await f.promise;
|
|
423
420
|
if (S.ok) {
|
|
424
421
|
const G = await S.json();
|
|
425
|
-
if (
|
|
422
|
+
if (ee(G)) {
|
|
426
423
|
c(G.user), B("authenticated");
|
|
427
424
|
return;
|
|
428
425
|
}
|
|
@@ -431,15 +428,15 @@ function Le({
|
|
|
431
428
|
try {
|
|
432
429
|
await b();
|
|
433
430
|
} catch {
|
|
434
|
-
|
|
431
|
+
d();
|
|
435
432
|
return;
|
|
436
433
|
}
|
|
437
|
-
const G =
|
|
434
|
+
const G = C(`${e}/user`);
|
|
438
435
|
try {
|
|
439
436
|
const H = await G.promise;
|
|
440
437
|
if (H.ok) {
|
|
441
438
|
const K = await H.json();
|
|
442
|
-
if (
|
|
439
|
+
if (ee(K)) {
|
|
443
440
|
c(K.user), B("authenticated");
|
|
444
441
|
return;
|
|
445
442
|
}
|
|
@@ -458,28 +455,28 @@ function Le({
|
|
|
458
455
|
e,
|
|
459
456
|
u.autoRefresh,
|
|
460
457
|
b,
|
|
461
|
-
|
|
462
|
-
|
|
458
|
+
C,
|
|
459
|
+
d,
|
|
463
460
|
B,
|
|
464
461
|
c
|
|
465
462
|
]);
|
|
466
|
-
|
|
467
|
-
!
|
|
463
|
+
P(() => {
|
|
464
|
+
!o.current || !u.syncTabs || o.current.setCallback((f) => {
|
|
468
465
|
switch (f.type) {
|
|
469
466
|
case "login":
|
|
470
467
|
c(f.user), B("authenticated");
|
|
471
468
|
break;
|
|
472
469
|
case "logout":
|
|
473
|
-
c(null), B("unauthenticated"),
|
|
470
|
+
c(null), B("unauthenticated"), h.current?.clear();
|
|
474
471
|
break;
|
|
475
472
|
case "refresh":
|
|
476
|
-
|
|
473
|
+
a();
|
|
477
474
|
break;
|
|
478
475
|
default:
|
|
479
476
|
console.warn("[Cedros Login] Unhandled tab sync event:", f);
|
|
480
477
|
}
|
|
481
478
|
});
|
|
482
|
-
}, [u.syncTabs,
|
|
479
|
+
}, [u.syncTabs, a, B, c]), P(() => {
|
|
483
480
|
const f = new AbortController(), S = i ?? 1e4, G = window.setTimeout(() => f.abort(), S);
|
|
484
481
|
return (async () => {
|
|
485
482
|
B("loading");
|
|
@@ -491,7 +488,7 @@ function Le({
|
|
|
491
488
|
});
|
|
492
489
|
if (K.ok) {
|
|
493
490
|
const J = await K.json();
|
|
494
|
-
if (
|
|
491
|
+
if (ee(J)) {
|
|
495
492
|
c(J.user), B("authenticated");
|
|
496
493
|
return;
|
|
497
494
|
}
|
|
@@ -500,7 +497,7 @@ function Le({
|
|
|
500
497
|
try {
|
|
501
498
|
await b();
|
|
502
499
|
} catch {
|
|
503
|
-
|
|
500
|
+
d();
|
|
504
501
|
return;
|
|
505
502
|
}
|
|
506
503
|
const J = await fetch(`${e}/user`, {
|
|
@@ -509,9 +506,9 @@ function Le({
|
|
|
509
506
|
signal: f.signal
|
|
510
507
|
});
|
|
511
508
|
if (J.ok) {
|
|
512
|
-
const
|
|
513
|
-
if (
|
|
514
|
-
c(
|
|
509
|
+
const Y = await J.json();
|
|
510
|
+
if (ee(Y)) {
|
|
511
|
+
c(Y.user), B("authenticated");
|
|
515
512
|
return;
|
|
516
513
|
}
|
|
517
514
|
}
|
|
@@ -528,18 +525,18 @@ function Le({
|
|
|
528
525
|
u.autoRefresh,
|
|
529
526
|
b,
|
|
530
527
|
k,
|
|
531
|
-
|
|
528
|
+
d,
|
|
532
529
|
B,
|
|
533
530
|
c,
|
|
534
531
|
i
|
|
535
532
|
]);
|
|
536
|
-
const I =
|
|
533
|
+
const I = E(
|
|
537
534
|
(f, S) => {
|
|
538
|
-
c(f), B("authenticated"), S &&
|
|
535
|
+
c(f), B("authenticated"), S && h.current?.setTokens(S), y.current && o.current?.broadcastLogin(f);
|
|
539
536
|
},
|
|
540
537
|
[c, B]
|
|
541
|
-
),
|
|
542
|
-
const f =
|
|
538
|
+
), g = E(async () => {
|
|
539
|
+
const f = oe(), S = new AbortController(), G = i ?? 1e4, H = window.setTimeout(() => S.abort(), G);
|
|
543
540
|
try {
|
|
544
541
|
await fetch(`${e}/logout`, {
|
|
545
542
|
method: "POST",
|
|
@@ -552,15 +549,15 @@ function Le({
|
|
|
552
549
|
});
|
|
553
550
|
} catch {
|
|
554
551
|
} finally {
|
|
555
|
-
window.clearTimeout(H), c(null), B("unauthenticated"),
|
|
552
|
+
window.clearTimeout(H), c(null), B("unauthenticated"), h.current?.clear(), o.current?.broadcastLogout(), p.current?.onLogout?.();
|
|
556
553
|
}
|
|
557
|
-
}, [e, k, c, B, i]), w =
|
|
554
|
+
}, [e, k, c, B, i]), w = E(() => h.current?.getAccessToken() ?? null, []);
|
|
558
555
|
return {
|
|
559
556
|
user: r,
|
|
560
|
-
authState:
|
|
557
|
+
authState: s,
|
|
561
558
|
handleLoginSuccess: I,
|
|
562
|
-
logout:
|
|
563
|
-
refreshUser:
|
|
559
|
+
logout: g,
|
|
560
|
+
refreshUser: a,
|
|
564
561
|
getAccessToken: w
|
|
565
562
|
};
|
|
566
563
|
}
|
|
@@ -601,7 +598,7 @@ function qA(e) {
|
|
|
601
598
|
throw new Error(`Invalid share length: expected >=16, got ${e.length}`);
|
|
602
599
|
return e;
|
|
603
600
|
}
|
|
604
|
-
function
|
|
601
|
+
function De(e) {
|
|
605
602
|
if (!Ze(e))
|
|
606
603
|
throw new Error(`Invalid key length: expected 32, got ${e.length}`);
|
|
607
604
|
return e;
|
|
@@ -621,10 +618,10 @@ function tA(e) {
|
|
|
621
618
|
throw new Error(`Invalid PRF salt length: expected 32, got ${e.length}`);
|
|
622
619
|
return e;
|
|
623
620
|
}
|
|
624
|
-
function
|
|
621
|
+
function W(e) {
|
|
625
622
|
return new Uint8Array(e);
|
|
626
623
|
}
|
|
627
|
-
function
|
|
624
|
+
function ie(e) {
|
|
628
625
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
629
626
|
throw new Error(
|
|
630
627
|
"WebCrypto API not available. Secure random generation requires a modern browser."
|
|
@@ -633,18 +630,18 @@ function ee(e) {
|
|
|
633
630
|
return crypto.getRandomValues(A), A;
|
|
634
631
|
}
|
|
635
632
|
function _A() {
|
|
636
|
-
return ze(
|
|
633
|
+
return ze(ie(16));
|
|
637
634
|
}
|
|
638
635
|
function iA() {
|
|
639
|
-
return eA(
|
|
636
|
+
return eA(ie(12));
|
|
640
637
|
}
|
|
641
638
|
function $A() {
|
|
642
|
-
return AA(
|
|
639
|
+
return AA(ie(16));
|
|
643
640
|
}
|
|
644
641
|
function zA() {
|
|
645
|
-
return tA(
|
|
642
|
+
return tA(ie(32));
|
|
646
643
|
}
|
|
647
|
-
function
|
|
644
|
+
function Fe(e) {
|
|
648
645
|
if (!(!e || e.length === 0)) {
|
|
649
646
|
if (typeof globalThis.crypto?.getRandomValues == "function")
|
|
650
647
|
globalThis.crypto.getRandomValues(e);
|
|
@@ -656,12 +653,12 @@ function De(e) {
|
|
|
656
653
|
}
|
|
657
654
|
function et(...e) {
|
|
658
655
|
for (const A of e)
|
|
659
|
-
A &&
|
|
656
|
+
A && Fe(A);
|
|
660
657
|
}
|
|
661
658
|
async function rA(e) {
|
|
662
659
|
return crypto.subtle.importKey(
|
|
663
660
|
"raw",
|
|
664
|
-
|
|
661
|
+
W(e),
|
|
665
662
|
{ name: "AES-GCM", length: 256 },
|
|
666
663
|
!1,
|
|
667
664
|
// not extractable
|
|
@@ -670,9 +667,9 @@ async function rA(e) {
|
|
|
670
667
|
}
|
|
671
668
|
async function nA(e, A, t) {
|
|
672
669
|
const i = t ?? iA(), r = await rA(A), n = await crypto.subtle.encrypt(
|
|
673
|
-
{ name: "AES-GCM", iv:
|
|
670
|
+
{ name: "AES-GCM", iv: W(i) },
|
|
674
671
|
r,
|
|
675
|
-
|
|
672
|
+
W(e)
|
|
676
673
|
);
|
|
677
674
|
return {
|
|
678
675
|
ciphertext: new Uint8Array(n),
|
|
@@ -682,11 +679,11 @@ async function nA(e, A, t) {
|
|
|
682
679
|
async function At(e, A) {
|
|
683
680
|
const t = await nA(e, A);
|
|
684
681
|
return {
|
|
685
|
-
ciphertext:
|
|
686
|
-
nonce:
|
|
682
|
+
ciphertext: we(t.ciphertext),
|
|
683
|
+
nonce: we(t.nonce)
|
|
687
684
|
};
|
|
688
685
|
}
|
|
689
|
-
function
|
|
686
|
+
function we(e) {
|
|
690
687
|
const t = [];
|
|
691
688
|
for (let i = 0; i < e.length; i += 32768) {
|
|
692
689
|
const r = e.subarray(i, Math.min(i + 32768, e.length));
|
|
@@ -709,27 +706,27 @@ function oA(e) {
|
|
|
709
706
|
async function sA(e, A, t, i = 32) {
|
|
710
707
|
const r = await crypto.subtle.importKey(
|
|
711
708
|
"raw",
|
|
712
|
-
|
|
709
|
+
W(e),
|
|
713
710
|
"HKDF",
|
|
714
711
|
!1,
|
|
715
712
|
["deriveBits"]
|
|
716
|
-
), n = new TextEncoder().encode(t),
|
|
713
|
+
), n = new TextEncoder().encode(t), s = await crypto.subtle.deriveBits(
|
|
717
714
|
{
|
|
718
715
|
name: "HKDF",
|
|
719
716
|
hash: "SHA-256",
|
|
720
|
-
salt:
|
|
717
|
+
salt: W(A ?? new Uint8Array(32)),
|
|
721
718
|
// Zero salt if not provided
|
|
722
|
-
info:
|
|
719
|
+
info: W(n)
|
|
723
720
|
},
|
|
724
721
|
r,
|
|
725
722
|
i * 8
|
|
726
723
|
// bits
|
|
727
724
|
);
|
|
728
|
-
return new Uint8Array(
|
|
725
|
+
return new Uint8Array(s);
|
|
729
726
|
}
|
|
730
727
|
async function tt(e, A) {
|
|
731
728
|
const t = await sA(e, A, "cedros-wallet-share-b-encryption", 32);
|
|
732
|
-
return
|
|
729
|
+
return De(t);
|
|
733
730
|
}
|
|
734
731
|
async function IA() {
|
|
735
732
|
try {
|
|
@@ -750,31 +747,31 @@ async function IA() {
|
|
|
750
747
|
return !1;
|
|
751
748
|
}
|
|
752
749
|
}
|
|
753
|
-
function
|
|
750
|
+
function X(e, A, t, i) {
|
|
754
751
|
function r(n) {
|
|
755
|
-
return n instanceof t ? n : new t(function(
|
|
756
|
-
|
|
752
|
+
return n instanceof t ? n : new t(function(s) {
|
|
753
|
+
s(n);
|
|
757
754
|
});
|
|
758
755
|
}
|
|
759
|
-
return new (t || (t = Promise))(function(n,
|
|
760
|
-
function
|
|
756
|
+
return new (t || (t = Promise))(function(n, s) {
|
|
757
|
+
function l(p) {
|
|
761
758
|
try {
|
|
762
|
-
|
|
759
|
+
o(i.next(p));
|
|
763
760
|
} catch (y) {
|
|
764
|
-
|
|
761
|
+
s(y);
|
|
765
762
|
}
|
|
766
763
|
}
|
|
767
|
-
function
|
|
764
|
+
function h(p) {
|
|
768
765
|
try {
|
|
769
|
-
|
|
766
|
+
o(i.throw(p));
|
|
770
767
|
} catch (y) {
|
|
771
|
-
|
|
768
|
+
s(y);
|
|
772
769
|
}
|
|
773
770
|
}
|
|
774
|
-
function
|
|
775
|
-
p.done ? n(p.value) : r(p.value).then(
|
|
771
|
+
function o(p) {
|
|
772
|
+
p.done ? n(p.value) : r(p.value).then(l, h);
|
|
776
773
|
}
|
|
777
|
-
|
|
774
|
+
o((i = i.apply(e, [])).next());
|
|
778
775
|
});
|
|
779
776
|
}
|
|
780
777
|
class D {
|
|
@@ -789,7 +786,7 @@ class D {
|
|
|
789
786
|
});
|
|
790
787
|
}
|
|
791
788
|
dispatch(A) {
|
|
792
|
-
return
|
|
789
|
+
return X(this, void 0, void 0, function* () {
|
|
793
790
|
const t = yield this.lock();
|
|
794
791
|
try {
|
|
795
792
|
return yield Promise.resolve(A());
|
|
@@ -799,19 +796,19 @@ class D {
|
|
|
799
796
|
});
|
|
800
797
|
}
|
|
801
798
|
}
|
|
802
|
-
var
|
|
799
|
+
var se;
|
|
803
800
|
function aA() {
|
|
804
801
|
return typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global;
|
|
805
802
|
}
|
|
806
|
-
const
|
|
807
|
-
function
|
|
803
|
+
const Ce = aA(), Ie = (se = Ce.Buffer) !== null && se !== void 0 ? se : null, gA = Ce.TextEncoder ? new Ce.TextEncoder() : null;
|
|
804
|
+
function Ue(e, A) {
|
|
808
805
|
return (e & 15) + (e >> 6 | e >> 3 & 8) << 4 | (A & 15) + (A >> 6 | A >> 3 & 8);
|
|
809
806
|
}
|
|
810
|
-
function
|
|
807
|
+
function me(e, A) {
|
|
811
808
|
const t = A.length >> 1;
|
|
812
809
|
for (let i = 0; i < t; i++) {
|
|
813
810
|
const r = i << 1;
|
|
814
|
-
e[i] =
|
|
811
|
+
e[i] = Ue(A.charCodeAt(r), A.charCodeAt(r + 1));
|
|
815
812
|
}
|
|
816
813
|
}
|
|
817
814
|
function lA(e, A) {
|
|
@@ -819,26 +816,26 @@ function lA(e, A) {
|
|
|
819
816
|
return !1;
|
|
820
817
|
for (let t = 0; t < A.length; t++) {
|
|
821
818
|
const i = t << 1;
|
|
822
|
-
if (A[t] !==
|
|
819
|
+
if (A[t] !== Ue(e.charCodeAt(i), e.charCodeAt(i + 1)))
|
|
823
820
|
return !1;
|
|
824
821
|
}
|
|
825
822
|
return !0;
|
|
826
823
|
}
|
|
827
|
-
const
|
|
828
|
-
function
|
|
824
|
+
const Qe = 87, Be = 48;
|
|
825
|
+
function he(e, A, t) {
|
|
829
826
|
let i = 0;
|
|
830
827
|
for (let r = 0; r < t; r++) {
|
|
831
828
|
let n = A[r] >>> 4;
|
|
832
|
-
e[i++] = n > 9 ? n +
|
|
829
|
+
e[i++] = n > 9 ? n + Qe : n + Be, n = A[r] & 15, e[i++] = n > 9 ? n + Qe : n + Be;
|
|
833
830
|
}
|
|
834
831
|
return String.fromCharCode.apply(null, e);
|
|
835
832
|
}
|
|
836
|
-
const T =
|
|
833
|
+
const T = Ie !== null ? (e) => {
|
|
837
834
|
if (typeof e == "string") {
|
|
838
|
-
const A =
|
|
835
|
+
const A = Ie.from(e, "utf8");
|
|
839
836
|
return new Uint8Array(A.buffer, A.byteOffset, A.length);
|
|
840
837
|
}
|
|
841
|
-
if (
|
|
838
|
+
if (Ie.isBuffer(e))
|
|
842
839
|
return new Uint8Array(e.buffer, e.byteOffset, e.length);
|
|
843
840
|
if (ArrayBuffer.isView(e))
|
|
844
841
|
return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
@@ -849,21 +846,21 @@ const T = oe !== null ? (e) => {
|
|
|
849
846
|
if (ArrayBuffer.isView(e))
|
|
850
847
|
return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
851
848
|
throw new Error("Invalid data type!");
|
|
852
|
-
}, O = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
849
|
+
}, O = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", q = new Uint8Array(256);
|
|
853
850
|
for (let e = 0; e < O.length; e++)
|
|
854
|
-
|
|
855
|
-
function
|
|
851
|
+
q[O.charCodeAt(e)] = e;
|
|
852
|
+
function de(e, A = !0) {
|
|
856
853
|
const t = e.length, i = t % 3, r = [], n = t - i;
|
|
857
|
-
for (let
|
|
858
|
-
const
|
|
859
|
-
r.push(
|
|
854
|
+
for (let s = 0; s < n; s += 3) {
|
|
855
|
+
const l = (e[s] << 16 & 16711680) + (e[s + 1] << 8 & 65280) + (e[s + 2] & 255), h = O.charAt(l >> 18 & 63) + O.charAt(l >> 12 & 63) + O.charAt(l >> 6 & 63) + O.charAt(l & 63);
|
|
856
|
+
r.push(h);
|
|
860
857
|
}
|
|
861
858
|
if (i === 1) {
|
|
862
|
-
const
|
|
863
|
-
r.push(`${
|
|
859
|
+
const s = e[t - 1], l = O.charAt(s >> 2), h = O.charAt(s << 4 & 63);
|
|
860
|
+
r.push(`${l}${h}`), A && r.push("==");
|
|
864
861
|
} else if (i === 2) {
|
|
865
|
-
const
|
|
866
|
-
r.push(`${
|
|
862
|
+
const s = (e[t - 2] << 8) + e[t - 1], l = O.charAt(s >> 10), h = O.charAt(s >> 4 & 63), o = O.charAt(s << 2 & 63);
|
|
863
|
+
r.push(`${l}${h}${o}`), A && r.push("=");
|
|
867
864
|
}
|
|
868
865
|
return r.join("");
|
|
869
866
|
}
|
|
@@ -876,30 +873,30 @@ function CA(e) {
|
|
|
876
873
|
const A = cA(e), t = e.length, i = new Uint8Array(A);
|
|
877
874
|
let r = 0;
|
|
878
875
|
for (let n = 0; n < t; n += 4) {
|
|
879
|
-
const
|
|
880
|
-
i[r] =
|
|
876
|
+
const s = q[e.charCodeAt(n)], l = q[e.charCodeAt(n + 1)], h = q[e.charCodeAt(n + 2)], o = q[e.charCodeAt(n + 3)];
|
|
877
|
+
i[r] = s << 2 | l >> 4, r += 1, i[r] = (l & 15) << 4 | h >> 2, r += 1, i[r] = (h & 3) << 6 | o & 63, r += 1;
|
|
881
878
|
}
|
|
882
879
|
return i;
|
|
883
880
|
}
|
|
884
|
-
const
|
|
885
|
-
function
|
|
886
|
-
return
|
|
881
|
+
const Ae = 16 * 1024, Z = 4, hA = new D(), ae = /* @__PURE__ */ new Map();
|
|
882
|
+
function be(e, A) {
|
|
883
|
+
return X(this, void 0, void 0, function* () {
|
|
887
884
|
let t = null, i = null, r = !1;
|
|
888
885
|
if (typeof WebAssembly > "u")
|
|
889
886
|
throw new Error("WebAssembly is not supported in this environment!");
|
|
890
|
-
const n = (
|
|
891
|
-
i.set(
|
|
892
|
-
},
|
|
893
|
-
t.exports.Hash_SetMemorySize(
|
|
894
|
-
const I = t.exports.Hash_GetBuffer(),
|
|
895
|
-
i = new Uint8Array(
|
|
896
|
-
},
|
|
897
|
-
if (!
|
|
898
|
-
const I = CA(e.data),
|
|
899
|
-
|
|
887
|
+
const n = (a, I = 0) => {
|
|
888
|
+
i.set(a, I);
|
|
889
|
+
}, s = () => i, l = () => t.exports, h = (a) => {
|
|
890
|
+
t.exports.Hash_SetMemorySize(a);
|
|
891
|
+
const I = t.exports.Hash_GetBuffer(), g = t.exports.memory.buffer;
|
|
892
|
+
i = new Uint8Array(g, I, a);
|
|
893
|
+
}, o = () => new DataView(t.exports.memory.buffer).getUint32(t.exports.STATE_SIZE, !0), p = hA.dispatch(() => X(this, void 0, void 0, function* () {
|
|
894
|
+
if (!ae.has(e.name)) {
|
|
895
|
+
const I = CA(e.data), g = WebAssembly.compile(I);
|
|
896
|
+
ae.set(e.name, g);
|
|
900
897
|
}
|
|
901
|
-
const
|
|
902
|
-
t = yield WebAssembly.instantiate(
|
|
898
|
+
const a = yield ae.get(e.name);
|
|
899
|
+
t = yield WebAssembly.instantiate(a, {
|
|
903
900
|
// env: {
|
|
904
901
|
// emscripten_memcpy_big: (dest, src, num) => {
|
|
905
902
|
// const memoryBuffer = wasmInstance.exports.memory.buffer;
|
|
@@ -913,81 +910,81 @@ function me(e, A) {
|
|
|
913
910
|
// },
|
|
914
911
|
// },
|
|
915
912
|
});
|
|
916
|
-
})), y = () =>
|
|
913
|
+
})), y = () => X(this, void 0, void 0, function* () {
|
|
917
914
|
t || (yield p);
|
|
918
|
-
const
|
|
919
|
-
i = new Uint8Array(I,
|
|
920
|
-
}), Q = (
|
|
921
|
-
r = !0, t.exports.Hash_Init(
|
|
922
|
-
}, m = (
|
|
915
|
+
const a = t.exports.Hash_GetBuffer(), I = t.exports.memory.buffer;
|
|
916
|
+
i = new Uint8Array(I, a, Ae);
|
|
917
|
+
}), Q = (a = null) => {
|
|
918
|
+
r = !0, t.exports.Hash_Init(a);
|
|
919
|
+
}, m = (a) => {
|
|
923
920
|
let I = 0;
|
|
924
|
-
for (; I <
|
|
925
|
-
const
|
|
926
|
-
I +=
|
|
921
|
+
for (; I < a.length; ) {
|
|
922
|
+
const g = a.subarray(I, I + Ae);
|
|
923
|
+
I += g.length, i.set(g), t.exports.Hash_Update(g.length);
|
|
927
924
|
}
|
|
928
|
-
}, U = (
|
|
925
|
+
}, U = (a) => {
|
|
929
926
|
if (!r)
|
|
930
927
|
throw new Error("update() called before init()");
|
|
931
|
-
const I = T(
|
|
928
|
+
const I = T(a);
|
|
932
929
|
m(I);
|
|
933
|
-
}, c = new Uint8Array(A * 2), B = (
|
|
930
|
+
}, c = new Uint8Array(A * 2), B = (a, I = null) => {
|
|
934
931
|
if (!r)
|
|
935
932
|
throw new Error("digest() called before init()");
|
|
936
|
-
return r = !1, t.exports.Hash_Final(I),
|
|
933
|
+
return r = !1, t.exports.Hash_Final(I), a === "binary" ? i.slice(0, A) : he(c, i, A);
|
|
937
934
|
}, u = () => {
|
|
938
935
|
if (!r)
|
|
939
936
|
throw new Error("save() can only be called after init() and before digest()");
|
|
940
|
-
const
|
|
941
|
-
return
|
|
942
|
-
}, b = (
|
|
943
|
-
if (!(
|
|
937
|
+
const a = t.exports.Hash_GetState(), I = o(), g = t.exports.memory.buffer, w = new Uint8Array(g, a, I), f = new Uint8Array(Z + I);
|
|
938
|
+
return me(f, e.hash), f.set(w, Z), f;
|
|
939
|
+
}, b = (a) => {
|
|
940
|
+
if (!(a instanceof Uint8Array))
|
|
944
941
|
throw new Error("load() expects an Uint8Array generated by save()");
|
|
945
|
-
const I = t.exports.Hash_GetState(),
|
|
946
|
-
if (
|
|
947
|
-
throw new Error(`Bad state length (expected ${w} bytes, got ${
|
|
948
|
-
if (!lA(e.hash,
|
|
942
|
+
const I = t.exports.Hash_GetState(), g = o(), w = Z + g, f = t.exports.memory.buffer;
|
|
943
|
+
if (a.length !== w)
|
|
944
|
+
throw new Error(`Bad state length (expected ${w} bytes, got ${a.length})`);
|
|
945
|
+
if (!lA(e.hash, a.subarray(0, Z)))
|
|
949
946
|
throw new Error("This state was written by an incompatible hash implementation");
|
|
950
|
-
const S =
|
|
951
|
-
new Uint8Array(f, I,
|
|
952
|
-
}, k = (
|
|
953
|
-
let
|
|
947
|
+
const S = a.subarray(Z);
|
|
948
|
+
new Uint8Array(f, I, g).set(S), r = !0;
|
|
949
|
+
}, k = (a) => typeof a == "string" ? a.length < Ae / 4 : a.byteLength < Ae;
|
|
950
|
+
let d = k;
|
|
954
951
|
switch (e.name) {
|
|
955
952
|
case "argon2":
|
|
956
953
|
case "scrypt":
|
|
957
|
-
|
|
954
|
+
d = () => !0;
|
|
958
955
|
break;
|
|
959
956
|
case "blake2b":
|
|
960
957
|
case "blake2s":
|
|
961
|
-
|
|
958
|
+
d = (a, I) => I <= 512 && k(a);
|
|
962
959
|
break;
|
|
963
960
|
case "blake3":
|
|
964
|
-
|
|
961
|
+
d = (a, I) => I === 0 && k(a);
|
|
965
962
|
break;
|
|
966
963
|
case "xxhash64":
|
|
967
964
|
// cannot simplify
|
|
968
965
|
case "xxhash3":
|
|
969
966
|
case "xxhash128":
|
|
970
967
|
case "crc64":
|
|
971
|
-
|
|
968
|
+
d = () => !1;
|
|
972
969
|
break;
|
|
973
970
|
}
|
|
974
|
-
const
|
|
975
|
-
if (!
|
|
976
|
-
return Q(I), U(
|
|
977
|
-
const w = T(
|
|
978
|
-
return i.set(w), t.exports.Hash_Calculate(w.length, I,
|
|
971
|
+
const C = (a, I = null, g = null) => {
|
|
972
|
+
if (!d(a, I))
|
|
973
|
+
return Q(I), U(a), B("hex", g);
|
|
974
|
+
const w = T(a);
|
|
975
|
+
return i.set(w), t.exports.Hash_Calculate(w.length, I, g), he(c, i, A);
|
|
979
976
|
};
|
|
980
977
|
return yield y(), {
|
|
981
|
-
getMemory:
|
|
978
|
+
getMemory: s,
|
|
982
979
|
writeMemory: n,
|
|
983
|
-
getExports:
|
|
984
|
-
setMemorySize:
|
|
980
|
+
getExports: l,
|
|
981
|
+
setMemorySize: h,
|
|
985
982
|
init: Q,
|
|
986
983
|
update: U,
|
|
987
984
|
digest: B,
|
|
988
985
|
save: u,
|
|
989
986
|
load: b,
|
|
990
|
-
calculate:
|
|
987
|
+
calculate: C,
|
|
991
988
|
hashLength: A
|
|
992
989
|
};
|
|
993
990
|
});
|
|
@@ -1003,15 +1000,15 @@ var fA = "argon2", uA = "AGFzbQEAAAABKQVgAX8Bf2AAAX9gEH9/f39/f39/f39/f39/f38AYAR
|
|
|
1003
1000
|
hash: EA
|
|
1004
1001
|
};
|
|
1005
1002
|
new D();
|
|
1006
|
-
function
|
|
1003
|
+
function Ee(e) {
|
|
1007
1004
|
return !Number.isInteger(e) || e < 8 || e > 512 || e % 8 !== 0 ? new Error("Invalid variant! Valid values: 8, 16, ..., 512") : null;
|
|
1008
1005
|
}
|
|
1009
1006
|
function yA(e, A) {
|
|
1010
1007
|
return e | A << 16;
|
|
1011
1008
|
}
|
|
1012
|
-
function
|
|
1013
|
-
if (
|
|
1014
|
-
return Promise.reject(
|
|
1009
|
+
function fe(e = 512, A = null) {
|
|
1010
|
+
if (Ee(e))
|
|
1011
|
+
return Promise.reject(Ee(e));
|
|
1015
1012
|
let t = null, i = e;
|
|
1016
1013
|
if (A !== null) {
|
|
1017
1014
|
if (t = T(A), t.length > 64)
|
|
@@ -1019,19 +1016,19 @@ function Ce(e = 512, A = null) {
|
|
|
1019
1016
|
i = yA(e, t.length);
|
|
1020
1017
|
}
|
|
1021
1018
|
const r = e / 8;
|
|
1022
|
-
return
|
|
1019
|
+
return be(pA, r).then((n) => {
|
|
1023
1020
|
i > 512 && n.writeMemory(t), n.init(i);
|
|
1024
|
-
const
|
|
1025
|
-
init: i > 512 ? () => (n.writeMemory(t), n.init(i),
|
|
1026
|
-
update: (
|
|
1021
|
+
const s = {
|
|
1022
|
+
init: i > 512 ? () => (n.writeMemory(t), n.init(i), s) : () => (n.init(i), s),
|
|
1023
|
+
update: (l) => (n.update(l), s),
|
|
1027
1024
|
// biome-ignore lint/suspicious/noExplicitAny: Conflict with IHasher type
|
|
1028
|
-
digest: (
|
|
1025
|
+
digest: (l) => n.digest(l),
|
|
1029
1026
|
save: () => n.save(),
|
|
1030
|
-
load: (
|
|
1027
|
+
load: (l) => (n.load(l), s),
|
|
1031
1028
|
blockSize: 128,
|
|
1032
1029
|
digestSize: r
|
|
1033
1030
|
};
|
|
1034
|
-
return
|
|
1031
|
+
return s;
|
|
1035
1032
|
});
|
|
1036
1033
|
}
|
|
1037
1034
|
function kA(e, A, t) {
|
|
@@ -1040,27 +1037,27 @@ function kA(e, A, t) {
|
|
|
1040
1037
|
`t=${A.iterations}`,
|
|
1041
1038
|
`p=${A.parallelism}`
|
|
1042
1039
|
].join(",");
|
|
1043
|
-
return `$argon2${A.hashType}$v=19$${i}$${
|
|
1040
|
+
return `$argon2${A.hashType}$v=19$${i}$${de(e, !1)}$${de(t, !1)}`;
|
|
1044
1041
|
}
|
|
1045
|
-
const
|
|
1046
|
-
function
|
|
1047
|
-
return
|
|
1042
|
+
const pe = new DataView(new ArrayBuffer(4));
|
|
1043
|
+
function x(e) {
|
|
1044
|
+
return pe.setInt32(0, e, !0), new Uint8Array(pe.buffer);
|
|
1048
1045
|
}
|
|
1049
|
-
function
|
|
1050
|
-
return
|
|
1046
|
+
function ge(e, A, t) {
|
|
1047
|
+
return X(this, void 0, void 0, function* () {
|
|
1051
1048
|
if (t <= 64) {
|
|
1052
|
-
const
|
|
1053
|
-
return
|
|
1049
|
+
const h = yield fe(t * 8);
|
|
1050
|
+
return h.update(x(t)), h.update(A), h.digest("binary");
|
|
1054
1051
|
}
|
|
1055
1052
|
const i = Math.ceil(t / 32) - 2, r = new Uint8Array(t);
|
|
1056
|
-
e.init(), e.update(
|
|
1053
|
+
e.init(), e.update(x(t)), e.update(A);
|
|
1057
1054
|
let n = e.digest("binary");
|
|
1058
1055
|
r.set(n.subarray(0, 32), 0);
|
|
1059
|
-
for (let
|
|
1060
|
-
e.init(), e.update(n), n = e.digest("binary"), r.set(n.subarray(0, 32),
|
|
1061
|
-
const
|
|
1062
|
-
let
|
|
1063
|
-
return
|
|
1056
|
+
for (let h = 1; h < i; h++)
|
|
1057
|
+
e.init(), e.update(n), n = e.digest("binary"), r.set(n.subarray(0, 32), h * 32);
|
|
1058
|
+
const s = t - 32 * i;
|
|
1059
|
+
let l;
|
|
1060
|
+
return s === 64 ? (l = e, l.init()) : l = yield fe(s * 8), l.update(n), n = l.digest("binary"), r.set(n.subarray(0, s), i * 32), r;
|
|
1064
1061
|
});
|
|
1065
1062
|
}
|
|
1066
1063
|
function SA(e) {
|
|
@@ -1074,30 +1071,30 @@ function SA(e) {
|
|
|
1074
1071
|
}
|
|
1075
1072
|
}
|
|
1076
1073
|
function DA(e) {
|
|
1077
|
-
return
|
|
1074
|
+
return X(this, void 0, void 0, function* () {
|
|
1078
1075
|
var A;
|
|
1079
|
-
const { parallelism: t, iterations: i, hashLength: r } = e, n = T(e.password),
|
|
1080
|
-
|
|
1081
|
-
|
|
1076
|
+
const { parallelism: t, iterations: i, hashLength: r } = e, n = T(e.password), s = T(e.salt), l = 19, h = SA(e.hashType), { memorySize: o } = e, p = T((A = e.secret) !== null && A !== void 0 ? A : ""), [y, Q] = yield Promise.all([
|
|
1077
|
+
be(QA, 1024),
|
|
1078
|
+
fe(512)
|
|
1082
1079
|
]);
|
|
1083
|
-
y.setMemorySize(
|
|
1080
|
+
y.setMemorySize(o * 1024 + 1024);
|
|
1084
1081
|
const m = new Uint8Array(24), U = new DataView(m.buffer);
|
|
1085
|
-
U.setInt32(0, t, !0), U.setInt32(4, r, !0), U.setInt32(8,
|
|
1086
|
-
const B = Math.floor(
|
|
1082
|
+
U.setInt32(0, t, !0), U.setInt32(4, r, !0), U.setInt32(8, o, !0), U.setInt32(12, i, !0), U.setInt32(16, l, !0), U.setInt32(20, h, !0), y.writeMemory(m, o * 1024), Q.init(), Q.update(m), Q.update(x(n.length)), Q.update(n), Q.update(x(s.length)), Q.update(s), Q.update(x(p.length)), Q.update(p), Q.update(x(0));
|
|
1083
|
+
const B = Math.floor(o / (t * 4)) * 4, u = new Uint8Array(72), b = Q.digest("binary");
|
|
1087
1084
|
u.set(b);
|
|
1088
|
-
for (let
|
|
1089
|
-
u.set(
|
|
1090
|
-
let
|
|
1091
|
-
y.writeMemory(I,
|
|
1085
|
+
for (let C = 0; C < t; C++) {
|
|
1086
|
+
u.set(x(0), 64), u.set(x(C), 68);
|
|
1087
|
+
let a = C * B, I = yield ge(Q, u, 1024);
|
|
1088
|
+
y.writeMemory(I, a * 1024), a += 1, u.set(x(1), 64), I = yield ge(Q, u, 1024), y.writeMemory(I, a * 1024);
|
|
1092
1089
|
}
|
|
1093
1090
|
const k = new Uint8Array(1024);
|
|
1094
|
-
|
|
1095
|
-
const
|
|
1091
|
+
me(k, y.calculate(new Uint8Array([]), o));
|
|
1092
|
+
const d = yield ge(Q, k, r);
|
|
1096
1093
|
if (e.outputType === "hex") {
|
|
1097
|
-
const
|
|
1098
|
-
return
|
|
1094
|
+
const C = new Uint8Array(r * 2);
|
|
1095
|
+
return he(C, d, r);
|
|
1099
1096
|
}
|
|
1100
|
-
return e.outputType === "encoded" ? kA(
|
|
1097
|
+
return e.outputType === "encoded" ? kA(s, e, d) : d;
|
|
1101
1098
|
});
|
|
1102
1099
|
}
|
|
1103
1100
|
const FA = (e) => {
|
|
@@ -1125,8 +1122,8 @@ const FA = (e) => {
|
|
|
1125
1122
|
if (e.outputType === void 0 && (e.outputType = "hex"), !["hex", "binary", "encoded"].includes(e.outputType))
|
|
1126
1123
|
throw new Error(`Insupported output type ${e.outputType}. Valid values: ['hex', 'binary', 'encoded']`);
|
|
1127
1124
|
};
|
|
1128
|
-
function
|
|
1129
|
-
return
|
|
1125
|
+
function Ge(e) {
|
|
1126
|
+
return X(this, void 0, void 0, function* () {
|
|
1130
1127
|
return FA(e), DA(Object.assign(Object.assign({}, e), { hashType: "id" }));
|
|
1131
1128
|
});
|
|
1132
1129
|
}
|
|
@@ -1154,7 +1151,7 @@ const UA = 32;
|
|
|
1154
1151
|
async function it(e, A, t = Xe) {
|
|
1155
1152
|
mA(t);
|
|
1156
1153
|
try {
|
|
1157
|
-
const i = await
|
|
1154
|
+
const i = await Ge({
|
|
1158
1155
|
password: e,
|
|
1159
1156
|
salt: A,
|
|
1160
1157
|
iterations: t.tCost,
|
|
@@ -1163,7 +1160,7 @@ async function it(e, A, t = Xe) {
|
|
|
1163
1160
|
hashLength: UA,
|
|
1164
1161
|
outputType: "binary"
|
|
1165
1162
|
});
|
|
1166
|
-
return
|
|
1163
|
+
return De(i);
|
|
1167
1164
|
} catch {
|
|
1168
1165
|
throw new Error("Key derivation failed");
|
|
1169
1166
|
}
|
|
@@ -1184,7 +1181,7 @@ function mA(e) {
|
|
|
1184
1181
|
}
|
|
1185
1182
|
async function bA() {
|
|
1186
1183
|
try {
|
|
1187
|
-
const e = await
|
|
1184
|
+
const e = await Ge({
|
|
1188
1185
|
password: "test",
|
|
1189
1186
|
salt: new Uint8Array(16),
|
|
1190
1187
|
iterations: 1,
|
|
@@ -1194,7 +1191,7 @@ async function bA() {
|
|
|
1194
1191
|
hashLength: 32,
|
|
1195
1192
|
outputType: "binary"
|
|
1196
1193
|
});
|
|
1197
|
-
return e.length !== 32 ? !1 : (
|
|
1194
|
+
return e.length !== 32 ? !1 : (Fe(e), !0);
|
|
1198
1195
|
} catch {
|
|
1199
1196
|
return !1;
|
|
1200
1197
|
}
|
|
@@ -1211,11 +1208,11 @@ function KA(e) {
|
|
|
1211
1208
|
"[Cedros] WebAuthn RP domain validation is not configured. Set wallet.allowedRpDomains to a non-empty list of allowed domains."
|
|
1212
1209
|
);
|
|
1213
1210
|
}
|
|
1214
|
-
function
|
|
1211
|
+
function ue() {
|
|
1215
1212
|
return typeof window < "u" && typeof window.PublicKeyCredential < "u" && typeof navigator.credentials < "u";
|
|
1216
1213
|
}
|
|
1217
1214
|
async function HA() {
|
|
1218
|
-
if (!
|
|
1215
|
+
if (!ue())
|
|
1219
1216
|
return !1;
|
|
1220
1217
|
try {
|
|
1221
1218
|
if (!await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())
|
|
@@ -1231,7 +1228,7 @@ async function HA() {
|
|
|
1231
1228
|
}
|
|
1232
1229
|
}
|
|
1233
1230
|
async function rt(e, A) {
|
|
1234
|
-
if (!
|
|
1231
|
+
if (!ue())
|
|
1235
1232
|
throw new Error("WebAuthn is not available in this browser");
|
|
1236
1233
|
KA();
|
|
1237
1234
|
const t = oA(e), i = await navigator.credentials.get({
|
|
@@ -1256,20 +1253,20 @@ async function rt(e, A) {
|
|
|
1256
1253
|
const n = i.getClientExtensionResults().prf?.results?.first;
|
|
1257
1254
|
if (!n)
|
|
1258
1255
|
throw new Error("PRF extension did not return a result during authentication");
|
|
1259
|
-
const
|
|
1260
|
-
if (
|
|
1256
|
+
const s = new Uint8Array(n);
|
|
1257
|
+
if (s.length !== 32)
|
|
1261
1258
|
throw new Error(
|
|
1262
|
-
`Unexpected PRF output length: expected 32 bytes, got ${
|
|
1259
|
+
`Unexpected PRF output length: expected 32 bytes, got ${s.length}. The authenticator may not be compatible.`
|
|
1263
1260
|
);
|
|
1264
|
-
return { prfOutput:
|
|
1261
|
+
return { prfOutput: s };
|
|
1265
1262
|
}
|
|
1266
1263
|
async function JA() {
|
|
1267
|
-
const [e, A, t, i, r, n,
|
|
1264
|
+
const [e, A, t, i, r, n, s] = await Promise.all([
|
|
1268
1265
|
MA(),
|
|
1269
1266
|
VA(),
|
|
1270
1267
|
IA(),
|
|
1271
|
-
|
|
1272
|
-
Promise.resolve(
|
|
1268
|
+
NA(),
|
|
1269
|
+
Promise.resolve(ue()),
|
|
1273
1270
|
HA(),
|
|
1274
1271
|
bA()
|
|
1275
1272
|
]);
|
|
@@ -1280,8 +1277,8 @@ async function JA() {
|
|
|
1280
1277
|
ed25519: i,
|
|
1281
1278
|
webAuthn: r,
|
|
1282
1279
|
webAuthnPrf: n,
|
|
1283
|
-
argon2:
|
|
1284
|
-
allSupported: e && A && t && r && n &&
|
|
1280
|
+
argon2: s,
|
|
1281
|
+
allSupported: e && A && t && r && n && s
|
|
1285
1282
|
};
|
|
1286
1283
|
}
|
|
1287
1284
|
async function MA() {
|
|
@@ -1297,12 +1294,12 @@ async function VA() {
|
|
|
1297
1294
|
"encrypt",
|
|
1298
1295
|
"decrypt"
|
|
1299
1296
|
]), A = new Uint8Array([1, 2, 3, 4]), t = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.encrypt({ name: "AES-GCM", iv: t }, e, A), r = await crypto.subtle.decrypt({ name: "AES-GCM", iv: t }, e, i), n = new Uint8Array(r);
|
|
1300
|
-
return n.length === A.length && n.every((
|
|
1297
|
+
return n.length === A.length && n.every((s, l) => s === A[l]);
|
|
1301
1298
|
} catch {
|
|
1302
1299
|
return !1;
|
|
1303
1300
|
}
|
|
1304
1301
|
}
|
|
1305
|
-
async function
|
|
1302
|
+
async function NA() {
|
|
1306
1303
|
try {
|
|
1307
1304
|
return await crypto.subtle.generateKey("Ed25519", !1, ["sign", "verify"]), !0;
|
|
1308
1305
|
} catch {
|
|
@@ -1357,13 +1354,13 @@ function ot() {
|
|
|
1357
1354
|
likelySupported: !1
|
|
1358
1355
|
};
|
|
1359
1356
|
}
|
|
1360
|
-
let
|
|
1361
|
-
const
|
|
1362
|
-
async function
|
|
1363
|
-
const A = Date.now(), t =
|
|
1364
|
-
return !e && !(typeof window > "u") && !t &&
|
|
1357
|
+
let te = null, le = null;
|
|
1358
|
+
const YA = 6e4;
|
|
1359
|
+
async function OA(e = !1) {
|
|
1360
|
+
const A = Date.now(), t = le === null || A - le > YA;
|
|
1361
|
+
return !e && !(typeof window > "u") && !t && te !== null || (te = await JA(), le = Date.now()), te;
|
|
1365
1362
|
}
|
|
1366
|
-
function
|
|
1363
|
+
function PA(e) {
|
|
1367
1364
|
switch (e.type) {
|
|
1368
1365
|
case "password":
|
|
1369
1366
|
return { password: e.password };
|
|
@@ -1371,186 +1368,186 @@ function OA(e) {
|
|
|
1371
1368
|
return { prfOutput: e.prfOutput };
|
|
1372
1369
|
}
|
|
1373
1370
|
}
|
|
1374
|
-
function
|
|
1375
|
-
const e =
|
|
1371
|
+
function vA() {
|
|
1372
|
+
const e = ke(), [A, t] = F(!1), [i, r] = F(null), n = e?.config.serverUrl, s = e?.config.requestTimeout, l = e?.config.retryAttempts, h = e?._internal?.getAccessToken, o = M(() => e ? new ye({
|
|
1376
1373
|
baseUrl: n,
|
|
1377
|
-
timeoutMs:
|
|
1378
|
-
retryAttempts:
|
|
1379
|
-
getAccessToken:
|
|
1380
|
-
}) : null, [e, n,
|
|
1381
|
-
if (!
|
|
1374
|
+
timeoutMs: s,
|
|
1375
|
+
retryAttempts: l,
|
|
1376
|
+
getAccessToken: h
|
|
1377
|
+
}) : null, [e, n, s, l, h]), p = E(async () => {
|
|
1378
|
+
if (!o)
|
|
1382
1379
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1383
1380
|
t(!0), r(null);
|
|
1384
1381
|
try {
|
|
1385
|
-
return await
|
|
1382
|
+
return await o.get("/wallet/status");
|
|
1386
1383
|
} catch (I) {
|
|
1387
|
-
const
|
|
1388
|
-
throw r(
|
|
1384
|
+
const g = V(I, "Failed to fetch wallet status");
|
|
1385
|
+
throw r(g.message), g;
|
|
1389
1386
|
} finally {
|
|
1390
1387
|
t(!1);
|
|
1391
1388
|
}
|
|
1392
|
-
}, [
|
|
1393
|
-
if (!
|
|
1389
|
+
}, [o]), y = E(async () => {
|
|
1390
|
+
if (!o)
|
|
1394
1391
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1395
1392
|
t(!0), r(null);
|
|
1396
1393
|
try {
|
|
1397
|
-
return await
|
|
1394
|
+
return await o.get("/wallet/material");
|
|
1398
1395
|
} catch (I) {
|
|
1399
|
-
const
|
|
1400
|
-
if (
|
|
1396
|
+
const g = V(I, "Failed to fetch wallet material");
|
|
1397
|
+
if (g.code === "NOT_FOUND")
|
|
1401
1398
|
return null;
|
|
1402
|
-
throw r(
|
|
1399
|
+
throw r(g.message), g;
|
|
1403
1400
|
} finally {
|
|
1404
1401
|
t(!1);
|
|
1405
1402
|
}
|
|
1406
|
-
}, [
|
|
1403
|
+
}, [o]), Q = E(
|
|
1407
1404
|
async (I) => {
|
|
1408
|
-
if (!
|
|
1405
|
+
if (!o)
|
|
1409
1406
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1410
1407
|
t(!0), r(null);
|
|
1411
1408
|
try {
|
|
1412
|
-
await
|
|
1413
|
-
} catch (
|
|
1414
|
-
const w =
|
|
1409
|
+
await o.post("/wallet/enroll", I);
|
|
1410
|
+
} catch (g) {
|
|
1411
|
+
const w = V(g, "Failed to enroll wallet");
|
|
1415
1412
|
throw r(w.message), w;
|
|
1416
1413
|
} finally {
|
|
1417
1414
|
t(!1);
|
|
1418
1415
|
}
|
|
1419
1416
|
},
|
|
1420
|
-
[
|
|
1421
|
-
), m =
|
|
1417
|
+
[o]
|
|
1418
|
+
), m = E(
|
|
1422
1419
|
async (I) => {
|
|
1423
|
-
if (!
|
|
1420
|
+
if (!o)
|
|
1424
1421
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1425
1422
|
t(!0), r(null);
|
|
1426
1423
|
try {
|
|
1427
|
-
await
|
|
1428
|
-
} catch (
|
|
1429
|
-
const w =
|
|
1424
|
+
await o.post("/wallet/recover", I);
|
|
1425
|
+
} catch (g) {
|
|
1426
|
+
const w = V(g, "Failed to recover wallet");
|
|
1430
1427
|
throw r(w.message), w;
|
|
1431
1428
|
} finally {
|
|
1432
1429
|
t(!1);
|
|
1433
1430
|
}
|
|
1434
1431
|
},
|
|
1435
|
-
[
|
|
1436
|
-
), U =
|
|
1432
|
+
[o]
|
|
1433
|
+
), U = E(
|
|
1437
1434
|
async (I) => {
|
|
1438
|
-
if (!
|
|
1435
|
+
if (!o)
|
|
1439
1436
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1440
1437
|
t(!0), r(null);
|
|
1441
1438
|
try {
|
|
1442
|
-
return await
|
|
1443
|
-
} catch (
|
|
1444
|
-
const w =
|
|
1439
|
+
return await o.post("/wallet/sign", I);
|
|
1440
|
+
} catch (g) {
|
|
1441
|
+
const w = V(g, "Failed to sign transaction");
|
|
1445
1442
|
throw r(w.message), w;
|
|
1446
1443
|
} finally {
|
|
1447
1444
|
t(!1);
|
|
1448
1445
|
}
|
|
1449
1446
|
},
|
|
1450
|
-
[
|
|
1451
|
-
), c =
|
|
1447
|
+
[o]
|
|
1448
|
+
), c = E(
|
|
1452
1449
|
async (I) => {
|
|
1453
|
-
if (!
|
|
1450
|
+
if (!o)
|
|
1454
1451
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1455
1452
|
t(!0), r(null);
|
|
1456
1453
|
try {
|
|
1457
|
-
await
|
|
1458
|
-
} catch (
|
|
1459
|
-
const w =
|
|
1454
|
+
await o.post("/wallet/rotate-user-secret", I);
|
|
1455
|
+
} catch (g) {
|
|
1456
|
+
const w = V(g, "Failed to rotate user secret");
|
|
1460
1457
|
throw r(w.message), w;
|
|
1461
1458
|
} finally {
|
|
1462
1459
|
t(!1);
|
|
1463
1460
|
}
|
|
1464
1461
|
},
|
|
1465
|
-
[
|
|
1466
|
-
), B =
|
|
1462
|
+
[o]
|
|
1463
|
+
), B = E(
|
|
1467
1464
|
async (I) => {
|
|
1468
|
-
if (!
|
|
1465
|
+
if (!o)
|
|
1469
1466
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1470
1467
|
t(!0), r(null);
|
|
1471
1468
|
try {
|
|
1472
|
-
return await
|
|
1469
|
+
return await o.post(
|
|
1473
1470
|
"/wallet/unlock",
|
|
1474
|
-
|
|
1471
|
+
PA(I)
|
|
1475
1472
|
);
|
|
1476
|
-
} catch (
|
|
1477
|
-
const w =
|
|
1473
|
+
} catch (g) {
|
|
1474
|
+
const w = V(g, "Failed to unlock wallet");
|
|
1478
1475
|
throw r(w.message), w;
|
|
1479
1476
|
} finally {
|
|
1480
1477
|
t(!1);
|
|
1481
1478
|
}
|
|
1482
1479
|
},
|
|
1483
|
-
[
|
|
1484
|
-
), u =
|
|
1485
|
-
if (!
|
|
1480
|
+
[o]
|
|
1481
|
+
), u = E(async () => {
|
|
1482
|
+
if (!o)
|
|
1486
1483
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1487
1484
|
t(!0), r(null);
|
|
1488
1485
|
try {
|
|
1489
|
-
await
|
|
1486
|
+
await o.post("/wallet/lock", {});
|
|
1490
1487
|
} catch (I) {
|
|
1491
|
-
const
|
|
1492
|
-
throw r(
|
|
1488
|
+
const g = V(I, "Failed to lock wallet");
|
|
1489
|
+
throw r(g.message), g;
|
|
1493
1490
|
} finally {
|
|
1494
1491
|
t(!1);
|
|
1495
1492
|
}
|
|
1496
|
-
}, [
|
|
1493
|
+
}, [o]), b = E(
|
|
1497
1494
|
async (I) => {
|
|
1498
|
-
if (!
|
|
1495
|
+
if (!o)
|
|
1499
1496
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1500
1497
|
t(!0), r(null);
|
|
1501
1498
|
try {
|
|
1502
|
-
return await
|
|
1503
|
-
} catch (
|
|
1504
|
-
const w =
|
|
1499
|
+
return await o.post("/wallet/share-b", I);
|
|
1500
|
+
} catch (g) {
|
|
1501
|
+
const w = V(g, "Failed to get Share B for recovery");
|
|
1505
1502
|
throw r(w.message), w;
|
|
1506
1503
|
} finally {
|
|
1507
1504
|
t(!1);
|
|
1508
1505
|
}
|
|
1509
1506
|
},
|
|
1510
|
-
[
|
|
1511
|
-
), k =
|
|
1507
|
+
[o]
|
|
1508
|
+
), k = E(
|
|
1512
1509
|
async (I) => {
|
|
1513
|
-
if (!
|
|
1510
|
+
if (!o)
|
|
1514
1511
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1515
1512
|
t(!0), r(null);
|
|
1516
1513
|
try {
|
|
1517
|
-
return await
|
|
1518
|
-
} catch (
|
|
1519
|
-
const w =
|
|
1514
|
+
return await o.post("/wallet/derived", I);
|
|
1515
|
+
} catch (g) {
|
|
1516
|
+
const w = V(g, "Failed to create derived wallet");
|
|
1520
1517
|
throw r(w.message), w;
|
|
1521
1518
|
} finally {
|
|
1522
1519
|
t(!1);
|
|
1523
1520
|
}
|
|
1524
1521
|
},
|
|
1525
|
-
[
|
|
1526
|
-
),
|
|
1527
|
-
if (!
|
|
1522
|
+
[o]
|
|
1523
|
+
), d = E(async () => {
|
|
1524
|
+
if (!o)
|
|
1528
1525
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1529
1526
|
t(!0), r(null);
|
|
1530
1527
|
try {
|
|
1531
|
-
return await
|
|
1528
|
+
return await o.get("/wallet/derived");
|
|
1532
1529
|
} catch (I) {
|
|
1533
|
-
const
|
|
1534
|
-
throw r(
|
|
1530
|
+
const g = V(I, "Failed to list wallets");
|
|
1531
|
+
throw r(g.message), g;
|
|
1535
1532
|
} finally {
|
|
1536
1533
|
t(!1);
|
|
1537
1534
|
}
|
|
1538
|
-
}, [
|
|
1535
|
+
}, [o]), C = E(
|
|
1539
1536
|
async (I) => {
|
|
1540
|
-
if (!
|
|
1537
|
+
if (!o)
|
|
1541
1538
|
throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
|
|
1542
1539
|
t(!0), r(null);
|
|
1543
1540
|
try {
|
|
1544
|
-
await
|
|
1545
|
-
} catch (
|
|
1546
|
-
const w =
|
|
1541
|
+
await o.delete(`/wallet/derived/${I}`);
|
|
1542
|
+
} catch (g) {
|
|
1543
|
+
const w = V(g, "Failed to delete derived wallet");
|
|
1547
1544
|
throw r(w.message), w;
|
|
1548
1545
|
} finally {
|
|
1549
1546
|
t(!1);
|
|
1550
1547
|
}
|
|
1551
1548
|
},
|
|
1552
|
-
[
|
|
1553
|
-
),
|
|
1549
|
+
[o]
|
|
1550
|
+
), a = E(() => r(null), []);
|
|
1554
1551
|
return {
|
|
1555
1552
|
getStatus: p,
|
|
1556
1553
|
getMaterial: y,
|
|
@@ -1562,14 +1559,14 @@ function xA() {
|
|
|
1562
1559
|
lock: u,
|
|
1563
1560
|
getShareBForRecovery: b,
|
|
1564
1561
|
createDerivedWallet: k,
|
|
1565
|
-
listAllWallets:
|
|
1566
|
-
deleteDerivedWallet:
|
|
1562
|
+
listAllWallets: d,
|
|
1563
|
+
deleteDerivedWallet: C,
|
|
1567
1564
|
isLoading: A,
|
|
1568
1565
|
error: i,
|
|
1569
|
-
clearError:
|
|
1566
|
+
clearError: a
|
|
1570
1567
|
};
|
|
1571
1568
|
}
|
|
1572
|
-
const
|
|
1569
|
+
const xA = {
|
|
1573
1570
|
status: "not_enrolled",
|
|
1574
1571
|
solanaPubkey: null,
|
|
1575
1572
|
authMethod: null,
|
|
@@ -1584,121 +1581,121 @@ const vA = {
|
|
|
1584
1581
|
}
|
|
1585
1582
|
};
|
|
1586
1583
|
function TA() {
|
|
1587
|
-
const A =
|
|
1588
|
-
|
|
1584
|
+
const A = ke() !== null, [t, i] = F("loading"), [r, n] = F(null), [s, l] = F(null), [h, o] = F(!1), [p, y] = F(!1), [Q, m] = F(null), [U, c] = F(null), { getStatus: B, isLoading: u } = vA(), b = N(!1);
|
|
1585
|
+
P(() => {
|
|
1589
1586
|
if (!A) return;
|
|
1590
|
-
let
|
|
1587
|
+
let C = !1;
|
|
1591
1588
|
return (async () => {
|
|
1592
1589
|
try {
|
|
1593
|
-
const I = await
|
|
1594
|
-
if (
|
|
1590
|
+
const I = await OA();
|
|
1591
|
+
if (C) return;
|
|
1595
1592
|
m(I), I.allSupported || (i("error"), c(
|
|
1596
1593
|
"Your browser or device does not support all required features. Please use a modern browser with a platform authenticator."
|
|
1597
1594
|
));
|
|
1598
1595
|
} catch {
|
|
1599
|
-
if (
|
|
1596
|
+
if (C) return;
|
|
1600
1597
|
m(null), i("error"), c("Failed to check crypto capabilities");
|
|
1601
1598
|
}
|
|
1602
1599
|
})(), () => {
|
|
1603
|
-
|
|
1600
|
+
C = !0;
|
|
1604
1601
|
};
|
|
1605
1602
|
}, [A]);
|
|
1606
|
-
const k =
|
|
1603
|
+
const k = E(async () => {
|
|
1607
1604
|
if (!(!A || !Q?.allSupported)) {
|
|
1608
1605
|
i("loading"), c(null);
|
|
1609
1606
|
try {
|
|
1610
|
-
const
|
|
1611
|
-
n(
|
|
1612
|
-
} catch (
|
|
1613
|
-
i("error"), c(
|
|
1607
|
+
const C = await B();
|
|
1608
|
+
n(C.solanaPubkey ?? null), l(C.authMethod ?? null), o(C.hasExternalWallet), y(C.unlocked), C.hasExternalWallet ? i("enrolled_unlocked") : C.enrolled ? i(C.unlocked ? "enrolled_unlocked" : "enrolled_locked") : i("not_enrolled");
|
|
1609
|
+
} catch (C) {
|
|
1610
|
+
i("error"), c(C instanceof Error ? C.message : "Failed to fetch wallet status");
|
|
1614
1611
|
}
|
|
1615
1612
|
}
|
|
1616
1613
|
}, [A, Q?.allSupported, B]);
|
|
1617
|
-
|
|
1614
|
+
P(() => {
|
|
1618
1615
|
A && Q?.allSupported && !u && !b.current && (b.current = !0, k());
|
|
1619
1616
|
}, [A, Q?.allSupported, u, k]);
|
|
1620
|
-
const
|
|
1617
|
+
const d = E(() => c(null), []);
|
|
1621
1618
|
return A ? {
|
|
1622
1619
|
status: t,
|
|
1623
1620
|
solanaPubkey: r,
|
|
1624
|
-
authMethod:
|
|
1625
|
-
hasExternalWallet:
|
|
1621
|
+
authMethod: s,
|
|
1622
|
+
hasExternalWallet: h,
|
|
1626
1623
|
isUnlocked: p,
|
|
1627
1624
|
capabilities: Q,
|
|
1628
1625
|
isSupported: Q?.allSupported ?? !1,
|
|
1629
1626
|
error: U,
|
|
1630
1627
|
refresh: k,
|
|
1631
|
-
clearError:
|
|
1632
|
-
} :
|
|
1628
|
+
clearError: d
|
|
1629
|
+
} : xA;
|
|
1633
1630
|
}
|
|
1634
|
-
const
|
|
1631
|
+
const re = "__CEDROS_EMBEDDED_WALLET__";
|
|
1635
1632
|
function RA(e) {
|
|
1636
|
-
typeof window < "u" && (window[
|
|
1633
|
+
typeof window < "u" && (window[re] = e);
|
|
1637
1634
|
}
|
|
1638
|
-
function
|
|
1639
|
-
typeof window < "u" && delete window[
|
|
1635
|
+
function ce() {
|
|
1636
|
+
typeof window < "u" && delete window[re];
|
|
1640
1637
|
}
|
|
1641
1638
|
function st() {
|
|
1642
|
-
return typeof window > "u" ? !1 : window[
|
|
1639
|
+
return typeof window > "u" ? !1 : window[re]?.available ?? !1;
|
|
1643
1640
|
}
|
|
1644
1641
|
function It() {
|
|
1645
|
-
return typeof window > "u" ? null : window[
|
|
1642
|
+
return typeof window > "u" ? null : window[re] ?? null;
|
|
1646
1643
|
}
|
|
1647
1644
|
function LA() {
|
|
1648
|
-
const { config: e, user: A } =
|
|
1649
|
-
return
|
|
1645
|
+
const { config: e, user: A } = Se(), { status: t, solanaPubkey: i, hasExternalWallet: r } = TA(), n = e.wallet?.exposeAvailability ?? !1, s = e.wallet?.exposePublicKey ?? !1;
|
|
1646
|
+
return P(() => {
|
|
1650
1647
|
if (!n || !A) {
|
|
1651
|
-
|
|
1648
|
+
ce();
|
|
1652
1649
|
return;
|
|
1653
1650
|
}
|
|
1654
1651
|
if (r) {
|
|
1655
|
-
|
|
1652
|
+
ce();
|
|
1656
1653
|
return;
|
|
1657
1654
|
}
|
|
1658
1655
|
if (t === "loading")
|
|
1659
1656
|
return;
|
|
1660
|
-
const
|
|
1657
|
+
const l = t === "enrolled_locked" || t === "enrolled_unlocked";
|
|
1661
1658
|
return RA({
|
|
1662
|
-
available:
|
|
1663
|
-
publicKey:
|
|
1659
|
+
available: l,
|
|
1660
|
+
publicKey: s && l ? i : null
|
|
1664
1661
|
}), () => {
|
|
1665
|
-
|
|
1662
|
+
ce();
|
|
1666
1663
|
};
|
|
1667
|
-
}, [n,
|
|
1664
|
+
}, [n, s, A, t, i, r]), null;
|
|
1668
1665
|
}
|
|
1669
1666
|
function at({ config: e, children: A }) {
|
|
1670
|
-
const [t, i] = F(null), [r, n] = F(!1),
|
|
1671
|
-
|
|
1672
|
-
const
|
|
1673
|
-
onLoginSuccess: (...
|
|
1674
|
-
onLoginError: (...
|
|
1675
|
-
onLogout: () =>
|
|
1676
|
-
onSessionExpired: () =>
|
|
1677
|
-
}),
|
|
1678
|
-
|
|
1667
|
+
const [t, i] = F(null), [r, n] = F(!1), s = N(e.callbacks);
|
|
1668
|
+
s.current = e.callbacks;
|
|
1669
|
+
const l = N({
|
|
1670
|
+
onLoginSuccess: (...v) => s.current?.onLoginSuccess?.(...v),
|
|
1671
|
+
onLoginError: (...v) => s.current?.onLoginError?.(...v),
|
|
1672
|
+
onLogout: () => s.current?.onLogout?.(),
|
|
1673
|
+
onSessionExpired: () => s.current?.onSessionExpired?.()
|
|
1674
|
+
}), h = N(null);
|
|
1675
|
+
P(() => {
|
|
1679
1676
|
if (typeof window > "u") return;
|
|
1680
|
-
const
|
|
1681
|
-
L && (
|
|
1677
|
+
const v = new URLSearchParams(window.location.search), L = v.get("ref") || v.get("referral");
|
|
1678
|
+
L && (h.current = L);
|
|
1682
1679
|
}, []);
|
|
1683
|
-
const
|
|
1680
|
+
const o = e.features === "auto", {
|
|
1684
1681
|
features: p,
|
|
1685
1682
|
googleClientId: y,
|
|
1686
1683
|
appleClientId: Q,
|
|
1687
1684
|
socialButtonOrder: m,
|
|
1688
1685
|
isLoading: U
|
|
1689
|
-
} =
|
|
1686
|
+
} = Ye(
|
|
1690
1687
|
e.serverUrl,
|
|
1691
|
-
|
|
1688
|
+
o,
|
|
1692
1689
|
e.requestTimeout
|
|
1693
|
-
), c =
|
|
1690
|
+
), c = M(() => !o || !p ? e : {
|
|
1694
1691
|
...e,
|
|
1695
1692
|
features: p,
|
|
1696
1693
|
googleClientId: e.googleClientId ?? y,
|
|
1697
1694
|
appleClientId: e.appleClientId ?? Q
|
|
1698
|
-
}, [e,
|
|
1695
|
+
}, [e, o, p, y, Q]), B = M(
|
|
1699
1696
|
() => JSON.stringify(c.themeOverrides ?? null),
|
|
1700
1697
|
[c.themeOverrides]
|
|
1701
|
-
), u =
|
|
1698
|
+
), u = M(() => JSON.stringify(c.session ?? null), [c.session]), b = M(() => JSON.stringify(c.features ?? null), [c.features]), k = M(() => JSON.stringify(c.forms ?? null), [c.forms]), d = M(
|
|
1702
1699
|
() => c,
|
|
1703
1700
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- Using serialized keys for deep comparison; callbacks excluded (see UI-06)
|
|
1704
1701
|
[
|
|
@@ -1713,64 +1710,62 @@ function at({ config: e, children: A }) {
|
|
|
1713
1710
|
b,
|
|
1714
1711
|
k
|
|
1715
1712
|
]
|
|
1716
|
-
)
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
const {
|
|
1722
|
-
user: h,
|
|
1713
|
+
), C = d.unstyled ?? !1, a = Ve({
|
|
1714
|
+
theme: C ? void 0 : d.theme,
|
|
1715
|
+
themeOverrides: C ? void 0 : d.themeOverrides
|
|
1716
|
+
}), {
|
|
1717
|
+
user: I,
|
|
1723
1718
|
authState: g,
|
|
1724
|
-
handleLoginSuccess:
|
|
1725
|
-
logout:
|
|
1726
|
-
refreshUser:
|
|
1727
|
-
getAccessToken:
|
|
1719
|
+
handleLoginSuccess: w,
|
|
1720
|
+
logout: f,
|
|
1721
|
+
refreshUser: S,
|
|
1722
|
+
getAccessToken: G
|
|
1728
1723
|
} = Le({
|
|
1729
|
-
serverUrl:
|
|
1730
|
-
session:
|
|
1731
|
-
callbacks:
|
|
1732
|
-
requestTimeoutMs:
|
|
1733
|
-
}),
|
|
1734
|
-
i(null), await
|
|
1735
|
-
}, [
|
|
1736
|
-
(...
|
|
1737
|
-
i(null),
|
|
1724
|
+
serverUrl: d.serverUrl,
|
|
1725
|
+
session: d.session,
|
|
1726
|
+
callbacks: l.current,
|
|
1727
|
+
requestTimeoutMs: d.requestTimeout
|
|
1728
|
+
}), H = E(async () => {
|
|
1729
|
+
i(null), await f();
|
|
1730
|
+
}, [f]), K = E(
|
|
1731
|
+
(...v) => {
|
|
1732
|
+
i(null), w(...v);
|
|
1738
1733
|
},
|
|
1739
|
-
[
|
|
1740
|
-
),
|
|
1734
|
+
[w]
|
|
1735
|
+
), J = E(() => n(!0), []), Y = E(() => n(!1), []), _ = M(
|
|
1741
1736
|
() => ({
|
|
1742
|
-
config:
|
|
1743
|
-
user:
|
|
1737
|
+
config: d,
|
|
1738
|
+
user: I,
|
|
1744
1739
|
authState: g,
|
|
1745
|
-
logout:
|
|
1746
|
-
refreshUser:
|
|
1747
|
-
socialButtonOrder:
|
|
1740
|
+
logout: H,
|
|
1741
|
+
refreshUser: S,
|
|
1742
|
+
socialButtonOrder: o ? m : void 0,
|
|
1748
1743
|
_internal: {
|
|
1749
|
-
handleLoginSuccess:
|
|
1750
|
-
getAccessToken:
|
|
1751
|
-
getReferralCode: () =>
|
|
1744
|
+
handleLoginSuccess: K,
|
|
1745
|
+
getAccessToken: G,
|
|
1746
|
+
getReferralCode: () => h.current
|
|
1752
1747
|
}
|
|
1753
1748
|
}),
|
|
1754
|
-
[
|
|
1755
|
-
),
|
|
1749
|
+
[d, I, g, H, S, o, m, K, G]
|
|
1750
|
+
), R = M(
|
|
1756
1751
|
() => ({
|
|
1757
1752
|
error: t,
|
|
1758
1753
|
isModalOpen: r,
|
|
1759
|
-
openModal:
|
|
1760
|
-
closeModal:
|
|
1754
|
+
openModal: J,
|
|
1755
|
+
closeModal: Y
|
|
1761
1756
|
}),
|
|
1762
|
-
[t, r,
|
|
1763
|
-
),
|
|
1764
|
-
() => ({ ...
|
|
1765
|
-
[
|
|
1757
|
+
[t, r, J, Y]
|
|
1758
|
+
), j = M(
|
|
1759
|
+
() => ({ ..._, ...R }),
|
|
1760
|
+
[_, R]
|
|
1766
1761
|
);
|
|
1767
|
-
return
|
|
1768
|
-
/* @__PURE__ */
|
|
1762
|
+
return o && U ? null : /* @__PURE__ */ $(He.Provider, { value: _, children: /* @__PURE__ */ $(Je.Provider, { value: R, children: /* @__PURE__ */ $(Me.Provider, { value: j, children: /* @__PURE__ */ Ke("div", { className: a.className, style: a.style, children: [
|
|
1763
|
+
/* @__PURE__ */ $(LA, {}),
|
|
1769
1764
|
A
|
|
1770
|
-
] }) }) });
|
|
1765
|
+
] }) }) }) });
|
|
1771
1766
|
}
|
|
1772
1767
|
function gt() {
|
|
1773
|
-
const { user: e, authState: A, error: t, logout: i, refreshUser: r, openModal: n, closeModal:
|
|
1768
|
+
const { user: e, authState: A, error: t, logout: i, refreshUser: r, openModal: n, closeModal: s } = Se();
|
|
1774
1769
|
return {
|
|
1775
1770
|
user: e,
|
|
1776
1771
|
authState: A,
|
|
@@ -1780,7 +1775,7 @@ function gt() {
|
|
|
1780
1775
|
logout: i,
|
|
1781
1776
|
refreshUser: r,
|
|
1782
1777
|
openLoginModal: n,
|
|
1783
|
-
closeLoginModal:
|
|
1778
|
+
closeLoginModal: s
|
|
1784
1779
|
};
|
|
1785
1780
|
}
|
|
1786
1781
|
export {
|
|
@@ -1790,23 +1785,24 @@ export {
|
|
|
1790
1785
|
ze as b,
|
|
1791
1786
|
et as c,
|
|
1792
1787
|
ot as d,
|
|
1793
|
-
|
|
1788
|
+
vA as e,
|
|
1794
1789
|
_A as f,
|
|
1795
1790
|
nt as g,
|
|
1796
1791
|
At as h,
|
|
1797
|
-
|
|
1798
|
-
|
|
1792
|
+
De as i,
|
|
1793
|
+
we as j,
|
|
1799
1794
|
$A as k,
|
|
1800
1795
|
zA as l,
|
|
1801
1796
|
rt as m,
|
|
1802
1797
|
tt as n,
|
|
1803
|
-
|
|
1798
|
+
PA as o,
|
|
1804
1799
|
oA as p,
|
|
1805
1800
|
TA as q,
|
|
1806
|
-
|
|
1807
|
-
|
|
1801
|
+
Ve as r,
|
|
1802
|
+
It as s,
|
|
1808
1803
|
qA as t,
|
|
1809
1804
|
gt as u,
|
|
1810
1805
|
mA as v,
|
|
1811
|
-
|
|
1806
|
+
Fe as w,
|
|
1807
|
+
st as x
|
|
1812
1808
|
};
|