@versini/auth-provider 6.3.2 → 6.3.3
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.js +394 -392
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import
|
|
1
|
+
var It = Object.defineProperty;
|
|
2
|
+
var _t = (e, t, n) => t in e ? It(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var Q = (e, t, n) => _t(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsx as ve } from "react/jsx-runtime";
|
|
5
|
+
import vt, { useSyncExternalStore as kt, useCallback as x, useEffect as Ae, createContext as Ct, useReducer as Pt, useRef as ke, useContext as Ot } from "react";
|
|
6
6
|
/*!
|
|
7
|
-
@versini/auth-provider v6.3.
|
|
7
|
+
@versini/auth-provider v6.3.3
|
|
8
8
|
© 2024 gizmette.com
|
|
9
9
|
*/
|
|
10
10
|
try {
|
|
11
11
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
12
|
-
version: "6.3.
|
|
13
|
-
buildTime: "07/
|
|
12
|
+
version: "6.3.3",
|
|
13
|
+
buildTime: "07/24/2024 07:46 AM EDT",
|
|
14
14
|
homepage: "https://github.com/aversini/auth-client",
|
|
15
15
|
license: "MIT"
|
|
16
16
|
});
|
|
@@ -29,10 +29,10 @@ function ie(e) {
|
|
|
29
29
|
o[i] = a.charCodeAt(i);
|
|
30
30
|
return s;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Te() {
|
|
33
33
|
return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function Je(e) {
|
|
36
36
|
const { id: t } = e;
|
|
37
37
|
return {
|
|
38
38
|
...e,
|
|
@@ -40,7 +40,7 @@ function Ye(e) {
|
|
|
40
40
|
transports: e.transports
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function Ye(e) {
|
|
44
44
|
return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
|
|
45
45
|
}
|
|
46
46
|
class b extends Error {
|
|
@@ -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 Nt({ error: e, options: t }) {
|
|
52
52
|
var r, a;
|
|
53
53
|
const { publicKey: n } = t;
|
|
54
54
|
if (!n)
|
|
@@ -98,7 +98,7 @@ function Dt({ error: e, options: t }) {
|
|
|
98
98
|
});
|
|
99
99
|
if (e.name === "SecurityError") {
|
|
100
100
|
const s = window.location.hostname;
|
|
101
|
-
if (
|
|
101
|
+
if (Ye(s)) {
|
|
102
102
|
if (n.rp.id !== s)
|
|
103
103
|
return new b({
|
|
104
104
|
message: `The RP ID "${n.rp.id}" is invalid for this domain`,
|
|
@@ -126,7 +126,7 @@ function Dt({ error: e, options: t }) {
|
|
|
126
126
|
}
|
|
127
127
|
return e;
|
|
128
128
|
}
|
|
129
|
-
class
|
|
129
|
+
class Dt {
|
|
130
130
|
createNewAbortSignal() {
|
|
131
131
|
if (this.controller) {
|
|
132
132
|
const n = new Error("Cancelling existing WebAuthn API call for new one");
|
|
@@ -142,14 +142,14 @@ class Ut {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
const
|
|
146
|
-
function
|
|
147
|
-
if (e && !(
|
|
145
|
+
const Ve = new Dt(), Ut = ["cross-platform", "platform"];
|
|
146
|
+
function je(e) {
|
|
147
|
+
if (e && !(Ut.indexOf(e) < 0))
|
|
148
148
|
return e;
|
|
149
149
|
}
|
|
150
|
-
async function
|
|
150
|
+
async function $t(e) {
|
|
151
151
|
var m;
|
|
152
|
-
if (!
|
|
152
|
+
if (!Te())
|
|
153
153
|
throw new Error("WebAuthn is not supported in this browser");
|
|
154
154
|
const n = { publicKey: {
|
|
155
155
|
...e,
|
|
@@ -158,14 +158,14 @@ async function Kt(e) {
|
|
|
158
158
|
...e.user,
|
|
159
159
|
id: ie(e.user.id)
|
|
160
160
|
},
|
|
161
|
-
excludeCredentials: (m = e.excludeCredentials) == null ? void 0 : m.map(
|
|
161
|
+
excludeCredentials: (m = e.excludeCredentials) == null ? void 0 : m.map(Je)
|
|
162
162
|
} };
|
|
163
|
-
n.signal =
|
|
163
|
+
n.signal = Ve.createNewAbortSignal();
|
|
164
164
|
let r;
|
|
165
165
|
try {
|
|
166
166
|
r = await navigator.credentials.create(n);
|
|
167
167
|
} catch (u) {
|
|
168
|
-
throw
|
|
168
|
+
throw Nt({ error: u, options: n });
|
|
169
169
|
}
|
|
170
170
|
if (!r)
|
|
171
171
|
throw new Error("Registration was not completed");
|
|
@@ -207,20 +207,20 @@ async function Kt(e) {
|
|
|
207
207
|
},
|
|
208
208
|
type: i,
|
|
209
209
|
clientExtensionResults: r.getClientExtensionResults(),
|
|
210
|
-
authenticatorAttachment:
|
|
210
|
+
authenticatorAttachment: je(r.authenticatorAttachment)
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
213
|
function fe(e, t) {
|
|
214
214
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
|
|
215
215
|
`, t);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
if (!
|
|
217
|
+
function Kt() {
|
|
218
|
+
if (!Te())
|
|
219
219
|
return new Promise((t) => t(!1));
|
|
220
220
|
const e = window.PublicKeyCredential;
|
|
221
221
|
return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function Ht({ error: e, options: t }) {
|
|
224
224
|
const { publicKey: n } = t;
|
|
225
225
|
if (!n)
|
|
226
226
|
throw Error("options was missing required publicKey property");
|
|
@@ -240,7 +240,7 @@ function Lt({ error: e, options: t }) {
|
|
|
240
240
|
});
|
|
241
241
|
if (e.name === "SecurityError") {
|
|
242
242
|
const r = window.location.hostname;
|
|
243
|
-
if (
|
|
243
|
+
if (Ye(r)) {
|
|
244
244
|
if (n.rpId !== r)
|
|
245
245
|
return new b({
|
|
246
246
|
message: `The RP ID "${n.rpId}" is invalid for this domain`,
|
|
@@ -261,30 +261,30 @@ function Lt({ error: e, options: t }) {
|
|
|
261
261
|
}
|
|
262
262
|
return e;
|
|
263
263
|
}
|
|
264
|
-
async function
|
|
264
|
+
async function Lt(e, t = !1) {
|
|
265
265
|
var p, m;
|
|
266
|
-
if (!
|
|
266
|
+
if (!Te())
|
|
267
267
|
throw new Error("WebAuthn is not supported in this browser");
|
|
268
268
|
let n;
|
|
269
|
-
((p = e.allowCredentials) == null ? void 0 : p.length) !== 0 && (n = (m = e.allowCredentials) == null ? void 0 : m.map(
|
|
269
|
+
((p = e.allowCredentials) == null ? void 0 : p.length) !== 0 && (n = (m = e.allowCredentials) == null ? void 0 : m.map(Je));
|
|
270
270
|
const r = {
|
|
271
271
|
...e,
|
|
272
272
|
challenge: ie(e.challenge),
|
|
273
273
|
allowCredentials: n
|
|
274
274
|
}, a = {};
|
|
275
275
|
if (t) {
|
|
276
|
-
if (!await
|
|
276
|
+
if (!await Kt())
|
|
277
277
|
throw Error("Browser does not support WebAuthn autofill");
|
|
278
278
|
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
|
|
279
279
|
throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
|
|
280
280
|
a.mediation = "conditional", r.allowCredentials = [];
|
|
281
281
|
}
|
|
282
|
-
a.publicKey = r, a.signal =
|
|
282
|
+
a.publicKey = r, a.signal = Ve.createNewAbortSignal();
|
|
283
283
|
let s;
|
|
284
284
|
try {
|
|
285
285
|
s = await navigator.credentials.get(a);
|
|
286
286
|
} catch (u) {
|
|
287
|
-
throw
|
|
287
|
+
throw Ht({ error: u, options: a });
|
|
288
288
|
}
|
|
289
289
|
if (!s)
|
|
290
290
|
throw new Error("Authentication was not completed");
|
|
@@ -301,7 +301,7 @@ async function Wt(e, t = !1) {
|
|
|
301
301
|
},
|
|
302
302
|
type: y,
|
|
303
303
|
clientExtensionResults: s.getClientExtensionResults(),
|
|
304
|
-
authenticatorAttachment:
|
|
304
|
+
authenticatorAttachment: je(s.authenticatorAttachment)
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
307
|
/*!
|
|
@@ -311,20 +311,20 @@ async function Wt(e, t = !1) {
|
|
|
311
311
|
try {
|
|
312
312
|
window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
|
|
313
313
|
version: "3.3.0",
|
|
314
|
-
buildTime: "07/
|
|
314
|
+
buildTime: "07/24/2024 07:46 AM EDT",
|
|
315
315
|
homepage: "https://github.com/aversini/auth-client",
|
|
316
316
|
license: "MIT"
|
|
317
317
|
});
|
|
318
318
|
} catch {
|
|
319
319
|
}
|
|
320
|
-
const
|
|
320
|
+
const F = {
|
|
321
321
|
ID_TOKEN: "id_token",
|
|
322
322
|
ACCESS_TOKEN: "token",
|
|
323
323
|
ID_AND_ACCESS_TOKEN: "id_token token",
|
|
324
324
|
CODE: "code",
|
|
325
325
|
REFRESH_TOKEN: "refresh_token",
|
|
326
326
|
PASSKEY: "passkey"
|
|
327
|
-
},
|
|
327
|
+
}, Fe = {
|
|
328
328
|
CLIENT_ID: "X-Auth-ClientId"
|
|
329
329
|
}, T = {
|
|
330
330
|
ALG: "RS256",
|
|
@@ -337,7 +337,7 @@ const j = {
|
|
|
337
337
|
CREATED_AT_KEY: "iat",
|
|
338
338
|
SCOPES_KEY: "scopes",
|
|
339
339
|
ISSUER: "gizmette.com"
|
|
340
|
-
},
|
|
340
|
+
}, Wt = `-----BEGIN PUBLIC KEY-----
|
|
341
341
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
|
|
342
342
|
w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
|
|
343
343
|
i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
|
|
@@ -349,24 +349,24 @@ awIDAQAB
|
|
|
349
349
|
AUTHENTICATE: "authenticate",
|
|
350
350
|
CODE: "code",
|
|
351
351
|
LOGOUT: "logout"
|
|
352
|
-
}, he = crypto,
|
|
353
|
-
function
|
|
352
|
+
}, he = crypto, Be = (e) => e instanceof CryptoKey, X = new TextEncoder(), B = new TextDecoder();
|
|
353
|
+
function xt(...e) {
|
|
354
354
|
const t = e.reduce((a, { length: s }) => a + s, 0), n = new Uint8Array(t);
|
|
355
355
|
let r = 0;
|
|
356
356
|
for (const a of e)
|
|
357
357
|
n.set(a, r), r += a.length;
|
|
358
358
|
return n;
|
|
359
359
|
}
|
|
360
|
-
const
|
|
360
|
+
const Mt = (e) => {
|
|
361
361
|
const t = atob(e), n = new Uint8Array(t.length);
|
|
362
362
|
for (let r = 0; r < t.length; r++)
|
|
363
363
|
n[r] = t.charCodeAt(r);
|
|
364
364
|
return n;
|
|
365
|
-
},
|
|
365
|
+
}, j = (e) => {
|
|
366
366
|
let t = e;
|
|
367
|
-
t instanceof Uint8Array && (t =
|
|
367
|
+
t instanceof Uint8Array && (t = B.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
368
368
|
try {
|
|
369
|
-
return
|
|
369
|
+
return Mt(t);
|
|
370
370
|
} catch {
|
|
371
371
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
372
372
|
}
|
|
@@ -394,7 +394,7 @@ let D = class extends Error {
|
|
|
394
394
|
super(t), this.code = "ERR_JWT_EXPIRED", this.claim = r, this.reason = a, this.payload = n;
|
|
395
395
|
}
|
|
396
396
|
};
|
|
397
|
-
class
|
|
397
|
+
class Gt extends D {
|
|
398
398
|
constructor() {
|
|
399
399
|
super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
400
400
|
}
|
|
@@ -418,7 +418,7 @@ class A extends D {
|
|
|
418
418
|
return "ERR_JWS_INVALID";
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
let
|
|
421
|
+
let C = class extends D {
|
|
422
422
|
constructor() {
|
|
423
423
|
super(...arguments), this.code = "ERR_JWT_INVALID";
|
|
424
424
|
}
|
|
@@ -426,7 +426,7 @@ let k = class extends D {
|
|
|
426
426
|
return "ERR_JWT_INVALID";
|
|
427
427
|
}
|
|
428
428
|
};
|
|
429
|
-
class
|
|
429
|
+
class Jt extends D {
|
|
430
430
|
constructor() {
|
|
431
431
|
super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
|
|
432
432
|
}
|
|
@@ -434,16 +434,16 @@ class Yt extends D {
|
|
|
434
434
|
return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function k(e, t = "algorithm.name") {
|
|
438
438
|
return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function Z(e, t) {
|
|
441
441
|
return e.name === t;
|
|
442
442
|
}
|
|
443
443
|
function ye(e) {
|
|
444
444
|
return parseInt(e.name.slice(4), 10);
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function Yt(e) {
|
|
447
447
|
switch (e) {
|
|
448
448
|
case "ES256":
|
|
449
449
|
return "P-256";
|
|
@@ -455,7 +455,7 @@ function Vt(e) {
|
|
|
455
455
|
throw new Error("unreachable");
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function Vt(e, t) {
|
|
459
459
|
if (t.length && !t.some((n) => e.usages.includes(n))) {
|
|
460
460
|
let n = "CryptoKey does not support this operation, its usages must include ";
|
|
461
461
|
if (t.length > 2) {
|
|
@@ -465,59 +465,59 @@ function jt(e, t) {
|
|
|
465
465
|
throw new TypeError(n);
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function jt(e, t, ...n) {
|
|
469
469
|
switch (t) {
|
|
470
470
|
case "HS256":
|
|
471
471
|
case "HS384":
|
|
472
472
|
case "HS512": {
|
|
473
|
-
if (!
|
|
474
|
-
throw
|
|
473
|
+
if (!Z(e.algorithm, "HMAC"))
|
|
474
|
+
throw k("HMAC");
|
|
475
475
|
const r = parseInt(t.slice(2), 10);
|
|
476
476
|
if (ye(e.algorithm.hash) !== r)
|
|
477
|
-
throw
|
|
477
|
+
throw k(`SHA-${r}`, "algorithm.hash");
|
|
478
478
|
break;
|
|
479
479
|
}
|
|
480
480
|
case "RS256":
|
|
481
481
|
case "RS384":
|
|
482
482
|
case "RS512": {
|
|
483
|
-
if (!
|
|
484
|
-
throw
|
|
483
|
+
if (!Z(e.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
484
|
+
throw k("RSASSA-PKCS1-v1_5");
|
|
485
485
|
const r = parseInt(t.slice(2), 10);
|
|
486
486
|
if (ye(e.algorithm.hash) !== r)
|
|
487
|
-
throw
|
|
487
|
+
throw k(`SHA-${r}`, "algorithm.hash");
|
|
488
488
|
break;
|
|
489
489
|
}
|
|
490
490
|
case "PS256":
|
|
491
491
|
case "PS384":
|
|
492
492
|
case "PS512": {
|
|
493
|
-
if (!
|
|
494
|
-
throw
|
|
493
|
+
if (!Z(e.algorithm, "RSA-PSS"))
|
|
494
|
+
throw k("RSA-PSS");
|
|
495
495
|
const r = parseInt(t.slice(2), 10);
|
|
496
496
|
if (ye(e.algorithm.hash) !== r)
|
|
497
|
-
throw
|
|
497
|
+
throw k(`SHA-${r}`, "algorithm.hash");
|
|
498
498
|
break;
|
|
499
499
|
}
|
|
500
500
|
case "EdDSA": {
|
|
501
501
|
if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
|
|
502
|
-
throw
|
|
502
|
+
throw k("Ed25519 or Ed448");
|
|
503
503
|
break;
|
|
504
504
|
}
|
|
505
505
|
case "ES256":
|
|
506
506
|
case "ES384":
|
|
507
507
|
case "ES512": {
|
|
508
|
-
if (!
|
|
509
|
-
throw
|
|
510
|
-
const r =
|
|
508
|
+
if (!Z(e.algorithm, "ECDSA"))
|
|
509
|
+
throw k("ECDSA");
|
|
510
|
+
const r = Yt(t);
|
|
511
511
|
if (e.algorithm.namedCurve !== r)
|
|
512
|
-
throw
|
|
512
|
+
throw k(r, "algorithm.namedCurve");
|
|
513
513
|
break;
|
|
514
514
|
}
|
|
515
515
|
default:
|
|
516
516
|
throw new TypeError("CryptoKey does not support this operation");
|
|
517
517
|
}
|
|
518
|
-
|
|
518
|
+
Vt(e, n);
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function qe(e, t, ...n) {
|
|
521
521
|
var r;
|
|
522
522
|
if (n.length > 2) {
|
|
523
523
|
const a = n.pop();
|
|
@@ -525,11 +525,11 @@ function ze(e, t, ...n) {
|
|
|
525
525
|
} else n.length === 2 ? e += `one of type ${n[0]} or ${n[1]}.` : e += `of type ${n[0]}.`;
|
|
526
526
|
return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (r = t.constructor) != null && r.name && (e += ` Received an instance of ${t.constructor.name}`), e;
|
|
527
527
|
}
|
|
528
|
-
const
|
|
529
|
-
function
|
|
530
|
-
return
|
|
528
|
+
const Pe = (e, ...t) => qe("Key must be ", e, ...t);
|
|
529
|
+
function ze(e, t, ...n) {
|
|
530
|
+
return qe(`Key for the ${e} algorithm must be `, t, ...n);
|
|
531
531
|
}
|
|
532
|
-
const
|
|
532
|
+
const Qe = (e) => Be(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", ce = ["CryptoKey"], Ft = (...e) => {
|
|
533
533
|
const t = e.filter(Boolean);
|
|
534
534
|
if (t.length === 0 || t.length === 1)
|
|
535
535
|
return !0;
|
|
@@ -548,11 +548,11 @@ const Xe = (e) => qe(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) ===
|
|
|
548
548
|
}
|
|
549
549
|
return !0;
|
|
550
550
|
};
|
|
551
|
-
function
|
|
551
|
+
function Bt(e) {
|
|
552
552
|
return typeof e == "object" && e !== null;
|
|
553
553
|
}
|
|
554
554
|
function ue(e) {
|
|
555
|
-
if (!
|
|
555
|
+
if (!Bt(e) || Object.prototype.toString.call(e) !== "[object Object]")
|
|
556
556
|
return !1;
|
|
557
557
|
if (Object.getPrototypeOf(e) === null)
|
|
558
558
|
return !0;
|
|
@@ -561,14 +561,14 @@ function ue(e) {
|
|
|
561
561
|
t = Object.getPrototypeOf(t);
|
|
562
562
|
return Object.getPrototypeOf(e) === t;
|
|
563
563
|
}
|
|
564
|
-
const
|
|
564
|
+
const qt = (e, t) => {
|
|
565
565
|
if (e.startsWith("RS") || e.startsWith("PS")) {
|
|
566
566
|
const { modulusLength: n } = t.algorithm;
|
|
567
567
|
if (typeof n != "number" || n < 2048)
|
|
568
568
|
throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
|
|
569
569
|
}
|
|
570
570
|
};
|
|
571
|
-
function
|
|
571
|
+
function zt(e) {
|
|
572
572
|
let t, n;
|
|
573
573
|
switch (e.kty) {
|
|
574
574
|
case "RSA": {
|
|
@@ -640,62 +640,62 @@ function Qt(e) {
|
|
|
640
640
|
}
|
|
641
641
|
return { algorithm: t, keyUsages: n };
|
|
642
642
|
}
|
|
643
|
-
const
|
|
643
|
+
const Qt = async (e) => {
|
|
644
644
|
if (!e.alg)
|
|
645
645
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
646
|
-
const { algorithm: t, keyUsages: n } =
|
|
646
|
+
const { algorithm: t, keyUsages: n } = zt(e), r = [
|
|
647
647
|
t,
|
|
648
648
|
e.ext ?? !1,
|
|
649
649
|
e.key_ops ?? n
|
|
650
650
|
], a = { ...e };
|
|
651
651
|
return delete a.alg, delete a.use, he.subtle.importKey("jwk", a, ...r);
|
|
652
|
-
},
|
|
652
|
+
}, Xe = (e) => j(e);
|
|
653
653
|
let ge, me;
|
|
654
|
-
const
|
|
654
|
+
const Ze = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", et = async (e, t, n, r) => {
|
|
655
655
|
let a = e.get(t);
|
|
656
656
|
if (a != null && a[r])
|
|
657
657
|
return a[r];
|
|
658
|
-
const s = await
|
|
658
|
+
const s = await Qt({ ...n, alg: r });
|
|
659
659
|
return a ? a[r] = s : e.set(t, { [r]: s }), s;
|
|
660
|
-
},
|
|
661
|
-
if (
|
|
660
|
+
}, Xt = (e, t) => {
|
|
661
|
+
if (Ze(e)) {
|
|
662
662
|
let n = e.export({ format: "jwk" });
|
|
663
|
-
return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ?
|
|
663
|
+
return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? Xe(n.k) : (me || (me = /* @__PURE__ */ new WeakMap()), et(me, e, n, t));
|
|
664
664
|
}
|
|
665
665
|
return e;
|
|
666
|
-
},
|
|
667
|
-
if (
|
|
666
|
+
}, Zt = (e, t) => {
|
|
667
|
+
if (Ze(e)) {
|
|
668
668
|
let n = e.export({ format: "jwk" });
|
|
669
|
-
return n.k ?
|
|
669
|
+
return n.k ? Xe(n.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), et(ge, e, n, t));
|
|
670
670
|
}
|
|
671
671
|
return e;
|
|
672
|
-
},
|
|
672
|
+
}, en = { normalizePublicKey: Xt, normalizePrivateKey: Zt }, P = (e, t, n = 0) => {
|
|
673
673
|
n === 0 && (t.unshift(t.length), t.unshift(6));
|
|
674
674
|
const r = e.indexOf(t[0], n);
|
|
675
675
|
if (r === -1)
|
|
676
676
|
return !1;
|
|
677
677
|
const a = e.subarray(r, r + t.length);
|
|
678
|
-
return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) ||
|
|
679
|
-
},
|
|
678
|
+
return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || P(e, t, r + 1);
|
|
679
|
+
}, Oe = (e) => {
|
|
680
680
|
switch (!0) {
|
|
681
|
-
case
|
|
681
|
+
case P(e, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
682
682
|
return "P-256";
|
|
683
|
-
case
|
|
683
|
+
case P(e, [43, 129, 4, 0, 34]):
|
|
684
684
|
return "P-384";
|
|
685
|
-
case
|
|
685
|
+
case P(e, [43, 129, 4, 0, 35]):
|
|
686
686
|
return "P-521";
|
|
687
|
-
case
|
|
687
|
+
case P(e, [43, 101, 110]):
|
|
688
688
|
return "X25519";
|
|
689
|
-
case
|
|
689
|
+
case P(e, [43, 101, 111]):
|
|
690
690
|
return "X448";
|
|
691
|
-
case
|
|
691
|
+
case P(e, [43, 101, 112]):
|
|
692
692
|
return "Ed25519";
|
|
693
|
-
case
|
|
693
|
+
case P(e, [43, 101, 113]):
|
|
694
694
|
return "Ed448";
|
|
695
695
|
default:
|
|
696
696
|
throw new O("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
|
|
697
697
|
}
|
|
698
|
-
},
|
|
698
|
+
}, tn = async (e, t, n, r, a) => {
|
|
699
699
|
let s, o;
|
|
700
700
|
const i = new Uint8Array(atob(n.replace(e, "")).split("").map((l) => l.charCodeAt(0)));
|
|
701
701
|
switch (r) {
|
|
@@ -731,43 +731,43 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
|
|
|
731
731
|
case "ECDH-ES+A128KW":
|
|
732
732
|
case "ECDH-ES+A192KW":
|
|
733
733
|
case "ECDH-ES+A256KW": {
|
|
734
|
-
const l =
|
|
734
|
+
const l = Oe(i);
|
|
735
735
|
s = l.startsWith("P-") ? { name: "ECDH", namedCurve: l } : { name: l }, o = [];
|
|
736
736
|
break;
|
|
737
737
|
}
|
|
738
738
|
case "EdDSA":
|
|
739
|
-
s = { name:
|
|
739
|
+
s = { name: Oe(i) }, o = ["verify"];
|
|
740
740
|
break;
|
|
741
741
|
default:
|
|
742
742
|
throw new O('Invalid or unsupported "alg" (Algorithm) value');
|
|
743
743
|
}
|
|
744
744
|
return he.subtle.importKey(t, i, s, !1, o);
|
|
745
|
-
},
|
|
746
|
-
async function
|
|
745
|
+
}, nn = (e, t, n) => tn(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
|
|
746
|
+
async function rn(e, t, n) {
|
|
747
747
|
if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
748
748
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
749
|
-
return
|
|
749
|
+
return nn(e, t);
|
|
750
750
|
}
|
|
751
|
-
const se = (e) => e == null ? void 0 : e[Symbol.toStringTag],
|
|
751
|
+
const se = (e) => e == null ? void 0 : e[Symbol.toStringTag], an = (e, t) => {
|
|
752
752
|
if (!(t instanceof Uint8Array)) {
|
|
753
|
-
if (!
|
|
754
|
-
throw new TypeError(
|
|
753
|
+
if (!Qe(t))
|
|
754
|
+
throw new TypeError(ze(e, t, ...ce, "Uint8Array"));
|
|
755
755
|
if (t.type !== "secret")
|
|
756
756
|
throw new TypeError(`${se(t)} instances for symmetric algorithms must be of type "secret"`);
|
|
757
757
|
}
|
|
758
|
-
},
|
|
759
|
-
if (!
|
|
760
|
-
throw new TypeError(
|
|
758
|
+
}, on = (e, t, n) => {
|
|
759
|
+
if (!Qe(t))
|
|
760
|
+
throw new TypeError(ze(e, t, ...ce));
|
|
761
761
|
if (t.type === "secret")
|
|
762
762
|
throw new TypeError(`${se(t)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
763
763
|
if (t.algorithm && n === "verify" && t.type === "private")
|
|
764
764
|
throw new TypeError(`${se(t)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
765
765
|
if (t.algorithm && n === "encrypt" && t.type === "private")
|
|
766
766
|
throw new TypeError(`${se(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
767
|
-
},
|
|
768
|
-
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ?
|
|
767
|
+
}, sn = (e, t, n) => {
|
|
768
|
+
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? an(e, t) : on(e, t, n);
|
|
769
769
|
};
|
|
770
|
-
function
|
|
770
|
+
function cn(e, t, n, r, a) {
|
|
771
771
|
if (a.crit !== void 0 && (r == null ? void 0 : r.crit) === void 0)
|
|
772
772
|
throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
773
773
|
if (!r || r.crit === void 0)
|
|
@@ -786,13 +786,13 @@ function un(e, t, n, r, a) {
|
|
|
786
786
|
}
|
|
787
787
|
return new Set(r.crit);
|
|
788
788
|
}
|
|
789
|
-
const
|
|
789
|
+
const un = (e, t) => {
|
|
790
790
|
if (t !== void 0 && (!Array.isArray(t) || t.some((n) => typeof n != "string")))
|
|
791
791
|
throw new TypeError(`"${e}" option must be an array of strings`);
|
|
792
792
|
if (t)
|
|
793
793
|
return new Set(t);
|
|
794
794
|
};
|
|
795
|
-
function
|
|
795
|
+
function ln(e, t) {
|
|
796
796
|
const n = `SHA-${e.slice(-3)}`;
|
|
797
797
|
switch (e) {
|
|
798
798
|
case "HS256":
|
|
@@ -817,27 +817,27 @@ function dn(e, t) {
|
|
|
817
817
|
throw new O(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
|
-
async function
|
|
821
|
-
if (t = await
|
|
822
|
-
return
|
|
820
|
+
async function dn(e, t, n) {
|
|
821
|
+
if (t = await en.normalizePublicKey(t, e), Be(t))
|
|
822
|
+
return jt(t, e, n), t;
|
|
823
823
|
if (t instanceof Uint8Array) {
|
|
824
824
|
if (!e.startsWith("HS"))
|
|
825
|
-
throw new TypeError(
|
|
825
|
+
throw new TypeError(Pe(t, ...ce));
|
|
826
826
|
return he.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [n]);
|
|
827
827
|
}
|
|
828
|
-
throw new TypeError(
|
|
828
|
+
throw new TypeError(Pe(t, ...ce, "Uint8Array"));
|
|
829
829
|
}
|
|
830
|
-
const
|
|
831
|
-
const a = await
|
|
832
|
-
|
|
833
|
-
const s =
|
|
830
|
+
const hn = async (e, t, n, r) => {
|
|
831
|
+
const a = await dn(e, t, "verify");
|
|
832
|
+
qt(e, a);
|
|
833
|
+
const s = ln(e, a.algorithm);
|
|
834
834
|
try {
|
|
835
835
|
return await he.subtle.verify(s, a, n, r);
|
|
836
836
|
} catch {
|
|
837
837
|
return !1;
|
|
838
838
|
}
|
|
839
839
|
};
|
|
840
|
-
async function
|
|
840
|
+
async function pn(e, t, n) {
|
|
841
841
|
if (!ue(e))
|
|
842
842
|
throw new A("Flattened JWS must be an object");
|
|
843
843
|
if (e.protected === void 0 && e.header === void 0)
|
|
@@ -853,64 +853,64 @@ async function fn(e, t, n) {
|
|
|
853
853
|
let r = {};
|
|
854
854
|
if (e.protected)
|
|
855
855
|
try {
|
|
856
|
-
const d =
|
|
857
|
-
r = JSON.parse(
|
|
856
|
+
const d = j(e.protected);
|
|
857
|
+
r = JSON.parse(B.decode(d));
|
|
858
858
|
} catch {
|
|
859
859
|
throw new A("JWS Protected Header is invalid");
|
|
860
860
|
}
|
|
861
|
-
if (!
|
|
861
|
+
if (!Ft(r, e.header))
|
|
862
862
|
throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
863
863
|
const a = {
|
|
864
864
|
...r,
|
|
865
865
|
...e.header
|
|
866
|
-
}, s =
|
|
866
|
+
}, s = cn(A, /* @__PURE__ */ new Map([["b64", !0]]), n == null ? void 0 : n.crit, r, a);
|
|
867
867
|
let o = !0;
|
|
868
868
|
if (s.has("b64") && (o = r.b64, typeof o != "boolean"))
|
|
869
869
|
throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
870
870
|
const { alg: i } = a;
|
|
871
871
|
if (typeof i != "string" || !i)
|
|
872
872
|
throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
873
|
-
const l = n &&
|
|
873
|
+
const l = n && un("algorithms", n.algorithms);
|
|
874
874
|
if (l && !l.has(i))
|
|
875
|
-
throw new
|
|
875
|
+
throw new Gt('"alg" (Algorithm) Header Parameter value not allowed');
|
|
876
876
|
if (o) {
|
|
877
877
|
if (typeof e.payload != "string")
|
|
878
878
|
throw new A("JWS Payload must be a string");
|
|
879
879
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
880
880
|
throw new A("JWS Payload must be a string or an Uint8Array instance");
|
|
881
881
|
let y = !1;
|
|
882
|
-
typeof t == "function" && (t = await t(r, e), y = !0),
|
|
883
|
-
const h =
|
|
882
|
+
typeof t == "function" && (t = await t(r, e), y = !0), sn(i, t, "verify");
|
|
883
|
+
const h = xt(X.encode(e.protected ?? ""), X.encode("."), typeof e.payload == "string" ? X.encode(e.payload) : e.payload);
|
|
884
884
|
let p;
|
|
885
885
|
try {
|
|
886
|
-
p =
|
|
886
|
+
p = j(e.signature);
|
|
887
887
|
} catch {
|
|
888
888
|
throw new A("Failed to base64url decode the signature");
|
|
889
889
|
}
|
|
890
|
-
if (!await
|
|
891
|
-
throw new
|
|
890
|
+
if (!await hn(i, t, p, h))
|
|
891
|
+
throw new Jt();
|
|
892
892
|
let m;
|
|
893
893
|
if (o)
|
|
894
894
|
try {
|
|
895
|
-
m =
|
|
895
|
+
m = j(e.payload);
|
|
896
896
|
} catch {
|
|
897
897
|
throw new A("Failed to base64url decode the payload");
|
|
898
898
|
}
|
|
899
|
-
else typeof e.payload == "string" ? m =
|
|
899
|
+
else typeof e.payload == "string" ? m = X.encode(e.payload) : m = e.payload;
|
|
900
900
|
const u = { payload: m };
|
|
901
901
|
return e.protected !== void 0 && (u.protectedHeader = r), e.header !== void 0 && (u.unprotectedHeader = e.header), y ? { ...u, key: t } : u;
|
|
902
902
|
}
|
|
903
|
-
async function
|
|
904
|
-
if (e instanceof Uint8Array && (e =
|
|
903
|
+
async function fn(e, t, n) {
|
|
904
|
+
if (e instanceof Uint8Array && (e = B.decode(e)), typeof e != "string")
|
|
905
905
|
throw new A("Compact JWS must be a string or Uint8Array");
|
|
906
906
|
const { 0: r, 1: a, 2: s, length: o } = e.split(".");
|
|
907
907
|
if (o !== 3)
|
|
908
908
|
throw new A("Invalid Compact JWS");
|
|
909
|
-
const i = await
|
|
909
|
+
const i = await pn({ payload: a, protected: r, signature: s }, t, n), l = { payload: i.payload, protectedHeader: i.protectedHeader };
|
|
910
910
|
return typeof t == "function" ? { ...l, key: i.key } : l;
|
|
911
911
|
}
|
|
912
|
-
const
|
|
913
|
-
const t =
|
|
912
|
+
const yn = (e) => Math.floor(e.getTime() / 1e3), tt = 60, nt = tt * 60, Re = nt * 24, gn = Re * 7, mn = Re * 365.25, wn = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Ne = (e) => {
|
|
913
|
+
const t = wn.exec(e);
|
|
914
914
|
if (!t || t[4] && t[1])
|
|
915
915
|
throw new TypeError("Invalid time period format");
|
|
916
916
|
const n = parseFloat(t[2]), r = t[3].toLowerCase();
|
|
@@ -928,40 +928,40 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
|
|
|
928
928
|
case "min":
|
|
929
929
|
case "mins":
|
|
930
930
|
case "m":
|
|
931
|
-
a = Math.round(n *
|
|
931
|
+
a = Math.round(n * tt);
|
|
932
932
|
break;
|
|
933
933
|
case "hour":
|
|
934
934
|
case "hours":
|
|
935
935
|
case "hr":
|
|
936
936
|
case "hrs":
|
|
937
937
|
case "h":
|
|
938
|
-
a = Math.round(n *
|
|
938
|
+
a = Math.round(n * nt);
|
|
939
939
|
break;
|
|
940
940
|
case "day":
|
|
941
941
|
case "days":
|
|
942
942
|
case "d":
|
|
943
|
-
a = Math.round(n *
|
|
943
|
+
a = Math.round(n * Re);
|
|
944
944
|
break;
|
|
945
945
|
case "week":
|
|
946
946
|
case "weeks":
|
|
947
947
|
case "w":
|
|
948
|
-
a = Math.round(n *
|
|
948
|
+
a = Math.round(n * gn);
|
|
949
949
|
break;
|
|
950
950
|
default:
|
|
951
|
-
a = Math.round(n *
|
|
951
|
+
a = Math.round(n * mn);
|
|
952
952
|
break;
|
|
953
953
|
}
|
|
954
954
|
return t[1] === "-" || t[4] === "ago" ? -a : a;
|
|
955
|
-
},
|
|
955
|
+
}, De = (e) => e.toLowerCase().replace(/^application\//, ""), En = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Sn = (e, t, n = {}) => {
|
|
956
956
|
let r;
|
|
957
957
|
try {
|
|
958
|
-
r = JSON.parse(
|
|
958
|
+
r = JSON.parse(B.decode(t));
|
|
959
959
|
} catch {
|
|
960
960
|
}
|
|
961
961
|
if (!ue(r))
|
|
962
|
-
throw new
|
|
962
|
+
throw new C("JWT Claims Set must be a top-level JSON object");
|
|
963
963
|
const { typ: a } = n;
|
|
964
|
-
if (a && (typeof e.typ != "string" ||
|
|
964
|
+
if (a && (typeof e.typ != "string" || De(e.typ) !== De(a)))
|
|
965
965
|
throw new _('unexpected "typ" JWT header value', r, "typ", "check_failed");
|
|
966
966
|
const { requiredClaims: s = [], issuer: o, subject: i, audience: l, maxTokenAge: y } = n, h = [...s];
|
|
967
967
|
y !== void 0 && h.push("iat"), l !== void 0 && h.push("aud"), i !== void 0 && h.push("sub"), o !== void 0 && h.push("iss");
|
|
@@ -972,12 +972,12 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
|
|
|
972
972
|
throw new _('unexpected "iss" claim value', r, "iss", "check_failed");
|
|
973
973
|
if (i && r.sub !== i)
|
|
974
974
|
throw new _('unexpected "sub" claim value', r, "sub", "check_failed");
|
|
975
|
-
if (l && !
|
|
975
|
+
if (l && !En(r.aud, typeof l == "string" ? [l] : l))
|
|
976
976
|
throw new _('unexpected "aud" claim value', r, "aud", "check_failed");
|
|
977
977
|
let p;
|
|
978
978
|
switch (typeof n.clockTolerance) {
|
|
979
979
|
case "string":
|
|
980
|
-
p =
|
|
980
|
+
p = Ne(n.clockTolerance);
|
|
981
981
|
break;
|
|
982
982
|
case "number":
|
|
983
983
|
p = n.clockTolerance;
|
|
@@ -988,7 +988,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
|
|
|
988
988
|
default:
|
|
989
989
|
throw new TypeError("Invalid clockTolerance option type");
|
|
990
990
|
}
|
|
991
|
-
const { currentDate: m } = n, u =
|
|
991
|
+
const { currentDate: m } = n, u = yn(m || /* @__PURE__ */ new Date());
|
|
992
992
|
if ((r.iat !== void 0 || y) && typeof r.iat != "number")
|
|
993
993
|
throw new _('"iat" claim must be a number', r, "iat", "invalid");
|
|
994
994
|
if (r.nbf !== void 0) {
|
|
@@ -1004,7 +1004,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
|
|
|
1004
1004
|
throw new Ce('"exp" claim timestamp check failed', r, "exp", "check_failed");
|
|
1005
1005
|
}
|
|
1006
1006
|
if (y) {
|
|
1007
|
-
const d = u - r.iat, g = typeof y == "number" ? y :
|
|
1007
|
+
const d = u - r.iat, g = typeof y == "number" ? y : Ne(y);
|
|
1008
1008
|
if (d - p > g)
|
|
1009
1009
|
throw new Ce('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
|
|
1010
1010
|
if (d < 0 - p)
|
|
@@ -1012,53 +1012,53 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
|
|
|
1012
1012
|
}
|
|
1013
1013
|
return r;
|
|
1014
1014
|
};
|
|
1015
|
-
async function
|
|
1015
|
+
async function An(e, t, n) {
|
|
1016
1016
|
var r;
|
|
1017
|
-
const a = await
|
|
1017
|
+
const a = await fn(e, t, n);
|
|
1018
1018
|
if ((r = a.protectedHeader.crit) != null && r.includes("b64") && a.protectedHeader.b64 === !1)
|
|
1019
|
-
throw new
|
|
1020
|
-
const s = { payload:
|
|
1019
|
+
throw new C("JWTs MUST NOT use unencoded payload");
|
|
1020
|
+
const s = { payload: Sn(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
|
|
1021
1021
|
return typeof t == "function" ? { ...s, key: a.key } : s;
|
|
1022
1022
|
}
|
|
1023
|
-
const
|
|
1024
|
-
function
|
|
1023
|
+
const Tn = j;
|
|
1024
|
+
function Rn(e) {
|
|
1025
1025
|
if (typeof e != "string")
|
|
1026
|
-
throw new
|
|
1026
|
+
throw new C("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
1027
1027
|
const { 1: t, length: n } = e.split(".");
|
|
1028
1028
|
if (n === 5)
|
|
1029
|
-
throw new
|
|
1029
|
+
throw new C("Only JWTs using Compact JWS serialization can be decoded");
|
|
1030
1030
|
if (n !== 3)
|
|
1031
|
-
throw new
|
|
1031
|
+
throw new C("Invalid JWT");
|
|
1032
1032
|
if (!t)
|
|
1033
|
-
throw new
|
|
1033
|
+
throw new C("JWTs must contain a payload");
|
|
1034
1034
|
let r;
|
|
1035
1035
|
try {
|
|
1036
|
-
r =
|
|
1036
|
+
r = Tn(t);
|
|
1037
1037
|
} catch {
|
|
1038
|
-
throw new
|
|
1038
|
+
throw new C("Failed to base64url decode the payload");
|
|
1039
1039
|
}
|
|
1040
1040
|
let a;
|
|
1041
1041
|
try {
|
|
1042
|
-
a = JSON.parse(
|
|
1042
|
+
a = JSON.parse(B.decode(r));
|
|
1043
1043
|
} catch {
|
|
1044
|
-
throw new
|
|
1044
|
+
throw new C("Failed to parse the decoded payload as JSON");
|
|
1045
1045
|
}
|
|
1046
1046
|
if (!ue(a))
|
|
1047
|
-
throw new
|
|
1047
|
+
throw new C("Invalid JWT Claims Set");
|
|
1048
1048
|
return a;
|
|
1049
1049
|
}
|
|
1050
|
-
const
|
|
1050
|
+
const M = async (e) => {
|
|
1051
1051
|
try {
|
|
1052
|
-
const t = T.ALG, n = await
|
|
1053
|
-
return await
|
|
1052
|
+
const t = T.ALG, n = await rn(Wt, t);
|
|
1053
|
+
return await An(e, n, {
|
|
1054
1054
|
issuer: T.ISSUER
|
|
1055
1055
|
});
|
|
1056
1056
|
} catch {
|
|
1057
1057
|
return;
|
|
1058
1058
|
}
|
|
1059
|
-
},
|
|
1059
|
+
}, bn = (e) => {
|
|
1060
1060
|
try {
|
|
1061
|
-
return
|
|
1061
|
+
return Rn(e);
|
|
1062
1062
|
} catch {
|
|
1063
1063
|
return;
|
|
1064
1064
|
}
|
|
@@ -1066,47 +1066,47 @@ const x = async (e) => {
|
|
|
1066
1066
|
var E = [];
|
|
1067
1067
|
for (var we = 0; we < 256; ++we)
|
|
1068
1068
|
E.push((we + 256).toString(16).slice(1));
|
|
1069
|
-
function
|
|
1069
|
+
function In(e, t = 0) {
|
|
1070
1070
|
return (E[e[t + 0]] + E[e[t + 1]] + E[e[t + 2]] + E[e[t + 3]] + "-" + E[e[t + 4]] + E[e[t + 5]] + "-" + E[e[t + 6]] + E[e[t + 7]] + "-" + E[e[t + 8]] + E[e[t + 9]] + "-" + E[e[t + 10]] + E[e[t + 11]] + E[e[t + 12]] + E[e[t + 13]] + E[e[t + 14]] + E[e[t + 15]]).toLowerCase();
|
|
1071
1071
|
}
|
|
1072
|
-
var
|
|
1073
|
-
function
|
|
1074
|
-
if (!
|
|
1072
|
+
var ee, _n = new Uint8Array(16);
|
|
1073
|
+
function vn() {
|
|
1074
|
+
if (!ee && (ee = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ee))
|
|
1075
1075
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1076
|
-
return
|
|
1076
|
+
return ee(_n);
|
|
1077
1077
|
}
|
|
1078
1078
|
var kn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1079
|
-
const
|
|
1079
|
+
const Ue = {
|
|
1080
1080
|
randomUUID: kn
|
|
1081
1081
|
};
|
|
1082
|
-
function
|
|
1083
|
-
if (
|
|
1084
|
-
return
|
|
1082
|
+
function $e(e, t, n) {
|
|
1083
|
+
if (Ue.randomUUID && !t && !e)
|
|
1084
|
+
return Ue.randomUUID();
|
|
1085
1085
|
e = e || {};
|
|
1086
|
-
var r = e.random || (e.rng ||
|
|
1087
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1086
|
+
var r = e.random || (e.rng || vn)();
|
|
1087
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, In(r);
|
|
1088
1088
|
}
|
|
1089
|
-
const
|
|
1089
|
+
const Ke = globalThis.crypto, Cn = (e) => `${$e()}${$e()}`.slice(0, e), Pn = (e) => btoa(
|
|
1090
1090
|
[...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
|
|
1091
1091
|
);
|
|
1092
|
-
async function
|
|
1093
|
-
if (!
|
|
1092
|
+
async function On(e) {
|
|
1093
|
+
if (!Ke.subtle)
|
|
1094
1094
|
throw new Error(
|
|
1095
1095
|
"crypto.subtle is available only in secure contexts (HTTPS)."
|
|
1096
1096
|
);
|
|
1097
|
-
const t = new TextEncoder().encode(e), n = await
|
|
1098
|
-
return
|
|
1097
|
+
const t = new TextEncoder().encode(e), n = await Ke.subtle.digest("SHA-256", t);
|
|
1098
|
+
return Pn(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1099
1099
|
}
|
|
1100
|
-
async function
|
|
1101
|
-
const n = Cn(43), r = await
|
|
1100
|
+
async function Nn(e) {
|
|
1101
|
+
const n = Cn(43), r = await On(n);
|
|
1102
1102
|
return {
|
|
1103
1103
|
code_verifier: n,
|
|
1104
1104
|
code_challenge: r
|
|
1105
1105
|
};
|
|
1106
1106
|
}
|
|
1107
|
-
const
|
|
1107
|
+
const Pr = async (e, t) => {
|
|
1108
1108
|
var n;
|
|
1109
|
-
const r = await
|
|
1109
|
+
const r = await M(e);
|
|
1110
1110
|
if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[T.SCOPES_KEY]))
|
|
1111
1111
|
return !1;
|
|
1112
1112
|
const a = r.payload[T.SCOPES_KEY];
|
|
@@ -1114,39 +1114,39 @@ const Cr = async (e, t) => {
|
|
|
1114
1114
|
(s) => t[s].every((o) => a.includes(o))
|
|
1115
1115
|
);
|
|
1116
1116
|
};
|
|
1117
|
-
function
|
|
1117
|
+
function rt(e, t) {
|
|
1118
1118
|
window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
|
|
1119
1119
|
}
|
|
1120
|
-
const
|
|
1120
|
+
const He = (e, t) => {
|
|
1121
1121
|
const n = JSON.stringify(
|
|
1122
1122
|
typeof t == "function" ? t() : t
|
|
1123
1123
|
);
|
|
1124
|
-
window.localStorage.setItem(e, n),
|
|
1125
|
-
},
|
|
1126
|
-
window.localStorage.removeItem(e),
|
|
1127
|
-
},
|
|
1128
|
-
function
|
|
1124
|
+
window.localStorage.setItem(e, n), rt(e, n);
|
|
1125
|
+
}, Dn = (e) => {
|
|
1126
|
+
window.localStorage.removeItem(e), rt(e, null);
|
|
1127
|
+
}, Le = (e) => window.localStorage.getItem(e), Un = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
|
|
1128
|
+
function te({
|
|
1129
1129
|
key: e,
|
|
1130
1130
|
initialValue: t
|
|
1131
1131
|
}) {
|
|
1132
|
-
const n = kt(
|
|
1132
|
+
const n = kt(Un, () => Le(e)), r = x(
|
|
1133
1133
|
(o) => {
|
|
1134
1134
|
try {
|
|
1135
1135
|
const i = typeof o == "function" ? o(JSON.parse(n)) : o;
|
|
1136
|
-
i == null ?
|
|
1136
|
+
i == null ? Dn(e) : He(e, i);
|
|
1137
1137
|
} catch (i) {
|
|
1138
1138
|
console.warn(i);
|
|
1139
1139
|
}
|
|
1140
1140
|
},
|
|
1141
1141
|
[e, n]
|
|
1142
|
-
), a =
|
|
1142
|
+
), a = x(() => {
|
|
1143
1143
|
r(t);
|
|
1144
|
-
}, [t, r]), s =
|
|
1144
|
+
}, [t, r]), s = x(() => {
|
|
1145
1145
|
r(null);
|
|
1146
1146
|
}, [r]);
|
|
1147
|
-
return
|
|
1147
|
+
return Ae(() => {
|
|
1148
1148
|
try {
|
|
1149
|
-
|
|
1149
|
+
Le(e) === null && typeof t < "u" && He(e, t);
|
|
1150
1150
|
} catch (o) {
|
|
1151
1151
|
console.warn(o);
|
|
1152
1152
|
}
|
|
@@ -1155,25 +1155,25 @@ function ee({
|
|
|
1155
1155
|
var S = [];
|
|
1156
1156
|
for (var Ee = 0; Ee < 256; ++Ee)
|
|
1157
1157
|
S.push((Ee + 256).toString(16).slice(1));
|
|
1158
|
-
function
|
|
1158
|
+
function $n(e, t = 0) {
|
|
1159
1159
|
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();
|
|
1160
1160
|
}
|
|
1161
|
-
var
|
|
1162
|
-
function
|
|
1163
|
-
if (!
|
|
1161
|
+
var ne, Kn = new Uint8Array(16);
|
|
1162
|
+
function Hn() {
|
|
1163
|
+
if (!ne && (ne = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ne))
|
|
1164
1164
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1165
|
-
return
|
|
1165
|
+
return ne(Kn);
|
|
1166
1166
|
}
|
|
1167
|
-
var
|
|
1168
|
-
const
|
|
1169
|
-
randomUUID:
|
|
1167
|
+
var Ln = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1168
|
+
const We = {
|
|
1169
|
+
randomUUID: Ln
|
|
1170
1170
|
};
|
|
1171
1171
|
function Se(e, t, n) {
|
|
1172
|
-
if (
|
|
1173
|
-
return
|
|
1172
|
+
if (We.randomUUID && !t && !e)
|
|
1173
|
+
return We.randomUUID();
|
|
1174
1174
|
e = e || {};
|
|
1175
|
-
var r = e.random || (e.rng ||
|
|
1176
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1175
|
+
var r = e.random || (e.rng || Hn)();
|
|
1176
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, $n(r);
|
|
1177
1177
|
}
|
|
1178
1178
|
/*!
|
|
1179
1179
|
@versini/ui-fingerprint v1.0.1
|
|
@@ -1188,20 +1188,20 @@ try {
|
|
|
1188
1188
|
});
|
|
1189
1189
|
} catch {
|
|
1190
1190
|
}
|
|
1191
|
-
const
|
|
1191
|
+
const Wn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), at = async (e) => {
|
|
1192
1192
|
if (e === "")
|
|
1193
1193
|
return "";
|
|
1194
1194
|
const t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
1195
1195
|
return Array.from(new Uint8Array(n)).map((r) => r.toString(16).padStart(2, "0")).join("");
|
|
1196
1196
|
};
|
|
1197
|
-
function
|
|
1197
|
+
function xe(e, t) {
|
|
1198
1198
|
return new Promise((n) => setTimeout(n, e, t));
|
|
1199
1199
|
}
|
|
1200
|
-
async function
|
|
1200
|
+
async function xn(e, t, n = 50) {
|
|
1201
1201
|
var r, a, s;
|
|
1202
1202
|
const o = document;
|
|
1203
1203
|
for (; !o.body; )
|
|
1204
|
-
await
|
|
1204
|
+
await xe(n);
|
|
1205
1205
|
const i = o.createElement("iframe");
|
|
1206
1206
|
try {
|
|
1207
1207
|
for (await new Promise((l, y) => {
|
|
@@ -1220,20 +1220,20 @@ async function Mn(e, t, n = 50) {
|
|
|
1220
1220
|
};
|
|
1221
1221
|
d();
|
|
1222
1222
|
}); !((a = (r = i.contentWindow) == null ? void 0 : r.document) != null && a.body); )
|
|
1223
|
-
await
|
|
1223
|
+
await xe(n);
|
|
1224
1224
|
return await e(i, i.contentWindow);
|
|
1225
1225
|
} finally {
|
|
1226
1226
|
(s = i.parentNode) == null || s.removeChild(i);
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
|
-
const
|
|
1229
|
+
const Mn = {
|
|
1230
1230
|
audio: {
|
|
1231
1231
|
sampleHash: "",
|
|
1232
1232
|
oscillator: "",
|
|
1233
1233
|
maxChannels: 0,
|
|
1234
1234
|
channelCountMode: ""
|
|
1235
1235
|
}
|
|
1236
|
-
},
|
|
1236
|
+
}, Gn = async (e) => new Promise((t) => {
|
|
1237
1237
|
try {
|
|
1238
1238
|
const n = new window.OfflineAudioContext(1, 5e3, 44100), r = n.createBufferSource(), a = n.createOscillator();
|
|
1239
1239
|
a.frequency.value = 1e3;
|
|
@@ -1242,7 +1242,7 @@ const Gn = {
|
|
|
1242
1242
|
const i = o.renderedBuffer.getChannelData(0);
|
|
1243
1243
|
a.disconnect(), s.disconnect(), t({
|
|
1244
1244
|
audio: {
|
|
1245
|
-
sampleHash:
|
|
1245
|
+
sampleHash: Wn(i),
|
|
1246
1246
|
oscillator: a.type,
|
|
1247
1247
|
maxChannels: n.destination.maxChannelCount,
|
|
1248
1248
|
channelCountMode: r.channelCountMode
|
|
@@ -1259,25 +1259,25 @@ const Gn = {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
});
|
|
1261
1261
|
}
|
|
1262
|
-
}),
|
|
1262
|
+
}), ot = { browser: "" }, Jn = async (e) => typeof navigator > "u" ? ot : { browser: navigator.userAgent }, st = {
|
|
1263
1263
|
canvas: {
|
|
1264
1264
|
data: ""
|
|
1265
1265
|
}
|
|
1266
|
-
},
|
|
1266
|
+
}, Yn = async (e) => {
|
|
1267
1267
|
try {
|
|
1268
1268
|
const t = Array.from(
|
|
1269
1269
|
{ length: 3 },
|
|
1270
|
-
() =>
|
|
1271
|
-
), n =
|
|
1270
|
+
() => Vn(300, 30)
|
|
1271
|
+
), n = Fn(t, 300, 30);
|
|
1272
1272
|
return {
|
|
1273
1273
|
canvas: {
|
|
1274
|
-
data: (await
|
|
1274
|
+
data: (await at(n.data.toString())).toString()
|
|
1275
1275
|
}
|
|
1276
1276
|
};
|
|
1277
1277
|
} catch {
|
|
1278
|
-
return
|
|
1278
|
+
return st;
|
|
1279
1279
|
}
|
|
1280
|
-
},
|
|
1280
|
+
}, Vn = (e, t) => {
|
|
1281
1281
|
const n = document.createElement("canvas"), r = n.getContext("2d");
|
|
1282
1282
|
if (!r)
|
|
1283
1283
|
return new ImageData(1, 1);
|
|
@@ -1286,7 +1286,7 @@ const Gn = {
|
|
|
1286
1286
|
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);
|
|
1287
1287
|
const s = "mmMwWLliI0O&1 - Les sanglots longs des violons de l'automne blessent mon coeur d'une langueur monotone";
|
|
1288
1288
|
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);
|
|
1289
|
-
},
|
|
1289
|
+
}, jn = (e) => {
|
|
1290
1290
|
if (e.length === 0)
|
|
1291
1291
|
return 0;
|
|
1292
1292
|
const t = {};
|
|
@@ -1296,17 +1296,17 @@ const Gn = {
|
|
|
1296
1296
|
for (const r in t)
|
|
1297
1297
|
t[r] > t[n] && (n = parseInt(r, 10));
|
|
1298
1298
|
return n;
|
|
1299
|
-
},
|
|
1299
|
+
}, Fn = (e, t, n) => {
|
|
1300
1300
|
const r = [];
|
|
1301
1301
|
for (let o = 0; o < e[0].data.length; o++) {
|
|
1302
1302
|
const i = [];
|
|
1303
1303
|
for (let l = 0; l < e.length; l++)
|
|
1304
1304
|
i.push(e[l].data[o]);
|
|
1305
|
-
r.push(
|
|
1305
|
+
r.push(jn(i));
|
|
1306
1306
|
}
|
|
1307
1307
|
const a = r, s = new Uint8ClampedArray(a);
|
|
1308
1308
|
return new ImageData(s, t, n);
|
|
1309
|
-
},
|
|
1309
|
+
}, Bn = [], qn = "mmMwWLliI0O&1", zn = "48px", $ = ["monospace", "sans-serif", "serif"], Me = [
|
|
1310
1310
|
"sans-serif-thin",
|
|
1311
1311
|
"ARNO PRO",
|
|
1312
1312
|
"Agency FB",
|
|
@@ -1344,17 +1344,17 @@ const Gn = {
|
|
|
1344
1344
|
"TRAJAN PRO",
|
|
1345
1345
|
"Univers CE 55 Medium",
|
|
1346
1346
|
"ZWAdobeF"
|
|
1347
|
-
],
|
|
1347
|
+
], Qn = async (e) => xn(async (t, { document: n }) => {
|
|
1348
1348
|
const r = n.body;
|
|
1349
|
-
r.style.fontSize =
|
|
1349
|
+
r.style.fontSize = zn;
|
|
1350
1350
|
const a = n.createElement("div");
|
|
1351
1351
|
a.style.setProperty("visibility", "hidden", "important");
|
|
1352
1352
|
const s = {}, o = {}, i = (d) => {
|
|
1353
1353
|
const g = n.createElement("span"), { style: R } = g;
|
|
1354
|
-
return R.position = "absolute", R.top = "0", R.left = "0", R.fontFamily = d, g.textContent =
|
|
1354
|
+
return R.position = "absolute", R.top = "0", R.left = "0", R.fontFamily = d, g.textContent = qn, a.appendChild(g), g;
|
|
1355
1355
|
}, l = (d, g) => i(`'${d}',${g}`), y = () => $.map(i), h = () => {
|
|
1356
1356
|
const d = {};
|
|
1357
|
-
for (const g of
|
|
1357
|
+
for (const g of Me)
|
|
1358
1358
|
d[g] = $.map(
|
|
1359
1359
|
(R) => l(g, R)
|
|
1360
1360
|
);
|
|
@@ -1365,23 +1365,23 @@ const Gn = {
|
|
|
1365
1365
|
r.appendChild(a);
|
|
1366
1366
|
for (let d = 0; d < $.length; d++)
|
|
1367
1367
|
s[$[d]] = m[d].offsetWidth, o[$[d]] = m[d].offsetHeight;
|
|
1368
|
-
return
|
|
1369
|
-
}),
|
|
1368
|
+
return Me.filter((d) => p(u[d]));
|
|
1369
|
+
}), it = {
|
|
1370
1370
|
vendor: "",
|
|
1371
1371
|
vendorUnmasked: "",
|
|
1372
1372
|
renderer: "",
|
|
1373
1373
|
rendererUnmasked: "",
|
|
1374
1374
|
version: "",
|
|
1375
1375
|
shadingLanguageVersion: ""
|
|
1376
|
-
},
|
|
1376
|
+
}, ct = {
|
|
1377
1377
|
hardware: {
|
|
1378
|
-
videocard:
|
|
1378
|
+
videocard: it,
|
|
1379
1379
|
architecture: 0,
|
|
1380
1380
|
deviceMemory: "undefined",
|
|
1381
1381
|
jsHeapSizeLimit: 0
|
|
1382
1382
|
}
|
|
1383
1383
|
};
|
|
1384
|
-
function
|
|
1384
|
+
function Xn() {
|
|
1385
1385
|
const e = document.createElement("canvas"), t = e.getContext("webgl") ?? e.getContext("experimental-webgl");
|
|
1386
1386
|
if (t && "getParameter" in t) {
|
|
1387
1387
|
const n = t.getExtension("WEBGL_debug_renderer_info");
|
|
@@ -1394,41 +1394,41 @@ function Zn() {
|
|
|
1394
1394
|
shadingLanguageVersion: (t.getParameter(t.SHADING_LANGUAGE_VERSION) || "").toString()
|
|
1395
1395
|
};
|
|
1396
1396
|
}
|
|
1397
|
-
return
|
|
1397
|
+
return it;
|
|
1398
1398
|
}
|
|
1399
|
-
function
|
|
1399
|
+
function Zn() {
|
|
1400
1400
|
const e = new Float32Array(1), t = new Uint8Array(e.buffer);
|
|
1401
1401
|
return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
|
|
1402
1402
|
}
|
|
1403
|
-
const
|
|
1403
|
+
const er = () => navigator.deviceMemory || 0, tr = () => window.performance && window.performance.memory || {
|
|
1404
1404
|
jsHeapSizeLimit: 0
|
|
1405
|
-
},
|
|
1405
|
+
}, nr = async (e) => new Promise((t) => {
|
|
1406
1406
|
try {
|
|
1407
|
-
const n =
|
|
1407
|
+
const n = er(), r = tr();
|
|
1408
1408
|
t({
|
|
1409
1409
|
hardware: {
|
|
1410
|
-
videocard:
|
|
1411
|
-
architecture:
|
|
1410
|
+
videocard: Xn(),
|
|
1411
|
+
architecture: Zn(),
|
|
1412
1412
|
deviceMemory: n.toString() || "undefined",
|
|
1413
1413
|
jsHeapSizeLimit: r.jsHeapSizeLimit || 0
|
|
1414
1414
|
}
|
|
1415
1415
|
});
|
|
1416
1416
|
} catch {
|
|
1417
|
-
t(
|
|
1417
|
+
t(ct);
|
|
1418
1418
|
}
|
|
1419
|
-
}),
|
|
1419
|
+
}), rr = {
|
|
1420
1420
|
locales: {
|
|
1421
1421
|
languages: "",
|
|
1422
1422
|
timezone: ""
|
|
1423
1423
|
}
|
|
1424
|
-
},
|
|
1424
|
+
}, ar = async (e) => new Promise((t) => {
|
|
1425
1425
|
t({
|
|
1426
1426
|
locales: {
|
|
1427
1427
|
languages: navigator.language,
|
|
1428
1428
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
1429
1429
|
}
|
|
1430
1430
|
});
|
|
1431
|
-
}),
|
|
1431
|
+
}), ut = {
|
|
1432
1432
|
screen: {
|
|
1433
1433
|
colorDepth: 0,
|
|
1434
1434
|
pixelDepth: 0,
|
|
@@ -1436,7 +1436,7 @@ const tr = () => navigator.deviceMemory || 0, nr = () => window.performance && w
|
|
|
1436
1436
|
maxTouchPoints: 0,
|
|
1437
1437
|
mediaMatches: []
|
|
1438
1438
|
}
|
|
1439
|
-
},
|
|
1439
|
+
}, or = async (e) => new Promise((t) => {
|
|
1440
1440
|
try {
|
|
1441
1441
|
const n = window.screen, r = {
|
|
1442
1442
|
screen: {
|
|
@@ -1444,15 +1444,15 @@ const tr = () => navigator.deviceMemory || 0, nr = () => window.performance && w
|
|
|
1444
1444
|
pixelDepth: n.pixelDepth,
|
|
1445
1445
|
isTouchScreen: navigator.maxTouchPoints > 0,
|
|
1446
1446
|
maxTouchPoints: navigator.maxTouchPoints,
|
|
1447
|
-
mediaMatches:
|
|
1447
|
+
mediaMatches: sr()
|
|
1448
1448
|
}
|
|
1449
1449
|
};
|
|
1450
1450
|
t(r);
|
|
1451
1451
|
} catch {
|
|
1452
|
-
t(
|
|
1452
|
+
t(ut);
|
|
1453
1453
|
}
|
|
1454
1454
|
});
|
|
1455
|
-
function
|
|
1455
|
+
function sr() {
|
|
1456
1456
|
const e = [], t = {
|
|
1457
1457
|
"prefers-contrast": [
|
|
1458
1458
|
"high",
|
|
@@ -1480,7 +1480,7 @@ function ir() {
|
|
|
1480
1480
|
});
|
|
1481
1481
|
}), e;
|
|
1482
1482
|
}
|
|
1483
|
-
const
|
|
1483
|
+
const ir = async (e) => {
|
|
1484
1484
|
try {
|
|
1485
1485
|
return {
|
|
1486
1486
|
system: {
|
|
@@ -1491,52 +1491,52 @@ const cr = async (e) => {
|
|
|
1491
1491
|
}
|
|
1492
1492
|
};
|
|
1493
1493
|
} catch {
|
|
1494
|
-
return
|
|
1494
|
+
return lt;
|
|
1495
1495
|
}
|
|
1496
|
-
},
|
|
1496
|
+
}, lt = {
|
|
1497
1497
|
system: {
|
|
1498
1498
|
platform: "",
|
|
1499
1499
|
cookieEnabled: !1,
|
|
1500
1500
|
productSub: "",
|
|
1501
1501
|
product: ""
|
|
1502
1502
|
}
|
|
1503
|
-
},
|
|
1503
|
+
}, cr = async (e) => {
|
|
1504
1504
|
try {
|
|
1505
1505
|
return Promise.all([
|
|
1506
|
+
Gn(),
|
|
1506
1507
|
Jn(),
|
|
1507
1508
|
Yn(),
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1509
|
+
Qn(),
|
|
1510
|
+
nr(),
|
|
1511
|
+
ar(),
|
|
1511
1512
|
or(),
|
|
1512
|
-
|
|
1513
|
-
cr()
|
|
1513
|
+
ir()
|
|
1514
1514
|
]);
|
|
1515
1515
|
} catch {
|
|
1516
1516
|
return [
|
|
1517
|
-
|
|
1517
|
+
Mn,
|
|
1518
|
+
ot,
|
|
1518
1519
|
st,
|
|
1519
|
-
|
|
1520
|
-
|
|
1520
|
+
Bn,
|
|
1521
|
+
ct,
|
|
1522
|
+
rr,
|
|
1521
1523
|
ut,
|
|
1522
|
-
|
|
1523
|
-
lt,
|
|
1524
|
-
dt
|
|
1524
|
+
lt
|
|
1525
1525
|
];
|
|
1526
1526
|
}
|
|
1527
|
-
},
|
|
1527
|
+
}, ur = async (e) => {
|
|
1528
1528
|
try {
|
|
1529
|
-
const t = await
|
|
1530
|
-
return await
|
|
1529
|
+
const t = await cr();
|
|
1530
|
+
return await at(JSON.stringify(t));
|
|
1531
1531
|
} catch {
|
|
1532
1532
|
return "";
|
|
1533
1533
|
}
|
|
1534
|
-
},
|
|
1534
|
+
}, K = "Oops! It looks like your session has expired. For your security, please log in again to continue.", lr = "Your session has been successfully terminated.", re = "Login failed. Please try again.", dr = "Error getting access token, please re-authenticate.", hr = "You forgot to wrap your component in <AuthProvider>.", le = {
|
|
1535
1535
|
dev: "https://auth.gizmette.local.com:3003",
|
|
1536
1536
|
prod: "https://mylogin.gizmette.com/auth"
|
|
1537
|
-
}, ae = "@@auth@@",
|
|
1537
|
+
}, ae = "@@auth@@", Y = "LOADING", V = "LOGIN", dt = "LOGOUT", pr = process.env.NODE_ENV === "production", ht = !pr, fr = (e) => {
|
|
1538
1538
|
try {
|
|
1539
|
-
const t =
|
|
1539
|
+
const t = bn(e);
|
|
1540
1540
|
return t ? t[T.USER_ID_KEY] : "";
|
|
1541
1541
|
} catch {
|
|
1542
1542
|
return "";
|
|
@@ -1548,13 +1548,13 @@ const cr = async (e) => {
|
|
|
1548
1548
|
}) => {
|
|
1549
1549
|
try {
|
|
1550
1550
|
const r = await fetch(
|
|
1551
|
-
|
|
1551
|
+
ht ? `${le.dev}/${e}` : `${le.prod}/${e}`,
|
|
1552
1552
|
{
|
|
1553
1553
|
credentials: "include",
|
|
1554
1554
|
method: "POST",
|
|
1555
1555
|
headers: {
|
|
1556
1556
|
"Content-Type": "application/json",
|
|
1557
|
-
[
|
|
1557
|
+
[Fe.CLIENT_ID]: `${t}`
|
|
1558
1558
|
},
|
|
1559
1559
|
body: JSON.stringify(n)
|
|
1560
1560
|
}
|
|
@@ -1597,7 +1597,7 @@ const cr = async (e) => {
|
|
|
1597
1597
|
status: !1
|
|
1598
1598
|
};
|
|
1599
1599
|
}
|
|
1600
|
-
},
|
|
1600
|
+
}, Ge = async ({
|
|
1601
1601
|
username: e,
|
|
1602
1602
|
password: t,
|
|
1603
1603
|
clientId: n,
|
|
@@ -1614,7 +1614,7 @@ const cr = async (e) => {
|
|
|
1614
1614
|
type: de.AUTHENTICATE,
|
|
1615
1615
|
clientId: n,
|
|
1616
1616
|
params: {
|
|
1617
|
-
type: a ||
|
|
1617
|
+
type: a || F.ID_AND_ACCESS_TOKEN,
|
|
1618
1618
|
username: e,
|
|
1619
1619
|
password: t,
|
|
1620
1620
|
sessionExpiration: s,
|
|
@@ -1624,7 +1624,7 @@ const cr = async (e) => {
|
|
|
1624
1624
|
domain: l,
|
|
1625
1625
|
fingerprint: y
|
|
1626
1626
|
}
|
|
1627
|
-
}), p = await
|
|
1627
|
+
}), p = await M(h.data.idToken);
|
|
1628
1628
|
return p && p.payload[T.USER_ID_KEY] !== "" && p.payload[T.NONCE_KEY] === r ? {
|
|
1629
1629
|
idToken: h.data.idToken,
|
|
1630
1630
|
accessToken: h.data.accessToken,
|
|
@@ -1649,7 +1649,7 @@ const cr = async (e) => {
|
|
|
1649
1649
|
type: de.CODE,
|
|
1650
1650
|
clientId: t,
|
|
1651
1651
|
params: {
|
|
1652
|
-
type:
|
|
1652
|
+
type: F.CODE,
|
|
1653
1653
|
nonce: e,
|
|
1654
1654
|
code_challenge: n
|
|
1655
1655
|
}
|
|
@@ -1678,15 +1678,15 @@ const cr = async (e) => {
|
|
|
1678
1678
|
type: de.AUTHENTICATE,
|
|
1679
1679
|
clientId: e,
|
|
1680
1680
|
params: {
|
|
1681
|
-
type:
|
|
1681
|
+
type: F.REFRESH_TOKEN,
|
|
1682
1682
|
userId: t,
|
|
1683
1683
|
nonce: n,
|
|
1684
1684
|
refreshToken: r,
|
|
1685
1685
|
accessToken: a,
|
|
1686
1686
|
domain: s,
|
|
1687
|
-
fingerprint: await
|
|
1687
|
+
fingerprint: await pt()
|
|
1688
1688
|
}
|
|
1689
|
-
}), i = await
|
|
1689
|
+
}), i = await M(o.data.accessToken);
|
|
1690
1690
|
return i && i.payload[T.USER_ID_KEY] !== "" && i.payload[T.NONCE_KEY] === n ? {
|
|
1691
1691
|
accessToken: o.data.accessToken,
|
|
1692
1692
|
refreshToken: o.data.refreshToken,
|
|
@@ -1778,7 +1778,7 @@ const cr = async (e) => {
|
|
|
1778
1778
|
username,
|
|
1779
1779
|
}
|
|
1780
1780
|
}`
|
|
1781
|
-
},
|
|
1781
|
+
}, H = {
|
|
1782
1782
|
GET_REGISTRATION_OPTIONS: {
|
|
1783
1783
|
schema: oe.GET_REGISTRATION_OPTIONS,
|
|
1784
1784
|
method: "getPasskeyRegistrationOptions"
|
|
@@ -1795,7 +1795,7 @@ const cr = async (e) => {
|
|
|
1795
1795
|
schema: oe.VERIFY_AUTHENTICATION,
|
|
1796
1796
|
method: "verifyPasskeyAuthentication"
|
|
1797
1797
|
}
|
|
1798
|
-
},
|
|
1798
|
+
}, L = async ({
|
|
1799
1799
|
accessToken: e,
|
|
1800
1800
|
type: t,
|
|
1801
1801
|
clientId: n,
|
|
@@ -1803,7 +1803,7 @@ const cr = async (e) => {
|
|
|
1803
1803
|
}) => {
|
|
1804
1804
|
try {
|
|
1805
1805
|
const a = t != null && t.data ? t.data(r) : r, s = `Bearer ${e}`, o = await fetch(
|
|
1806
|
-
|
|
1806
|
+
ht ? `${le.dev}/graphql` : `${le.prod}/graphql`,
|
|
1807
1807
|
{
|
|
1808
1808
|
method: "POST",
|
|
1809
1809
|
credentials: "include",
|
|
@@ -1811,7 +1811,7 @@ const cr = async (e) => {
|
|
|
1811
1811
|
authorization: s,
|
|
1812
1812
|
"Content-Type": "application/json",
|
|
1813
1813
|
Accept: "application/json",
|
|
1814
|
-
[
|
|
1814
|
+
[Fe.CLIENT_ID]: `${n}`
|
|
1815
1815
|
},
|
|
1816
1816
|
body: JSON.stringify({
|
|
1817
1817
|
query: t.schema,
|
|
@@ -1830,18 +1830,18 @@ const cr = async (e) => {
|
|
|
1830
1830
|
} catch (a) {
|
|
1831
1831
|
return console.error(a), { status: 500, data: [] };
|
|
1832
1832
|
}
|
|
1833
|
-
},
|
|
1833
|
+
}, pt = async () => {
|
|
1834
1834
|
try {
|
|
1835
|
-
return await
|
|
1835
|
+
return await ur();
|
|
1836
1836
|
} catch {
|
|
1837
1837
|
return "";
|
|
1838
1838
|
}
|
|
1839
1839
|
};
|
|
1840
1840
|
class wr {
|
|
1841
1841
|
constructor(t = null, n = null) {
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1842
|
+
Q(this, "refreshTokenPromise", null);
|
|
1843
|
+
Q(this, "accessToken");
|
|
1844
|
+
Q(this, "refreshToken");
|
|
1845
1845
|
this.accessToken = t || "", this.refreshToken = n || "";
|
|
1846
1846
|
}
|
|
1847
1847
|
async refreshtoken({
|
|
@@ -1868,7 +1868,7 @@ class wr {
|
|
|
1868
1868
|
nonce: r,
|
|
1869
1869
|
domain: a
|
|
1870
1870
|
}) {
|
|
1871
|
-
const s = await
|
|
1871
|
+
const s = await M(this.refreshToken);
|
|
1872
1872
|
if (s && s.payload[T.USER_ID_KEY] !== "") {
|
|
1873
1873
|
const o = await mr({
|
|
1874
1874
|
clientId: t,
|
|
@@ -1891,25 +1891,25 @@ class wr {
|
|
|
1891
1891
|
};
|
|
1892
1892
|
}
|
|
1893
1893
|
}
|
|
1894
|
-
const Er = (e) =>
|
|
1894
|
+
const Er = (e) => x(
|
|
1895
1895
|
(...t) => {
|
|
1896
1896
|
e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
|
|
1897
1897
|
},
|
|
1898
1898
|
[e]
|
|
1899
|
-
),
|
|
1899
|
+
), W = () => {
|
|
1900
1900
|
throw new Error(hr);
|
|
1901
|
-
},
|
|
1901
|
+
}, ft = Ct({
|
|
1902
1902
|
isAuthenticated: !1,
|
|
1903
1903
|
isLoading: !1,
|
|
1904
1904
|
authenticationType: null,
|
|
1905
|
-
login:
|
|
1906
|
-
logout:
|
|
1907
|
-
getAccessToken:
|
|
1908
|
-
getIdToken:
|
|
1909
|
-
registeringForPasskey:
|
|
1910
|
-
loginWithPasskey:
|
|
1905
|
+
login: W,
|
|
1906
|
+
logout: W,
|
|
1907
|
+
getAccessToken: W,
|
|
1908
|
+
getIdToken: W,
|
|
1909
|
+
registeringForPasskey: W,
|
|
1910
|
+
loginWithPasskey: W,
|
|
1911
1911
|
logoutReason: ""
|
|
1912
|
-
}), Sr =
|
|
1912
|
+
}), Sr = vt.createContext({
|
|
1913
1913
|
state: {
|
|
1914
1914
|
isLoading: !0,
|
|
1915
1915
|
isAuthenticated: !1,
|
|
@@ -1920,17 +1920,17 @@ const Er = (e) => W(
|
|
|
1920
1920
|
},
|
|
1921
1921
|
dispatch: () => {
|
|
1922
1922
|
}
|
|
1923
|
-
}), Ar = (e, t) => (t == null ? void 0 : t.type) ===
|
|
1923
|
+
}), Ar = (e, t) => (t == null ? void 0 : t.type) === Y ? {
|
|
1924
1924
|
...e,
|
|
1925
1925
|
isLoading: t.payload.isLoading
|
|
1926
|
-
} : (t == null ? void 0 : t.type) ===
|
|
1926
|
+
} : (t == null ? void 0 : t.type) === V ? {
|
|
1927
1927
|
...e,
|
|
1928
1928
|
isLoading: !1,
|
|
1929
1929
|
isAuthenticated: !0,
|
|
1930
1930
|
user: t.payload.user,
|
|
1931
1931
|
authenticationType: t.payload.authenticationType,
|
|
1932
1932
|
logoutReason: ""
|
|
1933
|
-
} : (t == null ? void 0 : t.type) ===
|
|
1933
|
+
} : (t == null ? void 0 : t.type) === dt ? {
|
|
1934
1934
|
...e,
|
|
1935
1935
|
isLoading: !1,
|
|
1936
1936
|
isAuthenticated: !1,
|
|
@@ -1944,37 +1944,37 @@ const Er = (e) => W(
|
|
|
1944
1944
|
domain: r = "",
|
|
1945
1945
|
debug: a = !1
|
|
1946
1946
|
}) => {
|
|
1947
|
-
const [s, o] =
|
|
1947
|
+
const [s, o] = Pt(Ar, {
|
|
1948
1948
|
isLoading: !0,
|
|
1949
1949
|
isAuthenticated: !1,
|
|
1950
1950
|
authenticationType: null,
|
|
1951
1951
|
user: void 0,
|
|
1952
1952
|
logoutReason: "",
|
|
1953
1953
|
debug: a
|
|
1954
|
-
}), i = Er(a), l = ke(!1), y = ke(""), [h, p, , m] =
|
|
1954
|
+
}), i = Er(a), l = ke(!1), y = ke(""), [h, p, , m] = te({
|
|
1955
1955
|
key: `${ae}::${n}::@@user@@`
|
|
1956
|
-
}), [u, d, , g] =
|
|
1956
|
+
}), [u, d, , g] = te({
|
|
1957
1957
|
key: `${ae}::${n}::@@access@@`
|
|
1958
|
-
}), [R,
|
|
1958
|
+
}), [R, q, , z] = te(
|
|
1959
1959
|
{
|
|
1960
1960
|
key: `${ae}::${n}::@@refresh@@`
|
|
1961
1961
|
}
|
|
1962
|
-
), [
|
|
1962
|
+
), [yt, be, , Ie] = te({
|
|
1963
1963
|
key: `${ae}::${n}::@@nonce@@`
|
|
1964
|
-
}),
|
|
1964
|
+
}), gt = new wr(u, R), U = x(
|
|
1965
1965
|
(c) => {
|
|
1966
1966
|
i(
|
|
1967
1967
|
"removeStateAndLocalStorage: removing state and local storage with reason: ",
|
|
1968
1968
|
c
|
|
1969
1969
|
), o({
|
|
1970
|
-
type:
|
|
1970
|
+
type: dt,
|
|
1971
1971
|
payload: {
|
|
1972
|
-
logoutReason: c ||
|
|
1972
|
+
logoutReason: c || K
|
|
1973
1973
|
}
|
|
1974
|
-
}), m(), g(),
|
|
1974
|
+
}), m(), g(), z(), Ie(), o({ type: Y, payload: { isLoading: !1 } });
|
|
1975
1975
|
},
|
|
1976
|
-
[g, m,
|
|
1977
|
-
), N =
|
|
1976
|
+
[g, m, Ie, z, i]
|
|
1977
|
+
), N = x(
|
|
1978
1978
|
async (c) => {
|
|
1979
1979
|
i("invalidateAndLogout: invalidating and logging out");
|
|
1980
1980
|
const { user: w } = s, f = (w == null ? void 0 : w.userId) || fr(h);
|
|
@@ -1987,7 +1987,7 @@ const Er = (e) => W(
|
|
|
1987
1987
|
refreshToken: R,
|
|
1988
1988
|
clientId: n,
|
|
1989
1989
|
domain: r
|
|
1990
|
-
}), U(c ||
|
|
1990
|
+
}), U(c || K);
|
|
1991
1991
|
},
|
|
1992
1992
|
[
|
|
1993
1993
|
u,
|
|
@@ -2000,15 +2000,15 @@ const Er = (e) => W(
|
|
|
2000
2000
|
i
|
|
2001
2001
|
]
|
|
2002
2002
|
);
|
|
2003
|
-
|
|
2003
|
+
Ae(() => ((async () => (i("useEffect: setting the fingerprint"), y.current = await pt()))(), () => {
|
|
2004
2004
|
i("useEffect: cleaning up the fingerprint"), y.current = "";
|
|
2005
|
-
}), []),
|
|
2005
|
+
}), []), Ae(() => {
|
|
2006
2006
|
if (!l.current)
|
|
2007
2007
|
return s.isLoading && h !== null ? (async () => {
|
|
2008
2008
|
try {
|
|
2009
|
-
const c = await
|
|
2009
|
+
const c = await M(h);
|
|
2010
2010
|
c && c.payload[T.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), o({
|
|
2011
|
-
type:
|
|
2011
|
+
type: V,
|
|
2012
2012
|
payload: {
|
|
2013
2013
|
authenticationType: c.payload[T.AUTH_TYPE_KEY],
|
|
2014
2014
|
user: {
|
|
@@ -2016,43 +2016,43 @@ const Er = (e) => W(
|
|
|
2016
2016
|
username: c.payload[T.USERNAME_KEY]
|
|
2017
2017
|
}
|
|
2018
2018
|
}
|
|
2019
|
-
})) : (i("useEffect: invalid JWT, invalidating and logging out"), await N(
|
|
2019
|
+
})) : (i("useEffect: invalid JWT, invalidating and logging out"), await N(K));
|
|
2020
2020
|
} catch {
|
|
2021
2021
|
i(
|
|
2022
2022
|
"useEffect: exception validating JWT, invalidating and logging out"
|
|
2023
|
-
), await N(
|
|
2023
|
+
), await N(K);
|
|
2024
2024
|
}
|
|
2025
|
-
})() : (i("useEffect: setting the loading state to false"), o({ type:
|
|
2025
|
+
})() : (i("useEffect: setting the loading state to false"), o({ type: Y, payload: { isLoading: !1 } })), () => {
|
|
2026
2026
|
l.current = !0;
|
|
2027
2027
|
};
|
|
2028
2028
|
}, [s.isLoading, h, N, i]);
|
|
2029
|
-
const
|
|
2029
|
+
const mt = async (c, w, f) => {
|
|
2030
2030
|
const I = Se();
|
|
2031
|
-
if (
|
|
2032
|
-
const { code_verifier:
|
|
2031
|
+
if (be(I), o({ type: Y, payload: { isLoading: !0 } }), m(), g(), z(), i("login: Logging in with type: ", f), f === F.CODE) {
|
|
2032
|
+
const { code_verifier: Rt, code_challenge: bt } = await Nn(), _e = await gr({
|
|
2033
2033
|
nonce: I,
|
|
2034
2034
|
clientId: n,
|
|
2035
|
-
code_challenge:
|
|
2035
|
+
code_challenge: bt
|
|
2036
2036
|
});
|
|
2037
|
-
if (
|
|
2038
|
-
const
|
|
2037
|
+
if (_e.status) {
|
|
2038
|
+
const J = await Ge({
|
|
2039
2039
|
username: c,
|
|
2040
2040
|
password: w,
|
|
2041
2041
|
clientId: n,
|
|
2042
2042
|
sessionExpiration: t,
|
|
2043
2043
|
nonce: I,
|
|
2044
2044
|
type: f,
|
|
2045
|
-
code:
|
|
2046
|
-
code_verifier:
|
|
2045
|
+
code: _e.code,
|
|
2046
|
+
code_verifier: Rt,
|
|
2047
2047
|
domain: r,
|
|
2048
2048
|
fingerprint: y.current
|
|
2049
2049
|
});
|
|
2050
|
-
return
|
|
2051
|
-
type:
|
|
2050
|
+
return J.status ? (p(J.idToken), d(J.accessToken), q(J.refreshToken), o({
|
|
2051
|
+
type: V,
|
|
2052
2052
|
payload: {
|
|
2053
2053
|
authenticationType: f,
|
|
2054
2054
|
user: {
|
|
2055
|
-
userId:
|
|
2055
|
+
userId: J.userId,
|
|
2056
2056
|
username: c
|
|
2057
2057
|
}
|
|
2058
2058
|
}
|
|
@@ -2060,7 +2060,7 @@ const Er = (e) => W(
|
|
|
2060
2060
|
}
|
|
2061
2061
|
return !1;
|
|
2062
2062
|
}
|
|
2063
|
-
const
|
|
2063
|
+
const G = await Ge({
|
|
2064
2064
|
username: c,
|
|
2065
2065
|
password: w,
|
|
2066
2066
|
clientId: n,
|
|
@@ -2070,54 +2070,56 @@ const Er = (e) => W(
|
|
|
2070
2070
|
domain: r,
|
|
2071
2071
|
fingerprint: y.current
|
|
2072
2072
|
});
|
|
2073
|
-
return
|
|
2074
|
-
type:
|
|
2073
|
+
return G.status ? (p(G.idToken), d(G.accessToken), q(G.refreshToken), o({
|
|
2074
|
+
type: V,
|
|
2075
2075
|
payload: {
|
|
2076
2076
|
authenticationType: f,
|
|
2077
2077
|
user: {
|
|
2078
|
-
userId:
|
|
2078
|
+
userId: G.userId,
|
|
2079
2079
|
username: c
|
|
2080
2080
|
}
|
|
2081
2081
|
}
|
|
2082
2082
|
}), !0) : (U(re), !1);
|
|
2083
|
-
},
|
|
2084
|
-
c == null || c.preventDefault(), await N(
|
|
2085
|
-
},
|
|
2083
|
+
}, wt = async (c) => {
|
|
2084
|
+
c == null || c.preventDefault(), await N(lr);
|
|
2085
|
+
}, Et = async () => {
|
|
2086
2086
|
const { isAuthenticated: c, user: w } = s;
|
|
2087
2087
|
try {
|
|
2088
2088
|
if (c && w && w.userId) {
|
|
2089
2089
|
if (u) {
|
|
2090
2090
|
i("getAccessToken");
|
|
2091
|
-
const I = await
|
|
2091
|
+
const I = await M(u);
|
|
2092
2092
|
if (I && I.payload[T.USER_ID_KEY] !== "")
|
|
2093
2093
|
return u;
|
|
2094
2094
|
}
|
|
2095
|
-
i("getAccessToken: invalid access token,
|
|
2096
|
-
const f = await
|
|
2095
|
+
i("getAccessToken: invalid access token, trying to refresh it");
|
|
2096
|
+
const f = await gt.refreshtoken({
|
|
2097
2097
|
clientId: n,
|
|
2098
2098
|
userId: w.userId,
|
|
2099
|
-
nonce:
|
|
2099
|
+
nonce: yt,
|
|
2100
2100
|
domain: r
|
|
2101
2101
|
});
|
|
2102
|
-
return f.status && f.status === "success" ? (d(f.newAccessToken),
|
|
2102
|
+
return f.status && f.status === "success" ? (d(f.newAccessToken), q(f.newRefreshToken), f.newAccessToken) : (i(
|
|
2103
|
+
"getAccessToken: invalid refresh token, need to re-authenticate"
|
|
2104
|
+
), await N(K), "");
|
|
2103
2105
|
}
|
|
2104
2106
|
return i(
|
|
2105
2107
|
"getAccessToken: user is not authenticated, cannot get access token"
|
|
2106
|
-
), await N(
|
|
2108
|
+
), await N(K), "";
|
|
2107
2109
|
} catch {
|
|
2108
2110
|
return i(
|
|
2109
2111
|
"getAccessToken: exception occurred, invalidating and logging out"
|
|
2110
|
-
), await N(
|
|
2112
|
+
), await N(dr), "";
|
|
2111
2113
|
}
|
|
2112
|
-
},
|
|
2114
|
+
}, St = () => {
|
|
2113
2115
|
if (s.isAuthenticated && h)
|
|
2114
2116
|
return h;
|
|
2115
|
-
},
|
|
2117
|
+
}, At = async () => {
|
|
2116
2118
|
const { user: c } = s;
|
|
2117
|
-
let w = await
|
|
2119
|
+
let w = await L({
|
|
2118
2120
|
accessToken: u,
|
|
2119
2121
|
clientId: n,
|
|
2120
|
-
type:
|
|
2122
|
+
type: H.GET_REGISTRATION_OPTIONS,
|
|
2121
2123
|
params: {
|
|
2122
2124
|
clientId: n,
|
|
2123
2125
|
id: c == null ? void 0 : c.userId,
|
|
@@ -2126,11 +2128,11 @@ const Er = (e) => W(
|
|
|
2126
2128
|
});
|
|
2127
2129
|
if (w.status)
|
|
2128
2130
|
try {
|
|
2129
|
-
const f = await
|
|
2130
|
-
w = await
|
|
2131
|
+
const f = await $t(w.data);
|
|
2132
|
+
w = await L({
|
|
2131
2133
|
accessToken: u,
|
|
2132
2134
|
clientId: n,
|
|
2133
|
-
type:
|
|
2135
|
+
type: H.VERIFY_REGISTRATION,
|
|
2134
2136
|
params: {
|
|
2135
2137
|
clientId: n,
|
|
2136
2138
|
id: c == null ? void 0 : c.userId,
|
|
@@ -2139,10 +2141,10 @@ const Er = (e) => W(
|
|
|
2139
2141
|
}
|
|
2140
2142
|
});
|
|
2141
2143
|
} catch {
|
|
2142
|
-
return await
|
|
2144
|
+
return await L({
|
|
2143
2145
|
accessToken: u,
|
|
2144
2146
|
clientId: n,
|
|
2145
|
-
type:
|
|
2147
|
+
type: H.VERIFY_REGISTRATION,
|
|
2146
2148
|
params: {
|
|
2147
2149
|
clientId: n,
|
|
2148
2150
|
id: c == null ? void 0 : c.userId,
|
|
@@ -2151,14 +2153,14 @@ const Er = (e) => W(
|
|
|
2151
2153
|
}
|
|
2152
2154
|
}), !1;
|
|
2153
2155
|
}
|
|
2154
|
-
},
|
|
2156
|
+
}, Tt = async () => {
|
|
2155
2157
|
const c = Se();
|
|
2156
|
-
|
|
2158
|
+
be(c), o({ type: Y, payload: { isLoading: !0 } }), m(), g(), z(), i("loginWithPasskey");
|
|
2157
2159
|
const w = Se();
|
|
2158
|
-
let f = await
|
|
2160
|
+
let f = await L({
|
|
2159
2161
|
accessToken: u,
|
|
2160
2162
|
clientId: n,
|
|
2161
|
-
type:
|
|
2163
|
+
type: H.GET_AUTHENTICATION_OPTIONS,
|
|
2162
2164
|
params: {
|
|
2163
2165
|
id: w,
|
|
2164
2166
|
clientId: n
|
|
@@ -2166,11 +2168,11 @@ const Er = (e) => W(
|
|
|
2166
2168
|
});
|
|
2167
2169
|
if (f.status)
|
|
2168
2170
|
try {
|
|
2169
|
-
const I = await
|
|
2170
|
-
return f = await
|
|
2171
|
+
const I = await Lt(f.data);
|
|
2172
|
+
return f = await L({
|
|
2171
2173
|
accessToken: u,
|
|
2172
2174
|
clientId: n,
|
|
2173
|
-
type:
|
|
2175
|
+
type: H.VERIFY_AUTHENTICATION,
|
|
2174
2176
|
params: {
|
|
2175
2177
|
clientId: n,
|
|
2176
2178
|
id: w,
|
|
@@ -2179,10 +2181,10 @@ const Er = (e) => W(
|
|
|
2179
2181
|
domain: r,
|
|
2180
2182
|
fingerprint: y.current
|
|
2181
2183
|
}
|
|
2182
|
-
}), f.data.status === "success" ? (p(f.data.idToken), d(f.data.accessToken),
|
|
2183
|
-
type:
|
|
2184
|
+
}), f.data.status === "success" ? (p(f.data.idToken), d(f.data.accessToken), q(f.data.refreshToken), o({
|
|
2185
|
+
type: V,
|
|
2184
2186
|
payload: {
|
|
2185
|
-
authenticationType:
|
|
2187
|
+
authenticationType: F.PASSKEY,
|
|
2186
2188
|
user: {
|
|
2187
2189
|
userId: f.data.userId,
|
|
2188
2190
|
username: f.data.username
|
|
@@ -2190,10 +2192,10 @@ const Er = (e) => W(
|
|
|
2190
2192
|
}
|
|
2191
2193
|
}), !0) : (U(re), !1);
|
|
2192
2194
|
} catch {
|
|
2193
|
-
return await
|
|
2195
|
+
return await L({
|
|
2194
2196
|
accessToken: u,
|
|
2195
2197
|
clientId: n,
|
|
2196
|
-
type:
|
|
2198
|
+
type: H.VERIFY_AUTHENTICATION,
|
|
2197
2199
|
params: {
|
|
2198
2200
|
clientId: n,
|
|
2199
2201
|
id: w,
|
|
@@ -2204,25 +2206,25 @@ const Er = (e) => W(
|
|
|
2204
2206
|
}), U(re), !1;
|
|
2205
2207
|
}
|
|
2206
2208
|
};
|
|
2207
|
-
return /* @__PURE__ */
|
|
2208
|
-
|
|
2209
|
+
return /* @__PURE__ */ ve(Sr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ve(
|
|
2210
|
+
ft.Provider,
|
|
2209
2211
|
{
|
|
2210
2212
|
value: {
|
|
2211
2213
|
...s,
|
|
2212
|
-
login:
|
|
2213
|
-
logout:
|
|
2214
|
-
getAccessToken:
|
|
2215
|
-
getIdToken:
|
|
2216
|
-
registeringForPasskey:
|
|
2217
|
-
loginWithPasskey:
|
|
2214
|
+
login: mt,
|
|
2215
|
+
logout: wt,
|
|
2216
|
+
getAccessToken: Et,
|
|
2217
|
+
getIdToken: St,
|
|
2218
|
+
registeringForPasskey: At,
|
|
2219
|
+
loginWithPasskey: Tt
|
|
2218
2220
|
},
|
|
2219
2221
|
children: e
|
|
2220
2222
|
}
|
|
2221
2223
|
) });
|
|
2222
|
-
}, Nr = (e =
|
|
2224
|
+
}, Nr = (e = ft) => Ot(e);
|
|
2223
2225
|
export {
|
|
2224
|
-
|
|
2226
|
+
F as AUTH_TYPES,
|
|
2225
2227
|
Or as AuthProvider,
|
|
2226
|
-
|
|
2228
|
+
Pr as isGranted,
|
|
2227
2229
|
Nr as useAuth
|
|
2228
2230
|
};
|