@versini/auth-provider 6.4.2 → 6.4.4
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/index.d.ts +11 -2
- package/dist/index.js +335 -334
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var X = (e, t, n) =>
|
|
1
|
+
var Nt = Object.defineProperty;
|
|
2
|
+
var Dt = (e, t, n) => t in e ? Nt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var X = (e, t, n) => Dt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as ke } from "react/jsx-runtime";
|
|
5
|
-
import
|
|
5
|
+
import Ut, { useSyncExternalStore as $t, useCallback as U, useEffect as Re, createContext as Kt, useReducer as Ht, useRef as Oe, useContext as Lt } from "react";
|
|
6
6
|
/*!
|
|
7
|
-
@versini/auth-provider v6.4.
|
|
7
|
+
@versini/auth-provider v6.4.4
|
|
8
8
|
© 2024 gizmette.com
|
|
9
9
|
*/
|
|
10
10
|
try {
|
|
11
11
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
12
|
-
version: "6.4.
|
|
13
|
-
buildTime: "07/
|
|
12
|
+
version: "6.4.4",
|
|
13
|
+
buildTime: "07/31/2024 08:11 PM EDT",
|
|
14
14
|
homepage: "https://github.com/aversini/auth-client",
|
|
15
15
|
license: "MIT"
|
|
16
16
|
});
|
|
@@ -48,7 +48,7 @@ class b extends Error {
|
|
|
48
48
|
super(t, { cause: r }), this.name = a ?? r.name, this.code = n;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function Wt({ error: e, options: t }) {
|
|
52
52
|
const { publicKey: n } = t;
|
|
53
53
|
if (!n)
|
|
54
54
|
throw Error("options was missing required publicKey property");
|
|
@@ -125,7 +125,7 @@ function Kt({ error: e, options: t }) {
|
|
|
125
125
|
}
|
|
126
126
|
return e;
|
|
127
127
|
}
|
|
128
|
-
class
|
|
128
|
+
class xt {
|
|
129
129
|
createNewAbortSignal() {
|
|
130
130
|
if (this.controller) {
|
|
131
131
|
const n = new Error("Cancelling existing WebAuthn API call for new one");
|
|
@@ -141,12 +141,12 @@ class Ht {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const Be = new
|
|
144
|
+
const Be = new xt(), Mt = ["cross-platform", "platform"];
|
|
145
145
|
function qe(e) {
|
|
146
|
-
if (e && !(
|
|
146
|
+
if (e && !(Mt.indexOf(e) < 0))
|
|
147
147
|
return e;
|
|
148
148
|
}
|
|
149
|
-
async function
|
|
149
|
+
async function Gt(e) {
|
|
150
150
|
if (!be())
|
|
151
151
|
throw new Error("WebAuthn is not supported in this browser");
|
|
152
152
|
const n = { publicKey: {
|
|
@@ -163,7 +163,7 @@ async function Wt(e) {
|
|
|
163
163
|
try {
|
|
164
164
|
r = await navigator.credentials.create(n);
|
|
165
165
|
} catch (g) {
|
|
166
|
-
throw
|
|
166
|
+
throw Wt({ error: g, options: n });
|
|
167
167
|
}
|
|
168
168
|
if (!r)
|
|
169
169
|
throw new Error("Registration was not completed");
|
|
@@ -212,13 +212,13 @@ function ge(e, t) {
|
|
|
212
212
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
|
|
213
213
|
`, t);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Jt() {
|
|
216
216
|
if (!be())
|
|
217
217
|
return new Promise((t) => t(!1));
|
|
218
218
|
const e = window.PublicKeyCredential;
|
|
219
219
|
return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Yt({ error: e, options: t }) {
|
|
222
222
|
const { publicKey: n } = t;
|
|
223
223
|
if (!n)
|
|
224
224
|
throw Error("options was missing required publicKey property");
|
|
@@ -259,7 +259,7 @@ function Mt({ error: e, options: t }) {
|
|
|
259
259
|
}
|
|
260
260
|
return e;
|
|
261
261
|
}
|
|
262
|
-
async function
|
|
262
|
+
async function Vt(e, t = !1) {
|
|
263
263
|
if (!be())
|
|
264
264
|
throw new Error("WebAuthn is not supported in this browser");
|
|
265
265
|
let n;
|
|
@@ -270,7 +270,7 @@ async function Gt(e, t = !1) {
|
|
|
270
270
|
allowCredentials: n
|
|
271
271
|
}, a = {};
|
|
272
272
|
if (t) {
|
|
273
|
-
if (!await
|
|
273
|
+
if (!await Jt())
|
|
274
274
|
throw Error("Browser does not support WebAuthn autofill");
|
|
275
275
|
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
|
|
276
276
|
throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
|
|
@@ -281,7 +281,7 @@ async function Gt(e, t = !1) {
|
|
|
281
281
|
try {
|
|
282
282
|
s = await navigator.credentials.get(a);
|
|
283
283
|
} catch (h) {
|
|
284
|
-
throw
|
|
284
|
+
throw Yt({ error: h, options: a });
|
|
285
285
|
}
|
|
286
286
|
if (!s)
|
|
287
287
|
throw new Error("Authentication was not completed");
|
|
@@ -308,7 +308,7 @@ async function Gt(e, t = !1) {
|
|
|
308
308
|
try {
|
|
309
309
|
window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
|
|
310
310
|
version: "3.3.0",
|
|
311
|
-
buildTime: "07/
|
|
311
|
+
buildTime: "07/31/2024 08:11 PM EDT",
|
|
312
312
|
homepage: "https://github.com/aversini/auth-client",
|
|
313
313
|
license: "MIT"
|
|
314
314
|
});
|
|
@@ -334,7 +334,7 @@ const G = {
|
|
|
334
334
|
CREATED_AT_KEY: "iat",
|
|
335
335
|
SCOPES_KEY: "scopes",
|
|
336
336
|
ISSUER: "gizmette.com"
|
|
337
|
-
},
|
|
337
|
+
}, jt = `-----BEGIN PUBLIC KEY-----
|
|
338
338
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
|
|
339
339
|
w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
|
|
340
340
|
i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
|
|
@@ -347,14 +347,14 @@ awIDAQAB
|
|
|
347
347
|
CODE: "code",
|
|
348
348
|
LOGOUT: "logout"
|
|
349
349
|
}, pe = crypto, Qe = (e) => e instanceof CryptoKey, Z = new TextEncoder(), q = new TextDecoder();
|
|
350
|
-
function
|
|
350
|
+
function Ft(...e) {
|
|
351
351
|
const t = e.reduce((a, { length: s }) => a + s, 0), n = new Uint8Array(t);
|
|
352
352
|
let r = 0;
|
|
353
353
|
for (const a of e)
|
|
354
354
|
n.set(a, r), r += a.length;
|
|
355
355
|
return n;
|
|
356
356
|
}
|
|
357
|
-
const
|
|
357
|
+
const Bt = (e) => {
|
|
358
358
|
const t = atob(e), n = new Uint8Array(t.length);
|
|
359
359
|
for (let r = 0; r < t.length; r++)
|
|
360
360
|
n[r] = t.charCodeAt(r);
|
|
@@ -363,7 +363,7 @@ const Vt = (e) => {
|
|
|
363
363
|
let t = e;
|
|
364
364
|
t instanceof Uint8Array && (t = q.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
365
365
|
try {
|
|
366
|
-
return
|
|
366
|
+
return Bt(t);
|
|
367
367
|
} catch {
|
|
368
368
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
369
369
|
}
|
|
@@ -391,7 +391,7 @@ let $ = class extends Error {
|
|
|
391
391
|
super(t), this.code = "ERR_JWT_EXPIRED", this.claim = r, this.reason = a, this.payload = n;
|
|
392
392
|
}
|
|
393
393
|
};
|
|
394
|
-
class
|
|
394
|
+
class qt extends $ {
|
|
395
395
|
constructor() {
|
|
396
396
|
super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
397
397
|
}
|
|
@@ -423,7 +423,7 @@ let k = class extends $ {
|
|
|
423
423
|
return "ERR_JWT_INVALID";
|
|
424
424
|
}
|
|
425
425
|
};
|
|
426
|
-
class
|
|
426
|
+
class zt extends $ {
|
|
427
427
|
constructor() {
|
|
428
428
|
super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
|
|
429
429
|
}
|
|
@@ -440,7 +440,7 @@ function ee(e, t) {
|
|
|
440
440
|
function me(e) {
|
|
441
441
|
return parseInt(e.name.slice(4), 10);
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function Qt(e) {
|
|
444
444
|
switch (e) {
|
|
445
445
|
case "ES256":
|
|
446
446
|
return "P-256";
|
|
@@ -452,7 +452,7 @@ function Bt(e) {
|
|
|
452
452
|
throw new Error("unreachable");
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function Xt(e, t) {
|
|
456
456
|
if (t.length && !t.some((n) => e.usages.includes(n))) {
|
|
457
457
|
let n = "CryptoKey does not support this operation, its usages must include ";
|
|
458
458
|
if (t.length > 2) {
|
|
@@ -462,7 +462,7 @@ function qt(e, t) {
|
|
|
462
462
|
throw new TypeError(n);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function Zt(e, t, ...n) {
|
|
466
466
|
switch (t) {
|
|
467
467
|
case "HS256":
|
|
468
468
|
case "HS384":
|
|
@@ -504,7 +504,7 @@ function zt(e, t, ...n) {
|
|
|
504
504
|
case "ES512": {
|
|
505
505
|
if (!ee(e.algorithm, "ECDSA"))
|
|
506
506
|
throw P("ECDSA");
|
|
507
|
-
const r =
|
|
507
|
+
const r = Qt(t);
|
|
508
508
|
if (e.algorithm.namedCurve !== r)
|
|
509
509
|
throw P(r, "algorithm.namedCurve");
|
|
510
510
|
break;
|
|
@@ -512,7 +512,7 @@ function zt(e, t, ...n) {
|
|
|
512
512
|
default:
|
|
513
513
|
throw new TypeError("CryptoKey does not support this operation");
|
|
514
514
|
}
|
|
515
|
-
|
|
515
|
+
Xt(e, n);
|
|
516
516
|
}
|
|
517
517
|
function Xe(e, t, ...n) {
|
|
518
518
|
var r;
|
|
@@ -526,7 +526,7 @@ const De = (e, ...t) => Xe("Key must be ", e, ...t);
|
|
|
526
526
|
function Ze(e, t, ...n) {
|
|
527
527
|
return Xe(`Key for the ${e} algorithm must be `, t, ...n);
|
|
528
528
|
}
|
|
529
|
-
const et = (e) => Qe(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ue = ["CryptoKey"],
|
|
529
|
+
const et = (e) => Qe(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ue = ["CryptoKey"], en = (...e) => {
|
|
530
530
|
const t = e.filter(Boolean);
|
|
531
531
|
if (t.length === 0 || t.length === 1)
|
|
532
532
|
return !0;
|
|
@@ -545,11 +545,11 @@ const et = (e) => Qe(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ue = ["C
|
|
|
545
545
|
}
|
|
546
546
|
return !0;
|
|
547
547
|
};
|
|
548
|
-
function
|
|
548
|
+
function tn(e) {
|
|
549
549
|
return typeof e == "object" && e !== null;
|
|
550
550
|
}
|
|
551
551
|
function le(e) {
|
|
552
|
-
if (!
|
|
552
|
+
if (!tn(e) || Object.prototype.toString.call(e) !== "[object Object]")
|
|
553
553
|
return !1;
|
|
554
554
|
if (Object.getPrototypeOf(e) === null)
|
|
555
555
|
return !0;
|
|
@@ -558,14 +558,14 @@ function le(e) {
|
|
|
558
558
|
t = Object.getPrototypeOf(t);
|
|
559
559
|
return Object.getPrototypeOf(e) === t;
|
|
560
560
|
}
|
|
561
|
-
const
|
|
561
|
+
const nn = (e, t) => {
|
|
562
562
|
if (e.startsWith("RS") || e.startsWith("PS")) {
|
|
563
563
|
const { modulusLength: n } = t.algorithm;
|
|
564
564
|
if (typeof n != "number" || n < 2048)
|
|
565
565
|
throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
|
|
566
566
|
}
|
|
567
567
|
};
|
|
568
|
-
function
|
|
568
|
+
function rn(e) {
|
|
569
569
|
let t, n;
|
|
570
570
|
switch (e.kty) {
|
|
571
571
|
case "RSA": {
|
|
@@ -637,36 +637,36 @@ function en(e) {
|
|
|
637
637
|
}
|
|
638
638
|
return { algorithm: t, keyUsages: n };
|
|
639
639
|
}
|
|
640
|
-
const
|
|
640
|
+
const an = async (e) => {
|
|
641
641
|
if (!e.alg)
|
|
642
642
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
643
|
-
const { algorithm: t, keyUsages: n } =
|
|
643
|
+
const { algorithm: t, keyUsages: n } = rn(e), r = [
|
|
644
644
|
t,
|
|
645
645
|
e.ext ?? !1,
|
|
646
646
|
e.key_ops ?? n
|
|
647
647
|
], a = { ...e };
|
|
648
648
|
return delete a.alg, delete a.use, pe.subtle.importKey("jwk", a, ...r);
|
|
649
649
|
}, tt = (e) => B(e);
|
|
650
|
-
let
|
|
650
|
+
let Ee, we;
|
|
651
651
|
const nt = (e) => e?.[Symbol.toStringTag] === "KeyObject", rt = async (e, t, n, r) => {
|
|
652
652
|
let a = e.get(t);
|
|
653
653
|
if (a != null && a[r])
|
|
654
654
|
return a[r];
|
|
655
|
-
const s = await
|
|
655
|
+
const s = await an({ ...n, alg: r });
|
|
656
656
|
return a ? a[r] = s : e.set(t, { [r]: s }), s;
|
|
657
|
-
},
|
|
657
|
+
}, on = (e, t) => {
|
|
658
658
|
if (nt(e)) {
|
|
659
659
|
let n = e.export({ format: "jwk" });
|
|
660
|
-
return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? tt(n.k) : (
|
|
660
|
+
return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? tt(n.k) : (we || (we = /* @__PURE__ */ new WeakMap()), rt(we, e, n, t));
|
|
661
661
|
}
|
|
662
662
|
return e;
|
|
663
|
-
},
|
|
663
|
+
}, sn = (e, t) => {
|
|
664
664
|
if (nt(e)) {
|
|
665
665
|
let n = e.export({ format: "jwk" });
|
|
666
|
-
return n.k ? tt(n.k) : (
|
|
666
|
+
return n.k ? tt(n.k) : (Ee || (Ee = /* @__PURE__ */ new WeakMap()), rt(Ee, e, n, t));
|
|
667
667
|
}
|
|
668
668
|
return e;
|
|
669
|
-
},
|
|
669
|
+
}, cn = { normalizePublicKey: on, normalizePrivateKey: sn }, O = (e, t, n = 0) => {
|
|
670
670
|
n === 0 && (t.unshift(t.length), t.unshift(6));
|
|
671
671
|
const r = e.indexOf(t[0], n);
|
|
672
672
|
if (r === -1)
|
|
@@ -692,7 +692,7 @@ const nt = (e) => e?.[Symbol.toStringTag] === "KeyObject", rt = async (e, t, n,
|
|
|
692
692
|
default:
|
|
693
693
|
throw new N("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
|
|
694
694
|
}
|
|
695
|
-
},
|
|
695
|
+
}, un = async (e, t, n, r, a) => {
|
|
696
696
|
let s, o;
|
|
697
697
|
const i = new Uint8Array(atob(n.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
|
|
698
698
|
switch (r) {
|
|
@@ -739,20 +739,20 @@ const nt = (e) => e?.[Symbol.toStringTag] === "KeyObject", rt = async (e, t, n,
|
|
|
739
739
|
throw new N('Invalid or unsupported "alg" (Algorithm) value');
|
|
740
740
|
}
|
|
741
741
|
return pe.subtle.importKey(t, i, s, !1, o);
|
|
742
|
-
},
|
|
743
|
-
async function
|
|
742
|
+
}, ln = (e, t, n) => un(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
|
|
743
|
+
async function dn(e, t, n) {
|
|
744
744
|
if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
745
745
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
746
|
-
return
|
|
746
|
+
return ln(e, t);
|
|
747
747
|
}
|
|
748
|
-
const ie = (e) => e?.[Symbol.toStringTag],
|
|
748
|
+
const ie = (e) => e?.[Symbol.toStringTag], hn = (e, t) => {
|
|
749
749
|
if (!(t instanceof Uint8Array)) {
|
|
750
750
|
if (!et(t))
|
|
751
751
|
throw new TypeError(Ze(e, t, ...ue, "Uint8Array"));
|
|
752
752
|
if (t.type !== "secret")
|
|
753
753
|
throw new TypeError(`${ie(t)} instances for symmetric algorithms must be of type "secret"`);
|
|
754
754
|
}
|
|
755
|
-
},
|
|
755
|
+
}, pn = (e, t, n) => {
|
|
756
756
|
if (!et(t))
|
|
757
757
|
throw new TypeError(Ze(e, t, ...ue));
|
|
758
758
|
if (t.type === "secret")
|
|
@@ -761,10 +761,10 @@ const ie = (e) => e?.[Symbol.toStringTag], un = (e, t) => {
|
|
|
761
761
|
throw new TypeError(`${ie(t)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
762
762
|
if (t.algorithm && n === "encrypt" && t.type === "private")
|
|
763
763
|
throw new TypeError(`${ie(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
764
|
-
},
|
|
765
|
-
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ?
|
|
764
|
+
}, fn = (e, t, n) => {
|
|
765
|
+
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? hn(e, t) : pn(e, t, n);
|
|
766
766
|
};
|
|
767
|
-
function
|
|
767
|
+
function yn(e, t, n, r, a) {
|
|
768
768
|
if (a.crit !== void 0 && r?.crit === void 0)
|
|
769
769
|
throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
770
770
|
if (!r || r.crit === void 0)
|
|
@@ -783,13 +783,13 @@ function hn(e, t, n, r, a) {
|
|
|
783
783
|
}
|
|
784
784
|
return new Set(r.crit);
|
|
785
785
|
}
|
|
786
|
-
const
|
|
786
|
+
const gn = (e, t) => {
|
|
787
787
|
if (t !== void 0 && (!Array.isArray(t) || t.some((n) => typeof n != "string")))
|
|
788
788
|
throw new TypeError(`"${e}" option must be an array of strings`);
|
|
789
789
|
if (t)
|
|
790
790
|
return new Set(t);
|
|
791
791
|
};
|
|
792
|
-
function
|
|
792
|
+
function mn(e, t) {
|
|
793
793
|
const n = `SHA-${e.slice(-3)}`;
|
|
794
794
|
switch (e) {
|
|
795
795
|
case "HS256":
|
|
@@ -814,9 +814,9 @@ function fn(e, t) {
|
|
|
814
814
|
throw new N(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
async function
|
|
818
|
-
if (t = await
|
|
819
|
-
return
|
|
817
|
+
async function En(e, t, n) {
|
|
818
|
+
if (t = await cn.normalizePublicKey(t, e), Qe(t))
|
|
819
|
+
return Zt(t, e, n), t;
|
|
820
820
|
if (t instanceof Uint8Array) {
|
|
821
821
|
if (!e.startsWith("HS"))
|
|
822
822
|
throw new TypeError(De(t, ...ue));
|
|
@@ -824,17 +824,17 @@ async function yn(e, t, n) {
|
|
|
824
824
|
}
|
|
825
825
|
throw new TypeError(De(t, ...ue, "Uint8Array"));
|
|
826
826
|
}
|
|
827
|
-
const
|
|
828
|
-
const a = await
|
|
829
|
-
|
|
830
|
-
const s =
|
|
827
|
+
const wn = async (e, t, n, r) => {
|
|
828
|
+
const a = await En(e, t, "verify");
|
|
829
|
+
nn(e, a);
|
|
830
|
+
const s = mn(e, a.algorithm);
|
|
831
831
|
try {
|
|
832
832
|
return await pe.subtle.verify(s, a, n, r);
|
|
833
833
|
} catch {
|
|
834
834
|
return !1;
|
|
835
835
|
}
|
|
836
836
|
};
|
|
837
|
-
async function
|
|
837
|
+
async function Sn(e, t, n) {
|
|
838
838
|
if (!le(e))
|
|
839
839
|
throw new A("Flattened JWS must be an object");
|
|
840
840
|
if (e.protected === void 0 && e.header === void 0)
|
|
@@ -855,37 +855,37 @@ async function mn(e, t, n) {
|
|
|
855
855
|
} catch {
|
|
856
856
|
throw new A("JWS Protected Header is invalid");
|
|
857
857
|
}
|
|
858
|
-
if (!
|
|
858
|
+
if (!en(r, e.header))
|
|
859
859
|
throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
860
860
|
const a = {
|
|
861
861
|
...r,
|
|
862
862
|
...e.header
|
|
863
|
-
}, s =
|
|
863
|
+
}, s = yn(A, /* @__PURE__ */ new Map([["b64", !0]]), n?.crit, r, a);
|
|
864
864
|
let o = !0;
|
|
865
865
|
if (s.has("b64") && (o = r.b64, typeof o != "boolean"))
|
|
866
866
|
throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
867
867
|
const { alg: i } = a;
|
|
868
868
|
if (typeof i != "string" || !i)
|
|
869
869
|
throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
870
|
-
const c = n &&
|
|
870
|
+
const c = n && gn("algorithms", n.algorithms);
|
|
871
871
|
if (c && !c.has(i))
|
|
872
|
-
throw new
|
|
872
|
+
throw new qt('"alg" (Algorithm) Header Parameter value not allowed');
|
|
873
873
|
if (o) {
|
|
874
874
|
if (typeof e.payload != "string")
|
|
875
875
|
throw new A("JWS Payload must be a string");
|
|
876
876
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
877
877
|
throw new A("JWS Payload must be a string or an Uint8Array instance");
|
|
878
878
|
let y = !1;
|
|
879
|
-
typeof t == "function" && (t = await t(r, e), y = !0),
|
|
880
|
-
const l =
|
|
879
|
+
typeof t == "function" && (t = await t(r, e), y = !0), fn(i, t, "verify");
|
|
880
|
+
const l = Ft(Z.encode(e.protected ?? ""), Z.encode("."), typeof e.payload == "string" ? Z.encode(e.payload) : e.payload);
|
|
881
881
|
let h;
|
|
882
882
|
try {
|
|
883
883
|
h = B(e.signature);
|
|
884
884
|
} catch {
|
|
885
885
|
throw new A("Failed to base64url decode the signature");
|
|
886
886
|
}
|
|
887
|
-
if (!await
|
|
888
|
-
throw new
|
|
887
|
+
if (!await wn(i, t, h, l))
|
|
888
|
+
throw new zt();
|
|
889
889
|
let g;
|
|
890
890
|
if (o)
|
|
891
891
|
try {
|
|
@@ -897,17 +897,17 @@ async function mn(e, t, n) {
|
|
|
897
897
|
const f = { payload: g };
|
|
898
898
|
return e.protected !== void 0 && (f.protectedHeader = r), e.header !== void 0 && (f.unprotectedHeader = e.header), y ? { ...f, key: t } : f;
|
|
899
899
|
}
|
|
900
|
-
async function
|
|
900
|
+
async function An(e, t, n) {
|
|
901
901
|
if (e instanceof Uint8Array && (e = q.decode(e)), typeof e != "string")
|
|
902
902
|
throw new A("Compact JWS must be a string or Uint8Array");
|
|
903
903
|
const { 0: r, 1: a, 2: s, length: o } = e.split(".");
|
|
904
904
|
if (o !== 3)
|
|
905
905
|
throw new A("Invalid Compact JWS");
|
|
906
|
-
const i = await
|
|
906
|
+
const i = await Sn({ payload: a, protected: r, signature: s }, t, n), c = { payload: i.payload, protectedHeader: i.protectedHeader };
|
|
907
907
|
return typeof t == "function" ? { ...c, key: i.key } : c;
|
|
908
908
|
}
|
|
909
|
-
const
|
|
910
|
-
const t =
|
|
909
|
+
const Tn = (e) => Math.floor(e.getTime() / 1e3), at = 60, ot = at * 60, Ie = ot * 24, Rn = Ie * 7, bn = Ie * 365.25, In = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, $e = (e) => {
|
|
910
|
+
const t = In.exec(e);
|
|
911
911
|
if (!t || t[4] && t[1])
|
|
912
912
|
throw new TypeError("Invalid time period format");
|
|
913
913
|
const n = parseFloat(t[2]), r = t[3].toLowerCase();
|
|
@@ -942,14 +942,14 @@ const En = (e) => Math.floor(e.getTime() / 1e3), at = 60, ot = at * 60, Ie = ot
|
|
|
942
942
|
case "week":
|
|
943
943
|
case "weeks":
|
|
944
944
|
case "w":
|
|
945
|
-
a = Math.round(n *
|
|
945
|
+
a = Math.round(n * Rn);
|
|
946
946
|
break;
|
|
947
947
|
default:
|
|
948
|
-
a = Math.round(n *
|
|
948
|
+
a = Math.round(n * bn);
|
|
949
949
|
break;
|
|
950
950
|
}
|
|
951
951
|
return t[1] === "-" || t[4] === "ago" ? -a : a;
|
|
952
|
-
}, Ke = (e) => e.toLowerCase().replace(/^application\//, ""),
|
|
952
|
+
}, Ke = (e) => e.toLowerCase().replace(/^application\//, ""), _n = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, vn = (e, t, n = {}) => {
|
|
953
953
|
let r;
|
|
954
954
|
try {
|
|
955
955
|
r = JSON.parse(q.decode(t));
|
|
@@ -969,7 +969,7 @@ const En = (e) => Math.floor(e.getTime() / 1e3), at = 60, ot = at * 60, Ie = ot
|
|
|
969
969
|
throw new _('unexpected "iss" claim value', r, "iss", "check_failed");
|
|
970
970
|
if (i && r.sub !== i)
|
|
971
971
|
throw new _('unexpected "sub" claim value', r, "sub", "check_failed");
|
|
972
|
-
if (c && !
|
|
972
|
+
if (c && !_n(r.aud, typeof c == "string" ? [c] : c))
|
|
973
973
|
throw new _('unexpected "aud" claim value', r, "aud", "check_failed");
|
|
974
974
|
let h;
|
|
975
975
|
switch (typeof n.clockTolerance) {
|
|
@@ -985,7 +985,7 @@ const En = (e) => Math.floor(e.getTime() / 1e3), at = 60, ot = at * 60, Ie = ot
|
|
|
985
985
|
default:
|
|
986
986
|
throw new TypeError("Invalid clockTolerance option type");
|
|
987
987
|
}
|
|
988
|
-
const { currentDate: g } = n, f =
|
|
988
|
+
const { currentDate: g } = n, f = Tn(g || /* @__PURE__ */ new Date());
|
|
989
989
|
if ((r.iat !== void 0 || y) && typeof r.iat != "number")
|
|
990
990
|
throw new _('"iat" claim must be a number', r, "iat", "invalid");
|
|
991
991
|
if (r.nbf !== void 0) {
|
|
@@ -1009,16 +1009,16 @@ const En = (e) => Math.floor(e.getTime() / 1e3), at = 60, ot = at * 60, Ie = ot
|
|
|
1009
1009
|
}
|
|
1010
1010
|
return r;
|
|
1011
1011
|
};
|
|
1012
|
-
async function
|
|
1012
|
+
async function Cn(e, t, n) {
|
|
1013
1013
|
var r;
|
|
1014
|
-
const a = await
|
|
1014
|
+
const a = await An(e, t, n);
|
|
1015
1015
|
if ((r = a.protectedHeader.crit) != null && r.includes("b64") && a.protectedHeader.b64 === !1)
|
|
1016
1016
|
throw new k("JWTs MUST NOT use unencoded payload");
|
|
1017
|
-
const s = { payload:
|
|
1017
|
+
const s = { payload: vn(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
|
|
1018
1018
|
return typeof t == "function" ? { ...s, key: a.key } : s;
|
|
1019
1019
|
}
|
|
1020
|
-
const
|
|
1021
|
-
function
|
|
1020
|
+
const Pn = B;
|
|
1021
|
+
function kn(e) {
|
|
1022
1022
|
if (typeof e != "string")
|
|
1023
1023
|
throw new k("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
1024
1024
|
const { 1: t, length: n } = e.split(".");
|
|
@@ -1030,7 +1030,7 @@ function vn(e) {
|
|
|
1030
1030
|
throw new k("JWTs must contain a payload");
|
|
1031
1031
|
let r;
|
|
1032
1032
|
try {
|
|
1033
|
-
r =
|
|
1033
|
+
r = Pn(t);
|
|
1034
1034
|
} catch {
|
|
1035
1035
|
throw new k("Failed to base64url decode the payload");
|
|
1036
1036
|
}
|
|
@@ -1046,62 +1046,62 @@ function vn(e) {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
const J = async (e) => {
|
|
1048
1048
|
try {
|
|
1049
|
-
const t = T.ALG, n = await
|
|
1050
|
-
return await
|
|
1049
|
+
const t = T.ALG, n = await dn(jt, t);
|
|
1050
|
+
return await Cn(e, n, {
|
|
1051
1051
|
issuer: T.ISSUER
|
|
1052
1052
|
});
|
|
1053
1053
|
} catch {
|
|
1054
1054
|
return;
|
|
1055
1055
|
}
|
|
1056
|
-
},
|
|
1056
|
+
}, On = (e) => {
|
|
1057
1057
|
try {
|
|
1058
|
-
return
|
|
1058
|
+
return kn(e);
|
|
1059
1059
|
} catch {
|
|
1060
1060
|
return;
|
|
1061
1061
|
}
|
|
1062
1062
|
};
|
|
1063
|
-
var
|
|
1063
|
+
var w = [];
|
|
1064
1064
|
for (var Se = 0; Se < 256; ++Se)
|
|
1065
|
-
|
|
1066
|
-
function
|
|
1067
|
-
return (
|
|
1065
|
+
w.push((Se + 256).toString(16).slice(1));
|
|
1066
|
+
function Nn(e, t = 0) {
|
|
1067
|
+
return (w[e[t + 0]] + w[e[t + 1]] + w[e[t + 2]] + w[e[t + 3]] + "-" + w[e[t + 4]] + w[e[t + 5]] + "-" + w[e[t + 6]] + w[e[t + 7]] + "-" + w[e[t + 8]] + w[e[t + 9]] + "-" + w[e[t + 10]] + w[e[t + 11]] + w[e[t + 12]] + w[e[t + 13]] + w[e[t + 14]] + w[e[t + 15]]).toLowerCase();
|
|
1068
1068
|
}
|
|
1069
|
-
var te,
|
|
1070
|
-
function
|
|
1069
|
+
var te, Dn = new Uint8Array(16);
|
|
1070
|
+
function Un() {
|
|
1071
1071
|
if (!te && (te = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !te))
|
|
1072
1072
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1073
|
-
return te(
|
|
1073
|
+
return te(Dn);
|
|
1074
1074
|
}
|
|
1075
|
-
var
|
|
1075
|
+
var $n = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1076
1076
|
const He = {
|
|
1077
|
-
randomUUID:
|
|
1077
|
+
randomUUID: $n
|
|
1078
1078
|
};
|
|
1079
1079
|
function Le(e, t, n) {
|
|
1080
1080
|
if (He.randomUUID && !t && !e)
|
|
1081
1081
|
return He.randomUUID();
|
|
1082
1082
|
e = e || {};
|
|
1083
|
-
var r = e.random || (e.rng ||
|
|
1084
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1083
|
+
var r = e.random || (e.rng || Un)();
|
|
1084
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Nn(r);
|
|
1085
1085
|
}
|
|
1086
|
-
const We = globalThis.crypto,
|
|
1086
|
+
const We = globalThis.crypto, Kn = (e) => `${Le()}${Le()}`.slice(0, e), Hn = (e) => btoa(
|
|
1087
1087
|
[...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
|
|
1088
1088
|
);
|
|
1089
|
-
async function
|
|
1089
|
+
async function Ln(e) {
|
|
1090
1090
|
if (!We.subtle)
|
|
1091
1091
|
throw new Error(
|
|
1092
1092
|
"crypto.subtle is available only in secure contexts (HTTPS)."
|
|
1093
1093
|
);
|
|
1094
1094
|
const t = new TextEncoder().encode(e), n = await We.subtle.digest("SHA-256", t);
|
|
1095
|
-
return
|
|
1095
|
+
return Hn(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1096
1096
|
}
|
|
1097
|
-
async function
|
|
1098
|
-
const n =
|
|
1097
|
+
async function Wn(e) {
|
|
1098
|
+
const n = Kn(43), r = await Ln(n);
|
|
1099
1099
|
return {
|
|
1100
1100
|
code_verifier: n,
|
|
1101
1101
|
code_challenge: r
|
|
1102
1102
|
};
|
|
1103
1103
|
}
|
|
1104
|
-
const
|
|
1104
|
+
const Hr = async (e, t) => {
|
|
1105
1105
|
var n;
|
|
1106
1106
|
const r = await J(e);
|
|
1107
1107
|
if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[T.SCOPES_KEY]))
|
|
@@ -1119,18 +1119,18 @@ const xe = (e, t) => {
|
|
|
1119
1119
|
typeof t == "function" ? t() : t
|
|
1120
1120
|
);
|
|
1121
1121
|
window.localStorage.setItem(e, n), st(e, n);
|
|
1122
|
-
},
|
|
1122
|
+
}, xn = (e) => {
|
|
1123
1123
|
window.localStorage.removeItem(e), st(e, null);
|
|
1124
|
-
}, Me = (e) => window.localStorage.getItem(e),
|
|
1124
|
+
}, Me = (e) => window.localStorage.getItem(e), Mn = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
|
|
1125
1125
|
function ne({
|
|
1126
1126
|
key: e,
|
|
1127
1127
|
initialValue: t
|
|
1128
1128
|
}) {
|
|
1129
|
-
const n =
|
|
1129
|
+
const n = $t(Mn, () => Me(e)), r = U(
|
|
1130
1130
|
(o) => {
|
|
1131
1131
|
try {
|
|
1132
1132
|
const i = typeof o == "function" ? o(JSON.parse(n)) : o;
|
|
1133
|
-
i == null ?
|
|
1133
|
+
i == null ? xn(e) : xe(e, i);
|
|
1134
1134
|
} catch (i) {
|
|
1135
1135
|
console.warn(i);
|
|
1136
1136
|
}
|
|
@@ -1152,30 +1152,108 @@ function ne({
|
|
|
1152
1152
|
var S = [];
|
|
1153
1153
|
for (var Ae = 0; Ae < 256; ++Ae)
|
|
1154
1154
|
S.push((Ae + 256).toString(16).slice(1));
|
|
1155
|
-
function
|
|
1155
|
+
function Gn(e, t = 0) {
|
|
1156
1156
|
return (S[e[t + 0]] + S[e[t + 1]] + S[e[t + 2]] + S[e[t + 3]] + "-" + S[e[t + 4]] + S[e[t + 5]] + "-" + S[e[t + 6]] + S[e[t + 7]] + "-" + S[e[t + 8]] + S[e[t + 9]] + "-" + S[e[t + 10]] + S[e[t + 11]] + S[e[t + 12]] + S[e[t + 13]] + S[e[t + 14]] + S[e[t + 15]]).toLowerCase();
|
|
1157
1157
|
}
|
|
1158
|
-
var re,
|
|
1159
|
-
function
|
|
1158
|
+
var re, Jn = new Uint8Array(16);
|
|
1159
|
+
function Yn() {
|
|
1160
1160
|
if (!re && (re = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !re))
|
|
1161
1161
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1162
|
-
return re(
|
|
1162
|
+
return re(Jn);
|
|
1163
1163
|
}
|
|
1164
|
-
var
|
|
1164
|
+
var Vn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1165
1165
|
const Ge = {
|
|
1166
|
-
randomUUID:
|
|
1166
|
+
randomUUID: Vn
|
|
1167
1167
|
};
|
|
1168
1168
|
function Te(e, t, n) {
|
|
1169
1169
|
if (Ge.randomUUID && !t && !e)
|
|
1170
1170
|
return Ge.randomUUID();
|
|
1171
1171
|
e = e || {};
|
|
1172
|
-
var r = e.random || (e.rng ||
|
|
1173
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1172
|
+
var r = e.random || (e.rng || Yn)();
|
|
1173
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Gn(r);
|
|
1174
1174
|
}
|
|
1175
|
-
const H = "
|
|
1175
|
+
const H = "Your session has expired. For your security, please log in again to continue.", jn = "Your session has been successfully terminated.", ae = "Login failed. Please try again.", Fn = "Error getting access token, please re-authenticate.", Bn = "You forgot to wrap your component in <AuthProvider>.", de = {
|
|
1176
1176
|
dev: "https://auth.gizmette.local.com:3003",
|
|
1177
1177
|
prod: "https://mylogin.gizmette.com/auth"
|
|
1178
|
-
}, oe = "@@auth@@", j = "LOADING", F = "LOGIN", it = "LOGOUT", fe = "success", C = "failure"
|
|
1178
|
+
}, oe = "@@auth@@", j = "LOADING", F = "LOGIN", it = "LOGOUT", fe = "success", C = "failure", ct = "include", ut = "POST", lt = "application/json", se = {
|
|
1179
|
+
GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
|
|
1180
|
+
$clientId: String!,
|
|
1181
|
+
$username: String!,
|
|
1182
|
+
$id: String!) {
|
|
1183
|
+
getPasskeyRegistrationOptions(clientId: $clientId, username: $username, id: $id) {
|
|
1184
|
+
challenge
|
|
1185
|
+
rp {
|
|
1186
|
+
id
|
|
1187
|
+
name
|
|
1188
|
+
}
|
|
1189
|
+
user {
|
|
1190
|
+
id
|
|
1191
|
+
name
|
|
1192
|
+
displayName
|
|
1193
|
+
}
|
|
1194
|
+
pubKeyCredParams {
|
|
1195
|
+
type
|
|
1196
|
+
alg
|
|
1197
|
+
}
|
|
1198
|
+
timeout
|
|
1199
|
+
attestation
|
|
1200
|
+
}
|
|
1201
|
+
}`,
|
|
1202
|
+
VERIFY_REGISTRATION: `mutation VerifyPasskeyRegistration(
|
|
1203
|
+
$clientId: String!,
|
|
1204
|
+
$username: String!,
|
|
1205
|
+
$id: String!,
|
|
1206
|
+
$registration: RegistrationOptionsInput!) {
|
|
1207
|
+
verifyPasskeyRegistration(
|
|
1208
|
+
clientId: $clientId,
|
|
1209
|
+
username: $username,
|
|
1210
|
+
id: $id,
|
|
1211
|
+
registration: $registration) {
|
|
1212
|
+
status
|
|
1213
|
+
message
|
|
1214
|
+
}
|
|
1215
|
+
}`,
|
|
1216
|
+
GET_AUTHENTICATION_OPTIONS: `mutation GetPasskeyAuthenticationOptions(
|
|
1217
|
+
$id: String!,
|
|
1218
|
+
$clientId: String!,
|
|
1219
|
+
) {
|
|
1220
|
+
getPasskeyAuthenticationOptions(
|
|
1221
|
+
id: $id,
|
|
1222
|
+
clientId: $clientId) {
|
|
1223
|
+
rpId,
|
|
1224
|
+
challenge,
|
|
1225
|
+
allowCredentials {
|
|
1226
|
+
id,
|
|
1227
|
+
type,
|
|
1228
|
+
transports
|
|
1229
|
+
}
|
|
1230
|
+
timeout,
|
|
1231
|
+
userVerification,
|
|
1232
|
+
}
|
|
1233
|
+
}`,
|
|
1234
|
+
VERIFY_AUTHENTICATION: `mutation VerifyPasskeyAuthentication(
|
|
1235
|
+
$clientId: String!,
|
|
1236
|
+
$id: String!,
|
|
1237
|
+
$authentication: AuthenticationOptionsInput!,
|
|
1238
|
+
$nonce: String!,
|
|
1239
|
+
$domain: String,
|
|
1240
|
+
$fingerprint: String) {
|
|
1241
|
+
verifyPasskeyAuthentication(
|
|
1242
|
+
clientId: $clientId,
|
|
1243
|
+
id: $id,
|
|
1244
|
+
authentication: $authentication,
|
|
1245
|
+
nonce: $nonce,
|
|
1246
|
+
domain: $domain,
|
|
1247
|
+
fingerprint: $fingerprint) {
|
|
1248
|
+
status,
|
|
1249
|
+
idToken,
|
|
1250
|
+
accessToken,
|
|
1251
|
+
refreshToken,
|
|
1252
|
+
userId,
|
|
1253
|
+
username,
|
|
1254
|
+
}
|
|
1255
|
+
}`
|
|
1256
|
+
};
|
|
1179
1257
|
/*!
|
|
1180
1258
|
@versini/ui-fingerprint v1.0.1
|
|
1181
1259
|
© 2024 gizmette.com
|
|
@@ -1189,7 +1267,7 @@ try {
|
|
|
1189
1267
|
});
|
|
1190
1268
|
} catch {
|
|
1191
1269
|
}
|
|
1192
|
-
const
|
|
1270
|
+
const qn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), dt = async (e) => {
|
|
1193
1271
|
if (e === "")
|
|
1194
1272
|
return "";
|
|
1195
1273
|
const t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
@@ -1198,7 +1276,7 @@ const jn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join
|
|
|
1198
1276
|
function Je(e, t) {
|
|
1199
1277
|
return new Promise((n) => setTimeout(n, e, t));
|
|
1200
1278
|
}
|
|
1201
|
-
async function
|
|
1279
|
+
async function zn(e, t, n = 50) {
|
|
1202
1280
|
var r, a, s;
|
|
1203
1281
|
const o = document;
|
|
1204
1282
|
for (; !o.body; )
|
|
@@ -1227,14 +1305,14 @@ async function Fn(e, t, n = 50) {
|
|
|
1227
1305
|
(s = i.parentNode) == null || s.removeChild(i);
|
|
1228
1306
|
}
|
|
1229
1307
|
}
|
|
1230
|
-
const
|
|
1308
|
+
const Qn = {
|
|
1231
1309
|
audio: {
|
|
1232
1310
|
sampleHash: "",
|
|
1233
1311
|
oscillator: "",
|
|
1234
1312
|
maxChannels: 0,
|
|
1235
1313
|
channelCountMode: ""
|
|
1236
1314
|
}
|
|
1237
|
-
},
|
|
1315
|
+
}, Xn = async (e) => new Promise((t) => {
|
|
1238
1316
|
try {
|
|
1239
1317
|
const n = new window.OfflineAudioContext(1, 5e3, 44100), r = n.createBufferSource(), a = n.createOscillator();
|
|
1240
1318
|
a.frequency.value = 1e3;
|
|
@@ -1243,7 +1321,7 @@ const Bn = {
|
|
|
1243
1321
|
const i = o.renderedBuffer.getChannelData(0);
|
|
1244
1322
|
a.disconnect(), s.disconnect(), t({
|
|
1245
1323
|
audio: {
|
|
1246
|
-
sampleHash:
|
|
1324
|
+
sampleHash: qn(i),
|
|
1247
1325
|
oscillator: a.type,
|
|
1248
1326
|
maxChannels: n.destination.maxChannelCount,
|
|
1249
1327
|
channelCountMode: r.channelCountMode
|
|
@@ -1260,25 +1338,25 @@ const Bn = {
|
|
|
1260
1338
|
}
|
|
1261
1339
|
});
|
|
1262
1340
|
}
|
|
1263
|
-
}),
|
|
1341
|
+
}), ht = { browser: "" }, Zn = async (e) => typeof navigator > "u" ? ht : { browser: navigator.userAgent }, pt = {
|
|
1264
1342
|
canvas: {
|
|
1265
1343
|
data: ""
|
|
1266
1344
|
}
|
|
1267
|
-
},
|
|
1345
|
+
}, er = async (e) => {
|
|
1268
1346
|
try {
|
|
1269
1347
|
const t = Array.from(
|
|
1270
1348
|
{ length: 3 },
|
|
1271
|
-
() =>
|
|
1272
|
-
), n =
|
|
1349
|
+
() => tr(300, 30)
|
|
1350
|
+
), n = rr(t, 300, 30);
|
|
1273
1351
|
return {
|
|
1274
1352
|
canvas: {
|
|
1275
|
-
data: (await
|
|
1353
|
+
data: (await dt(n.data.toString())).toString()
|
|
1276
1354
|
}
|
|
1277
1355
|
};
|
|
1278
1356
|
} catch {
|
|
1279
|
-
return
|
|
1357
|
+
return pt;
|
|
1280
1358
|
}
|
|
1281
|
-
},
|
|
1359
|
+
}, tr = (e, t) => {
|
|
1282
1360
|
const n = document.createElement("canvas"), r = n.getContext("2d");
|
|
1283
1361
|
if (!r)
|
|
1284
1362
|
return new ImageData(1, 1);
|
|
@@ -1287,7 +1365,7 @@ const Bn = {
|
|
|
1287
1365
|
a.addColorStop(0, "red"), a.addColorStop(1 / 6, "orange"), a.addColorStop(2 / 6, "yellow"), a.addColorStop(3 / 6, "green"), a.addColorStop(4 / 6, "blue"), a.addColorStop(5 / 6, "indigo"), a.addColorStop(1, "violet"), r.fillStyle = a, r.fillRect(0, 0, n.width, n.height);
|
|
1288
1366
|
const s = "mmMwWLliI0O&1 - Les sanglots longs des violons de l'automne blessent mon coeur d'une langueur monotone";
|
|
1289
1367
|
return r.font = "26.321px Arial", r.fillStyle = "black", r.fillText(s, -5, 15), r.fillStyle = "rgba(0, 0, 255, 0.5)", r.fillText(s, -3.3, 17.7), r.beginPath(), r.moveTo(0, 0), r.lineTo(n.width * 2 / 7, n.height), r.strokeStyle = "white", r.lineWidth = 2, r.stroke(), r.getImageData(0, 0, n.width, n.height);
|
|
1290
|
-
},
|
|
1368
|
+
}, nr = (e) => {
|
|
1291
1369
|
if (e.length === 0)
|
|
1292
1370
|
return 0;
|
|
1293
1371
|
const t = {};
|
|
@@ -1297,17 +1375,17 @@ const Bn = {
|
|
|
1297
1375
|
for (const r in t)
|
|
1298
1376
|
t[r] > t[n] && (n = parseInt(r, 10));
|
|
1299
1377
|
return n;
|
|
1300
|
-
},
|
|
1378
|
+
}, rr = (e, t, n) => {
|
|
1301
1379
|
const r = [];
|
|
1302
1380
|
for (let o = 0; o < e[0].data.length; o++) {
|
|
1303
1381
|
const i = [];
|
|
1304
1382
|
for (let c = 0; c < e.length; c++)
|
|
1305
1383
|
i.push(e[c].data[o]);
|
|
1306
|
-
r.push(
|
|
1384
|
+
r.push(nr(i));
|
|
1307
1385
|
}
|
|
1308
1386
|
const a = r, s = new Uint8ClampedArray(a);
|
|
1309
1387
|
return new ImageData(s, t, n);
|
|
1310
|
-
},
|
|
1388
|
+
}, ar = [], or = "mmMwWLliI0O&1", sr = "48px", L = ["monospace", "sans-serif", "serif"], Ye = [
|
|
1311
1389
|
"sans-serif-thin",
|
|
1312
1390
|
"ARNO PRO",
|
|
1313
1391
|
"Agency FB",
|
|
@@ -1345,14 +1423,14 @@ const Bn = {
|
|
|
1345
1423
|
"TRAJAN PRO",
|
|
1346
1424
|
"Univers CE 55 Medium",
|
|
1347
1425
|
"ZWAdobeF"
|
|
1348
|
-
],
|
|
1426
|
+
], ir = async (e) => zn(async (t, { document: n }) => {
|
|
1349
1427
|
const r = n.body;
|
|
1350
|
-
r.style.fontSize =
|
|
1428
|
+
r.style.fontSize = sr;
|
|
1351
1429
|
const a = n.createElement("div");
|
|
1352
1430
|
a.style.setProperty("visibility", "hidden", "important");
|
|
1353
1431
|
const s = {}, o = {}, i = (u) => {
|
|
1354
1432
|
const m = n.createElement("span"), { style: R } = m;
|
|
1355
|
-
return R.position = "absolute", R.top = "0", R.left = "0", R.fontFamily = u, m.textContent =
|
|
1433
|
+
return R.position = "absolute", R.top = "0", R.left = "0", R.fontFamily = u, m.textContent = or, a.appendChild(m), m;
|
|
1356
1434
|
}, c = (u, m) => i(`'${u}',${m}`), y = () => L.map(i), l = () => {
|
|
1357
1435
|
const u = {};
|
|
1358
1436
|
for (const m of Ye)
|
|
@@ -1367,22 +1445,22 @@ const Bn = {
|
|
|
1367
1445
|
for (let u = 0; u < L.length; u++)
|
|
1368
1446
|
s[L[u]] = g[u].offsetWidth, o[L[u]] = g[u].offsetHeight;
|
|
1369
1447
|
return Ye.filter((u) => h(f[u]));
|
|
1370
|
-
}),
|
|
1448
|
+
}), ft = {
|
|
1371
1449
|
vendor: "",
|
|
1372
1450
|
vendorUnmasked: "",
|
|
1373
1451
|
renderer: "",
|
|
1374
1452
|
rendererUnmasked: "",
|
|
1375
1453
|
version: "",
|
|
1376
1454
|
shadingLanguageVersion: ""
|
|
1377
|
-
},
|
|
1455
|
+
}, yt = {
|
|
1378
1456
|
hardware: {
|
|
1379
|
-
videocard:
|
|
1457
|
+
videocard: ft,
|
|
1380
1458
|
architecture: 0,
|
|
1381
1459
|
deviceMemory: "undefined",
|
|
1382
1460
|
jsHeapSizeLimit: 0
|
|
1383
1461
|
}
|
|
1384
1462
|
};
|
|
1385
|
-
function
|
|
1463
|
+
function cr() {
|
|
1386
1464
|
const e = document.createElement("canvas"), t = e.getContext("webgl") ?? e.getContext("experimental-webgl");
|
|
1387
1465
|
if (t && "getParameter" in t) {
|
|
1388
1466
|
const n = t.getExtension("WEBGL_debug_renderer_info");
|
|
@@ -1395,41 +1473,41 @@ function or() {
|
|
|
1395
1473
|
shadingLanguageVersion: (t.getParameter(t.SHADING_LANGUAGE_VERSION) || "").toString()
|
|
1396
1474
|
};
|
|
1397
1475
|
}
|
|
1398
|
-
return
|
|
1476
|
+
return ft;
|
|
1399
1477
|
}
|
|
1400
|
-
function
|
|
1478
|
+
function ur() {
|
|
1401
1479
|
const e = new Float32Array(1), t = new Uint8Array(e.buffer);
|
|
1402
1480
|
return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
|
|
1403
1481
|
}
|
|
1404
|
-
const
|
|
1482
|
+
const lr = () => navigator.deviceMemory || 0, dr = () => window.performance && window.performance.memory || {
|
|
1405
1483
|
jsHeapSizeLimit: 0
|
|
1406
|
-
},
|
|
1484
|
+
}, hr = async (e) => new Promise((t) => {
|
|
1407
1485
|
try {
|
|
1408
|
-
const n =
|
|
1486
|
+
const n = lr(), r = dr();
|
|
1409
1487
|
t({
|
|
1410
1488
|
hardware: {
|
|
1411
|
-
videocard:
|
|
1412
|
-
architecture:
|
|
1489
|
+
videocard: cr(),
|
|
1490
|
+
architecture: ur(),
|
|
1413
1491
|
deviceMemory: n.toString() || "undefined",
|
|
1414
1492
|
jsHeapSizeLimit: r.jsHeapSizeLimit || 0
|
|
1415
1493
|
}
|
|
1416
1494
|
});
|
|
1417
1495
|
} catch {
|
|
1418
|
-
t(
|
|
1496
|
+
t(yt);
|
|
1419
1497
|
}
|
|
1420
|
-
}),
|
|
1498
|
+
}), pr = {
|
|
1421
1499
|
locales: {
|
|
1422
1500
|
languages: "",
|
|
1423
1501
|
timezone: ""
|
|
1424
1502
|
}
|
|
1425
|
-
},
|
|
1503
|
+
}, fr = async (e) => new Promise((t) => {
|
|
1426
1504
|
t({
|
|
1427
1505
|
locales: {
|
|
1428
1506
|
languages: navigator.language,
|
|
1429
1507
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
1430
1508
|
}
|
|
1431
1509
|
});
|
|
1432
|
-
}),
|
|
1510
|
+
}), gt = {
|
|
1433
1511
|
screen: {
|
|
1434
1512
|
colorDepth: 0,
|
|
1435
1513
|
pixelDepth: 0,
|
|
@@ -1437,7 +1515,7 @@ const ir = () => navigator.deviceMemory || 0, cr = () => window.performance && w
|
|
|
1437
1515
|
maxTouchPoints: 0,
|
|
1438
1516
|
mediaMatches: []
|
|
1439
1517
|
}
|
|
1440
|
-
},
|
|
1518
|
+
}, yr = async (e) => new Promise((t) => {
|
|
1441
1519
|
try {
|
|
1442
1520
|
const n = window.screen, r = {
|
|
1443
1521
|
screen: {
|
|
@@ -1445,15 +1523,15 @@ const ir = () => navigator.deviceMemory || 0, cr = () => window.performance && w
|
|
|
1445
1523
|
pixelDepth: n.pixelDepth,
|
|
1446
1524
|
isTouchScreen: navigator.maxTouchPoints > 0,
|
|
1447
1525
|
maxTouchPoints: navigator.maxTouchPoints,
|
|
1448
|
-
mediaMatches:
|
|
1526
|
+
mediaMatches: gr()
|
|
1449
1527
|
}
|
|
1450
1528
|
};
|
|
1451
1529
|
t(r);
|
|
1452
1530
|
} catch {
|
|
1453
|
-
t(
|
|
1531
|
+
t(gt);
|
|
1454
1532
|
}
|
|
1455
1533
|
});
|
|
1456
|
-
function
|
|
1534
|
+
function gr() {
|
|
1457
1535
|
const e = [], t = {
|
|
1458
1536
|
"prefers-contrast": [
|
|
1459
1537
|
"high",
|
|
@@ -1481,7 +1559,7 @@ function pr() {
|
|
|
1481
1559
|
});
|
|
1482
1560
|
}), e;
|
|
1483
1561
|
}
|
|
1484
|
-
const
|
|
1562
|
+
const mr = async (e) => {
|
|
1485
1563
|
try {
|
|
1486
1564
|
return {
|
|
1487
1565
|
system: {
|
|
@@ -1492,124 +1570,46 @@ const fr = async (e) => {
|
|
|
1492
1570
|
}
|
|
1493
1571
|
};
|
|
1494
1572
|
} catch {
|
|
1495
|
-
return
|
|
1573
|
+
return mt;
|
|
1496
1574
|
}
|
|
1497
|
-
},
|
|
1575
|
+
}, mt = {
|
|
1498
1576
|
system: {
|
|
1499
1577
|
platform: "",
|
|
1500
1578
|
cookieEnabled: !1,
|
|
1501
1579
|
productSub: "",
|
|
1502
1580
|
product: ""
|
|
1503
1581
|
}
|
|
1504
|
-
},
|
|
1582
|
+
}, Er = async (e) => {
|
|
1505
1583
|
try {
|
|
1506
1584
|
return Promise.all([
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
ur(e),
|
|
1512
|
-
dr(),
|
|
1585
|
+
Xn(e),
|
|
1586
|
+
Zn(),
|
|
1587
|
+
er(e),
|
|
1588
|
+
ir(),
|
|
1513
1589
|
hr(e),
|
|
1514
|
-
fr(
|
|
1590
|
+
fr(),
|
|
1591
|
+
yr(e),
|
|
1592
|
+
mr(e)
|
|
1515
1593
|
]);
|
|
1516
1594
|
} catch {
|
|
1517
1595
|
return [
|
|
1518
|
-
|
|
1519
|
-
ut,
|
|
1520
|
-
lt,
|
|
1521
|
-
tr,
|
|
1596
|
+
Qn,
|
|
1522
1597
|
ht,
|
|
1523
|
-
lr,
|
|
1524
1598
|
pt,
|
|
1525
|
-
|
|
1599
|
+
ar,
|
|
1600
|
+
yt,
|
|
1601
|
+
pr,
|
|
1602
|
+
gt,
|
|
1603
|
+
mt
|
|
1526
1604
|
];
|
|
1527
1605
|
}
|
|
1528
|
-
},
|
|
1606
|
+
}, wr = async (e) => {
|
|
1529
1607
|
try {
|
|
1530
|
-
const t = await
|
|
1531
|
-
return await
|
|
1608
|
+
const t = await Er(e);
|
|
1609
|
+
return await dt(JSON.stringify(t));
|
|
1532
1610
|
} catch {
|
|
1533
1611
|
return "";
|
|
1534
1612
|
}
|
|
1535
|
-
}, se = {
|
|
1536
|
-
GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
|
|
1537
|
-
$clientId: String!,
|
|
1538
|
-
$username: String!,
|
|
1539
|
-
$id: String!) {
|
|
1540
|
-
getPasskeyRegistrationOptions(clientId: $clientId, username: $username, id: $id) {
|
|
1541
|
-
challenge
|
|
1542
|
-
rp {
|
|
1543
|
-
id
|
|
1544
|
-
name
|
|
1545
|
-
}
|
|
1546
|
-
user {
|
|
1547
|
-
id
|
|
1548
|
-
name
|
|
1549
|
-
displayName
|
|
1550
|
-
}
|
|
1551
|
-
pubKeyCredParams {
|
|
1552
|
-
type
|
|
1553
|
-
alg
|
|
1554
|
-
}
|
|
1555
|
-
timeout
|
|
1556
|
-
attestation
|
|
1557
|
-
}
|
|
1558
|
-
}`,
|
|
1559
|
-
VERIFY_REGISTRATION: `mutation VerifyPasskeyRegistration(
|
|
1560
|
-
$clientId: String!,
|
|
1561
|
-
$username: String!,
|
|
1562
|
-
$id: String!,
|
|
1563
|
-
$registration: RegistrationOptionsInput!) {
|
|
1564
|
-
verifyPasskeyRegistration(
|
|
1565
|
-
clientId: $clientId,
|
|
1566
|
-
username: $username,
|
|
1567
|
-
id: $id,
|
|
1568
|
-
registration: $registration) {
|
|
1569
|
-
status
|
|
1570
|
-
message
|
|
1571
|
-
}
|
|
1572
|
-
}`,
|
|
1573
|
-
GET_AUTHENTICATION_OPTIONS: `mutation GetPasskeyAuthenticationOptions(
|
|
1574
|
-
$id: String!,
|
|
1575
|
-
$clientId: String!,
|
|
1576
|
-
) {
|
|
1577
|
-
getPasskeyAuthenticationOptions(
|
|
1578
|
-
id: $id,
|
|
1579
|
-
clientId: $clientId) {
|
|
1580
|
-
rpId,
|
|
1581
|
-
challenge,
|
|
1582
|
-
allowCredentials {
|
|
1583
|
-
id,
|
|
1584
|
-
type,
|
|
1585
|
-
transports
|
|
1586
|
-
}
|
|
1587
|
-
timeout,
|
|
1588
|
-
userVerification,
|
|
1589
|
-
}
|
|
1590
|
-
}`,
|
|
1591
|
-
VERIFY_AUTHENTICATION: `mutation VerifyPasskeyAuthentication(
|
|
1592
|
-
$clientId: String!,
|
|
1593
|
-
$id: String!,
|
|
1594
|
-
$authentication: AuthenticationOptionsInput!,
|
|
1595
|
-
$nonce: String!,
|
|
1596
|
-
$domain: String,
|
|
1597
|
-
$fingerprint: String) {
|
|
1598
|
-
verifyPasskeyAuthentication(
|
|
1599
|
-
clientId: $clientId,
|
|
1600
|
-
id: $id,
|
|
1601
|
-
authentication: $authentication,
|
|
1602
|
-
nonce: $nonce,
|
|
1603
|
-
domain: $domain,
|
|
1604
|
-
fingerprint: $fingerprint) {
|
|
1605
|
-
status,
|
|
1606
|
-
idToken,
|
|
1607
|
-
accessToken,
|
|
1608
|
-
refreshToken,
|
|
1609
|
-
userId,
|
|
1610
|
-
username,
|
|
1611
|
-
}
|
|
1612
|
-
}`
|
|
1613
1613
|
}, W = {
|
|
1614
1614
|
GET_REGISTRATION_OPTIONS: {
|
|
1615
1615
|
schema: se.GET_REGISTRATION_OPTIONS,
|
|
@@ -1634,15 +1634,14 @@ const fr = async (e) => {
|
|
|
1634
1634
|
params: r = {}
|
|
1635
1635
|
}) => {
|
|
1636
1636
|
try {
|
|
1637
|
-
const a =
|
|
1638
|
-
|
|
1637
|
+
const a = r, s = `Bearer ${e}`, o = await fetch(
|
|
1638
|
+
Et ? `${de.dev}/graphql` : `${de.prod}/graphql`,
|
|
1639
1639
|
{
|
|
1640
|
-
|
|
1641
|
-
|
|
1640
|
+
credentials: ct,
|
|
1641
|
+
method: ut,
|
|
1642
1642
|
headers: {
|
|
1643
1643
|
authorization: s,
|
|
1644
|
-
"Content-Type":
|
|
1645
|
-
Accept: "application/json",
|
|
1644
|
+
"Content-Type": lt,
|
|
1646
1645
|
[ze.CLIENT_ID]: `${n}`
|
|
1647
1646
|
},
|
|
1648
1647
|
body: JSON.stringify({
|
|
@@ -1668,12 +1667,12 @@ const fr = async (e) => {
|
|
|
1668
1667
|
}) => {
|
|
1669
1668
|
try {
|
|
1670
1669
|
const r = await fetch(
|
|
1671
|
-
|
|
1670
|
+
Et ? `${de.dev}/${e}` : `${de.prod}/${e}`,
|
|
1672
1671
|
{
|
|
1673
|
-
credentials:
|
|
1674
|
-
method:
|
|
1672
|
+
credentials: ct,
|
|
1673
|
+
method: ut,
|
|
1675
1674
|
headers: {
|
|
1676
|
-
"Content-Type":
|
|
1675
|
+
"Content-Type": lt,
|
|
1677
1676
|
[ze.CLIENT_ID]: `${t}`
|
|
1678
1677
|
},
|
|
1679
1678
|
body: JSON.stringify(n)
|
|
@@ -1689,21 +1688,21 @@ const fr = async (e) => {
|
|
|
1689
1688
|
} catch (r) {
|
|
1690
1689
|
return console.error(r), { status: C, data: [] };
|
|
1691
1690
|
}
|
|
1692
|
-
},
|
|
1691
|
+
}, Sr = process.env.NODE_ENV === "production", Et = !Sr, wt = {
|
|
1693
1692
|
isLoading: !0,
|
|
1694
1693
|
isAuthenticated: !1,
|
|
1695
1694
|
authenticationType: null,
|
|
1696
1695
|
user: void 0,
|
|
1697
1696
|
logoutReason: "",
|
|
1698
1697
|
debug: !1
|
|
1699
|
-
},
|
|
1698
|
+
}, Ar = (e) => {
|
|
1700
1699
|
try {
|
|
1701
|
-
const t =
|
|
1700
|
+
const t = On(e);
|
|
1702
1701
|
return t ? t[T.USER_ID_KEY] : "";
|
|
1703
1702
|
} catch {
|
|
1704
1703
|
return "";
|
|
1705
1704
|
}
|
|
1706
|
-
},
|
|
1705
|
+
}, Tr = async ({
|
|
1707
1706
|
userId: e,
|
|
1708
1707
|
idToken: t,
|
|
1709
1708
|
accessToken: n,
|
|
@@ -1772,7 +1771,7 @@ const fr = async (e) => {
|
|
|
1772
1771
|
status: !1
|
|
1773
1772
|
};
|
|
1774
1773
|
}
|
|
1775
|
-
},
|
|
1774
|
+
}, Rr = async ({
|
|
1776
1775
|
nonce: e,
|
|
1777
1776
|
clientId: t,
|
|
1778
1777
|
code_challenge: n
|
|
@@ -1800,7 +1799,7 @@ const fr = async (e) => {
|
|
|
1800
1799
|
data: ""
|
|
1801
1800
|
};
|
|
1802
1801
|
}
|
|
1803
|
-
},
|
|
1802
|
+
}, br = async ({
|
|
1804
1803
|
clientId: e,
|
|
1805
1804
|
userId: t,
|
|
1806
1805
|
nonce: n,
|
|
@@ -1819,7 +1818,7 @@ const fr = async (e) => {
|
|
|
1819
1818
|
refreshToken: r,
|
|
1820
1819
|
accessToken: a,
|
|
1821
1820
|
domain: s,
|
|
1822
|
-
fingerprint: await
|
|
1821
|
+
fingerprint: await St()
|
|
1823
1822
|
}
|
|
1824
1823
|
}), i = await J(o?.data?.accessToken);
|
|
1825
1824
|
return i && i.payload[T.USER_ID_KEY] !== "" && i.payload[T.NONCE_KEY] === n ? {
|
|
@@ -1835,14 +1834,14 @@ const fr = async (e) => {
|
|
|
1835
1834
|
status: !1
|
|
1836
1835
|
};
|
|
1837
1836
|
}
|
|
1838
|
-
},
|
|
1837
|
+
}, St = async () => {
|
|
1839
1838
|
try {
|
|
1840
|
-
return await
|
|
1839
|
+
return await wr();
|
|
1841
1840
|
} catch {
|
|
1842
1841
|
return "";
|
|
1843
1842
|
}
|
|
1844
1843
|
};
|
|
1845
|
-
class
|
|
1844
|
+
class Ir {
|
|
1846
1845
|
constructor(t = null, n = null) {
|
|
1847
1846
|
X(this, "refreshTokenPromise", null);
|
|
1848
1847
|
X(this, "accessToken");
|
|
@@ -1875,7 +1874,7 @@ class Tr {
|
|
|
1875
1874
|
}) {
|
|
1876
1875
|
const s = await J(this.refreshToken);
|
|
1877
1876
|
if (s && s.payload[T.USER_ID_KEY] !== "") {
|
|
1878
|
-
const o = await
|
|
1877
|
+
const o = await br({
|
|
1879
1878
|
clientId: t,
|
|
1880
1879
|
userId: n,
|
|
1881
1880
|
nonce: r,
|
|
@@ -1896,14 +1895,14 @@ class Tr {
|
|
|
1896
1895
|
};
|
|
1897
1896
|
}
|
|
1898
1897
|
}
|
|
1899
|
-
const
|
|
1898
|
+
const _r = (e) => U(
|
|
1900
1899
|
(...t) => {
|
|
1901
1900
|
e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
|
|
1902
1901
|
},
|
|
1903
1902
|
[e]
|
|
1904
1903
|
), M = () => {
|
|
1905
|
-
throw new Error(
|
|
1906
|
-
},
|
|
1904
|
+
throw new Error(Bn);
|
|
1905
|
+
}, At = Kt({
|
|
1907
1906
|
isAuthenticated: !1,
|
|
1908
1907
|
isLoading: !1,
|
|
1909
1908
|
authenticationType: null,
|
|
@@ -1914,11 +1913,11 @@ const Rr = (e) => U(
|
|
|
1914
1913
|
registeringForPasskey: M,
|
|
1915
1914
|
loginWithPasskey: M,
|
|
1916
1915
|
logoutReason: ""
|
|
1917
|
-
}),
|
|
1918
|
-
state:
|
|
1916
|
+
}), vr = Ut.createContext({
|
|
1917
|
+
state: wt,
|
|
1919
1918
|
dispatch: () => {
|
|
1920
1919
|
}
|
|
1921
|
-
}),
|
|
1920
|
+
}), Cr = (e, t) => t?.type === j ? {
|
|
1922
1921
|
...e,
|
|
1923
1922
|
isLoading: t.payload.isLoading
|
|
1924
1923
|
} : t?.type === F ? {
|
|
@@ -1935,17 +1934,17 @@ const Rr = (e) => U(
|
|
|
1935
1934
|
user: void 0,
|
|
1936
1935
|
authenticationType: null,
|
|
1937
1936
|
logoutReason: t.payload.logoutReason
|
|
1938
|
-
} : e,
|
|
1937
|
+
} : e, Lr = ({
|
|
1939
1938
|
children: e,
|
|
1940
1939
|
sessionExpiration: t,
|
|
1941
1940
|
clientId: n,
|
|
1942
1941
|
domain: r = "",
|
|
1943
1942
|
debug: a = !1
|
|
1944
1943
|
}) => {
|
|
1945
|
-
const [s, o] =
|
|
1946
|
-
...
|
|
1944
|
+
const [s, o] = Ht(Cr, {
|
|
1945
|
+
...wt,
|
|
1947
1946
|
debug: a
|
|
1948
|
-
}), i =
|
|
1947
|
+
}), i = _r(a), c = Oe(!1), y = Oe(""), [l, h, , g] = ne({
|
|
1949
1948
|
key: `${oe}::${n}::@@user@@`
|
|
1950
1949
|
}), [f, u, , m] = ne({
|
|
1951
1950
|
key: `${oe}::${n}::@@access@@`
|
|
@@ -1953,9 +1952,9 @@ const Rr = (e) => U(
|
|
|
1953
1952
|
{
|
|
1954
1953
|
key: `${oe}::${n}::@@refresh@@`
|
|
1955
1954
|
}
|
|
1956
|
-
), [
|
|
1955
|
+
), [Tt, ve, , Ce] = ne({
|
|
1957
1956
|
key: `${oe}::${n}::@@nonce@@`
|
|
1958
|
-
}),
|
|
1957
|
+
}), Rt = new Ir(f, R), Q = U(() => {
|
|
1959
1958
|
i("removeLocalStorage: removing local storage"), g(), m(), _e(), Ce();
|
|
1960
1959
|
}, [
|
|
1961
1960
|
m,
|
|
@@ -1979,10 +1978,10 @@ const Rr = (e) => U(
|
|
|
1979
1978
|
), D = U(
|
|
1980
1979
|
async (d) => {
|
|
1981
1980
|
i("invalidateAndLogout: invalidating and logging out");
|
|
1982
|
-
const { user:
|
|
1981
|
+
const { user: E } = s, p = E?.userId || Ar(l);
|
|
1983
1982
|
p || i(
|
|
1984
1983
|
"invalidateAndLogout: user cannot be identified, logging out without userId"
|
|
1985
|
-
), await
|
|
1984
|
+
), await Tr({
|
|
1986
1985
|
userId: p,
|
|
1987
1986
|
idToken: l,
|
|
1988
1987
|
accessToken: f,
|
|
@@ -2002,7 +2001,7 @@ const Rr = (e) => U(
|
|
|
2002
2001
|
i
|
|
2003
2002
|
]
|
|
2004
2003
|
);
|
|
2005
|
-
Re(() => ((async () => y.current = await
|
|
2004
|
+
Re(() => ((async () => y.current = await St())(), () => {
|
|
2006
2005
|
y.current = "";
|
|
2007
2006
|
}), []), Re(() => {
|
|
2008
2007
|
if (!c.current)
|
|
@@ -2028,24 +2027,25 @@ const Rr = (e) => U(
|
|
|
2028
2027
|
c.current = !0;
|
|
2029
2028
|
};
|
|
2030
2029
|
}, [s.isLoading, l, D, i]);
|
|
2031
|
-
const
|
|
2030
|
+
const bt = async (d, E, p = G.CODE) => {
|
|
2031
|
+
o({ type: j, payload: { isLoading: !0 } }), Q();
|
|
2032
2032
|
const I = Te();
|
|
2033
|
-
if (ve(I),
|
|
2034
|
-
const { code_verifier:
|
|
2033
|
+
if (ve(I), i("login: Logging in with type: ", p), p === G.CODE) {
|
|
2034
|
+
const { code_verifier: kt, code_challenge: Ot } = await Wn(), Pe = await Rr({
|
|
2035
2035
|
nonce: I,
|
|
2036
2036
|
clientId: n,
|
|
2037
|
-
code_challenge:
|
|
2037
|
+
code_challenge: Ot
|
|
2038
2038
|
});
|
|
2039
2039
|
if (Pe.status) {
|
|
2040
2040
|
const V = await Ve({
|
|
2041
2041
|
username: d,
|
|
2042
|
-
password:
|
|
2042
|
+
password: E,
|
|
2043
2043
|
clientId: n,
|
|
2044
2044
|
sessionExpiration: t,
|
|
2045
2045
|
nonce: I,
|
|
2046
2046
|
type: p,
|
|
2047
2047
|
code: Pe.data,
|
|
2048
|
-
code_verifier:
|
|
2048
|
+
code_verifier: kt,
|
|
2049
2049
|
domain: r,
|
|
2050
2050
|
fingerprint: y.current
|
|
2051
2051
|
});
|
|
@@ -2064,7 +2064,7 @@ const Rr = (e) => U(
|
|
|
2064
2064
|
}
|
|
2065
2065
|
const Y = await Ve({
|
|
2066
2066
|
username: d,
|
|
2067
|
-
password:
|
|
2067
|
+
password: E,
|
|
2068
2068
|
clientId: n,
|
|
2069
2069
|
sessionExpiration: t,
|
|
2070
2070
|
nonce: I,
|
|
@@ -2082,12 +2082,12 @@ const Rr = (e) => U(
|
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
2084
|
}), !0) : (K(ae), !1);
|
|
2085
|
-
},
|
|
2086
|
-
d?.preventDefault(), await D(
|
|
2087
|
-
},
|
|
2088
|
-
const { isAuthenticated: d, user:
|
|
2085
|
+
}, It = async (d) => {
|
|
2086
|
+
d?.preventDefault(), await D(jn);
|
|
2087
|
+
}, _t = async () => {
|
|
2088
|
+
const { isAuthenticated: d, user: E } = s;
|
|
2089
2089
|
try {
|
|
2090
|
-
if (d &&
|
|
2090
|
+
if (d && E && E.userId) {
|
|
2091
2091
|
if (f) {
|
|
2092
2092
|
i("getAccessToken");
|
|
2093
2093
|
const I = await J(f);
|
|
@@ -2095,10 +2095,10 @@ const Rr = (e) => U(
|
|
|
2095
2095
|
return f;
|
|
2096
2096
|
}
|
|
2097
2097
|
i("getAccessToken: invalid access token, trying to refresh it");
|
|
2098
|
-
const p = await
|
|
2098
|
+
const p = await Rt.refreshtoken({
|
|
2099
2099
|
clientId: n,
|
|
2100
|
-
userId:
|
|
2101
|
-
nonce:
|
|
2100
|
+
userId: E.userId,
|
|
2101
|
+
nonce: Tt,
|
|
2102
2102
|
domain: r
|
|
2103
2103
|
});
|
|
2104
2104
|
return p.status && p.status === "success" && p.newAccessToken ? (u(p.newAccessToken), z(p.newRefreshToken), p.newAccessToken) : (i(
|
|
@@ -2111,11 +2111,11 @@ const Rr = (e) => U(
|
|
|
2111
2111
|
} catch {
|
|
2112
2112
|
return i(
|
|
2113
2113
|
"getAccessToken: exception occurred, invalidating and logging out"
|
|
2114
|
-
), await D(
|
|
2114
|
+
), await D(Fn), "";
|
|
2115
2115
|
}
|
|
2116
|
-
},
|
|
2116
|
+
}, vt = () => s.isAuthenticated && l ? l : "", Ct = async () => {
|
|
2117
2117
|
const { user: d } = s;
|
|
2118
|
-
let
|
|
2118
|
+
let E = await x({
|
|
2119
2119
|
accessToken: f,
|
|
2120
2120
|
clientId: n,
|
|
2121
2121
|
type: W.GET_REGISTRATION_OPTIONS,
|
|
@@ -2125,10 +2125,10 @@ const Rr = (e) => U(
|
|
|
2125
2125
|
username: d?.username
|
|
2126
2126
|
}
|
|
2127
2127
|
});
|
|
2128
|
-
if (
|
|
2128
|
+
if (E.status)
|
|
2129
2129
|
try {
|
|
2130
|
-
const p = await
|
|
2131
|
-
return
|
|
2130
|
+
const p = await Gt(E.data);
|
|
2131
|
+
return E = await x({
|
|
2132
2132
|
accessToken: f,
|
|
2133
2133
|
clientId: n,
|
|
2134
2134
|
type: W.VERIFY_REGISTRATION,
|
|
@@ -2138,7 +2138,7 @@ const Rr = (e) => U(
|
|
|
2138
2138
|
username: d?.username,
|
|
2139
2139
|
registration: p
|
|
2140
2140
|
}
|
|
2141
|
-
}), !!(
|
|
2141
|
+
}), !!(E.status && E.data.length > 0);
|
|
2142
2142
|
} catch {
|
|
2143
2143
|
return await x({
|
|
2144
2144
|
accessToken: f,
|
|
@@ -2153,29 +2153,30 @@ const Rr = (e) => U(
|
|
|
2153
2153
|
}), !1;
|
|
2154
2154
|
}
|
|
2155
2155
|
return !1;
|
|
2156
|
-
},
|
|
2156
|
+
}, Pt = async () => {
|
|
2157
|
+
o({ type: j, payload: { isLoading: !0 } }), Q();
|
|
2157
2158
|
const d = Te();
|
|
2158
|
-
ve(d),
|
|
2159
|
-
const
|
|
2159
|
+
ve(d), i("loginWithPasskey");
|
|
2160
|
+
const E = Te();
|
|
2160
2161
|
let p = await x({
|
|
2161
2162
|
accessToken: f,
|
|
2162
2163
|
clientId: n,
|
|
2163
2164
|
type: W.GET_AUTHENTICATION_OPTIONS,
|
|
2164
2165
|
params: {
|
|
2165
|
-
id:
|
|
2166
|
+
id: E,
|
|
2166
2167
|
clientId: n
|
|
2167
2168
|
}
|
|
2168
2169
|
});
|
|
2169
2170
|
if (p.status)
|
|
2170
2171
|
try {
|
|
2171
|
-
const I = await
|
|
2172
|
+
const I = await Vt(p.data);
|
|
2172
2173
|
return p = await x({
|
|
2173
2174
|
accessToken: f,
|
|
2174
2175
|
clientId: n,
|
|
2175
2176
|
type: W.VERIFY_AUTHENTICATION,
|
|
2176
2177
|
params: {
|
|
2177
2178
|
clientId: n,
|
|
2178
|
-
id:
|
|
2179
|
+
id: E,
|
|
2179
2180
|
authentication: I,
|
|
2180
2181
|
nonce: d,
|
|
2181
2182
|
domain: r,
|
|
@@ -2198,7 +2199,7 @@ const Rr = (e) => U(
|
|
|
2198
2199
|
type: W.VERIFY_AUTHENTICATION,
|
|
2199
2200
|
params: {
|
|
2200
2201
|
clientId: n,
|
|
2201
|
-
id:
|
|
2202
|
+
id: E,
|
|
2202
2203
|
authentication: {},
|
|
2203
2204
|
nonce: d,
|
|
2204
2205
|
domain: r
|
|
@@ -2207,25 +2208,25 @@ const Rr = (e) => U(
|
|
|
2207
2208
|
}
|
|
2208
2209
|
return !1;
|
|
2209
2210
|
};
|
|
2210
|
-
return /* @__PURE__ */ ke(
|
|
2211
|
-
|
|
2211
|
+
return /* @__PURE__ */ ke(vr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ke(
|
|
2212
|
+
At.Provider,
|
|
2212
2213
|
{
|
|
2213
2214
|
value: {
|
|
2214
2215
|
...s,
|
|
2215
|
-
login:
|
|
2216
|
-
logout:
|
|
2217
|
-
getAccessToken:
|
|
2218
|
-
getIdToken:
|
|
2219
|
-
registeringForPasskey:
|
|
2220
|
-
loginWithPasskey:
|
|
2216
|
+
login: bt,
|
|
2217
|
+
logout: It,
|
|
2218
|
+
getAccessToken: _t,
|
|
2219
|
+
getIdToken: vt,
|
|
2220
|
+
registeringForPasskey: Ct,
|
|
2221
|
+
loginWithPasskey: Pt
|
|
2221
2222
|
},
|
|
2222
2223
|
children: e
|
|
2223
2224
|
}
|
|
2224
2225
|
) });
|
|
2225
|
-
},
|
|
2226
|
+
}, Wr = (e = At) => Lt(e);
|
|
2226
2227
|
export {
|
|
2227
2228
|
G as AUTH_TYPES,
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2229
|
+
Lr as AuthProvider,
|
|
2230
|
+
Hr as isGranted,
|
|
2231
|
+
Wr as useAuth
|
|
2231
2232
|
};
|