@versini/auth-provider 6.2.0 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +400 -358
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var _t = Object.defineProperty;
|
|
2
2
|
var vt = (e, t, n) => t in e ? _t(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import kt, { useSyncExternalStore as Pt, useCallback as x, useEffect as
|
|
3
|
+
var z = (e, t, n) => vt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsx as ke } from "react/jsx-runtime";
|
|
5
|
+
import kt, { useSyncExternalStore as Pt, useCallback as x, useEffect as Te, createContext as Ct, useReducer as Ot, useRef as Pe, useContext as Nt } from "react";
|
|
6
6
|
/*!
|
|
7
|
-
@versini/auth-provider v6.2.
|
|
7
|
+
@versini/auth-provider v6.2.1
|
|
8
8
|
© 2024 gizmette.com
|
|
9
9
|
*/
|
|
10
10
|
try {
|
|
11
11
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
12
|
-
version: "6.2.
|
|
13
|
-
buildTime: "07/18/2024
|
|
12
|
+
version: "6.2.1",
|
|
13
|
+
buildTime: "07/18/2024 12:26 PM EDT",
|
|
14
14
|
homepage: "https://github.com/aversini/auth-client",
|
|
15
15
|
license: "MIT"
|
|
16
16
|
});
|
|
@@ -23,20 +23,20 @@ function k(e) {
|
|
|
23
23
|
n += String.fromCharCode(a);
|
|
24
24
|
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function ie(e) {
|
|
27
27
|
const t = e.replace(/-/g, "+").replace(/_/g, "/"), n = (4 - t.length % 4) % 4, r = t.padEnd(t.length + n, "="), a = atob(r), s = new ArrayBuffer(a.length), o = new Uint8Array(s);
|
|
28
28
|
for (let i = 0; i < a.length; i++)
|
|
29
29
|
o[i] = a.charCodeAt(i);
|
|
30
30
|
return s;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Re() {
|
|
33
33
|
return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
|
|
34
34
|
}
|
|
35
35
|
function Ve(e) {
|
|
36
36
|
const { id: t } = e;
|
|
37
37
|
return {
|
|
38
38
|
...e,
|
|
39
|
-
id:
|
|
39
|
+
id: ie(t),
|
|
40
40
|
transports: e.transports
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -143,20 +143,20 @@ class Ut {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
const je = new Ut(), $t = ["cross-platform", "platform"];
|
|
146
|
-
function
|
|
146
|
+
function Fe(e) {
|
|
147
147
|
if (e && !($t.indexOf(e) < 0))
|
|
148
148
|
return e;
|
|
149
149
|
}
|
|
150
|
-
async function
|
|
150
|
+
async function Kt(e) {
|
|
151
151
|
var p;
|
|
152
|
-
if (!
|
|
152
|
+
if (!Re())
|
|
153
153
|
throw new Error("WebAuthn is not supported in this browser");
|
|
154
154
|
const n = { publicKey: {
|
|
155
155
|
...e,
|
|
156
|
-
challenge:
|
|
156
|
+
challenge: ie(e.challenge),
|
|
157
157
|
user: {
|
|
158
158
|
...e.user,
|
|
159
|
-
id:
|
|
159
|
+
id: ie(e.user.id)
|
|
160
160
|
},
|
|
161
161
|
excludeCredentials: (p = e.excludeCredentials) == null ? void 0 : p.map(Ve)
|
|
162
162
|
} };
|
|
@@ -172,27 +172,27 @@ async function Ht(e) {
|
|
|
172
172
|
const { id: a, rawId: s, response: o, type: i } = r;
|
|
173
173
|
let u;
|
|
174
174
|
typeof o.getTransports == "function" && (u = o.getTransports());
|
|
175
|
-
let
|
|
175
|
+
let f;
|
|
176
176
|
if (typeof o.getPublicKeyAlgorithm == "function")
|
|
177
177
|
try {
|
|
178
|
-
|
|
178
|
+
f = o.getPublicKeyAlgorithm();
|
|
179
179
|
} catch (l) {
|
|
180
|
-
|
|
180
|
+
fe("getPublicKeyAlgorithm()", l);
|
|
181
181
|
}
|
|
182
|
-
let
|
|
182
|
+
let y;
|
|
183
183
|
if (typeof o.getPublicKey == "function")
|
|
184
184
|
try {
|
|
185
185
|
const l = o.getPublicKey();
|
|
186
|
-
l !== null && (
|
|
186
|
+
l !== null && (y = k(l));
|
|
187
187
|
} catch (l) {
|
|
188
|
-
|
|
188
|
+
fe("getPublicKey()", l);
|
|
189
189
|
}
|
|
190
190
|
let h;
|
|
191
191
|
if (typeof o.getAuthenticatorData == "function")
|
|
192
192
|
try {
|
|
193
193
|
h = k(o.getAuthenticatorData());
|
|
194
194
|
} catch (l) {
|
|
195
|
-
|
|
195
|
+
fe("getAuthenticatorData()", l);
|
|
196
196
|
}
|
|
197
197
|
return {
|
|
198
198
|
id: a,
|
|
@@ -201,21 +201,21 @@ async function Ht(e) {
|
|
|
201
201
|
attestationObject: k(o.attestationObject),
|
|
202
202
|
clientDataJSON: k(o.clientDataJSON),
|
|
203
203
|
transports: u,
|
|
204
|
-
publicKeyAlgorithm:
|
|
205
|
-
publicKey:
|
|
204
|
+
publicKeyAlgorithm: f,
|
|
205
|
+
publicKey: y,
|
|
206
206
|
authenticatorData: h
|
|
207
207
|
},
|
|
208
208
|
type: i,
|
|
209
209
|
clientExtensionResults: r.getClientExtensionResults(),
|
|
210
|
-
authenticatorAttachment:
|
|
210
|
+
authenticatorAttachment: Fe(r.authenticatorAttachment)
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
|
-
function
|
|
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 Ht() {
|
|
218
|
+
if (!Re())
|
|
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();
|
|
@@ -261,19 +261,19 @@ function Lt({ error: e, options: t }) {
|
|
|
261
261
|
}
|
|
262
262
|
return e;
|
|
263
263
|
}
|
|
264
|
-
async function
|
|
264
|
+
async function Wt(e, t = !1) {
|
|
265
265
|
var h, p;
|
|
266
|
-
if (!
|
|
266
|
+
if (!Re())
|
|
267
267
|
throw new Error("WebAuthn is not supported in this browser");
|
|
268
268
|
let n;
|
|
269
269
|
((h = e.allowCredentials) == null ? void 0 : h.length) !== 0 && (n = (p = e.allowCredentials) == null ? void 0 : p.map(Ve));
|
|
270
270
|
const r = {
|
|
271
271
|
...e,
|
|
272
|
-
challenge:
|
|
272
|
+
challenge: ie(e.challenge),
|
|
273
273
|
allowCredentials: n
|
|
274
274
|
}, a = {};
|
|
275
275
|
if (t) {
|
|
276
|
-
if (!await
|
|
276
|
+
if (!await Ht())
|
|
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');
|
|
@@ -288,20 +288,20 @@ async function xt(e, t = !1) {
|
|
|
288
288
|
}
|
|
289
289
|
if (!s)
|
|
290
290
|
throw new Error("Authentication was not completed");
|
|
291
|
-
const { id: o, rawId: i, response: u, type:
|
|
292
|
-
let
|
|
293
|
-
return u.userHandle && (
|
|
291
|
+
const { id: o, rawId: i, response: u, type: f } = s;
|
|
292
|
+
let y;
|
|
293
|
+
return u.userHandle && (y = k(u.userHandle)), {
|
|
294
294
|
id: o,
|
|
295
295
|
rawId: k(i),
|
|
296
296
|
response: {
|
|
297
297
|
authenticatorData: k(u.authenticatorData),
|
|
298
298
|
clientDataJSON: k(u.clientDataJSON),
|
|
299
299
|
signature: k(u.signature),
|
|
300
|
-
userHandle:
|
|
300
|
+
userHandle: y
|
|
301
301
|
},
|
|
302
|
-
type:
|
|
302
|
+
type: f,
|
|
303
303
|
clientExtensionResults: s.getClientExtensionResults(),
|
|
304
|
-
authenticatorAttachment:
|
|
304
|
+
authenticatorAttachment: Fe(s.authenticatorAttachment)
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
307
|
/*!
|
|
@@ -311,13 +311,13 @@ async function xt(e, t = !1) {
|
|
|
311
311
|
try {
|
|
312
312
|
window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
|
|
313
313
|
version: "2.12.1",
|
|
314
|
-
buildTime: "07/18/2024
|
|
314
|
+
buildTime: "07/18/2024 12:26 PM 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 j = {
|
|
321
321
|
ID_TOKEN: "id_token",
|
|
322
322
|
ACCESS_TOKEN: "token",
|
|
323
323
|
ID_AND_ACCESS_TOKEN: "id_token token",
|
|
@@ -334,7 +334,7 @@ const Y = {
|
|
|
334
334
|
USERNAME_KEY: "username",
|
|
335
335
|
AUTH_TYPE_KEY: "auth_type",
|
|
336
336
|
ISSUER: "gizmette.com"
|
|
337
|
-
},
|
|
337
|
+
}, xt = `-----BEGIN PUBLIC KEY-----
|
|
338
338
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
|
|
339
339
|
w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
|
|
340
340
|
i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
|
|
@@ -342,12 +342,12 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
|
|
|
342
342
|
l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
|
|
343
343
|
sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
|
|
344
344
|
awIDAQAB
|
|
345
|
-
-----END PUBLIC KEY-----`,
|
|
345
|
+
-----END PUBLIC KEY-----`, de = {
|
|
346
346
|
AUTHENTICATE: "authenticate",
|
|
347
347
|
CODE: "code",
|
|
348
348
|
LOGOUT: "logout"
|
|
349
|
-
},
|
|
350
|
-
function
|
|
349
|
+
}, he = crypto, qe = (e) => e instanceof CryptoKey, Q = new TextEncoder(), B = new TextDecoder();
|
|
350
|
+
function Mt(...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)
|
|
@@ -359,16 +359,16 @@ const Gt = (e) => {
|
|
|
359
359
|
for (let r = 0; r < t.length; r++)
|
|
360
360
|
n[r] = t.charCodeAt(r);
|
|
361
361
|
return n;
|
|
362
|
-
},
|
|
362
|
+
}, Y = (e) => {
|
|
363
363
|
let t = e;
|
|
364
|
-
t instanceof Uint8Array && (t =
|
|
364
|
+
t instanceof Uint8Array && (t = B.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
365
365
|
try {
|
|
366
366
|
return Gt(t);
|
|
367
367
|
} catch {
|
|
368
368
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
369
369
|
}
|
|
370
370
|
};
|
|
371
|
-
let
|
|
371
|
+
let U = class extends Error {
|
|
372
372
|
static get code() {
|
|
373
373
|
return "ERR_JOSE_GENERIC";
|
|
374
374
|
}
|
|
@@ -376,14 +376,14 @@ let D = class extends Error {
|
|
|
376
376
|
var n;
|
|
377
377
|
super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
|
|
378
378
|
}
|
|
379
|
-
}, v = class extends
|
|
379
|
+
}, v = class extends U {
|
|
380
380
|
static get code() {
|
|
381
381
|
return "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
382
382
|
}
|
|
383
383
|
constructor(t, n, r = "unspecified", a = "unspecified") {
|
|
384
384
|
super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = r, this.reason = a, this.payload = n;
|
|
385
385
|
}
|
|
386
|
-
},
|
|
386
|
+
}, Ce = class extends U {
|
|
387
387
|
static get code() {
|
|
388
388
|
return "ERR_JWT_EXPIRED";
|
|
389
389
|
}
|
|
@@ -391,7 +391,7 @@ let D = 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 Jt extends U {
|
|
395
395
|
constructor() {
|
|
396
396
|
super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
397
397
|
}
|
|
@@ -399,7 +399,7 @@ class Vt extends D {
|
|
|
399
399
|
return "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
let
|
|
402
|
+
let N = class extends U {
|
|
403
403
|
constructor() {
|
|
404
404
|
super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
|
|
405
405
|
}
|
|
@@ -407,7 +407,7 @@ let O = class extends D {
|
|
|
407
407
|
return "ERR_JOSE_NOT_SUPPORTED";
|
|
408
408
|
}
|
|
409
409
|
};
|
|
410
|
-
class R extends
|
|
410
|
+
class R extends U {
|
|
411
411
|
constructor() {
|
|
412
412
|
super(...arguments), this.code = "ERR_JWS_INVALID";
|
|
413
413
|
}
|
|
@@ -415,7 +415,7 @@ class R extends D {
|
|
|
415
415
|
return "ERR_JWS_INVALID";
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
let
|
|
418
|
+
let C = class extends U {
|
|
419
419
|
constructor() {
|
|
420
420
|
super(...arguments), this.code = "ERR_JWT_INVALID";
|
|
421
421
|
}
|
|
@@ -423,7 +423,7 @@ let qe = class extends D {
|
|
|
423
423
|
return "ERR_JWT_INVALID";
|
|
424
424
|
}
|
|
425
425
|
};
|
|
426
|
-
class
|
|
426
|
+
class Vt extends U {
|
|
427
427
|
constructor() {
|
|
428
428
|
super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
|
|
429
429
|
}
|
|
@@ -434,13 +434,13 @@ class Yt extends D {
|
|
|
434
434
|
function P(e, t = "algorithm.name") {
|
|
435
435
|
return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function X(e, t) {
|
|
438
438
|
return e.name === t;
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function ye(e) {
|
|
441
441
|
return parseInt(e.name.slice(4), 10);
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function Yt(e) {
|
|
444
444
|
switch (e) {
|
|
445
445
|
case "ES256":
|
|
446
446
|
return "P-256";
|
|
@@ -452,7 +452,7 @@ function jt(e) {
|
|
|
452
452
|
throw new Error("unreachable");
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function jt(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,35 +462,35 @@ function Jt(e, t) {
|
|
|
462
462
|
throw new TypeError(n);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function Ft(e, t, ...n) {
|
|
466
466
|
switch (t) {
|
|
467
467
|
case "HS256":
|
|
468
468
|
case "HS384":
|
|
469
469
|
case "HS512": {
|
|
470
|
-
if (!
|
|
470
|
+
if (!X(e.algorithm, "HMAC"))
|
|
471
471
|
throw P("HMAC");
|
|
472
472
|
const r = parseInt(t.slice(2), 10);
|
|
473
|
-
if (
|
|
473
|
+
if (ye(e.algorithm.hash) !== r)
|
|
474
474
|
throw P(`SHA-${r}`, "algorithm.hash");
|
|
475
475
|
break;
|
|
476
476
|
}
|
|
477
477
|
case "RS256":
|
|
478
478
|
case "RS384":
|
|
479
479
|
case "RS512": {
|
|
480
|
-
if (!
|
|
480
|
+
if (!X(e.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
481
481
|
throw P("RSASSA-PKCS1-v1_5");
|
|
482
482
|
const r = parseInt(t.slice(2), 10);
|
|
483
|
-
if (
|
|
483
|
+
if (ye(e.algorithm.hash) !== r)
|
|
484
484
|
throw P(`SHA-${r}`, "algorithm.hash");
|
|
485
485
|
break;
|
|
486
486
|
}
|
|
487
487
|
case "PS256":
|
|
488
488
|
case "PS384":
|
|
489
489
|
case "PS512": {
|
|
490
|
-
if (!
|
|
490
|
+
if (!X(e.algorithm, "RSA-PSS"))
|
|
491
491
|
throw P("RSA-PSS");
|
|
492
492
|
const r = parseInt(t.slice(2), 10);
|
|
493
|
-
if (
|
|
493
|
+
if (ye(e.algorithm.hash) !== r)
|
|
494
494
|
throw P(`SHA-${r}`, "algorithm.hash");
|
|
495
495
|
break;
|
|
496
496
|
}
|
|
@@ -502,9 +502,9 @@ function Bt(e, t, ...n) {
|
|
|
502
502
|
case "ES256":
|
|
503
503
|
case "ES384":
|
|
504
504
|
case "ES512": {
|
|
505
|
-
if (!
|
|
505
|
+
if (!X(e.algorithm, "ECDSA"))
|
|
506
506
|
throw P("ECDSA");
|
|
507
|
-
const r =
|
|
507
|
+
const r = Yt(t);
|
|
508
508
|
if (e.algorithm.namedCurve !== r)
|
|
509
509
|
throw P(r, "algorithm.namedCurve");
|
|
510
510
|
break;
|
|
@@ -512,7 +512,7 @@ function Bt(e, t, ...n) {
|
|
|
512
512
|
default:
|
|
513
513
|
throw new TypeError("CryptoKey does not support this operation");
|
|
514
514
|
}
|
|
515
|
-
|
|
515
|
+
jt(e, n);
|
|
516
516
|
}
|
|
517
517
|
function ze(e, t, ...n) {
|
|
518
518
|
var r;
|
|
@@ -522,11 +522,11 @@ function ze(e, t, ...n) {
|
|
|
522
522
|
} else n.length === 2 ? e += `one of type ${n[0]} or ${n[1]}.` : e += `of type ${n[0]}.`;
|
|
523
523
|
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;
|
|
524
524
|
}
|
|
525
|
-
const
|
|
525
|
+
const Oe = (e, ...t) => ze("Key must be ", e, ...t);
|
|
526
526
|
function Qe(e, t, ...n) {
|
|
527
527
|
return ze(`Key for the ${e} algorithm must be `, t, ...n);
|
|
528
528
|
}
|
|
529
|
-
const Xe = (e) =>
|
|
529
|
+
const Xe = (e) => qe(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", ce = ["CryptoKey"], Bt = (...e) => {
|
|
530
530
|
const t = e.filter(Boolean);
|
|
531
531
|
if (t.length === 0 || t.length === 1)
|
|
532
532
|
return !0;
|
|
@@ -548,7 +548,7 @@ const Xe = (e) => Fe(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) ===
|
|
|
548
548
|
function qt(e) {
|
|
549
549
|
return typeof e == "object" && e !== null;
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function ue(e) {
|
|
552
552
|
if (!qt(e) || Object.prototype.toString.call(e) !== "[object Object]")
|
|
553
553
|
return !1;
|
|
554
554
|
if (Object.getPrototypeOf(e) === null)
|
|
@@ -590,7 +590,7 @@ function Qt(e) {
|
|
|
590
590
|
}, n = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
591
591
|
break;
|
|
592
592
|
default:
|
|
593
|
-
throw new
|
|
593
|
+
throw new N('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
594
594
|
}
|
|
595
595
|
break;
|
|
596
596
|
}
|
|
@@ -612,7 +612,7 @@ function Qt(e) {
|
|
|
612
612
|
t = { name: "ECDH", namedCurve: e.crv }, n = e.d ? ["deriveBits"] : [];
|
|
613
613
|
break;
|
|
614
614
|
default:
|
|
615
|
-
throw new
|
|
615
|
+
throw new N('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
616
616
|
}
|
|
617
617
|
break;
|
|
618
618
|
}
|
|
@@ -628,12 +628,12 @@ function Qt(e) {
|
|
|
628
628
|
t = { name: e.crv }, n = e.d ? ["deriveBits"] : [];
|
|
629
629
|
break;
|
|
630
630
|
default:
|
|
631
|
-
throw new
|
|
631
|
+
throw new N('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
632
632
|
}
|
|
633
633
|
break;
|
|
634
634
|
}
|
|
635
635
|
default:
|
|
636
|
-
throw new
|
|
636
|
+
throw new N('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
637
637
|
}
|
|
638
638
|
return { algorithm: t, keyUsages: n };
|
|
639
639
|
}
|
|
@@ -645,9 +645,9 @@ const Xt = async (e) => {
|
|
|
645
645
|
e.ext ?? !1,
|
|
646
646
|
e.key_ops ?? n
|
|
647
647
|
], a = { ...e };
|
|
648
|
-
return delete a.alg, delete a.use,
|
|
649
|
-
}, Ze = (e) =>
|
|
650
|
-
let
|
|
648
|
+
return delete a.alg, delete a.use, he.subtle.importKey("jwk", a, ...r);
|
|
649
|
+
}, Ze = (e) => Y(e);
|
|
650
|
+
let ge, me;
|
|
651
651
|
const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", tt = async (e, t, n, r) => {
|
|
652
652
|
let a = e.get(t);
|
|
653
653
|
if (a != null && a[r])
|
|
@@ -657,40 +657,40 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
|
|
|
657
657
|
}, Zt = (e, t) => {
|
|
658
658
|
if (et(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 ? Ze(n.k) : (
|
|
660
|
+
return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? Ze(n.k) : (me || (me = /* @__PURE__ */ new WeakMap()), tt(me, e, n, t));
|
|
661
661
|
}
|
|
662
662
|
return e;
|
|
663
663
|
}, en = (e, t) => {
|
|
664
664
|
if (et(e)) {
|
|
665
665
|
let n = e.export({ format: "jwk" });
|
|
666
|
-
return n.k ? Ze(n.k) : (
|
|
666
|
+
return n.k ? Ze(n.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), tt(ge, e, n, t));
|
|
667
667
|
}
|
|
668
668
|
return e;
|
|
669
|
-
}, tn = { normalizePublicKey: Zt, normalizePrivateKey: en },
|
|
669
|
+
}, tn = { normalizePublicKey: Zt, normalizePrivateKey: en }, 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)
|
|
673
673
|
return !1;
|
|
674
674
|
const a = e.subarray(r, r + t.length);
|
|
675
|
-
return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) ||
|
|
676
|
-
},
|
|
675
|
+
return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || O(e, t, r + 1);
|
|
676
|
+
}, Ne = (e) => {
|
|
677
677
|
switch (!0) {
|
|
678
|
-
case
|
|
678
|
+
case O(e, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
679
679
|
return "P-256";
|
|
680
|
-
case
|
|
680
|
+
case O(e, [43, 129, 4, 0, 34]):
|
|
681
681
|
return "P-384";
|
|
682
|
-
case
|
|
682
|
+
case O(e, [43, 129, 4, 0, 35]):
|
|
683
683
|
return "P-521";
|
|
684
|
-
case
|
|
684
|
+
case O(e, [43, 101, 110]):
|
|
685
685
|
return "X25519";
|
|
686
|
-
case
|
|
686
|
+
case O(e, [43, 101, 111]):
|
|
687
687
|
return "X448";
|
|
688
|
-
case
|
|
688
|
+
case O(e, [43, 101, 112]):
|
|
689
689
|
return "Ed25519";
|
|
690
|
-
case
|
|
690
|
+
case O(e, [43, 101, 113]):
|
|
691
691
|
return "Ed448";
|
|
692
692
|
default:
|
|
693
|
-
throw new
|
|
693
|
+
throw new N("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
|
|
694
694
|
}
|
|
695
695
|
}, nn = async (e, t, n, r, a) => {
|
|
696
696
|
let s, o;
|
|
@@ -728,39 +728,39 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
|
|
|
728
728
|
case "ECDH-ES+A128KW":
|
|
729
729
|
case "ECDH-ES+A192KW":
|
|
730
730
|
case "ECDH-ES+A256KW": {
|
|
731
|
-
const u =
|
|
731
|
+
const u = Ne(i);
|
|
732
732
|
s = u.startsWith("P-") ? { name: "ECDH", namedCurve: u } : { name: u }, o = [];
|
|
733
733
|
break;
|
|
734
734
|
}
|
|
735
735
|
case "EdDSA":
|
|
736
|
-
s = { name:
|
|
736
|
+
s = { name: Ne(i) }, o = ["verify"];
|
|
737
737
|
break;
|
|
738
738
|
default:
|
|
739
|
-
throw new
|
|
739
|
+
throw new N('Invalid or unsupported "alg" (Algorithm) value');
|
|
740
740
|
}
|
|
741
|
-
return
|
|
741
|
+
return he.subtle.importKey(t, i, s, !1, o);
|
|
742
742
|
}, rn = (e, t, n) => nn(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
|
|
743
743
|
async function an(e, t, n) {
|
|
744
744
|
if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
745
745
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
746
746
|
return rn(e, t);
|
|
747
747
|
}
|
|
748
|
-
const
|
|
748
|
+
const se = (e) => e == null ? void 0 : e[Symbol.toStringTag], on = (e, t) => {
|
|
749
749
|
if (!(t instanceof Uint8Array)) {
|
|
750
750
|
if (!Xe(t))
|
|
751
|
-
throw new TypeError(Qe(e, t, ...
|
|
751
|
+
throw new TypeError(Qe(e, t, ...ce, "Uint8Array"));
|
|
752
752
|
if (t.type !== "secret")
|
|
753
|
-
throw new TypeError(`${
|
|
753
|
+
throw new TypeError(`${se(t)} instances for symmetric algorithms must be of type "secret"`);
|
|
754
754
|
}
|
|
755
755
|
}, sn = (e, t, n) => {
|
|
756
756
|
if (!Xe(t))
|
|
757
|
-
throw new TypeError(Qe(e, t, ...
|
|
757
|
+
throw new TypeError(Qe(e, t, ...ce));
|
|
758
758
|
if (t.type === "secret")
|
|
759
|
-
throw new TypeError(`${
|
|
759
|
+
throw new TypeError(`${se(t)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
760
760
|
if (t.algorithm && n === "verify" && t.type === "private")
|
|
761
|
-
throw new TypeError(`${
|
|
761
|
+
throw new TypeError(`${se(t)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
762
762
|
if (t.algorithm && n === "encrypt" && t.type === "private")
|
|
763
|
-
throw new TypeError(`${
|
|
763
|
+
throw new TypeError(`${se(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
764
764
|
}, cn = (e, t, n) => {
|
|
765
765
|
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? on(e, t) : sn(e, t, n);
|
|
766
766
|
};
|
|
@@ -775,7 +775,7 @@ function un(e, t, n, r, a) {
|
|
|
775
775
|
n !== void 0 ? s = new Map([...Object.entries(n), ...t.entries()]) : s = t;
|
|
776
776
|
for (const o of r.crit) {
|
|
777
777
|
if (!s.has(o))
|
|
778
|
-
throw new
|
|
778
|
+
throw new N(`Extension Header Parameter "${o}" is not recognized`);
|
|
779
779
|
if (a[o] === void 0)
|
|
780
780
|
throw new e(`Extension Header Parameter "${o}" is missing`);
|
|
781
781
|
if (s.get(o) && r[o] === void 0)
|
|
@@ -811,31 +811,31 @@ function dn(e, t) {
|
|
|
811
811
|
case "EdDSA":
|
|
812
812
|
return { name: t.name };
|
|
813
813
|
default:
|
|
814
|
-
throw new
|
|
814
|
+
throw new N(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
async function hn(e, t, n) {
|
|
818
|
-
if (t = await tn.normalizePublicKey(t, e),
|
|
819
|
-
return
|
|
818
|
+
if (t = await tn.normalizePublicKey(t, e), qe(t))
|
|
819
|
+
return Ft(t, e, n), t;
|
|
820
820
|
if (t instanceof Uint8Array) {
|
|
821
821
|
if (!e.startsWith("HS"))
|
|
822
|
-
throw new TypeError(
|
|
823
|
-
return
|
|
822
|
+
throw new TypeError(Oe(t, ...ce));
|
|
823
|
+
return he.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [n]);
|
|
824
824
|
}
|
|
825
|
-
throw new TypeError(
|
|
825
|
+
throw new TypeError(Oe(t, ...ce, "Uint8Array"));
|
|
826
826
|
}
|
|
827
827
|
const pn = async (e, t, n, r) => {
|
|
828
828
|
const a = await hn(e, t, "verify");
|
|
829
829
|
zt(e, a);
|
|
830
830
|
const s = dn(e, a.algorithm);
|
|
831
831
|
try {
|
|
832
|
-
return await
|
|
832
|
+
return await he.subtle.verify(s, a, n, r);
|
|
833
833
|
} catch {
|
|
834
834
|
return !1;
|
|
835
835
|
}
|
|
836
836
|
};
|
|
837
837
|
async function fn(e, t, n) {
|
|
838
|
-
if (!
|
|
838
|
+
if (!ue(e))
|
|
839
839
|
throw new R("Flattened JWS must be an object");
|
|
840
840
|
if (e.protected === void 0 && e.header === void 0)
|
|
841
841
|
throw new R('Flattened JWS must have either of the "protected" or "header" members');
|
|
@@ -845,17 +845,17 @@ async function fn(e, t, n) {
|
|
|
845
845
|
throw new R("JWS Payload missing");
|
|
846
846
|
if (typeof e.signature != "string")
|
|
847
847
|
throw new R("JWS Signature missing or incorrect type");
|
|
848
|
-
if (e.header !== void 0 && !
|
|
848
|
+
if (e.header !== void 0 && !ue(e.header))
|
|
849
849
|
throw new R("JWS Unprotected Header incorrect type");
|
|
850
850
|
let r = {};
|
|
851
851
|
if (e.protected)
|
|
852
852
|
try {
|
|
853
|
-
const d =
|
|
854
|
-
r = JSON.parse(
|
|
853
|
+
const d = Y(e.protected);
|
|
854
|
+
r = JSON.parse(B.decode(d));
|
|
855
855
|
} catch {
|
|
856
856
|
throw new R("JWS Protected Header is invalid");
|
|
857
857
|
}
|
|
858
|
-
if (!
|
|
858
|
+
if (!Bt(r, e.header))
|
|
859
859
|
throw new R("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
860
860
|
const a = {
|
|
861
861
|
...r,
|
|
@@ -869,36 +869,36 @@ async function fn(e, t, n) {
|
|
|
869
869
|
throw new R('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
870
870
|
const u = n && ln("algorithms", n.algorithms);
|
|
871
871
|
if (u && !u.has(i))
|
|
872
|
-
throw new
|
|
872
|
+
throw new Jt('"alg" (Algorithm) Header Parameter value not allowed');
|
|
873
873
|
if (o) {
|
|
874
874
|
if (typeof e.payload != "string")
|
|
875
875
|
throw new R("JWS Payload must be a string");
|
|
876
876
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
877
877
|
throw new R("JWS Payload must be a string or an Uint8Array instance");
|
|
878
|
-
let
|
|
879
|
-
typeof t == "function" && (t = await t(r, e),
|
|
880
|
-
const
|
|
878
|
+
let f = !1;
|
|
879
|
+
typeof t == "function" && (t = await t(r, e), f = !0), cn(i, t, "verify");
|
|
880
|
+
const y = Mt(Q.encode(e.protected ?? ""), Q.encode("."), typeof e.payload == "string" ? Q.encode(e.payload) : e.payload);
|
|
881
881
|
let h;
|
|
882
882
|
try {
|
|
883
|
-
h =
|
|
883
|
+
h = Y(e.signature);
|
|
884
884
|
} catch {
|
|
885
885
|
throw new R("Failed to base64url decode the signature");
|
|
886
886
|
}
|
|
887
|
-
if (!await pn(i, t, h,
|
|
888
|
-
throw new
|
|
887
|
+
if (!await pn(i, t, h, y))
|
|
888
|
+
throw new Vt();
|
|
889
889
|
let p;
|
|
890
890
|
if (o)
|
|
891
891
|
try {
|
|
892
|
-
p =
|
|
892
|
+
p = Y(e.payload);
|
|
893
893
|
} catch {
|
|
894
894
|
throw new R("Failed to base64url decode the payload");
|
|
895
895
|
}
|
|
896
|
-
else typeof e.payload == "string" ? p =
|
|
896
|
+
else typeof e.payload == "string" ? p = Q.encode(e.payload) : p = e.payload;
|
|
897
897
|
const l = { payload: p };
|
|
898
|
-
return e.protected !== void 0 && (l.protectedHeader = r), e.header !== void 0 && (l.unprotectedHeader = e.header),
|
|
898
|
+
return e.protected !== void 0 && (l.protectedHeader = r), e.header !== void 0 && (l.unprotectedHeader = e.header), f ? { ...l, key: t } : l;
|
|
899
899
|
}
|
|
900
900
|
async function yn(e, t, n) {
|
|
901
|
-
if (e instanceof Uint8Array && (e =
|
|
901
|
+
if (e instanceof Uint8Array && (e = B.decode(e)), typeof e != "string")
|
|
902
902
|
throw new R("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)
|
|
@@ -906,7 +906,7 @@ async function yn(e, t, n) {
|
|
|
906
906
|
const i = await fn({ payload: a, protected: r, signature: s }, t, n), u = { payload: i.payload, protectedHeader: i.protectedHeader };
|
|
907
907
|
return typeof t == "function" ? { ...u, key: i.key } : u;
|
|
908
908
|
}
|
|
909
|
-
const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60,
|
|
909
|
+
const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt * 24, mn = be * 7, wn = be * 365.25, En = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, De = (e) => {
|
|
910
910
|
const t = En.exec(e);
|
|
911
911
|
if (!t || t[4] && t[1])
|
|
912
912
|
throw new TypeError("Invalid time period format");
|
|
@@ -937,7 +937,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
|
|
|
937
937
|
case "day":
|
|
938
938
|
case "days":
|
|
939
939
|
case "d":
|
|
940
|
-
a = Math.round(n *
|
|
940
|
+
a = Math.round(n * be);
|
|
941
941
|
break;
|
|
942
942
|
case "week":
|
|
943
943
|
case "weeks":
|
|
@@ -949,20 +949,20 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
|
|
|
949
949
|
break;
|
|
950
950
|
}
|
|
951
951
|
return t[1] === "-" || t[4] === "ago" ? -a : a;
|
|
952
|
-
},
|
|
952
|
+
}, Ue = (e) => e.toLowerCase().replace(/^application\//, ""), Sn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, An = (e, t, n = {}) => {
|
|
953
953
|
let r;
|
|
954
954
|
try {
|
|
955
|
-
r = JSON.parse(
|
|
955
|
+
r = JSON.parse(B.decode(t));
|
|
956
956
|
} catch {
|
|
957
957
|
}
|
|
958
|
-
if (!
|
|
959
|
-
throw new
|
|
958
|
+
if (!ue(r))
|
|
959
|
+
throw new C("JWT Claims Set must be a top-level JSON object");
|
|
960
960
|
const { typ: a } = n;
|
|
961
|
-
if (a && (typeof e.typ != "string" ||
|
|
961
|
+
if (a && (typeof e.typ != "string" || Ue(e.typ) !== Ue(a)))
|
|
962
962
|
throw new v('unexpected "typ" JWT header value', r, "typ", "check_failed");
|
|
963
|
-
const { requiredClaims: s = [], issuer: o, subject: i, audience: u, maxTokenAge:
|
|
964
|
-
|
|
965
|
-
for (const d of new Set(
|
|
963
|
+
const { requiredClaims: s = [], issuer: o, subject: i, audience: u, maxTokenAge: f } = n, y = [...s];
|
|
964
|
+
f !== void 0 && y.push("iat"), u !== void 0 && y.push("aud"), i !== void 0 && y.push("sub"), o !== void 0 && y.push("iss");
|
|
965
|
+
for (const d of new Set(y.reverse()))
|
|
966
966
|
if (!(d in r))
|
|
967
967
|
throw new v(`missing required "${d}" claim`, r, d, "missing");
|
|
968
968
|
if (o && !(Array.isArray(o) ? o : [o]).includes(r.iss))
|
|
@@ -974,7 +974,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
|
|
|
974
974
|
let h;
|
|
975
975
|
switch (typeof n.clockTolerance) {
|
|
976
976
|
case "string":
|
|
977
|
-
h =
|
|
977
|
+
h = De(n.clockTolerance);
|
|
978
978
|
break;
|
|
979
979
|
case "number":
|
|
980
980
|
h = n.clockTolerance;
|
|
@@ -986,7 +986,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
|
|
|
986
986
|
throw new TypeError("Invalid clockTolerance option type");
|
|
987
987
|
}
|
|
988
988
|
const { currentDate: p } = n, l = gn(p || /* @__PURE__ */ new Date());
|
|
989
|
-
if ((r.iat !== void 0 ||
|
|
989
|
+
if ((r.iat !== void 0 || f) && typeof r.iat != "number")
|
|
990
990
|
throw new v('"iat" claim must be a number', r, "iat", "invalid");
|
|
991
991
|
if (r.nbf !== void 0) {
|
|
992
992
|
if (typeof r.nbf != "number")
|
|
@@ -998,12 +998,12 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
|
|
|
998
998
|
if (typeof r.exp != "number")
|
|
999
999
|
throw new v('"exp" claim must be a number', r, "exp", "invalid");
|
|
1000
1000
|
if (r.exp <= l - h)
|
|
1001
|
-
throw new
|
|
1001
|
+
throw new Ce('"exp" claim timestamp check failed', r, "exp", "check_failed");
|
|
1002
1002
|
}
|
|
1003
|
-
if (
|
|
1004
|
-
const d = l - r.iat, m = typeof
|
|
1003
|
+
if (f) {
|
|
1004
|
+
const d = l - r.iat, m = typeof f == "number" ? f : De(f);
|
|
1005
1005
|
if (d - h > m)
|
|
1006
|
-
throw new
|
|
1006
|
+
throw new Ce('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
|
|
1007
1007
|
if (d < 0 - h)
|
|
1008
1008
|
throw new v('"iat" claim timestamp check failed (it should be in the past)', r, "iat", "check_failed");
|
|
1009
1009
|
}
|
|
@@ -1013,56 +1013,89 @@ async function Tn(e, t, n) {
|
|
|
1013
1013
|
var r;
|
|
1014
1014
|
const a = await yn(e, t, n);
|
|
1015
1015
|
if ((r = a.protectedHeader.crit) != null && r.includes("b64") && a.protectedHeader.b64 === !1)
|
|
1016
|
-
throw new
|
|
1016
|
+
throw new C("JWTs MUST NOT use unencoded payload");
|
|
1017
1017
|
const s = { payload: An(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
|
|
1018
1018
|
return typeof t == "function" ? { ...s, key: a.key } : s;
|
|
1019
1019
|
}
|
|
1020
|
-
const
|
|
1020
|
+
const Rn = Y;
|
|
1021
|
+
function bn(e) {
|
|
1022
|
+
if (typeof e != "string")
|
|
1023
|
+
throw new C("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
1024
|
+
const { 1: t, length: n } = e.split(".");
|
|
1025
|
+
if (n === 5)
|
|
1026
|
+
throw new C("Only JWTs using Compact JWS serialization can be decoded");
|
|
1027
|
+
if (n !== 3)
|
|
1028
|
+
throw new C("Invalid JWT");
|
|
1029
|
+
if (!t)
|
|
1030
|
+
throw new C("JWTs must contain a payload");
|
|
1031
|
+
let r;
|
|
1021
1032
|
try {
|
|
1022
|
-
|
|
1033
|
+
r = Rn(t);
|
|
1034
|
+
} catch {
|
|
1035
|
+
throw new C("Failed to base64url decode the payload");
|
|
1036
|
+
}
|
|
1037
|
+
let a;
|
|
1038
|
+
try {
|
|
1039
|
+
a = JSON.parse(B.decode(r));
|
|
1040
|
+
} catch {
|
|
1041
|
+
throw new C("Failed to parse the decoded payload as JSON");
|
|
1042
|
+
}
|
|
1043
|
+
if (!ue(a))
|
|
1044
|
+
throw new C("Invalid JWT Claims Set");
|
|
1045
|
+
return a;
|
|
1046
|
+
}
|
|
1047
|
+
const F = async (e) => {
|
|
1048
|
+
try {
|
|
1049
|
+
const t = I.ALG, n = await an(xt, t);
|
|
1023
1050
|
return await Tn(e, n, {
|
|
1024
1051
|
issuer: I.ISSUER
|
|
1025
1052
|
});
|
|
1026
1053
|
} catch {
|
|
1027
1054
|
return;
|
|
1028
1055
|
}
|
|
1056
|
+
}, In = (e) => {
|
|
1057
|
+
try {
|
|
1058
|
+
return bn(e);
|
|
1059
|
+
} catch {
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1029
1062
|
};
|
|
1030
1063
|
var A = [];
|
|
1031
|
-
for (var
|
|
1032
|
-
A.push((
|
|
1033
|
-
function
|
|
1064
|
+
for (var we = 0; we < 256; ++we)
|
|
1065
|
+
A.push((we + 256).toString(16).slice(1));
|
|
1066
|
+
function _n(e, t = 0) {
|
|
1034
1067
|
return (A[e[t + 0]] + A[e[t + 1]] + A[e[t + 2]] + A[e[t + 3]] + "-" + A[e[t + 4]] + A[e[t + 5]] + "-" + A[e[t + 6]] + A[e[t + 7]] + "-" + A[e[t + 8]] + A[e[t + 9]] + "-" + A[e[t + 10]] + A[e[t + 11]] + A[e[t + 12]] + A[e[t + 13]] + A[e[t + 14]] + A[e[t + 15]]).toLowerCase();
|
|
1035
1068
|
}
|
|
1036
|
-
var
|
|
1037
|
-
function
|
|
1038
|
-
if (!
|
|
1069
|
+
var Z, vn = new Uint8Array(16);
|
|
1070
|
+
function kn() {
|
|
1071
|
+
if (!Z && (Z = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Z))
|
|
1039
1072
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1040
|
-
return
|
|
1073
|
+
return Z(vn);
|
|
1041
1074
|
}
|
|
1042
|
-
var
|
|
1043
|
-
const
|
|
1044
|
-
randomUUID:
|
|
1075
|
+
var Pn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1076
|
+
const $e = {
|
|
1077
|
+
randomUUID: Pn
|
|
1045
1078
|
};
|
|
1046
|
-
function
|
|
1047
|
-
if (
|
|
1048
|
-
return
|
|
1079
|
+
function Ke(e, t, n) {
|
|
1080
|
+
if ($e.randomUUID && !t && !e)
|
|
1081
|
+
return $e.randomUUID();
|
|
1049
1082
|
e = e || {};
|
|
1050
|
-
var r = e.random || (e.rng ||
|
|
1051
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1083
|
+
var r = e.random || (e.rng || kn)();
|
|
1084
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, _n(r);
|
|
1052
1085
|
}
|
|
1053
|
-
const He = globalThis.crypto,
|
|
1086
|
+
const He = globalThis.crypto, Cn = (e) => `${Ke()}${Ke()}`.slice(0, e), On = (e) => btoa(
|
|
1054
1087
|
[...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
|
|
1055
1088
|
);
|
|
1056
|
-
async function
|
|
1089
|
+
async function Nn(e) {
|
|
1057
1090
|
if (!He.subtle)
|
|
1058
1091
|
throw new Error(
|
|
1059
1092
|
"crypto.subtle is available only in secure contexts (HTTPS)."
|
|
1060
1093
|
);
|
|
1061
1094
|
const t = new TextEncoder().encode(e), n = await He.subtle.digest("SHA-256", t);
|
|
1062
|
-
return
|
|
1095
|
+
return On(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1063
1096
|
}
|
|
1064
|
-
async function
|
|
1065
|
-
const n =
|
|
1097
|
+
async function Dn(e) {
|
|
1098
|
+
const n = Cn(43), r = await Nn(n);
|
|
1066
1099
|
return {
|
|
1067
1100
|
code_verifier: n,
|
|
1068
1101
|
code_challenge: r
|
|
@@ -1071,23 +1104,23 @@ async function Cn(e) {
|
|
|
1071
1104
|
function at(e, t) {
|
|
1072
1105
|
window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
|
|
1073
1106
|
}
|
|
1074
|
-
const
|
|
1107
|
+
const Le = (e, t) => {
|
|
1075
1108
|
const n = JSON.stringify(
|
|
1076
1109
|
typeof t == "function" ? t() : t
|
|
1077
1110
|
);
|
|
1078
1111
|
window.localStorage.setItem(e, n), at(e, n);
|
|
1079
|
-
},
|
|
1112
|
+
}, Un = (e) => {
|
|
1080
1113
|
window.localStorage.removeItem(e), at(e, null);
|
|
1081
|
-
},
|
|
1082
|
-
function
|
|
1114
|
+
}, We = (e) => window.localStorage.getItem(e), $n = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
|
|
1115
|
+
function ee({
|
|
1083
1116
|
key: e,
|
|
1084
1117
|
initialValue: t
|
|
1085
1118
|
}) {
|
|
1086
|
-
const n = Pt(
|
|
1119
|
+
const n = Pt($n, () => We(e)), r = x(
|
|
1087
1120
|
(o) => {
|
|
1088
1121
|
try {
|
|
1089
1122
|
const i = typeof o == "function" ? o(JSON.parse(n)) : o;
|
|
1090
|
-
i == null ?
|
|
1123
|
+
i == null ? Un(e) : Le(e, i);
|
|
1091
1124
|
} catch (i) {
|
|
1092
1125
|
console.warn(i);
|
|
1093
1126
|
}
|
|
@@ -1098,36 +1131,36 @@ function Q({
|
|
|
1098
1131
|
}, [t, r]), s = x(() => {
|
|
1099
1132
|
r(null);
|
|
1100
1133
|
}, [r]);
|
|
1101
|
-
return
|
|
1134
|
+
return Te(() => {
|
|
1102
1135
|
try {
|
|
1103
|
-
|
|
1136
|
+
We(e) === null && typeof t < "u" && Le(e, t);
|
|
1104
1137
|
} catch (o) {
|
|
1105
1138
|
console.warn(o);
|
|
1106
1139
|
}
|
|
1107
1140
|
}, [e, t]), [n ? JSON.parse(n) : null, r, a, s];
|
|
1108
1141
|
}
|
|
1109
1142
|
var T = [];
|
|
1110
|
-
for (var
|
|
1111
|
-
T.push((
|
|
1112
|
-
function
|
|
1143
|
+
for (var Ee = 0; Ee < 256; ++Ee)
|
|
1144
|
+
T.push((Ee + 256).toString(16).slice(1));
|
|
1145
|
+
function Kn(e, t = 0) {
|
|
1113
1146
|
return (T[e[t + 0]] + T[e[t + 1]] + T[e[t + 2]] + T[e[t + 3]] + "-" + T[e[t + 4]] + T[e[t + 5]] + "-" + T[e[t + 6]] + T[e[t + 7]] + "-" + T[e[t + 8]] + T[e[t + 9]] + "-" + T[e[t + 10]] + T[e[t + 11]] + T[e[t + 12]] + T[e[t + 13]] + T[e[t + 14]] + T[e[t + 15]]).toLowerCase();
|
|
1114
1147
|
}
|
|
1115
|
-
var
|
|
1116
|
-
function
|
|
1117
|
-
if (!
|
|
1148
|
+
var te, Hn = new Uint8Array(16);
|
|
1149
|
+
function Ln() {
|
|
1150
|
+
if (!te && (te = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !te))
|
|
1118
1151
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1119
|
-
return
|
|
1152
|
+
return te(Hn);
|
|
1120
1153
|
}
|
|
1121
|
-
var
|
|
1154
|
+
var Wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1122
1155
|
const xe = {
|
|
1123
|
-
randomUUID:
|
|
1156
|
+
randomUUID: Wn
|
|
1124
1157
|
};
|
|
1125
|
-
function
|
|
1158
|
+
function Se(e, t, n) {
|
|
1126
1159
|
if (xe.randomUUID && !t && !e)
|
|
1127
1160
|
return xe.randomUUID();
|
|
1128
1161
|
e = e || {};
|
|
1129
|
-
var r = e.random || (e.rng ||
|
|
1130
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1162
|
+
var r = e.random || (e.rng || Ln)();
|
|
1163
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Kn(r);
|
|
1131
1164
|
}
|
|
1132
1165
|
/*!
|
|
1133
1166
|
@versini/ui-fingerprint v1.0.1
|
|
@@ -1142,7 +1175,7 @@ try {
|
|
|
1142
1175
|
});
|
|
1143
1176
|
} catch {
|
|
1144
1177
|
}
|
|
1145
|
-
const
|
|
1178
|
+
const xn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), ot = async (e) => {
|
|
1146
1179
|
if (e === "")
|
|
1147
1180
|
return "";
|
|
1148
1181
|
const t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
@@ -1151,26 +1184,26 @@ const Kn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join
|
|
|
1151
1184
|
function Me(e, t) {
|
|
1152
1185
|
return new Promise((n) => setTimeout(n, e, t));
|
|
1153
1186
|
}
|
|
1154
|
-
async function
|
|
1187
|
+
async function Mn(e, t, n = 50) {
|
|
1155
1188
|
var r, a, s;
|
|
1156
1189
|
const o = document;
|
|
1157
1190
|
for (; !o.body; )
|
|
1158
1191
|
await Me(n);
|
|
1159
1192
|
const i = o.createElement("iframe");
|
|
1160
1193
|
try {
|
|
1161
|
-
for (await new Promise((u,
|
|
1162
|
-
let
|
|
1194
|
+
for (await new Promise((u, f) => {
|
|
1195
|
+
let y = !1;
|
|
1163
1196
|
const h = () => {
|
|
1164
|
-
|
|
1197
|
+
y = !0, u();
|
|
1165
1198
|
}, p = (m) => {
|
|
1166
|
-
|
|
1199
|
+
y = !0, f(m);
|
|
1167
1200
|
};
|
|
1168
1201
|
i.onload = h, i.onerror = p;
|
|
1169
1202
|
const { style: l } = i;
|
|
1170
1203
|
l.setProperty("display", "block", "important"), l.position = "absolute", l.top = "0", l.left = "0", l.visibility = "hidden", i.src = "about:blank", o.body.appendChild(i);
|
|
1171
1204
|
const d = () => {
|
|
1172
1205
|
var m, S;
|
|
1173
|
-
|
|
1206
|
+
y || (((S = (m = i.contentWindow) == null ? void 0 : m.document) == null ? void 0 : S.readyState) === "complete" ? h() : setTimeout(d, 10));
|
|
1174
1207
|
};
|
|
1175
1208
|
d();
|
|
1176
1209
|
}); !((a = (r = i.contentWindow) == null ? void 0 : r.document) != null && a.body); )
|
|
@@ -1180,14 +1213,14 @@ async function Ln(e, t, n = 50) {
|
|
|
1180
1213
|
(s = i.parentNode) == null || s.removeChild(i);
|
|
1181
1214
|
}
|
|
1182
1215
|
}
|
|
1183
|
-
const
|
|
1216
|
+
const Gn = {
|
|
1184
1217
|
audio: {
|
|
1185
1218
|
sampleHash: "",
|
|
1186
1219
|
oscillator: "",
|
|
1187
1220
|
maxChannels: 0,
|
|
1188
1221
|
channelCountMode: ""
|
|
1189
1222
|
}
|
|
1190
|
-
},
|
|
1223
|
+
}, Jn = async (e) => new Promise((t) => {
|
|
1191
1224
|
try {
|
|
1192
1225
|
const n = new window.OfflineAudioContext(1, 5e3, 44100), r = n.createBufferSource(), a = n.createOscillator();
|
|
1193
1226
|
a.frequency.value = 1e3;
|
|
@@ -1196,7 +1229,7 @@ const xn = {
|
|
|
1196
1229
|
const i = o.renderedBuffer.getChannelData(0);
|
|
1197
1230
|
a.disconnect(), s.disconnect(), t({
|
|
1198
1231
|
audio: {
|
|
1199
|
-
sampleHash:
|
|
1232
|
+
sampleHash: xn(i),
|
|
1200
1233
|
oscillator: a.type,
|
|
1201
1234
|
maxChannels: n.destination.maxChannelCount,
|
|
1202
1235
|
channelCountMode: r.channelCountMode
|
|
@@ -1213,16 +1246,16 @@ const xn = {
|
|
|
1213
1246
|
}
|
|
1214
1247
|
});
|
|
1215
1248
|
}
|
|
1216
|
-
}), st = { browser: "" },
|
|
1249
|
+
}), st = { browser: "" }, Vn = async (e) => typeof navigator > "u" ? st : { browser: navigator.userAgent }, it = {
|
|
1217
1250
|
canvas: {
|
|
1218
1251
|
data: ""
|
|
1219
1252
|
}
|
|
1220
|
-
},
|
|
1253
|
+
}, Yn = async (e) => {
|
|
1221
1254
|
try {
|
|
1222
1255
|
const t = Array.from(
|
|
1223
1256
|
{ length: 3 },
|
|
1224
|
-
() =>
|
|
1225
|
-
), n =
|
|
1257
|
+
() => jn(300, 30)
|
|
1258
|
+
), n = Bn(t, 300, 30);
|
|
1226
1259
|
return {
|
|
1227
1260
|
canvas: {
|
|
1228
1261
|
data: (await ot(n.data.toString())).toString()
|
|
@@ -1231,7 +1264,7 @@ const xn = {
|
|
|
1231
1264
|
} catch {
|
|
1232
1265
|
return it;
|
|
1233
1266
|
}
|
|
1234
|
-
},
|
|
1267
|
+
}, jn = (e, t) => {
|
|
1235
1268
|
const n = document.createElement("canvas"), r = n.getContext("2d");
|
|
1236
1269
|
if (!r)
|
|
1237
1270
|
return new ImageData(1, 1);
|
|
@@ -1240,7 +1273,7 @@ const xn = {
|
|
|
1240
1273
|
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);
|
|
1241
1274
|
const s = "mmMwWLliI0O&1 - Les sanglots longs des violons de l'automne blessent mon coeur d'une langueur monotone";
|
|
1242
1275
|
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);
|
|
1243
|
-
},
|
|
1276
|
+
}, Fn = (e) => {
|
|
1244
1277
|
if (e.length === 0)
|
|
1245
1278
|
return 0;
|
|
1246
1279
|
const t = {};
|
|
@@ -1250,17 +1283,17 @@ const xn = {
|
|
|
1250
1283
|
for (const r in t)
|
|
1251
1284
|
t[r] > t[n] && (n = parseInt(r, 10));
|
|
1252
1285
|
return n;
|
|
1253
|
-
},
|
|
1286
|
+
}, Bn = (e, t, n) => {
|
|
1254
1287
|
const r = [];
|
|
1255
1288
|
for (let o = 0; o < e[0].data.length; o++) {
|
|
1256
1289
|
const i = [];
|
|
1257
1290
|
for (let u = 0; u < e.length; u++)
|
|
1258
1291
|
i.push(e[u].data[o]);
|
|
1259
|
-
r.push(
|
|
1292
|
+
r.push(Fn(i));
|
|
1260
1293
|
}
|
|
1261
1294
|
const a = r, s = new Uint8ClampedArray(a);
|
|
1262
1295
|
return new ImageData(s, t, n);
|
|
1263
|
-
},
|
|
1296
|
+
}, qn = [], zn = "mmMwWLliI0O&1", Qn = "48px", K = ["monospace", "sans-serif", "serif"], Ge = [
|
|
1264
1297
|
"sans-serif-thin",
|
|
1265
1298
|
"ARNO PRO",
|
|
1266
1299
|
"Agency FB",
|
|
@@ -1298,28 +1331,28 @@ const xn = {
|
|
|
1298
1331
|
"TRAJAN PRO",
|
|
1299
1332
|
"Univers CE 55 Medium",
|
|
1300
1333
|
"ZWAdobeF"
|
|
1301
|
-
],
|
|
1334
|
+
], Xn = async (e) => Mn(async (t, { document: n }) => {
|
|
1302
1335
|
const r = n.body;
|
|
1303
|
-
r.style.fontSize =
|
|
1336
|
+
r.style.fontSize = Qn;
|
|
1304
1337
|
const a = n.createElement("div");
|
|
1305
1338
|
a.style.setProperty("visibility", "hidden", "important");
|
|
1306
1339
|
const s = {}, o = {}, i = (d) => {
|
|
1307
1340
|
const m = n.createElement("span"), { style: S } = m;
|
|
1308
|
-
return S.position = "absolute", S.top = "0", S.left = "0", S.fontFamily = d, m.textContent =
|
|
1309
|
-
}, u = (d, m) => i(`'${d}',${m}`),
|
|
1341
|
+
return S.position = "absolute", S.top = "0", S.left = "0", S.fontFamily = d, m.textContent = zn, a.appendChild(m), m;
|
|
1342
|
+
}, u = (d, m) => i(`'${d}',${m}`), f = () => K.map(i), y = () => {
|
|
1310
1343
|
const d = {};
|
|
1311
|
-
for (const m of
|
|
1312
|
-
d[m] =
|
|
1344
|
+
for (const m of Ge)
|
|
1345
|
+
d[m] = K.map(
|
|
1313
1346
|
(S) => u(m, S)
|
|
1314
1347
|
);
|
|
1315
1348
|
return d;
|
|
1316
|
-
}, h = (d) =>
|
|
1349
|
+
}, h = (d) => K.some(
|
|
1317
1350
|
(m, S) => d[S].offsetWidth !== s[m] || d[S].offsetHeight !== o[m]
|
|
1318
|
-
), p =
|
|
1351
|
+
), p = f(), l = y();
|
|
1319
1352
|
r.appendChild(a);
|
|
1320
|
-
for (let d = 0; d <
|
|
1321
|
-
s[
|
|
1322
|
-
return
|
|
1353
|
+
for (let d = 0; d < K.length; d++)
|
|
1354
|
+
s[K[d]] = p[d].offsetWidth, o[K[d]] = p[d].offsetHeight;
|
|
1355
|
+
return Ge.filter((d) => h(l[d]));
|
|
1323
1356
|
}), ct = {
|
|
1324
1357
|
vendor: "",
|
|
1325
1358
|
vendorUnmasked: "",
|
|
@@ -1335,7 +1368,7 @@ const xn = {
|
|
|
1335
1368
|
jsHeapSizeLimit: 0
|
|
1336
1369
|
}
|
|
1337
1370
|
};
|
|
1338
|
-
function
|
|
1371
|
+
function Zn() {
|
|
1339
1372
|
const e = document.createElement("canvas"), t = e.getContext("webgl") ?? e.getContext("experimental-webgl");
|
|
1340
1373
|
if (t && "getParameter" in t) {
|
|
1341
1374
|
const n = t.getExtension("WEBGL_debug_renderer_info");
|
|
@@ -1350,19 +1383,19 @@ function zn() {
|
|
|
1350
1383
|
}
|
|
1351
1384
|
return ct;
|
|
1352
1385
|
}
|
|
1353
|
-
function
|
|
1386
|
+
function er() {
|
|
1354
1387
|
const e = new Float32Array(1), t = new Uint8Array(e.buffer);
|
|
1355
1388
|
return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
|
|
1356
1389
|
}
|
|
1357
|
-
const
|
|
1390
|
+
const tr = () => navigator.deviceMemory || 0, nr = () => window.performance && window.performance.memory || {
|
|
1358
1391
|
jsHeapSizeLimit: 0
|
|
1359
|
-
},
|
|
1392
|
+
}, rr = async (e) => new Promise((t) => {
|
|
1360
1393
|
try {
|
|
1361
|
-
const n =
|
|
1394
|
+
const n = tr(), r = nr();
|
|
1362
1395
|
t({
|
|
1363
1396
|
hardware: {
|
|
1364
|
-
videocard:
|
|
1365
|
-
architecture:
|
|
1397
|
+
videocard: Zn(),
|
|
1398
|
+
architecture: er(),
|
|
1366
1399
|
deviceMemory: n.toString() || "undefined",
|
|
1367
1400
|
jsHeapSizeLimit: r.jsHeapSizeLimit || 0
|
|
1368
1401
|
}
|
|
@@ -1370,12 +1403,12 @@ const Xn = () => navigator.deviceMemory || 0, Zn = () => window.performance && w
|
|
|
1370
1403
|
} catch {
|
|
1371
1404
|
t(ut);
|
|
1372
1405
|
}
|
|
1373
|
-
}),
|
|
1406
|
+
}), ar = {
|
|
1374
1407
|
locales: {
|
|
1375
1408
|
languages: "",
|
|
1376
1409
|
timezone: ""
|
|
1377
1410
|
}
|
|
1378
|
-
},
|
|
1411
|
+
}, or = async (e) => new Promise((t) => {
|
|
1379
1412
|
t({
|
|
1380
1413
|
locales: {
|
|
1381
1414
|
languages: navigator.language,
|
|
@@ -1390,7 +1423,7 @@ const Xn = () => navigator.deviceMemory || 0, Zn = () => window.performance && w
|
|
|
1390
1423
|
maxTouchPoints: 0,
|
|
1391
1424
|
mediaMatches: []
|
|
1392
1425
|
}
|
|
1393
|
-
},
|
|
1426
|
+
}, sr = async (e) => new Promise((t) => {
|
|
1394
1427
|
try {
|
|
1395
1428
|
const n = window.screen, r = {
|
|
1396
1429
|
screen: {
|
|
@@ -1398,7 +1431,7 @@ const Xn = () => navigator.deviceMemory || 0, Zn = () => window.performance && w
|
|
|
1398
1431
|
pixelDepth: n.pixelDepth,
|
|
1399
1432
|
isTouchScreen: navigator.maxTouchPoints > 0,
|
|
1400
1433
|
maxTouchPoints: navigator.maxTouchPoints,
|
|
1401
|
-
mediaMatches:
|
|
1434
|
+
mediaMatches: ir()
|
|
1402
1435
|
}
|
|
1403
1436
|
};
|
|
1404
1437
|
t(r);
|
|
@@ -1406,7 +1439,7 @@ const Xn = () => navigator.deviceMemory || 0, Zn = () => window.performance && w
|
|
|
1406
1439
|
t(lt);
|
|
1407
1440
|
}
|
|
1408
1441
|
});
|
|
1409
|
-
function
|
|
1442
|
+
function ir() {
|
|
1410
1443
|
const e = [], t = {
|
|
1411
1444
|
"prefers-contrast": [
|
|
1412
1445
|
"high",
|
|
@@ -1434,7 +1467,7 @@ function ar() {
|
|
|
1434
1467
|
});
|
|
1435
1468
|
}), e;
|
|
1436
1469
|
}
|
|
1437
|
-
const
|
|
1470
|
+
const cr = async (e) => {
|
|
1438
1471
|
try {
|
|
1439
1472
|
return {
|
|
1440
1473
|
system: {
|
|
@@ -1454,48 +1487,55 @@ const or = async (e) => {
|
|
|
1454
1487
|
productSub: "",
|
|
1455
1488
|
product: ""
|
|
1456
1489
|
}
|
|
1457
|
-
},
|
|
1490
|
+
}, ur = async (e) => {
|
|
1458
1491
|
try {
|
|
1459
1492
|
return Promise.all([
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
er(),
|
|
1465
|
-
nr(),
|
|
1493
|
+
Jn(),
|
|
1494
|
+
Vn(),
|
|
1495
|
+
Yn(),
|
|
1496
|
+
Xn(),
|
|
1466
1497
|
rr(),
|
|
1467
|
-
or()
|
|
1498
|
+
or(),
|
|
1499
|
+
sr(),
|
|
1500
|
+
cr()
|
|
1468
1501
|
]);
|
|
1469
1502
|
} catch {
|
|
1470
1503
|
return [
|
|
1471
|
-
|
|
1504
|
+
Gn,
|
|
1472
1505
|
st,
|
|
1473
1506
|
it,
|
|
1474
|
-
|
|
1507
|
+
qn,
|
|
1475
1508
|
ut,
|
|
1476
|
-
|
|
1509
|
+
ar,
|
|
1477
1510
|
lt,
|
|
1478
1511
|
dt
|
|
1479
1512
|
];
|
|
1480
1513
|
}
|
|
1481
|
-
},
|
|
1514
|
+
}, lr = async (e) => {
|
|
1482
1515
|
try {
|
|
1483
|
-
const t = await
|
|
1516
|
+
const t = await ur();
|
|
1484
1517
|
return await ot(JSON.stringify(t));
|
|
1485
1518
|
} catch {
|
|
1486
1519
|
return "";
|
|
1487
1520
|
}
|
|
1488
|
-
},
|
|
1521
|
+
}, ne = "Oops! It looks like your session has expired. For your security, please log in again to continue.", dr = "Your session has been successfully terminated.", re = "Login failed. Please try again.", Ae = "Error getting access token, please re-authenticate.", hr = "You forgot to wrap your component in <AuthProvider>.", le = {
|
|
1489
1522
|
dev: "https://auth.gizmette.local.com:3003",
|
|
1490
1523
|
prod: "https://mylogin.gizmette.com/auth"
|
|
1491
|
-
},
|
|
1524
|
+
}, ae = "@@auth@@", J = "LOADING", V = "LOGIN", ht = "LOGOUT", pr = process.env.NODE_ENV === "production", pt = !pr, fr = (e) => {
|
|
1525
|
+
try {
|
|
1526
|
+
const t = In(e);
|
|
1527
|
+
return t ? t[I.USER_ID_KEY] : "";
|
|
1528
|
+
} catch {
|
|
1529
|
+
return "";
|
|
1530
|
+
}
|
|
1531
|
+
}, pe = async ({
|
|
1492
1532
|
type: e,
|
|
1493
1533
|
clientId: t,
|
|
1494
1534
|
params: n = {}
|
|
1495
1535
|
}) => {
|
|
1496
1536
|
try {
|
|
1497
1537
|
const r = await fetch(
|
|
1498
|
-
pt ? `${
|
|
1538
|
+
pt ? `${le.dev}/${e}` : `${le.prod}/${e}`,
|
|
1499
1539
|
{
|
|
1500
1540
|
credentials: "include",
|
|
1501
1541
|
method: "POST",
|
|
@@ -1517,7 +1557,7 @@ const or = async (e) => {
|
|
|
1517
1557
|
} catch (r) {
|
|
1518
1558
|
return console.error(r), { status: 500, data: [] };
|
|
1519
1559
|
}
|
|
1520
|
-
},
|
|
1560
|
+
}, yr = async ({
|
|
1521
1561
|
userId: e,
|
|
1522
1562
|
idToken: t,
|
|
1523
1563
|
accessToken: n,
|
|
@@ -1527,8 +1567,8 @@ const or = async (e) => {
|
|
|
1527
1567
|
}) => {
|
|
1528
1568
|
try {
|
|
1529
1569
|
return {
|
|
1530
|
-
status: (await
|
|
1531
|
-
type:
|
|
1570
|
+
status: (await pe({
|
|
1571
|
+
type: de.LOGOUT,
|
|
1532
1572
|
clientId: a,
|
|
1533
1573
|
params: {
|
|
1534
1574
|
userId: e,
|
|
@@ -1544,7 +1584,7 @@ const or = async (e) => {
|
|
|
1544
1584
|
status: !1
|
|
1545
1585
|
};
|
|
1546
1586
|
}
|
|
1547
|
-
},
|
|
1587
|
+
}, Je = async ({
|
|
1548
1588
|
username: e,
|
|
1549
1589
|
password: t,
|
|
1550
1590
|
clientId: n,
|
|
@@ -1554,14 +1594,14 @@ const or = async (e) => {
|
|
|
1554
1594
|
code: o,
|
|
1555
1595
|
code_verifier: i,
|
|
1556
1596
|
domain: u,
|
|
1557
|
-
fingerprint:
|
|
1597
|
+
fingerprint: f
|
|
1558
1598
|
}) => {
|
|
1559
1599
|
try {
|
|
1560
|
-
const
|
|
1561
|
-
type:
|
|
1600
|
+
const y = await pe({
|
|
1601
|
+
type: de.AUTHENTICATE,
|
|
1562
1602
|
clientId: n,
|
|
1563
1603
|
params: {
|
|
1564
|
-
type: a ||
|
|
1604
|
+
type: a || j.ID_AND_ACCESS_TOKEN,
|
|
1565
1605
|
username: e,
|
|
1566
1606
|
password: t,
|
|
1567
1607
|
sessionExpiration: s,
|
|
@@ -1569,13 +1609,13 @@ const or = async (e) => {
|
|
|
1569
1609
|
code: o,
|
|
1570
1610
|
code_verifier: i,
|
|
1571
1611
|
domain: u,
|
|
1572
|
-
fingerprint:
|
|
1612
|
+
fingerprint: f
|
|
1573
1613
|
}
|
|
1574
|
-
}), h = await
|
|
1614
|
+
}), h = await F(y.data.idToken);
|
|
1575
1615
|
return h && h.payload[I.USER_ID_KEY] !== "" && h.payload[I.NONCE_KEY] === r ? {
|
|
1576
|
-
idToken:
|
|
1577
|
-
accessToken:
|
|
1578
|
-
refreshToken:
|
|
1616
|
+
idToken: y.data.idToken,
|
|
1617
|
+
accessToken: y.data.accessToken,
|
|
1618
|
+
refreshToken: y.data.refreshToken,
|
|
1579
1619
|
userId: h.payload[I.USER_ID_KEY],
|
|
1580
1620
|
status: !0
|
|
1581
1621
|
} : {
|
|
@@ -1586,17 +1626,17 @@ const or = async (e) => {
|
|
|
1586
1626
|
status: !1
|
|
1587
1627
|
};
|
|
1588
1628
|
}
|
|
1589
|
-
},
|
|
1629
|
+
}, gr = async ({
|
|
1590
1630
|
nonce: e,
|
|
1591
1631
|
clientId: t,
|
|
1592
1632
|
code_challenge: n
|
|
1593
1633
|
}) => {
|
|
1594
1634
|
try {
|
|
1595
|
-
const r = await
|
|
1596
|
-
type:
|
|
1635
|
+
const r = await pe({
|
|
1636
|
+
type: de.CODE,
|
|
1597
1637
|
clientId: t,
|
|
1598
1638
|
params: {
|
|
1599
|
-
type:
|
|
1639
|
+
type: j.CODE,
|
|
1600
1640
|
nonce: e,
|
|
1601
1641
|
code_challenge: n
|
|
1602
1642
|
}
|
|
@@ -1612,7 +1652,7 @@ const or = async (e) => {
|
|
|
1612
1652
|
status: !1
|
|
1613
1653
|
};
|
|
1614
1654
|
}
|
|
1615
|
-
},
|
|
1655
|
+
}, mr = async ({
|
|
1616
1656
|
clientId: e,
|
|
1617
1657
|
userId: t,
|
|
1618
1658
|
nonce: n,
|
|
@@ -1621,11 +1661,11 @@ const or = async (e) => {
|
|
|
1621
1661
|
domain: s
|
|
1622
1662
|
}) => {
|
|
1623
1663
|
try {
|
|
1624
|
-
const o = await
|
|
1625
|
-
type:
|
|
1664
|
+
const o = await pe({
|
|
1665
|
+
type: de.AUTHENTICATE,
|
|
1626
1666
|
clientId: e,
|
|
1627
1667
|
params: {
|
|
1628
|
-
type:
|
|
1668
|
+
type: j.REFRESH_TOKEN,
|
|
1629
1669
|
userId: t,
|
|
1630
1670
|
nonce: n,
|
|
1631
1671
|
refreshToken: r,
|
|
@@ -1633,7 +1673,7 @@ const or = async (e) => {
|
|
|
1633
1673
|
domain: s,
|
|
1634
1674
|
fingerprint: await ft()
|
|
1635
1675
|
}
|
|
1636
|
-
}), i = await
|
|
1676
|
+
}), i = await F(o.data.accessToken);
|
|
1637
1677
|
return i && i.payload[I.USER_ID_KEY] !== "" && i.payload[I.NONCE_KEY] === n ? {
|
|
1638
1678
|
accessToken: o.data.accessToken,
|
|
1639
1679
|
refreshToken: o.data.refreshToken,
|
|
@@ -1647,7 +1687,7 @@ const or = async (e) => {
|
|
|
1647
1687
|
status: !1
|
|
1648
1688
|
};
|
|
1649
1689
|
}
|
|
1650
|
-
},
|
|
1690
|
+
}, oe = {
|
|
1651
1691
|
GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
|
|
1652
1692
|
$clientId: String!,
|
|
1653
1693
|
$username: String!,
|
|
@@ -1724,22 +1764,22 @@ const or = async (e) => {
|
|
|
1724
1764
|
}`
|
|
1725
1765
|
}, H = {
|
|
1726
1766
|
GET_REGISTRATION_OPTIONS: {
|
|
1727
|
-
schema:
|
|
1767
|
+
schema: oe.GET_REGISTRATION_OPTIONS,
|
|
1728
1768
|
method: "getPasskeyRegistrationOptions"
|
|
1729
1769
|
},
|
|
1730
1770
|
VERIFY_REGISTRATION: {
|
|
1731
|
-
schema:
|
|
1771
|
+
schema: oe.VERIFY_REGISTRATION,
|
|
1732
1772
|
method: "verifyPasskeyRegistration"
|
|
1733
1773
|
},
|
|
1734
1774
|
GET_AUTHENTICATION_OPTIONS: {
|
|
1735
|
-
schema:
|
|
1775
|
+
schema: oe.GET_AUTHENTICATION_OPTIONS,
|
|
1736
1776
|
method: "getPasskeyAuthenticationOptions"
|
|
1737
1777
|
},
|
|
1738
1778
|
VERIFY_AUTHENTICATION: {
|
|
1739
|
-
schema:
|
|
1779
|
+
schema: oe.VERIFY_AUTHENTICATION,
|
|
1740
1780
|
method: "verifyPasskeyAuthentication"
|
|
1741
1781
|
}
|
|
1742
|
-
},
|
|
1782
|
+
}, L = async ({
|
|
1743
1783
|
accessToken: e,
|
|
1744
1784
|
type: t,
|
|
1745
1785
|
clientId: n,
|
|
@@ -1747,7 +1787,7 @@ const or = async (e) => {
|
|
|
1747
1787
|
}) => {
|
|
1748
1788
|
try {
|
|
1749
1789
|
const a = t != null && t.data ? t.data(r) : r, s = `Bearer ${e}`, o = await fetch(
|
|
1750
|
-
pt ? `${
|
|
1790
|
+
pt ? `${le.dev}/graphql` : `${le.prod}/graphql`,
|
|
1751
1791
|
{
|
|
1752
1792
|
method: "POST",
|
|
1753
1793
|
credentials: "include",
|
|
@@ -1776,16 +1816,16 @@ const or = async (e) => {
|
|
|
1776
1816
|
}
|
|
1777
1817
|
}, ft = async () => {
|
|
1778
1818
|
try {
|
|
1779
|
-
return await
|
|
1819
|
+
return await lr();
|
|
1780
1820
|
} catch {
|
|
1781
1821
|
return "";
|
|
1782
1822
|
}
|
|
1783
1823
|
};
|
|
1784
|
-
class
|
|
1824
|
+
class wr {
|
|
1785
1825
|
constructor(t = null, n = null) {
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1826
|
+
z(this, "refreshTokenPromise", null);
|
|
1827
|
+
z(this, "accessToken");
|
|
1828
|
+
z(this, "refreshToken");
|
|
1789
1829
|
this.accessToken = t || "", this.refreshToken = n || "";
|
|
1790
1830
|
}
|
|
1791
1831
|
async refreshtoken({
|
|
@@ -1812,9 +1852,9 @@ class fr {
|
|
|
1812
1852
|
nonce: r,
|
|
1813
1853
|
domain: a
|
|
1814
1854
|
}) {
|
|
1815
|
-
const s = await
|
|
1855
|
+
const s = await F(this.refreshToken);
|
|
1816
1856
|
if (s && s.payload[I.USER_ID_KEY] !== "") {
|
|
1817
|
-
const o = await
|
|
1857
|
+
const o = await mr({
|
|
1818
1858
|
clientId: t,
|
|
1819
1859
|
userId: n,
|
|
1820
1860
|
nonce: r,
|
|
@@ -1835,20 +1875,20 @@ class fr {
|
|
|
1835
1875
|
};
|
|
1836
1876
|
}
|
|
1837
1877
|
}
|
|
1838
|
-
const
|
|
1839
|
-
throw new Error(
|
|
1878
|
+
const W = () => {
|
|
1879
|
+
throw new Error(hr);
|
|
1840
1880
|
}, yt = Ct({
|
|
1841
1881
|
isAuthenticated: !1,
|
|
1842
1882
|
isLoading: !1,
|
|
1843
1883
|
authenticationType: null,
|
|
1844
|
-
login:
|
|
1845
|
-
logout:
|
|
1846
|
-
getAccessToken:
|
|
1847
|
-
getIdToken:
|
|
1848
|
-
registeringForPasskey:
|
|
1849
|
-
loginWithPasskey:
|
|
1884
|
+
login: W,
|
|
1885
|
+
logout: W,
|
|
1886
|
+
getAccessToken: W,
|
|
1887
|
+
getIdToken: W,
|
|
1888
|
+
registeringForPasskey: W,
|
|
1889
|
+
loginWithPasskey: W,
|
|
1850
1890
|
logoutReason: ""
|
|
1851
|
-
}),
|
|
1891
|
+
}), Er = kt.createContext({
|
|
1852
1892
|
state: {
|
|
1853
1893
|
isLoading: !0,
|
|
1854
1894
|
isAuthenticated: !1,
|
|
@@ -1859,7 +1899,7 @@ const L = () => {
|
|
|
1859
1899
|
},
|
|
1860
1900
|
dispatch: () => {
|
|
1861
1901
|
}
|
|
1862
|
-
}),
|
|
1902
|
+
}), Sr = (e, t) => (t == null ? void 0 : t.type) === J ? {
|
|
1863
1903
|
...e,
|
|
1864
1904
|
isLoading: t.payload.isLoading
|
|
1865
1905
|
} : (t == null ? void 0 : t.type) === V ? {
|
|
@@ -1876,36 +1916,36 @@ const L = () => {
|
|
|
1876
1916
|
user: void 0,
|
|
1877
1917
|
authenticationType: null,
|
|
1878
1918
|
logoutReason: t.payload.logoutReason
|
|
1879
|
-
} : e,
|
|
1919
|
+
} : e, Pr = ({
|
|
1880
1920
|
children: e,
|
|
1881
1921
|
sessionExpiration: t,
|
|
1882
1922
|
clientId: n,
|
|
1883
1923
|
domain: r = "",
|
|
1884
1924
|
debug: a = !1
|
|
1885
1925
|
}) => {
|
|
1886
|
-
const [s, o] = Ot(
|
|
1926
|
+
const [s, o] = Ot(Sr, {
|
|
1887
1927
|
isLoading: !0,
|
|
1888
1928
|
isAuthenticated: !1,
|
|
1889
1929
|
authenticationType: null,
|
|
1890
1930
|
user: void 0,
|
|
1891
1931
|
logoutReason: "",
|
|
1892
1932
|
debug: a
|
|
1893
|
-
}), i =
|
|
1894
|
-
key: `${
|
|
1895
|
-
}), [p, l, , d] =
|
|
1896
|
-
key: `${
|
|
1897
|
-
}), [m, S, ,
|
|
1933
|
+
}), i = Pe(!1), u = Pe(""), [f, y, , h] = ee({
|
|
1934
|
+
key: `${ae}::${n}::@@user@@`
|
|
1935
|
+
}), [p, l, , d] = ee({
|
|
1936
|
+
key: `${ae}::${n}::@@access@@`
|
|
1937
|
+
}), [m, S, , q] = ee(
|
|
1898
1938
|
{
|
|
1899
|
-
key: `${
|
|
1939
|
+
key: `${ae}::${n}::@@refresh@@`
|
|
1900
1940
|
}
|
|
1901
|
-
), [gt,
|
|
1902
|
-
key: `${
|
|
1941
|
+
), [gt, Ie, , _e] = ee({
|
|
1942
|
+
key: `${ae}::${n}::@@nonce@@`
|
|
1903
1943
|
}), w = x(
|
|
1904
1944
|
(...c) => {
|
|
1905
1945
|
a && console.info(`==> [Auth ${Date.now()}]: `, ...c);
|
|
1906
1946
|
},
|
|
1907
1947
|
[a]
|
|
1908
|
-
), mt = new
|
|
1948
|
+
), mt = new wr(p, m), $ = x(
|
|
1909
1949
|
(c) => {
|
|
1910
1950
|
w(
|
|
1911
1951
|
"removeStateAndLocalStorage: removing state and local storage with reason: ",
|
|
@@ -1913,42 +1953,44 @@ const L = () => {
|
|
|
1913
1953
|
), o({
|
|
1914
1954
|
type: ht,
|
|
1915
1955
|
payload: {
|
|
1916
|
-
logoutReason: c ||
|
|
1956
|
+
logoutReason: c || ne
|
|
1917
1957
|
}
|
|
1918
|
-
}), h(), d(),
|
|
1958
|
+
}), h(), d(), q(), _e(), o({ type: J, payload: { isLoading: !1 } });
|
|
1919
1959
|
},
|
|
1920
|
-
[d, h,
|
|
1921
|
-
),
|
|
1960
|
+
[d, h, _e, q, w]
|
|
1961
|
+
), D = x(
|
|
1922
1962
|
async (c) => {
|
|
1923
1963
|
w("invalidateAndLogout: invalidating and logging out");
|
|
1924
|
-
const { user: E } = s;
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1964
|
+
const { user: E } = s, g = (E == null ? void 0 : E.userId) || fr(f);
|
|
1965
|
+
g || w(
|
|
1966
|
+
"invalidateAndLogout: user cannot be identified, logging out without userId"
|
|
1967
|
+
), await yr({
|
|
1968
|
+
userId: g,
|
|
1969
|
+
idToken: f,
|
|
1928
1970
|
accessToken: p,
|
|
1929
1971
|
refreshToken: m,
|
|
1930
1972
|
clientId: n,
|
|
1931
1973
|
domain: r
|
|
1932
|
-
}),
|
|
1974
|
+
}), $(c || ne);
|
|
1933
1975
|
},
|
|
1934
1976
|
[
|
|
1935
1977
|
p,
|
|
1936
1978
|
s,
|
|
1937
1979
|
n,
|
|
1938
1980
|
r,
|
|
1939
|
-
|
|
1981
|
+
f,
|
|
1940
1982
|
m,
|
|
1941
|
-
|
|
1983
|
+
$,
|
|
1942
1984
|
w
|
|
1943
1985
|
]
|
|
1944
1986
|
);
|
|
1945
|
-
|
|
1987
|
+
Te(() => ((async () => (w("useEffect: setting the fingerprint"), u.current = await ft()))(), () => {
|
|
1946
1988
|
w("useEffect: cleaning up the fingerprint"), u.current = "";
|
|
1947
|
-
}), []),
|
|
1989
|
+
}), []), Te(() => {
|
|
1948
1990
|
if (!i.current)
|
|
1949
|
-
return s.isLoading &&
|
|
1991
|
+
return s.isLoading && f !== null ? (async () => {
|
|
1950
1992
|
try {
|
|
1951
|
-
const c = await
|
|
1993
|
+
const c = await F(f);
|
|
1952
1994
|
c && c.payload[I.USER_ID_KEY] !== "" ? (w("useEffect: setting the authentication state"), o({
|
|
1953
1995
|
type: V,
|
|
1954
1996
|
payload: {
|
|
@@ -1958,51 +2000,51 @@ const L = () => {
|
|
|
1958
2000
|
username: c.payload[I.USERNAME_KEY]
|
|
1959
2001
|
}
|
|
1960
2002
|
}
|
|
1961
|
-
})) : (w("useEffect: invalid JWT, invalidating and logging out"), await
|
|
2003
|
+
})) : (w("useEffect: invalid JWT, invalidating and logging out"), await D(ne));
|
|
1962
2004
|
} catch {
|
|
1963
2005
|
w(
|
|
1964
2006
|
"useEffect: exception validating JWT, invalidating and logging out"
|
|
1965
|
-
), await
|
|
2007
|
+
), await D(ne);
|
|
1966
2008
|
}
|
|
1967
|
-
})() : (w("useEffect: setting the loading state to false"), o({ type:
|
|
2009
|
+
})() : (w("useEffect: setting the loading state to false"), o({ type: J, payload: { isLoading: !1 } })), () => {
|
|
1968
2010
|
i.current = !0;
|
|
1969
2011
|
};
|
|
1970
|
-
}, [s.isLoading,
|
|
2012
|
+
}, [s.isLoading, f, D, w]);
|
|
1971
2013
|
const wt = async (c, E, g) => {
|
|
1972
|
-
const _ =
|
|
1973
|
-
if (
|
|
1974
|
-
const { code_verifier: bt, code_challenge: It } = await
|
|
2014
|
+
const _ = Se();
|
|
2015
|
+
if (Ie(_), o({ type: J, payload: { isLoading: !0 } }), h(), d(), q(), w("login: Logging in with type: ", g), g === j.CODE) {
|
|
2016
|
+
const { code_verifier: bt, code_challenge: It } = await Dn(), ve = await gr({
|
|
1975
2017
|
nonce: _,
|
|
1976
2018
|
clientId: n,
|
|
1977
2019
|
code_challenge: It
|
|
1978
2020
|
});
|
|
1979
|
-
if (
|
|
1980
|
-
const
|
|
2021
|
+
if (ve.status) {
|
|
2022
|
+
const G = await Je({
|
|
1981
2023
|
username: c,
|
|
1982
2024
|
password: E,
|
|
1983
2025
|
clientId: n,
|
|
1984
2026
|
sessionExpiration: t,
|
|
1985
2027
|
nonce: _,
|
|
1986
2028
|
type: g,
|
|
1987
|
-
code:
|
|
2029
|
+
code: ve.code,
|
|
1988
2030
|
code_verifier: bt,
|
|
1989
2031
|
domain: r,
|
|
1990
2032
|
fingerprint: u.current
|
|
1991
2033
|
});
|
|
1992
|
-
return
|
|
2034
|
+
return G.status ? (y(G.idToken), l(G.accessToken), S(G.refreshToken), o({
|
|
1993
2035
|
type: V,
|
|
1994
2036
|
payload: {
|
|
1995
2037
|
authenticationType: g,
|
|
1996
2038
|
user: {
|
|
1997
|
-
userId:
|
|
2039
|
+
userId: G.userId,
|
|
1998
2040
|
username: c
|
|
1999
2041
|
}
|
|
2000
2042
|
}
|
|
2001
|
-
}), !0) : (
|
|
2043
|
+
}), !0) : ($(re), !1);
|
|
2002
2044
|
}
|
|
2003
2045
|
return !1;
|
|
2004
2046
|
}
|
|
2005
|
-
const M = await
|
|
2047
|
+
const M = await Je({
|
|
2006
2048
|
username: c,
|
|
2007
2049
|
password: E,
|
|
2008
2050
|
clientId: n,
|
|
@@ -2012,7 +2054,7 @@ const L = () => {
|
|
|
2012
2054
|
domain: r,
|
|
2013
2055
|
fingerprint: u.current
|
|
2014
2056
|
});
|
|
2015
|
-
return M.status ? (
|
|
2057
|
+
return M.status ? (y(M.idToken), l(M.accessToken), S(M.refreshToken), o({
|
|
2016
2058
|
type: V,
|
|
2017
2059
|
payload: {
|
|
2018
2060
|
authenticationType: g,
|
|
@@ -2021,16 +2063,16 @@ const L = () => {
|
|
|
2021
2063
|
username: c
|
|
2022
2064
|
}
|
|
2023
2065
|
}
|
|
2024
|
-
}), !0) : (
|
|
2066
|
+
}), !0) : ($(re), !1);
|
|
2025
2067
|
}, Et = async (c) => {
|
|
2026
|
-
c == null || c.preventDefault(), await
|
|
2068
|
+
c == null || c.preventDefault(), await D(dr);
|
|
2027
2069
|
}, St = async () => {
|
|
2028
2070
|
const { isAuthenticated: c, user: E } = s;
|
|
2029
2071
|
try {
|
|
2030
2072
|
if (c && E && E.userId) {
|
|
2031
2073
|
if (p) {
|
|
2032
2074
|
w("getAccessToken");
|
|
2033
|
-
const _ = await
|
|
2075
|
+
const _ = await F(p);
|
|
2034
2076
|
if (_ && _.payload[I.USER_ID_KEY] !== "")
|
|
2035
2077
|
return p;
|
|
2036
2078
|
}
|
|
@@ -2041,22 +2083,22 @@ const L = () => {
|
|
|
2041
2083
|
nonce: gt,
|
|
2042
2084
|
domain: r
|
|
2043
2085
|
});
|
|
2044
|
-
return g.status && g.status === "success" ? (l(g.newAccessToken), S(g.newRefreshToken), g.newAccessToken) : (w("getAccessToken: invalid refresh token, re-authenticating user"), await
|
|
2086
|
+
return g.status && g.status === "success" ? (l(g.newAccessToken), S(g.newRefreshToken), g.newAccessToken) : (w("getAccessToken: invalid refresh token, re-authenticating user"), await D(Ae), "");
|
|
2045
2087
|
}
|
|
2046
2088
|
return w(
|
|
2047
2089
|
"getAccessToken: user is not authenticated, cannot get access token"
|
|
2048
|
-
), await
|
|
2090
|
+
), await D(Ae), "";
|
|
2049
2091
|
} catch {
|
|
2050
2092
|
return w(
|
|
2051
2093
|
"getAccessToken: exception occurred, invalidating and logging out"
|
|
2052
|
-
), await
|
|
2094
|
+
), await D(Ae), "";
|
|
2053
2095
|
}
|
|
2054
2096
|
}, At = () => {
|
|
2055
|
-
if (s.isAuthenticated &&
|
|
2056
|
-
return
|
|
2097
|
+
if (s.isAuthenticated && f)
|
|
2098
|
+
return f;
|
|
2057
2099
|
}, Tt = async () => {
|
|
2058
2100
|
const { user: c } = s;
|
|
2059
|
-
let E = await
|
|
2101
|
+
let E = await L({
|
|
2060
2102
|
accessToken: p,
|
|
2061
2103
|
clientId: n,
|
|
2062
2104
|
type: H.GET_REGISTRATION_OPTIONS,
|
|
@@ -2068,8 +2110,8 @@ const L = () => {
|
|
|
2068
2110
|
});
|
|
2069
2111
|
if (E.status)
|
|
2070
2112
|
try {
|
|
2071
|
-
const g = await
|
|
2072
|
-
E = await
|
|
2113
|
+
const g = await Kt(E.data);
|
|
2114
|
+
E = await L({
|
|
2073
2115
|
accessToken: p,
|
|
2074
2116
|
clientId: n,
|
|
2075
2117
|
type: H.VERIFY_REGISTRATION,
|
|
@@ -2081,7 +2123,7 @@ const L = () => {
|
|
|
2081
2123
|
}
|
|
2082
2124
|
});
|
|
2083
2125
|
} catch {
|
|
2084
|
-
return await
|
|
2126
|
+
return await L({
|
|
2085
2127
|
accessToken: p,
|
|
2086
2128
|
clientId: n,
|
|
2087
2129
|
type: H.VERIFY_REGISTRATION,
|
|
@@ -2094,10 +2136,10 @@ const L = () => {
|
|
|
2094
2136
|
}), !1;
|
|
2095
2137
|
}
|
|
2096
2138
|
}, Rt = async () => {
|
|
2097
|
-
const c =
|
|
2098
|
-
|
|
2099
|
-
const E =
|
|
2100
|
-
let g = await
|
|
2139
|
+
const c = Se();
|
|
2140
|
+
Ie(c), o({ type: J, payload: { isLoading: !0 } }), h(), d(), q(), w("loginWithPasskey");
|
|
2141
|
+
const E = Se();
|
|
2142
|
+
let g = await L({
|
|
2101
2143
|
accessToken: p,
|
|
2102
2144
|
clientId: n,
|
|
2103
2145
|
type: H.GET_AUTHENTICATION_OPTIONS,
|
|
@@ -2108,8 +2150,8 @@ const L = () => {
|
|
|
2108
2150
|
});
|
|
2109
2151
|
if (g.status)
|
|
2110
2152
|
try {
|
|
2111
|
-
const _ = await
|
|
2112
|
-
return g = await
|
|
2153
|
+
const _ = await Wt(g.data);
|
|
2154
|
+
return g = await L({
|
|
2113
2155
|
accessToken: p,
|
|
2114
2156
|
clientId: n,
|
|
2115
2157
|
type: H.VERIFY_AUTHENTICATION,
|
|
@@ -2121,18 +2163,18 @@ const L = () => {
|
|
|
2121
2163
|
domain: r,
|
|
2122
2164
|
fingerprint: u.current
|
|
2123
2165
|
}
|
|
2124
|
-
}), g.data.status === "success" ? (
|
|
2166
|
+
}), g.data.status === "success" ? (y(g.data.idToken), l(g.data.accessToken), S(g.data.refreshToken), o({
|
|
2125
2167
|
type: V,
|
|
2126
2168
|
payload: {
|
|
2127
|
-
authenticationType:
|
|
2169
|
+
authenticationType: j.PASSKEY,
|
|
2128
2170
|
user: {
|
|
2129
2171
|
userId: g.data.userId,
|
|
2130
2172
|
username: g.data.username
|
|
2131
2173
|
}
|
|
2132
2174
|
}
|
|
2133
|
-
}), !0) : (
|
|
2175
|
+
}), !0) : ($(re), !1);
|
|
2134
2176
|
} catch {
|
|
2135
|
-
return await
|
|
2177
|
+
return await L({
|
|
2136
2178
|
accessToken: p,
|
|
2137
2179
|
clientId: n,
|
|
2138
2180
|
type: H.VERIFY_AUTHENTICATION,
|
|
@@ -2143,10 +2185,10 @@ const L = () => {
|
|
|
2143
2185
|
nonce: c,
|
|
2144
2186
|
domain: r
|
|
2145
2187
|
}
|
|
2146
|
-
}),
|
|
2188
|
+
}), $(re), !1;
|
|
2147
2189
|
}
|
|
2148
2190
|
};
|
|
2149
|
-
return /* @__PURE__ */
|
|
2191
|
+
return /* @__PURE__ */ ke(Er.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ke(
|
|
2150
2192
|
yt.Provider,
|
|
2151
2193
|
{
|
|
2152
2194
|
value: {
|
|
@@ -2161,9 +2203,9 @@ const L = () => {
|
|
|
2161
2203
|
children: e
|
|
2162
2204
|
}
|
|
2163
2205
|
) });
|
|
2164
|
-
},
|
|
2206
|
+
}, Cr = (e = yt) => Nt(e);
|
|
2165
2207
|
export {
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2208
|
+
j as AUTH_TYPES,
|
|
2209
|
+
Pr as AuthProvider,
|
|
2210
|
+
Cr as useAuth
|
|
2169
2211
|
};
|