@versini/auth-provider 6.4.0 → 6.4.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.d.ts +2 -2
- package/dist/index.js +436 -429
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Q = (e, t, n) =>
|
|
4
|
-
import { jsx as
|
|
5
|
-
import Pt, { useSyncExternalStore as
|
|
1
|
+
var Ct = Object.defineProperty;
|
|
2
|
+
var kt = (e, t, n) => t in e ? Ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var Q = (e, t, n) => kt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsx as Ce } from "react/jsx-runtime";
|
|
5
|
+
import Pt, { useSyncExternalStore as Ot, useCallback as D, useEffect as Ae, createContext as Nt, useReducer as Dt, useRef as ke, useContext as Ut } from "react";
|
|
6
6
|
/*!
|
|
7
|
-
@versini/auth-provider v6.4.
|
|
7
|
+
@versini/auth-provider v6.4.1
|
|
8
8
|
© 2024 gizmette.com
|
|
9
9
|
*/
|
|
10
10
|
try {
|
|
11
11
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
12
|
-
version: "6.4.
|
|
13
|
-
buildTime: "07/
|
|
12
|
+
version: "6.4.1",
|
|
13
|
+
buildTime: "07/27/2024 11:42 AM EDT",
|
|
14
14
|
homepage: "https://github.com/aversini/auth-client",
|
|
15
15
|
license: "MIT"
|
|
16
16
|
});
|
|
@@ -32,7 +32,7 @@ function ie(e) {
|
|
|
32
32
|
function Te() {
|
|
33
33
|
return window?.PublicKeyCredential !== void 0 && typeof window.PublicKeyCredential == "function";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function Ve(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 je(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 $t({ error: e, options: t }) {
|
|
52
52
|
const { publicKey: n } = t;
|
|
53
53
|
if (!n)
|
|
54
54
|
throw Error("options was missing required publicKey property");
|
|
@@ -97,7 +97,7 @@ function Ut({ error: e, options: t }) {
|
|
|
97
97
|
});
|
|
98
98
|
if (e.name === "SecurityError") {
|
|
99
99
|
const r = window.location.hostname;
|
|
100
|
-
if (
|
|
100
|
+
if (je(r)) {
|
|
101
101
|
if (n.rp.id !== r)
|
|
102
102
|
return new b({
|
|
103
103
|
message: `The RP ID "${n.rp.id}" is invalid for this domain`,
|
|
@@ -125,7 +125,7 @@ function Ut({ error: e, options: t }) {
|
|
|
125
125
|
}
|
|
126
126
|
return e;
|
|
127
127
|
}
|
|
128
|
-
class
|
|
128
|
+
class Kt {
|
|
129
129
|
createNewAbortSignal() {
|
|
130
130
|
if (this.controller) {
|
|
131
131
|
const n = new Error("Cancelling existing WebAuthn API call for new one");
|
|
@@ -141,12 +141,12 @@ class $t {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
function
|
|
146
|
-
if (e && !(
|
|
144
|
+
const Fe = new Kt(), Ht = ["cross-platform", "platform"];
|
|
145
|
+
function Be(e) {
|
|
146
|
+
if (e && !(Ht.indexOf(e) < 0))
|
|
147
147
|
return e;
|
|
148
148
|
}
|
|
149
|
-
async function
|
|
149
|
+
async function Lt(e) {
|
|
150
150
|
if (!Te())
|
|
151
151
|
throw new Error("WebAuthn is not supported in this browser");
|
|
152
152
|
const n = { publicKey: {
|
|
@@ -156,41 +156,41 @@ async function Ht(e) {
|
|
|
156
156
|
...e.user,
|
|
157
157
|
id: ie(e.user.id)
|
|
158
158
|
},
|
|
159
|
-
excludeCredentials: e.excludeCredentials?.map(
|
|
159
|
+
excludeCredentials: e.excludeCredentials?.map(Ve)
|
|
160
160
|
} };
|
|
161
|
-
n.signal =
|
|
161
|
+
n.signal = Fe.createNewAbortSignal();
|
|
162
162
|
let r;
|
|
163
163
|
try {
|
|
164
164
|
r = await navigator.credentials.create(n);
|
|
165
|
-
} catch (
|
|
166
|
-
throw
|
|
165
|
+
} catch (g) {
|
|
166
|
+
throw $t({ error: g, options: n });
|
|
167
167
|
}
|
|
168
168
|
if (!r)
|
|
169
169
|
throw new Error("Registration was not completed");
|
|
170
170
|
const { id: a, rawId: s, response: o, type: i } = r;
|
|
171
171
|
let c;
|
|
172
172
|
typeof o.getTransports == "function" && (c = o.getTransports());
|
|
173
|
-
let
|
|
173
|
+
let y;
|
|
174
174
|
if (typeof o.getPublicKeyAlgorithm == "function")
|
|
175
175
|
try {
|
|
176
|
-
|
|
177
|
-
} catch (
|
|
178
|
-
fe("getPublicKeyAlgorithm()",
|
|
176
|
+
y = o.getPublicKeyAlgorithm();
|
|
177
|
+
} catch (g) {
|
|
178
|
+
fe("getPublicKeyAlgorithm()", g);
|
|
179
179
|
}
|
|
180
180
|
let l;
|
|
181
181
|
if (typeof o.getPublicKey == "function")
|
|
182
182
|
try {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
} catch (
|
|
186
|
-
fe("getPublicKey()",
|
|
183
|
+
const g = o.getPublicKey();
|
|
184
|
+
g !== null && (l = v(g));
|
|
185
|
+
} catch (g) {
|
|
186
|
+
fe("getPublicKey()", g);
|
|
187
187
|
}
|
|
188
188
|
let h;
|
|
189
189
|
if (typeof o.getAuthenticatorData == "function")
|
|
190
190
|
try {
|
|
191
191
|
h = v(o.getAuthenticatorData());
|
|
192
|
-
} catch (
|
|
193
|
-
fe("getAuthenticatorData()",
|
|
192
|
+
} catch (g) {
|
|
193
|
+
fe("getAuthenticatorData()", g);
|
|
194
194
|
}
|
|
195
195
|
return {
|
|
196
196
|
id: a,
|
|
@@ -199,26 +199,26 @@ async function Ht(e) {
|
|
|
199
199
|
attestationObject: v(o.attestationObject),
|
|
200
200
|
clientDataJSON: v(o.clientDataJSON),
|
|
201
201
|
transports: c,
|
|
202
|
-
publicKeyAlgorithm:
|
|
202
|
+
publicKeyAlgorithm: y,
|
|
203
203
|
publicKey: l,
|
|
204
204
|
authenticatorData: h
|
|
205
205
|
},
|
|
206
206
|
type: i,
|
|
207
207
|
clientExtensionResults: r.getClientExtensionResults(),
|
|
208
|
-
authenticatorAttachment:
|
|
208
|
+
authenticatorAttachment: Be(r.authenticatorAttachment)
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
function fe(e, t) {
|
|
212
212
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
|
|
213
213
|
`, t);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Wt() {
|
|
216
216
|
if (!Te())
|
|
217
217
|
return new Promise((t) => t(!1));
|
|
218
218
|
const e = window.PublicKeyCredential;
|
|
219
219
|
return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function xt({ error: e, options: t }) {
|
|
222
222
|
const { publicKey: n } = t;
|
|
223
223
|
if (!n)
|
|
224
224
|
throw Error("options was missing required publicKey property");
|
|
@@ -238,7 +238,7 @@ function Wt({ error: e, options: t }) {
|
|
|
238
238
|
});
|
|
239
239
|
if (e.name === "SecurityError") {
|
|
240
240
|
const r = window.location.hostname;
|
|
241
|
-
if (
|
|
241
|
+
if (je(r)) {
|
|
242
242
|
if (n.rpId !== r)
|
|
243
243
|
return new b({
|
|
244
244
|
message: `The RP ID "${n.rpId}" is invalid for this domain`,
|
|
@@ -259,33 +259,33 @@ function Wt({ error: e, options: t }) {
|
|
|
259
259
|
}
|
|
260
260
|
return e;
|
|
261
261
|
}
|
|
262
|
-
async function
|
|
262
|
+
async function Mt(e, t = !1) {
|
|
263
263
|
if (!Te())
|
|
264
264
|
throw new Error("WebAuthn is not supported in this browser");
|
|
265
265
|
let n;
|
|
266
|
-
e.allowCredentials?.length !== 0 && (n = e.allowCredentials?.map(
|
|
266
|
+
e.allowCredentials?.length !== 0 && (n = e.allowCredentials?.map(Ve));
|
|
267
267
|
const r = {
|
|
268
268
|
...e,
|
|
269
269
|
challenge: ie(e.challenge),
|
|
270
270
|
allowCredentials: n
|
|
271
271
|
}, a = {};
|
|
272
272
|
if (t) {
|
|
273
|
-
if (!await
|
|
273
|
+
if (!await Wt())
|
|
274
274
|
throw Error("Browser does not support WebAuthn autofill");
|
|
275
275
|
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
|
|
276
276
|
throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
|
|
277
277
|
a.mediation = "conditional", r.allowCredentials = [];
|
|
278
278
|
}
|
|
279
|
-
a.publicKey = r, a.signal =
|
|
279
|
+
a.publicKey = r, a.signal = Fe.createNewAbortSignal();
|
|
280
280
|
let s;
|
|
281
281
|
try {
|
|
282
282
|
s = await navigator.credentials.get(a);
|
|
283
283
|
} catch (h) {
|
|
284
|
-
throw
|
|
284
|
+
throw xt({ error: h, options: a });
|
|
285
285
|
}
|
|
286
286
|
if (!s)
|
|
287
287
|
throw new Error("Authentication was not completed");
|
|
288
|
-
const { id: o, rawId: i, response: c, type:
|
|
288
|
+
const { id: o, rawId: i, response: c, type: y } = s;
|
|
289
289
|
let l;
|
|
290
290
|
return c.userHandle && (l = v(c.userHandle)), {
|
|
291
291
|
id: o,
|
|
@@ -296,9 +296,9 @@ async function xt(e, t = !1) {
|
|
|
296
296
|
signature: v(c.signature),
|
|
297
297
|
userHandle: l
|
|
298
298
|
},
|
|
299
|
-
type:
|
|
299
|
+
type: y,
|
|
300
300
|
clientExtensionResults: s.getClientExtensionResults(),
|
|
301
|
-
authenticatorAttachment:
|
|
301
|
+
authenticatorAttachment: Be(s.authenticatorAttachment)
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
304
|
/*!
|
|
@@ -308,7 +308,7 @@ async function xt(e, t = !1) {
|
|
|
308
308
|
try {
|
|
309
309
|
window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
|
|
310
310
|
version: "3.3.0",
|
|
311
|
-
buildTime: "07/
|
|
311
|
+
buildTime: "07/27/2024 11:42 AM EDT",
|
|
312
312
|
homepage: "https://github.com/aversini/auth-client",
|
|
313
313
|
license: "MIT"
|
|
314
314
|
});
|
|
@@ -321,7 +321,7 @@ const M = {
|
|
|
321
321
|
CODE: "code",
|
|
322
322
|
REFRESH_TOKEN: "refresh_token",
|
|
323
323
|
PASSKEY: "passkey"
|
|
324
|
-
},
|
|
324
|
+
}, qe = {
|
|
325
325
|
CLIENT_ID: "X-Auth-ClientId"
|
|
326
326
|
}, A = {
|
|
327
327
|
ALG: "RS256",
|
|
@@ -334,7 +334,7 @@ const M = {
|
|
|
334
334
|
CREATED_AT_KEY: "iat",
|
|
335
335
|
SCOPES_KEY: "scopes",
|
|
336
336
|
ISSUER: "gizmette.com"
|
|
337
|
-
},
|
|
337
|
+
}, Gt = `-----BEGIN PUBLIC KEY-----
|
|
338
338
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
|
|
339
339
|
w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
|
|
340
340
|
i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
|
|
@@ -346,15 +346,15 @@ awIDAQAB
|
|
|
346
346
|
AUTHENTICATE: "authenticate",
|
|
347
347
|
CODE: "code",
|
|
348
348
|
LOGOUT: "logout"
|
|
349
|
-
}, he = crypto,
|
|
350
|
-
function
|
|
349
|
+
}, he = crypto, ze = (e) => e instanceof CryptoKey, X = new TextEncoder(), B = new TextDecoder();
|
|
350
|
+
function Jt(...e) {
|
|
351
351
|
const t = e.reduce((a, { length: s }) => a + s, 0), n = new Uint8Array(t);
|
|
352
352
|
let r = 0;
|
|
353
353
|
for (const a of e)
|
|
354
354
|
n.set(a, r), r += a.length;
|
|
355
355
|
return n;
|
|
356
356
|
}
|
|
357
|
-
const
|
|
357
|
+
const Yt = (e) => {
|
|
358
358
|
const t = atob(e), n = new Uint8Array(t.length);
|
|
359
359
|
for (let r = 0; r < t.length; r++)
|
|
360
360
|
n[r] = t.charCodeAt(r);
|
|
@@ -363,12 +363,12 @@ const Jt = (e) => {
|
|
|
363
363
|
let t = e;
|
|
364
364
|
t instanceof Uint8Array && (t = B.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
365
365
|
try {
|
|
366
|
-
return
|
|
366
|
+
return Yt(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
|
-
}, _ = class extends
|
|
379
|
+
}, _ = 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
|
-
}, Pe = class extends
|
|
386
|
+
}, Pe = 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 Vt extends U {
|
|
395
395
|
constructor() {
|
|
396
396
|
super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
397
397
|
}
|
|
@@ -399,7 +399,7 @@ class Yt extends D {
|
|
|
399
399
|
return "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
let O = class extends
|
|
402
|
+
let O = 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 S extends
|
|
410
|
+
class S extends U {
|
|
411
411
|
constructor() {
|
|
412
412
|
super(...arguments), this.code = "ERR_JWS_INVALID";
|
|
413
413
|
}
|
|
@@ -415,7 +415,7 @@ class S extends D {
|
|
|
415
415
|
return "ERR_JWS_INVALID";
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
let
|
|
418
|
+
let k = class extends U {
|
|
419
419
|
constructor() {
|
|
420
420
|
super(...arguments), this.code = "ERR_JWT_INVALID";
|
|
421
421
|
}
|
|
@@ -423,7 +423,7 @@ let P = class extends D {
|
|
|
423
423
|
return "ERR_JWT_INVALID";
|
|
424
424
|
}
|
|
425
425
|
};
|
|
426
|
-
class
|
|
426
|
+
class jt extends U {
|
|
427
427
|
constructor() {
|
|
428
428
|
super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
|
|
429
429
|
}
|
|
@@ -440,7 +440,7 @@ function Z(e, t) {
|
|
|
440
440
|
function ye(e) {
|
|
441
441
|
return parseInt(e.name.slice(4), 10);
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function Ft(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 Bt(e, t) {
|
|
456
456
|
if (t.length && !t.some((n) => e.usages.includes(n))) {
|
|
457
457
|
let n = "CryptoKey does not support this operation, its usages must include ";
|
|
458
458
|
if (t.length > 2) {
|
|
@@ -462,7 +462,7 @@ function Ft(e, t) {
|
|
|
462
462
|
throw new TypeError(n);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function qt(e, t, ...n) {
|
|
466
466
|
switch (t) {
|
|
467
467
|
case "HS256":
|
|
468
468
|
case "HS384":
|
|
@@ -504,7 +504,7 @@ function Bt(e, t, ...n) {
|
|
|
504
504
|
case "ES512": {
|
|
505
505
|
if (!Z(e.algorithm, "ECDSA"))
|
|
506
506
|
throw C("ECDSA");
|
|
507
|
-
const r =
|
|
507
|
+
const r = Ft(t);
|
|
508
508
|
if (e.algorithm.namedCurve !== r)
|
|
509
509
|
throw C(r, "algorithm.namedCurve");
|
|
510
510
|
break;
|
|
@@ -512,9 +512,9 @@ function Bt(e, t, ...n) {
|
|
|
512
512
|
default:
|
|
513
513
|
throw new TypeError("CryptoKey does not support this operation");
|
|
514
514
|
}
|
|
515
|
-
|
|
515
|
+
Bt(e, n);
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Qe(e, t, ...n) {
|
|
518
518
|
var r;
|
|
519
519
|
if (n.length > 2) {
|
|
520
520
|
const a = n.pop();
|
|
@@ -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
|
|
526
|
-
function
|
|
527
|
-
return
|
|
525
|
+
const Oe = (e, ...t) => Qe("Key must be ", e, ...t);
|
|
526
|
+
function Xe(e, t, ...n) {
|
|
527
|
+
return Qe(`Key for the ${e} algorithm must be `, t, ...n);
|
|
528
528
|
}
|
|
529
|
-
const
|
|
529
|
+
const Ze = (e) => ze(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ce = ["CryptoKey"], zt = (...e) => {
|
|
530
530
|
const t = e.filter(Boolean);
|
|
531
531
|
if (t.length === 0 || t.length === 1)
|
|
532
532
|
return !0;
|
|
@@ -545,11 +545,11 @@ const Xe = (e) => qe(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ce = ["C
|
|
|
545
545
|
}
|
|
546
546
|
return !0;
|
|
547
547
|
};
|
|
548
|
-
function
|
|
548
|
+
function Qt(e) {
|
|
549
549
|
return typeof e == "object" && e !== null;
|
|
550
550
|
}
|
|
551
551
|
function ue(e) {
|
|
552
|
-
if (!
|
|
552
|
+
if (!Qt(e) || Object.prototype.toString.call(e) !== "[object Object]")
|
|
553
553
|
return !1;
|
|
554
554
|
if (Object.getPrototypeOf(e) === null)
|
|
555
555
|
return !0;
|
|
@@ -558,14 +558,14 @@ function ue(e) {
|
|
|
558
558
|
t = Object.getPrototypeOf(t);
|
|
559
559
|
return Object.getPrototypeOf(e) === t;
|
|
560
560
|
}
|
|
561
|
-
const
|
|
561
|
+
const Xt = (e, t) => {
|
|
562
562
|
if (e.startsWith("RS") || e.startsWith("PS")) {
|
|
563
563
|
const { modulusLength: n } = t.algorithm;
|
|
564
564
|
if (typeof n != "number" || n < 2048)
|
|
565
565
|
throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
|
|
566
566
|
}
|
|
567
567
|
};
|
|
568
|
-
function
|
|
568
|
+
function Zt(e) {
|
|
569
569
|
let t, n;
|
|
570
570
|
switch (e.kty) {
|
|
571
571
|
case "RSA": {
|
|
@@ -637,62 +637,62 @@ function Xt(e) {
|
|
|
637
637
|
}
|
|
638
638
|
return { algorithm: t, keyUsages: n };
|
|
639
639
|
}
|
|
640
|
-
const
|
|
640
|
+
const en = async (e) => {
|
|
641
641
|
if (!e.alg)
|
|
642
642
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
643
|
-
const { algorithm: t, keyUsages: n } =
|
|
643
|
+
const { algorithm: t, keyUsages: n } = Zt(e), r = [
|
|
644
644
|
t,
|
|
645
645
|
e.ext ?? !1,
|
|
646
646
|
e.key_ops ?? n
|
|
647
647
|
], a = { ...e };
|
|
648
648
|
return delete a.alg, delete a.use, he.subtle.importKey("jwk", a, ...r);
|
|
649
|
-
},
|
|
649
|
+
}, et = (e) => F(e);
|
|
650
650
|
let ge, me;
|
|
651
|
-
const
|
|
651
|
+
const tt = (e) => e?.[Symbol.toStringTag] === "KeyObject", nt = async (e, t, n, r) => {
|
|
652
652
|
let a = e.get(t);
|
|
653
653
|
if (a != null && a[r])
|
|
654
654
|
return a[r];
|
|
655
|
-
const s = await
|
|
655
|
+
const s = await en({ ...n, alg: r });
|
|
656
656
|
return a ? a[r] = s : e.set(t, { [r]: s }), s;
|
|
657
|
-
},
|
|
658
|
-
if (
|
|
657
|
+
}, tn = (e, t) => {
|
|
658
|
+
if (tt(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 ?
|
|
660
|
+
return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? et(n.k) : (me || (me = /* @__PURE__ */ new WeakMap()), nt(me, e, n, t));
|
|
661
661
|
}
|
|
662
662
|
return e;
|
|
663
|
-
},
|
|
664
|
-
if (
|
|
663
|
+
}, nn = (e, t) => {
|
|
664
|
+
if (tt(e)) {
|
|
665
665
|
let n = e.export({ format: "jwk" });
|
|
666
|
-
return n.k ?
|
|
666
|
+
return n.k ? et(n.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), nt(ge, e, n, t));
|
|
667
667
|
}
|
|
668
668
|
return e;
|
|
669
|
-
},
|
|
669
|
+
}, rn = { normalizePublicKey: tn, normalizePrivateKey: nn }, P = (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]) || P(e, t, r + 1);
|
|
676
|
+
}, Ne = (e) => {
|
|
677
677
|
switch (!0) {
|
|
678
|
-
case
|
|
678
|
+
case P(e, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
679
679
|
return "P-256";
|
|
680
|
-
case
|
|
680
|
+
case P(e, [43, 129, 4, 0, 34]):
|
|
681
681
|
return "P-384";
|
|
682
|
-
case
|
|
682
|
+
case P(e, [43, 129, 4, 0, 35]):
|
|
683
683
|
return "P-521";
|
|
684
|
-
case
|
|
684
|
+
case P(e, [43, 101, 110]):
|
|
685
685
|
return "X25519";
|
|
686
|
-
case
|
|
686
|
+
case P(e, [43, 101, 111]):
|
|
687
687
|
return "X448";
|
|
688
|
-
case
|
|
688
|
+
case P(e, [43, 101, 112]):
|
|
689
689
|
return "Ed25519";
|
|
690
|
-
case
|
|
690
|
+
case P(e, [43, 101, 113]):
|
|
691
691
|
return "Ed448";
|
|
692
692
|
default:
|
|
693
693
|
throw new O("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
|
|
694
694
|
}
|
|
695
|
-
},
|
|
695
|
+
}, an = async (e, t, n, r, a) => {
|
|
696
696
|
let s, o;
|
|
697
697
|
const i = new Uint8Array(atob(n.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
|
|
698
698
|
switch (r) {
|
|
@@ -728,43 +728,43 @@ const et = (e) => e?.[Symbol.toStringTag] === "KeyObject", tt = async (e, t, n,
|
|
|
728
728
|
case "ECDH-ES+A128KW":
|
|
729
729
|
case "ECDH-ES+A192KW":
|
|
730
730
|
case "ECDH-ES+A256KW": {
|
|
731
|
-
const c =
|
|
731
|
+
const c = Ne(i);
|
|
732
732
|
s = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, 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
739
|
throw new O('Invalid or unsupported "alg" (Algorithm) value');
|
|
740
740
|
}
|
|
741
741
|
return he.subtle.importKey(t, i, s, !1, o);
|
|
742
|
-
},
|
|
743
|
-
async function
|
|
742
|
+
}, on = (e, t, n) => an(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
|
|
743
|
+
async function sn(e, t, n) {
|
|
744
744
|
if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
745
745
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
746
|
-
return
|
|
746
|
+
return on(e, t);
|
|
747
747
|
}
|
|
748
|
-
const se = (e) => e?.[Symbol.toStringTag],
|
|
748
|
+
const se = (e) => e?.[Symbol.toStringTag], cn = (e, t) => {
|
|
749
749
|
if (!(t instanceof Uint8Array)) {
|
|
750
|
-
if (!
|
|
751
|
-
throw new TypeError(
|
|
750
|
+
if (!Ze(t))
|
|
751
|
+
throw new TypeError(Xe(e, t, ...ce, "Uint8Array"));
|
|
752
752
|
if (t.type !== "secret")
|
|
753
753
|
throw new TypeError(`${se(t)} instances for symmetric algorithms must be of type "secret"`);
|
|
754
754
|
}
|
|
755
|
-
},
|
|
756
|
-
if (!
|
|
757
|
-
throw new TypeError(
|
|
755
|
+
}, un = (e, t, n) => {
|
|
756
|
+
if (!Ze(t))
|
|
757
|
+
throw new TypeError(Xe(e, t, ...ce));
|
|
758
758
|
if (t.type === "secret")
|
|
759
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
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
763
|
throw new TypeError(`${se(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
764
|
-
},
|
|
765
|
-
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ?
|
|
764
|
+
}, ln = (e, t, n) => {
|
|
765
|
+
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? cn(e, t) : un(e, t, n);
|
|
766
766
|
};
|
|
767
|
-
function
|
|
767
|
+
function dn(e, t, n, r, a) {
|
|
768
768
|
if (a.crit !== void 0 && r?.crit === void 0)
|
|
769
769
|
throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
770
770
|
if (!r || r.crit === void 0)
|
|
@@ -783,13 +783,13 @@ function ln(e, t, n, r, a) {
|
|
|
783
783
|
}
|
|
784
784
|
return new Set(r.crit);
|
|
785
785
|
}
|
|
786
|
-
const
|
|
786
|
+
const hn = (e, t) => {
|
|
787
787
|
if (t !== void 0 && (!Array.isArray(t) || t.some((n) => typeof n != "string")))
|
|
788
788
|
throw new TypeError(`"${e}" option must be an array of strings`);
|
|
789
789
|
if (t)
|
|
790
790
|
return new Set(t);
|
|
791
791
|
};
|
|
792
|
-
function
|
|
792
|
+
function pn(e, t) {
|
|
793
793
|
const n = `SHA-${e.slice(-3)}`;
|
|
794
794
|
switch (e) {
|
|
795
795
|
case "HS256":
|
|
@@ -814,27 +814,27 @@ function hn(e, t) {
|
|
|
814
814
|
throw new O(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
async function
|
|
818
|
-
if (t = await
|
|
819
|
-
return
|
|
817
|
+
async function fn(e, t, n) {
|
|
818
|
+
if (t = await rn.normalizePublicKey(t, e), ze(t))
|
|
819
|
+
return qt(t, e, n), t;
|
|
820
820
|
if (t instanceof Uint8Array) {
|
|
821
821
|
if (!e.startsWith("HS"))
|
|
822
|
-
throw new TypeError(
|
|
822
|
+
throw new TypeError(Oe(t, ...ce));
|
|
823
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
|
-
const
|
|
828
|
-
const a = await
|
|
829
|
-
|
|
830
|
-
const s =
|
|
827
|
+
const yn = async (e, t, n, r) => {
|
|
828
|
+
const a = await fn(e, t, "verify");
|
|
829
|
+
Xt(e, a);
|
|
830
|
+
const s = pn(e, a.algorithm);
|
|
831
831
|
try {
|
|
832
832
|
return await he.subtle.verify(s, a, n, r);
|
|
833
833
|
} catch {
|
|
834
834
|
return !1;
|
|
835
835
|
}
|
|
836
836
|
};
|
|
837
|
-
async function
|
|
837
|
+
async function gn(e, t, n) {
|
|
838
838
|
if (!ue(e))
|
|
839
839
|
throw new S("Flattened JWS must be an object");
|
|
840
840
|
if (e.protected === void 0 && e.header === void 0)
|
|
@@ -855,59 +855,59 @@ async function yn(e, t, n) {
|
|
|
855
855
|
} catch {
|
|
856
856
|
throw new S("JWS Protected Header is invalid");
|
|
857
857
|
}
|
|
858
|
-
if (!
|
|
858
|
+
if (!zt(r, e.header))
|
|
859
859
|
throw new S("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
860
860
|
const a = {
|
|
861
861
|
...r,
|
|
862
862
|
...e.header
|
|
863
|
-
}, s =
|
|
863
|
+
}, s = dn(S, /* @__PURE__ */ new Map([["b64", !0]]), n?.crit, r, a);
|
|
864
864
|
let o = !0;
|
|
865
865
|
if (s.has("b64") && (o = r.b64, typeof o != "boolean"))
|
|
866
866
|
throw new S('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
867
867
|
const { alg: i } = a;
|
|
868
868
|
if (typeof i != "string" || !i)
|
|
869
869
|
throw new S('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
870
|
-
const c = n &&
|
|
870
|
+
const c = n && hn("algorithms", n.algorithms);
|
|
871
871
|
if (c && !c.has(i))
|
|
872
|
-
throw new
|
|
872
|
+
throw new Vt('"alg" (Algorithm) Header Parameter value not allowed');
|
|
873
873
|
if (o) {
|
|
874
874
|
if (typeof e.payload != "string")
|
|
875
875
|
throw new S("JWS Payload must be a string");
|
|
876
876
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
877
877
|
throw new S("JWS Payload must be a string or an Uint8Array instance");
|
|
878
|
-
let
|
|
879
|
-
typeof t == "function" && (t = await t(r, e),
|
|
880
|
-
const l =
|
|
878
|
+
let y = !1;
|
|
879
|
+
typeof t == "function" && (t = await t(r, e), y = !0), ln(i, t, "verify");
|
|
880
|
+
const l = Jt(X.encode(e.protected ?? ""), X.encode("."), typeof e.payload == "string" ? X.encode(e.payload) : e.payload);
|
|
881
881
|
let h;
|
|
882
882
|
try {
|
|
883
883
|
h = F(e.signature);
|
|
884
884
|
} catch {
|
|
885
885
|
throw new S("Failed to base64url decode the signature");
|
|
886
886
|
}
|
|
887
|
-
if (!await
|
|
888
|
-
throw new
|
|
889
|
-
let
|
|
887
|
+
if (!await yn(i, t, h, l))
|
|
888
|
+
throw new jt();
|
|
889
|
+
let g;
|
|
890
890
|
if (o)
|
|
891
891
|
try {
|
|
892
|
-
|
|
892
|
+
g = F(e.payload);
|
|
893
893
|
} catch {
|
|
894
894
|
throw new S("Failed to base64url decode the payload");
|
|
895
895
|
}
|
|
896
|
-
else typeof e.payload == "string" ?
|
|
897
|
-
const
|
|
898
|
-
return e.protected !== void 0 && (
|
|
896
|
+
else typeof e.payload == "string" ? g = X.encode(e.payload) : g = e.payload;
|
|
897
|
+
const f = { payload: g };
|
|
898
|
+
return e.protected !== void 0 && (f.protectedHeader = r), e.header !== void 0 && (f.unprotectedHeader = e.header), y ? { ...f, key: t } : f;
|
|
899
899
|
}
|
|
900
|
-
async function
|
|
900
|
+
async function mn(e, t, n) {
|
|
901
901
|
if (e instanceof Uint8Array && (e = B.decode(e)), typeof e != "string")
|
|
902
902
|
throw new S("Compact JWS must be a string or Uint8Array");
|
|
903
903
|
const { 0: r, 1: a, 2: s, length: o } = e.split(".");
|
|
904
904
|
if (o !== 3)
|
|
905
905
|
throw new S("Invalid Compact JWS");
|
|
906
|
-
const i = await
|
|
906
|
+
const i = await gn({ payload: a, protected: r, signature: s }, t, n), c = { payload: i.payload, protectedHeader: i.protectedHeader };
|
|
907
907
|
return typeof t == "function" ? { ...c, key: i.key } : c;
|
|
908
908
|
}
|
|
909
|
-
const
|
|
910
|
-
const t =
|
|
909
|
+
const wn = (e) => Math.floor(e.getTime() / 1e3), rt = 60, at = rt * 60, Re = at * 24, En = Re * 7, Sn = Re * 365.25, An = /^(\+|\-)? ?(\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
|
+
const t = An.exec(e);
|
|
911
911
|
if (!t || t[4] && t[1])
|
|
912
912
|
throw new TypeError("Invalid time period format");
|
|
913
913
|
const n = parseFloat(t[2]), r = t[3].toLowerCase();
|
|
@@ -925,14 +925,14 @@ const mn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
|
|
|
925
925
|
case "min":
|
|
926
926
|
case "mins":
|
|
927
927
|
case "m":
|
|
928
|
-
a = Math.round(n *
|
|
928
|
+
a = Math.round(n * rt);
|
|
929
929
|
break;
|
|
930
930
|
case "hour":
|
|
931
931
|
case "hours":
|
|
932
932
|
case "hr":
|
|
933
933
|
case "hrs":
|
|
934
934
|
case "h":
|
|
935
|
-
a = Math.round(n *
|
|
935
|
+
a = Math.round(n * at);
|
|
936
936
|
break;
|
|
937
937
|
case "day":
|
|
938
938
|
case "days":
|
|
@@ -942,26 +942,26 @@ const mn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
|
|
|
942
942
|
case "week":
|
|
943
943
|
case "weeks":
|
|
944
944
|
case "w":
|
|
945
|
-
a = Math.round(n *
|
|
945
|
+
a = Math.round(n * En);
|
|
946
946
|
break;
|
|
947
947
|
default:
|
|
948
|
-
a = Math.round(n *
|
|
948
|
+
a = Math.round(n * Sn);
|
|
949
949
|
break;
|
|
950
950
|
}
|
|
951
951
|
return t[1] === "-" || t[4] === "ago" ? -a : a;
|
|
952
|
-
},
|
|
952
|
+
}, Ue = (e) => e.toLowerCase().replace(/^application\//, ""), Tn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Rn = (e, t, n = {}) => {
|
|
953
953
|
let r;
|
|
954
954
|
try {
|
|
955
955
|
r = JSON.parse(B.decode(t));
|
|
956
956
|
} catch {
|
|
957
957
|
}
|
|
958
958
|
if (!ue(r))
|
|
959
|
-
throw new
|
|
959
|
+
throw new k("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 _('unexpected "typ" JWT header value', r, "typ", "check_failed");
|
|
963
|
-
const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge:
|
|
964
|
-
|
|
963
|
+
const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: y } = n, l = [...s];
|
|
964
|
+
y !== void 0 && l.push("iat"), c !== void 0 && l.push("aud"), i !== void 0 && l.push("sub"), o !== void 0 && l.push("iss");
|
|
965
965
|
for (const u of new Set(l.reverse()))
|
|
966
966
|
if (!(u in r))
|
|
967
967
|
throw new _(`missing required "${u}" claim`, r, u, "missing");
|
|
@@ -969,12 +969,12 @@ const mn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
|
|
|
969
969
|
throw new _('unexpected "iss" claim value', r, "iss", "check_failed");
|
|
970
970
|
if (i && r.sub !== i)
|
|
971
971
|
throw new _('unexpected "sub" claim value', r, "sub", "check_failed");
|
|
972
|
-
if (c && !
|
|
972
|
+
if (c && !Tn(r.aud, typeof c == "string" ? [c] : c))
|
|
973
973
|
throw new _('unexpected "aud" claim value', r, "aud", "check_failed");
|
|
974
974
|
let h;
|
|
975
975
|
switch (typeof n.clockTolerance) {
|
|
976
976
|
case "string":
|
|
977
|
-
h =
|
|
977
|
+
h = De(n.clockTolerance);
|
|
978
978
|
break;
|
|
979
979
|
case "number":
|
|
980
980
|
h = n.clockTolerance;
|
|
@@ -985,23 +985,23 @@ const mn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
|
|
|
985
985
|
default:
|
|
986
986
|
throw new TypeError("Invalid clockTolerance option type");
|
|
987
987
|
}
|
|
988
|
-
const { currentDate:
|
|
989
|
-
if ((r.iat !== void 0 ||
|
|
988
|
+
const { currentDate: g } = n, f = wn(g || /* @__PURE__ */ new Date());
|
|
989
|
+
if ((r.iat !== void 0 || y) && typeof r.iat != "number")
|
|
990
990
|
throw new _('"iat" claim must be a number', r, "iat", "invalid");
|
|
991
991
|
if (r.nbf !== void 0) {
|
|
992
992
|
if (typeof r.nbf != "number")
|
|
993
993
|
throw new _('"nbf" claim must be a number', r, "nbf", "invalid");
|
|
994
|
-
if (r.nbf >
|
|
994
|
+
if (r.nbf > f + h)
|
|
995
995
|
throw new _('"nbf" claim timestamp check failed', r, "nbf", "check_failed");
|
|
996
996
|
}
|
|
997
997
|
if (r.exp !== void 0) {
|
|
998
998
|
if (typeof r.exp != "number")
|
|
999
999
|
throw new _('"exp" claim must be a number', r, "exp", "invalid");
|
|
1000
|
-
if (r.exp <=
|
|
1000
|
+
if (r.exp <= f - h)
|
|
1001
1001
|
throw new Pe('"exp" claim timestamp check failed', r, "exp", "check_failed");
|
|
1002
1002
|
}
|
|
1003
|
-
if (
|
|
1004
|
-
const u =
|
|
1003
|
+
if (y) {
|
|
1004
|
+
const u = f - r.iat, m = typeof y == "number" ? y : De(y);
|
|
1005
1005
|
if (u - h > m)
|
|
1006
1006
|
throw new Pe('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
|
|
1007
1007
|
if (u < 0 - h)
|
|
@@ -1009,53 +1009,53 @@ const mn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
|
|
|
1009
1009
|
}
|
|
1010
1010
|
return r;
|
|
1011
1011
|
};
|
|
1012
|
-
async function
|
|
1012
|
+
async function bn(e, t, n) {
|
|
1013
1013
|
var r;
|
|
1014
|
-
const a = await
|
|
1014
|
+
const a = await mn(e, t, n);
|
|
1015
1015
|
if ((r = a.protectedHeader.crit) != null && r.includes("b64") && a.protectedHeader.b64 === !1)
|
|
1016
|
-
throw new
|
|
1017
|
-
const s = { payload:
|
|
1016
|
+
throw new k("JWTs MUST NOT use unencoded payload");
|
|
1017
|
+
const s = { payload: Rn(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
|
|
1018
1018
|
return typeof t == "function" ? { ...s, key: a.key } : s;
|
|
1019
1019
|
}
|
|
1020
|
-
const
|
|
1021
|
-
function
|
|
1020
|
+
const In = F;
|
|
1021
|
+
function _n(e) {
|
|
1022
1022
|
if (typeof e != "string")
|
|
1023
|
-
throw new
|
|
1023
|
+
throw new k("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
1024
1024
|
const { 1: t, length: n } = e.split(".");
|
|
1025
1025
|
if (n === 5)
|
|
1026
|
-
throw new
|
|
1026
|
+
throw new k("Only JWTs using Compact JWS serialization can be decoded");
|
|
1027
1027
|
if (n !== 3)
|
|
1028
|
-
throw new
|
|
1028
|
+
throw new k("Invalid JWT");
|
|
1029
1029
|
if (!t)
|
|
1030
|
-
throw new
|
|
1030
|
+
throw new k("JWTs must contain a payload");
|
|
1031
1031
|
let r;
|
|
1032
1032
|
try {
|
|
1033
|
-
r =
|
|
1033
|
+
r = In(t);
|
|
1034
1034
|
} catch {
|
|
1035
|
-
throw new
|
|
1035
|
+
throw new k("Failed to base64url decode the payload");
|
|
1036
1036
|
}
|
|
1037
1037
|
let a;
|
|
1038
1038
|
try {
|
|
1039
1039
|
a = JSON.parse(B.decode(r));
|
|
1040
1040
|
} catch {
|
|
1041
|
-
throw new
|
|
1041
|
+
throw new k("Failed to parse the decoded payload as JSON");
|
|
1042
1042
|
}
|
|
1043
1043
|
if (!ue(a))
|
|
1044
|
-
throw new
|
|
1044
|
+
throw new k("Invalid JWT Claims Set");
|
|
1045
1045
|
return a;
|
|
1046
1046
|
}
|
|
1047
1047
|
const G = async (e) => {
|
|
1048
1048
|
try {
|
|
1049
|
-
const t = A.ALG, n = await
|
|
1050
|
-
return await
|
|
1049
|
+
const t = A.ALG, n = await sn(Gt, t);
|
|
1050
|
+
return await bn(e, n, {
|
|
1051
1051
|
issuer: A.ISSUER
|
|
1052
1052
|
});
|
|
1053
1053
|
} catch {
|
|
1054
1054
|
return;
|
|
1055
1055
|
}
|
|
1056
|
-
},
|
|
1056
|
+
}, vn = (e) => {
|
|
1057
1057
|
try {
|
|
1058
|
-
return
|
|
1058
|
+
return _n(e);
|
|
1059
1059
|
} catch {
|
|
1060
1060
|
return;
|
|
1061
1061
|
}
|
|
@@ -1063,45 +1063,45 @@ const G = async (e) => {
|
|
|
1063
1063
|
var w = [];
|
|
1064
1064
|
for (var we = 0; we < 256; ++we)
|
|
1065
1065
|
w.push((we + 256).toString(16).slice(1));
|
|
1066
|
-
function
|
|
1066
|
+
function Cn(e, t = 0) {
|
|
1067
1067
|
return (w[e[t + 0]] + w[e[t + 1]] + w[e[t + 2]] + w[e[t + 3]] + "-" + w[e[t + 4]] + w[e[t + 5]] + "-" + w[e[t + 6]] + w[e[t + 7]] + "-" + w[e[t + 8]] + w[e[t + 9]] + "-" + w[e[t + 10]] + w[e[t + 11]] + w[e[t + 12]] + w[e[t + 13]] + w[e[t + 14]] + w[e[t + 15]]).toLowerCase();
|
|
1068
1068
|
}
|
|
1069
|
-
var ee,
|
|
1069
|
+
var ee, kn = new Uint8Array(16);
|
|
1070
1070
|
function Pn() {
|
|
1071
1071
|
if (!ee && (ee = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ee))
|
|
1072
1072
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1073
|
-
return ee(
|
|
1073
|
+
return ee(kn);
|
|
1074
1074
|
}
|
|
1075
|
-
var
|
|
1076
|
-
const
|
|
1077
|
-
randomUUID:
|
|
1075
|
+
var On = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1076
|
+
const $e = {
|
|
1077
|
+
randomUUID: On
|
|
1078
1078
|
};
|
|
1079
|
-
function
|
|
1080
|
-
if (
|
|
1081
|
-
return
|
|
1079
|
+
function Ke(e, t, n) {
|
|
1080
|
+
if ($e.randomUUID && !t && !e)
|
|
1081
|
+
return $e.randomUUID();
|
|
1082
1082
|
e = e || {};
|
|
1083
1083
|
var r = e.random || (e.rng || Pn)();
|
|
1084
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1084
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Cn(r);
|
|
1085
1085
|
}
|
|
1086
|
-
const
|
|
1086
|
+
const He = globalThis.crypto, Nn = (e) => `${Ke()}${Ke()}`.slice(0, e), Dn = (e) => btoa(
|
|
1087
1087
|
[...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
|
|
1088
1088
|
);
|
|
1089
|
-
async function
|
|
1090
|
-
if (!
|
|
1089
|
+
async function Un(e) {
|
|
1090
|
+
if (!He.subtle)
|
|
1091
1091
|
throw new Error(
|
|
1092
1092
|
"crypto.subtle is available only in secure contexts (HTTPS)."
|
|
1093
1093
|
);
|
|
1094
|
-
const t = new TextEncoder().encode(e), n = await
|
|
1095
|
-
return
|
|
1094
|
+
const t = new TextEncoder().encode(e), n = await He.subtle.digest("SHA-256", t);
|
|
1095
|
+
return Dn(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1096
1096
|
}
|
|
1097
|
-
async function
|
|
1098
|
-
const n =
|
|
1097
|
+
async function $n(e) {
|
|
1098
|
+
const n = Nn(43), r = await Un(n);
|
|
1099
1099
|
return {
|
|
1100
1100
|
code_verifier: n,
|
|
1101
1101
|
code_challenge: r
|
|
1102
1102
|
};
|
|
1103
1103
|
}
|
|
1104
|
-
const
|
|
1104
|
+
const Ur = async (e, t) => {
|
|
1105
1105
|
var n;
|
|
1106
1106
|
const r = await G(e);
|
|
1107
1107
|
if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[A.SCOPES_KEY]))
|
|
@@ -1111,39 +1111,39 @@ const Dr = async (e, t) => {
|
|
|
1111
1111
|
(s) => t[s].every((o) => a.includes(o))
|
|
1112
1112
|
);
|
|
1113
1113
|
};
|
|
1114
|
-
function
|
|
1114
|
+
function ot(e, t) {
|
|
1115
1115
|
window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
|
|
1116
1116
|
}
|
|
1117
|
-
const
|
|
1117
|
+
const Le = (e, t) => {
|
|
1118
1118
|
const n = JSON.stringify(
|
|
1119
1119
|
typeof t == "function" ? t() : t
|
|
1120
1120
|
);
|
|
1121
|
-
window.localStorage.setItem(e, n),
|
|
1122
|
-
},
|
|
1123
|
-
window.localStorage.removeItem(e),
|
|
1124
|
-
},
|
|
1121
|
+
window.localStorage.setItem(e, n), ot(e, n);
|
|
1122
|
+
}, Kn = (e) => {
|
|
1123
|
+
window.localStorage.removeItem(e), ot(e, null);
|
|
1124
|
+
}, We = (e) => window.localStorage.getItem(e), Hn = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
|
|
1125
1125
|
function te({
|
|
1126
1126
|
key: e,
|
|
1127
1127
|
initialValue: t
|
|
1128
1128
|
}) {
|
|
1129
|
-
const n =
|
|
1129
|
+
const n = Ot(Hn, () => We(e)), r = D(
|
|
1130
1130
|
(o) => {
|
|
1131
1131
|
try {
|
|
1132
1132
|
const i = typeof o == "function" ? o(JSON.parse(n)) : o;
|
|
1133
|
-
i == null ?
|
|
1133
|
+
i == null ? Kn(e) : Le(e, i);
|
|
1134
1134
|
} catch (i) {
|
|
1135
1135
|
console.warn(i);
|
|
1136
1136
|
}
|
|
1137
1137
|
},
|
|
1138
1138
|
[e, n]
|
|
1139
|
-
), a =
|
|
1139
|
+
), a = D(() => {
|
|
1140
1140
|
r(t);
|
|
1141
|
-
}, [t, r]), s =
|
|
1141
|
+
}, [t, r]), s = D(() => {
|
|
1142
1142
|
r(null);
|
|
1143
1143
|
}, [r]);
|
|
1144
1144
|
return Ae(() => {
|
|
1145
1145
|
try {
|
|
1146
|
-
|
|
1146
|
+
We(e) === null && typeof t < "u" && Le(e, t);
|
|
1147
1147
|
} catch (o) {
|
|
1148
1148
|
console.warn(o);
|
|
1149
1149
|
}
|
|
@@ -1152,30 +1152,30 @@ function te({
|
|
|
1152
1152
|
var E = [];
|
|
1153
1153
|
for (var Ee = 0; Ee < 256; ++Ee)
|
|
1154
1154
|
E.push((Ee + 256).toString(16).slice(1));
|
|
1155
|
-
function
|
|
1155
|
+
function Ln(e, t = 0) {
|
|
1156
1156
|
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();
|
|
1157
1157
|
}
|
|
1158
|
-
var ne,
|
|
1159
|
-
function
|
|
1158
|
+
var ne, Wn = new Uint8Array(16);
|
|
1159
|
+
function xn() {
|
|
1160
1160
|
if (!ne && (ne = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ne))
|
|
1161
1161
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1162
|
-
return ne(
|
|
1162
|
+
return ne(Wn);
|
|
1163
1163
|
}
|
|
1164
|
-
var
|
|
1165
|
-
const
|
|
1166
|
-
randomUUID:
|
|
1164
|
+
var Mn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1165
|
+
const xe = {
|
|
1166
|
+
randomUUID: Mn
|
|
1167
1167
|
};
|
|
1168
1168
|
function Se(e, t, n) {
|
|
1169
|
-
if (
|
|
1170
|
-
return
|
|
1169
|
+
if (xe.randomUUID && !t && !e)
|
|
1170
|
+
return xe.randomUUID();
|
|
1171
1171
|
e = e || {};
|
|
1172
|
-
var r = e.random || (e.rng ||
|
|
1173
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1172
|
+
var r = e.random || (e.rng || xn)();
|
|
1173
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ln(r);
|
|
1174
1174
|
}
|
|
1175
|
-
const
|
|
1175
|
+
const K = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Gn = "Your session has been successfully terminated.", re = "Login failed. Please try again.", Jn = "Error getting access token, please re-authenticate.", Yn = "You forgot to wrap your component in <AuthProvider>.", le = {
|
|
1176
1176
|
dev: "https://auth.gizmette.local.com:3003",
|
|
1177
1177
|
prod: "https://mylogin.gizmette.com/auth"
|
|
1178
|
-
}, ae = "@@auth@@", V = "LOADING", j = "LOGIN",
|
|
1178
|
+
}, ae = "@@auth@@", V = "LOADING", j = "LOGIN", st = "LOGOUT", Vn = "success", Me = "failure";
|
|
1179
1179
|
/*!
|
|
1180
1180
|
@versini/ui-fingerprint v1.0.1
|
|
1181
1181
|
© 2024 gizmette.com
|
|
@@ -1189,52 +1189,52 @@ try {
|
|
|
1189
1189
|
});
|
|
1190
1190
|
} catch {
|
|
1191
1191
|
}
|
|
1192
|
-
const
|
|
1192
|
+
const jn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), it = async (e) => {
|
|
1193
1193
|
if (e === "")
|
|
1194
1194
|
return "";
|
|
1195
1195
|
const t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
1196
1196
|
return Array.from(new Uint8Array(n)).map((r) => r.toString(16).padStart(2, "0")).join("");
|
|
1197
1197
|
};
|
|
1198
|
-
function
|
|
1198
|
+
function Ge(e, t) {
|
|
1199
1199
|
return new Promise((n) => setTimeout(n, e, t));
|
|
1200
1200
|
}
|
|
1201
|
-
async function
|
|
1201
|
+
async function Fn(e, t, n = 50) {
|
|
1202
1202
|
var r, a, s;
|
|
1203
1203
|
const o = document;
|
|
1204
1204
|
for (; !o.body; )
|
|
1205
|
-
await
|
|
1205
|
+
await Ge(n);
|
|
1206
1206
|
const i = o.createElement("iframe");
|
|
1207
1207
|
try {
|
|
1208
|
-
for (await new Promise((c,
|
|
1208
|
+
for (await new Promise((c, y) => {
|
|
1209
1209
|
let l = !1;
|
|
1210
1210
|
const h = () => {
|
|
1211
1211
|
l = !0, c();
|
|
1212
|
-
},
|
|
1213
|
-
l = !0,
|
|
1212
|
+
}, g = (m) => {
|
|
1213
|
+
l = !0, y(m);
|
|
1214
1214
|
};
|
|
1215
|
-
i.onload = h, i.onerror =
|
|
1216
|
-
const { style:
|
|
1217
|
-
|
|
1215
|
+
i.onload = h, i.onerror = g;
|
|
1216
|
+
const { style: f } = i;
|
|
1217
|
+
f.setProperty("display", "block", "important"), f.position = "absolute", f.top = "0", f.left = "0", f.visibility = "hidden", i.src = "about:blank", o.body.appendChild(i);
|
|
1218
1218
|
const u = () => {
|
|
1219
1219
|
var m, T;
|
|
1220
1220
|
l || (((T = (m = i.contentWindow) == null ? void 0 : m.document) == null ? void 0 : T.readyState) === "complete" ? h() : setTimeout(u, 10));
|
|
1221
1221
|
};
|
|
1222
1222
|
u();
|
|
1223
1223
|
}); !((a = (r = i.contentWindow) == null ? void 0 : r.document) != null && a.body); )
|
|
1224
|
-
await
|
|
1224
|
+
await Ge(n);
|
|
1225
1225
|
return await e(i, i.contentWindow);
|
|
1226
1226
|
} finally {
|
|
1227
1227
|
(s = i.parentNode) == null || s.removeChild(i);
|
|
1228
1228
|
}
|
|
1229
1229
|
}
|
|
1230
|
-
const
|
|
1230
|
+
const Bn = {
|
|
1231
1231
|
audio: {
|
|
1232
1232
|
sampleHash: "",
|
|
1233
1233
|
oscillator: "",
|
|
1234
1234
|
maxChannels: 0,
|
|
1235
1235
|
channelCountMode: ""
|
|
1236
1236
|
}
|
|
1237
|
-
},
|
|
1237
|
+
}, qn = async (e) => new Promise((t) => {
|
|
1238
1238
|
try {
|
|
1239
1239
|
const n = new window.OfflineAudioContext(1, 5e3, 44100), r = n.createBufferSource(), a = n.createOscillator();
|
|
1240
1240
|
a.frequency.value = 1e3;
|
|
@@ -1243,7 +1243,7 @@ const Fn = {
|
|
|
1243
1243
|
const i = o.renderedBuffer.getChannelData(0);
|
|
1244
1244
|
a.disconnect(), s.disconnect(), t({
|
|
1245
1245
|
audio: {
|
|
1246
|
-
sampleHash:
|
|
1246
|
+
sampleHash: jn(i),
|
|
1247
1247
|
oscillator: a.type,
|
|
1248
1248
|
maxChannels: n.destination.maxChannelCount,
|
|
1249
1249
|
channelCountMode: r.channelCountMode
|
|
@@ -1260,25 +1260,25 @@ const Fn = {
|
|
|
1260
1260
|
}
|
|
1261
1261
|
});
|
|
1262
1262
|
}
|
|
1263
|
-
}),
|
|
1263
|
+
}), ct = { browser: "" }, zn = async (e) => typeof navigator > "u" ? ct : { browser: navigator.userAgent }, ut = {
|
|
1264
1264
|
canvas: {
|
|
1265
1265
|
data: ""
|
|
1266
1266
|
}
|
|
1267
|
-
},
|
|
1267
|
+
}, Qn = async (e) => {
|
|
1268
1268
|
try {
|
|
1269
1269
|
const t = Array.from(
|
|
1270
1270
|
{ length: 3 },
|
|
1271
|
-
() =>
|
|
1272
|
-
), n =
|
|
1271
|
+
() => Xn(300, 30)
|
|
1272
|
+
), n = er(t, 300, 30);
|
|
1273
1273
|
return {
|
|
1274
1274
|
canvas: {
|
|
1275
|
-
data: (await
|
|
1275
|
+
data: (await it(n.data.toString())).toString()
|
|
1276
1276
|
}
|
|
1277
1277
|
};
|
|
1278
1278
|
} catch {
|
|
1279
|
-
return
|
|
1279
|
+
return ut;
|
|
1280
1280
|
}
|
|
1281
|
-
},
|
|
1281
|
+
}, Xn = (e, t) => {
|
|
1282
1282
|
const n = document.createElement("canvas"), r = n.getContext("2d");
|
|
1283
1283
|
if (!r)
|
|
1284
1284
|
return new ImageData(1, 1);
|
|
@@ -1287,7 +1287,7 @@ const Fn = {
|
|
|
1287
1287
|
a.addColorStop(0, "red"), a.addColorStop(1 / 6, "orange"), a.addColorStop(2 / 6, "yellow"), a.addColorStop(3 / 6, "green"), a.addColorStop(4 / 6, "blue"), a.addColorStop(5 / 6, "indigo"), a.addColorStop(1, "violet"), r.fillStyle = a, r.fillRect(0, 0, n.width, n.height);
|
|
1288
1288
|
const s = "mmMwWLliI0O&1 - Les sanglots longs des violons de l'automne blessent mon coeur d'une langueur monotone";
|
|
1289
1289
|
return r.font = "26.321px Arial", r.fillStyle = "black", r.fillText(s, -5, 15), r.fillStyle = "rgba(0, 0, 255, 0.5)", r.fillText(s, -3.3, 17.7), r.beginPath(), r.moveTo(0, 0), r.lineTo(n.width * 2 / 7, n.height), r.strokeStyle = "white", r.lineWidth = 2, r.stroke(), r.getImageData(0, 0, n.width, n.height);
|
|
1290
|
-
},
|
|
1290
|
+
}, Zn = (e) => {
|
|
1291
1291
|
if (e.length === 0)
|
|
1292
1292
|
return 0;
|
|
1293
1293
|
const t = {};
|
|
@@ -1297,17 +1297,17 @@ const Fn = {
|
|
|
1297
1297
|
for (const r in t)
|
|
1298
1298
|
t[r] > t[n] && (n = parseInt(r, 10));
|
|
1299
1299
|
return n;
|
|
1300
|
-
},
|
|
1300
|
+
}, er = (e, t, n) => {
|
|
1301
1301
|
const r = [];
|
|
1302
1302
|
for (let o = 0; o < e[0].data.length; o++) {
|
|
1303
1303
|
const i = [];
|
|
1304
1304
|
for (let c = 0; c < e.length; c++)
|
|
1305
1305
|
i.push(e[c].data[o]);
|
|
1306
|
-
r.push(
|
|
1306
|
+
r.push(Zn(i));
|
|
1307
1307
|
}
|
|
1308
1308
|
const a = r, s = new Uint8ClampedArray(a);
|
|
1309
1309
|
return new ImageData(s, t, n);
|
|
1310
|
-
},
|
|
1310
|
+
}, tr = [], nr = "mmMwWLliI0O&1", rr = "48px", H = ["monospace", "sans-serif", "serif"], Je = [
|
|
1311
1311
|
"sans-serif-thin",
|
|
1312
1312
|
"ARNO PRO",
|
|
1313
1313
|
"Agency FB",
|
|
@@ -1345,44 +1345,44 @@ const Fn = {
|
|
|
1345
1345
|
"TRAJAN PRO",
|
|
1346
1346
|
"Univers CE 55 Medium",
|
|
1347
1347
|
"ZWAdobeF"
|
|
1348
|
-
],
|
|
1348
|
+
], ar = async (e) => Fn(async (t, { document: n }) => {
|
|
1349
1349
|
const r = n.body;
|
|
1350
|
-
r.style.fontSize =
|
|
1350
|
+
r.style.fontSize = rr;
|
|
1351
1351
|
const a = n.createElement("div");
|
|
1352
1352
|
a.style.setProperty("visibility", "hidden", "important");
|
|
1353
1353
|
const s = {}, o = {}, i = (u) => {
|
|
1354
1354
|
const m = n.createElement("span"), { style: T } = m;
|
|
1355
|
-
return T.position = "absolute", T.top = "0", T.left = "0", T.fontFamily = u, m.textContent =
|
|
1356
|
-
}, c = (u, m) => i(`'${u}',${m}`),
|
|
1355
|
+
return T.position = "absolute", T.top = "0", T.left = "0", T.fontFamily = u, m.textContent = nr, a.appendChild(m), m;
|
|
1356
|
+
}, c = (u, m) => i(`'${u}',${m}`), y = () => H.map(i), l = () => {
|
|
1357
1357
|
const u = {};
|
|
1358
|
-
for (const m of
|
|
1359
|
-
u[m] =
|
|
1358
|
+
for (const m of Je)
|
|
1359
|
+
u[m] = H.map(
|
|
1360
1360
|
(T) => c(m, T)
|
|
1361
1361
|
);
|
|
1362
1362
|
return u;
|
|
1363
|
-
}, h = (u) =>
|
|
1363
|
+
}, h = (u) => H.some(
|
|
1364
1364
|
(m, T) => u[T].offsetWidth !== s[m] || u[T].offsetHeight !== o[m]
|
|
1365
|
-
),
|
|
1365
|
+
), g = y(), f = l();
|
|
1366
1366
|
r.appendChild(a);
|
|
1367
|
-
for (let u = 0; u <
|
|
1368
|
-
s[
|
|
1369
|
-
return
|
|
1370
|
-
}),
|
|
1367
|
+
for (let u = 0; u < H.length; u++)
|
|
1368
|
+
s[H[u]] = g[u].offsetWidth, o[H[u]] = g[u].offsetHeight;
|
|
1369
|
+
return Je.filter((u) => h(f[u]));
|
|
1370
|
+
}), lt = {
|
|
1371
1371
|
vendor: "",
|
|
1372
1372
|
vendorUnmasked: "",
|
|
1373
1373
|
renderer: "",
|
|
1374
1374
|
rendererUnmasked: "",
|
|
1375
1375
|
version: "",
|
|
1376
1376
|
shadingLanguageVersion: ""
|
|
1377
|
-
},
|
|
1377
|
+
}, dt = {
|
|
1378
1378
|
hardware: {
|
|
1379
|
-
videocard:
|
|
1379
|
+
videocard: lt,
|
|
1380
1380
|
architecture: 0,
|
|
1381
1381
|
deviceMemory: "undefined",
|
|
1382
1382
|
jsHeapSizeLimit: 0
|
|
1383
1383
|
}
|
|
1384
1384
|
};
|
|
1385
|
-
function
|
|
1385
|
+
function or() {
|
|
1386
1386
|
const e = document.createElement("canvas"), t = e.getContext("webgl") ?? e.getContext("experimental-webgl");
|
|
1387
1387
|
if (t && "getParameter" in t) {
|
|
1388
1388
|
const n = t.getExtension("WEBGL_debug_renderer_info");
|
|
@@ -1395,41 +1395,41 @@ function ar() {
|
|
|
1395
1395
|
shadingLanguageVersion: (t.getParameter(t.SHADING_LANGUAGE_VERSION) || "").toString()
|
|
1396
1396
|
};
|
|
1397
1397
|
}
|
|
1398
|
-
return
|
|
1398
|
+
return lt;
|
|
1399
1399
|
}
|
|
1400
|
-
function
|
|
1400
|
+
function sr() {
|
|
1401
1401
|
const e = new Float32Array(1), t = new Uint8Array(e.buffer);
|
|
1402
1402
|
return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
|
|
1403
1403
|
}
|
|
1404
|
-
const
|
|
1404
|
+
const ir = () => navigator.deviceMemory || 0, cr = () => window.performance && window.performance.memory || {
|
|
1405
1405
|
jsHeapSizeLimit: 0
|
|
1406
|
-
},
|
|
1406
|
+
}, ur = async (e) => new Promise((t) => {
|
|
1407
1407
|
try {
|
|
1408
|
-
const n =
|
|
1408
|
+
const n = ir(), r = cr();
|
|
1409
1409
|
t({
|
|
1410
1410
|
hardware: {
|
|
1411
|
-
videocard:
|
|
1412
|
-
architecture:
|
|
1411
|
+
videocard: or(),
|
|
1412
|
+
architecture: sr(),
|
|
1413
1413
|
deviceMemory: n.toString() || "undefined",
|
|
1414
1414
|
jsHeapSizeLimit: r.jsHeapSizeLimit || 0
|
|
1415
1415
|
}
|
|
1416
1416
|
});
|
|
1417
1417
|
} catch {
|
|
1418
|
-
t(
|
|
1418
|
+
t(dt);
|
|
1419
1419
|
}
|
|
1420
|
-
}),
|
|
1420
|
+
}), lr = {
|
|
1421
1421
|
locales: {
|
|
1422
1422
|
languages: "",
|
|
1423
1423
|
timezone: ""
|
|
1424
1424
|
}
|
|
1425
|
-
},
|
|
1425
|
+
}, dr = async (e) => new Promise((t) => {
|
|
1426
1426
|
t({
|
|
1427
1427
|
locales: {
|
|
1428
1428
|
languages: navigator.language,
|
|
1429
1429
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
1430
1430
|
}
|
|
1431
1431
|
});
|
|
1432
|
-
}),
|
|
1432
|
+
}), ht = {
|
|
1433
1433
|
screen: {
|
|
1434
1434
|
colorDepth: 0,
|
|
1435
1435
|
pixelDepth: 0,
|
|
@@ -1437,7 +1437,7 @@ const sr = () => navigator.deviceMemory || 0, ir = () => window.performance && w
|
|
|
1437
1437
|
maxTouchPoints: 0,
|
|
1438
1438
|
mediaMatches: []
|
|
1439
1439
|
}
|
|
1440
|
-
},
|
|
1440
|
+
}, hr = async (e) => new Promise((t) => {
|
|
1441
1441
|
try {
|
|
1442
1442
|
const n = window.screen, r = {
|
|
1443
1443
|
screen: {
|
|
@@ -1445,15 +1445,15 @@ const sr = () => navigator.deviceMemory || 0, ir = () => window.performance && w
|
|
|
1445
1445
|
pixelDepth: n.pixelDepth,
|
|
1446
1446
|
isTouchScreen: navigator.maxTouchPoints > 0,
|
|
1447
1447
|
maxTouchPoints: navigator.maxTouchPoints,
|
|
1448
|
-
mediaMatches:
|
|
1448
|
+
mediaMatches: pr()
|
|
1449
1449
|
}
|
|
1450
1450
|
};
|
|
1451
1451
|
t(r);
|
|
1452
1452
|
} catch {
|
|
1453
|
-
t(
|
|
1453
|
+
t(ht);
|
|
1454
1454
|
}
|
|
1455
1455
|
});
|
|
1456
|
-
function
|
|
1456
|
+
function pr() {
|
|
1457
1457
|
const e = [], t = {
|
|
1458
1458
|
"prefers-contrast": [
|
|
1459
1459
|
"high",
|
|
@@ -1481,7 +1481,7 @@ function hr() {
|
|
|
1481
1481
|
});
|
|
1482
1482
|
}), e;
|
|
1483
1483
|
}
|
|
1484
|
-
const
|
|
1484
|
+
const fr = async (e) => {
|
|
1485
1485
|
try {
|
|
1486
1486
|
return {
|
|
1487
1487
|
system: {
|
|
@@ -1492,43 +1492,43 @@ const pr = async (e) => {
|
|
|
1492
1492
|
}
|
|
1493
1493
|
};
|
|
1494
1494
|
} catch {
|
|
1495
|
-
return
|
|
1495
|
+
return pt;
|
|
1496
1496
|
}
|
|
1497
|
-
},
|
|
1497
|
+
}, pt = {
|
|
1498
1498
|
system: {
|
|
1499
1499
|
platform: "",
|
|
1500
1500
|
cookieEnabled: !1,
|
|
1501
1501
|
productSub: "",
|
|
1502
1502
|
product: ""
|
|
1503
1503
|
}
|
|
1504
|
-
},
|
|
1504
|
+
}, yr = async (e) => {
|
|
1505
1505
|
try {
|
|
1506
1506
|
return Promise.all([
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1507
|
+
qn(e),
|
|
1508
|
+
zn(),
|
|
1509
|
+
Qn(e),
|
|
1510
|
+
ar(),
|
|
1511
|
+
ur(e),
|
|
1512
|
+
dr(),
|
|
1513
|
+
hr(e),
|
|
1514
|
+
fr(e)
|
|
1515
1515
|
]);
|
|
1516
1516
|
} catch {
|
|
1517
1517
|
return [
|
|
1518
|
-
|
|
1519
|
-
it,
|
|
1518
|
+
Bn,
|
|
1520
1519
|
ct,
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
ur,
|
|
1520
|
+
ut,
|
|
1521
|
+
tr,
|
|
1524
1522
|
dt,
|
|
1525
|
-
|
|
1523
|
+
lr,
|
|
1524
|
+
ht,
|
|
1525
|
+
pt
|
|
1526
1526
|
];
|
|
1527
1527
|
}
|
|
1528
|
-
},
|
|
1528
|
+
}, gr = async (e) => {
|
|
1529
1529
|
try {
|
|
1530
|
-
const t = await
|
|
1531
|
-
return await
|
|
1530
|
+
const t = await yr(e);
|
|
1531
|
+
return await it(JSON.stringify(t));
|
|
1532
1532
|
} catch {
|
|
1533
1533
|
return "";
|
|
1534
1534
|
}
|
|
@@ -1610,7 +1610,7 @@ const pr = async (e) => {
|
|
|
1610
1610
|
username,
|
|
1611
1611
|
}
|
|
1612
1612
|
}`
|
|
1613
|
-
},
|
|
1613
|
+
}, L = {
|
|
1614
1614
|
GET_REGISTRATION_OPTIONS: {
|
|
1615
1615
|
schema: oe.GET_REGISTRATION_OPTIONS,
|
|
1616
1616
|
method: "getPasskeyRegistrationOptions"
|
|
@@ -1627,7 +1627,7 @@ const pr = async (e) => {
|
|
|
1627
1627
|
schema: oe.VERIFY_AUTHENTICATION,
|
|
1628
1628
|
method: "verifyPasskeyAuthentication"
|
|
1629
1629
|
}
|
|
1630
|
-
},
|
|
1630
|
+
}, W = async ({
|
|
1631
1631
|
accessToken: e,
|
|
1632
1632
|
type: t,
|
|
1633
1633
|
clientId: n,
|
|
@@ -1635,7 +1635,7 @@ const pr = async (e) => {
|
|
|
1635
1635
|
}) => {
|
|
1636
1636
|
try {
|
|
1637
1637
|
const a = t?.data ? t.data(r) : r, s = `Bearer ${e}`, o = await fetch(
|
|
1638
|
-
|
|
1638
|
+
ft ? `${le.dev}/graphql` : `${le.prod}/graphql`,
|
|
1639
1639
|
{
|
|
1640
1640
|
method: "POST",
|
|
1641
1641
|
credentials: "include",
|
|
@@ -1643,7 +1643,7 @@ const pr = async (e) => {
|
|
|
1643
1643
|
authorization: s,
|
|
1644
1644
|
"Content-Type": "application/json",
|
|
1645
1645
|
Accept: "application/json",
|
|
1646
|
-
[
|
|
1646
|
+
[qe.CLIENT_ID]: `${n}`
|
|
1647
1647
|
},
|
|
1648
1648
|
body: JSON.stringify({
|
|
1649
1649
|
query: t.schema,
|
|
@@ -1669,13 +1669,13 @@ const pr = async (e) => {
|
|
|
1669
1669
|
}) => {
|
|
1670
1670
|
try {
|
|
1671
1671
|
const r = await fetch(
|
|
1672
|
-
|
|
1672
|
+
ft ? `${le.dev}/${e}` : `${le.prod}/${e}`,
|
|
1673
1673
|
{
|
|
1674
1674
|
credentials: "include",
|
|
1675
1675
|
method: "POST",
|
|
1676
1676
|
headers: {
|
|
1677
1677
|
"Content-Type": "application/json",
|
|
1678
|
-
[
|
|
1678
|
+
[qe.CLIENT_ID]: `${t}`
|
|
1679
1679
|
},
|
|
1680
1680
|
body: JSON.stringify(n)
|
|
1681
1681
|
}
|
|
@@ -1691,21 +1691,21 @@ const pr = async (e) => {
|
|
|
1691
1691
|
} catch (r) {
|
|
1692
1692
|
return console.error(r), { status: 500, data: [] };
|
|
1693
1693
|
}
|
|
1694
|
-
},
|
|
1694
|
+
}, mr = process.env.NODE_ENV === "production", ft = !mr, yt = {
|
|
1695
1695
|
isLoading: !0,
|
|
1696
1696
|
isAuthenticated: !1,
|
|
1697
1697
|
authenticationType: null,
|
|
1698
1698
|
user: void 0,
|
|
1699
1699
|
logoutReason: "",
|
|
1700
1700
|
debug: !1
|
|
1701
|
-
},
|
|
1701
|
+
}, wr = (e) => {
|
|
1702
1702
|
try {
|
|
1703
|
-
const t =
|
|
1703
|
+
const t = vn(e);
|
|
1704
1704
|
return t ? t[A.USER_ID_KEY] : "";
|
|
1705
1705
|
} catch {
|
|
1706
1706
|
return "";
|
|
1707
1707
|
}
|
|
1708
|
-
},
|
|
1708
|
+
}, Er = async ({
|
|
1709
1709
|
userId: e,
|
|
1710
1710
|
idToken: t,
|
|
1711
1711
|
accessToken: n,
|
|
@@ -1732,7 +1732,7 @@ const pr = async (e) => {
|
|
|
1732
1732
|
status: !1
|
|
1733
1733
|
};
|
|
1734
1734
|
}
|
|
1735
|
-
},
|
|
1735
|
+
}, Ye = async ({
|
|
1736
1736
|
username: e,
|
|
1737
1737
|
password: t,
|
|
1738
1738
|
clientId: n,
|
|
@@ -1742,7 +1742,7 @@ const pr = async (e) => {
|
|
|
1742
1742
|
code: o,
|
|
1743
1743
|
code_verifier: i,
|
|
1744
1744
|
domain: c,
|
|
1745
|
-
fingerprint:
|
|
1745
|
+
fingerprint: y
|
|
1746
1746
|
}) => {
|
|
1747
1747
|
try {
|
|
1748
1748
|
const l = await pe({
|
|
@@ -1757,7 +1757,7 @@ const pr = async (e) => {
|
|
|
1757
1757
|
code: o,
|
|
1758
1758
|
code_verifier: i,
|
|
1759
1759
|
domain: c,
|
|
1760
|
-
fingerprint:
|
|
1760
|
+
fingerprint: y
|
|
1761
1761
|
}
|
|
1762
1762
|
}), h = await G(l?.data?.idToken);
|
|
1763
1763
|
return h && h.payload[A.USER_ID_KEY] !== "" && h.payload[A.NONCE_KEY] === r ? {
|
|
@@ -1774,7 +1774,7 @@ const pr = async (e) => {
|
|
|
1774
1774
|
status: !1
|
|
1775
1775
|
};
|
|
1776
1776
|
}
|
|
1777
|
-
},
|
|
1777
|
+
}, Sr = async ({
|
|
1778
1778
|
nonce: e,
|
|
1779
1779
|
clientId: t,
|
|
1780
1780
|
code_challenge: n
|
|
@@ -1800,7 +1800,7 @@ const pr = async (e) => {
|
|
|
1800
1800
|
status: !1
|
|
1801
1801
|
};
|
|
1802
1802
|
}
|
|
1803
|
-
},
|
|
1803
|
+
}, Ar = async ({
|
|
1804
1804
|
clientId: e,
|
|
1805
1805
|
userId: t,
|
|
1806
1806
|
nonce: n,
|
|
@@ -1819,7 +1819,7 @@ const pr = async (e) => {
|
|
|
1819
1819
|
refreshToken: r,
|
|
1820
1820
|
accessToken: a,
|
|
1821
1821
|
domain: s,
|
|
1822
|
-
fingerprint: await
|
|
1822
|
+
fingerprint: await gt()
|
|
1823
1823
|
}
|
|
1824
1824
|
}), i = await G(o?.data?.accessToken);
|
|
1825
1825
|
return i && i.payload[A.USER_ID_KEY] !== "" && i.payload[A.NONCE_KEY] === n ? {
|
|
@@ -1835,14 +1835,14 @@ const pr = async (e) => {
|
|
|
1835
1835
|
status: !1
|
|
1836
1836
|
};
|
|
1837
1837
|
}
|
|
1838
|
-
},
|
|
1838
|
+
}, gt = async () => {
|
|
1839
1839
|
try {
|
|
1840
|
-
return await
|
|
1840
|
+
return await gr();
|
|
1841
1841
|
} catch {
|
|
1842
1842
|
return "";
|
|
1843
1843
|
}
|
|
1844
1844
|
};
|
|
1845
|
-
class
|
|
1845
|
+
class Tr {
|
|
1846
1846
|
constructor(t = null, n = null) {
|
|
1847
1847
|
Q(this, "refreshTokenPromise", null);
|
|
1848
1848
|
Q(this, "accessToken");
|
|
@@ -1875,7 +1875,7 @@ class Ar {
|
|
|
1875
1875
|
}) {
|
|
1876
1876
|
const s = await G(this.refreshToken);
|
|
1877
1877
|
if (s && s.payload[A.USER_ID_KEY] !== "") {
|
|
1878
|
-
const o = await
|
|
1878
|
+
const o = await Ar({
|
|
1879
1879
|
clientId: t,
|
|
1880
1880
|
userId: n,
|
|
1881
1881
|
nonce: r,
|
|
@@ -1884,41 +1884,41 @@ class Ar {
|
|
|
1884
1884
|
domain: a
|
|
1885
1885
|
});
|
|
1886
1886
|
return o.status ? (this.accessToken = o.accessToken, this.refreshToken = o.refreshToken, {
|
|
1887
|
-
status:
|
|
1887
|
+
status: Vn,
|
|
1888
1888
|
newAccessToken: o.accessToken,
|
|
1889
1889
|
newRefreshToken: o.refreshToken
|
|
1890
1890
|
}) : {
|
|
1891
|
-
status:
|
|
1891
|
+
status: Me
|
|
1892
1892
|
};
|
|
1893
1893
|
} else
|
|
1894
1894
|
return {
|
|
1895
|
-
status:
|
|
1895
|
+
status: Me
|
|
1896
1896
|
};
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
|
-
const
|
|
1899
|
+
const Rr = (e) => D(
|
|
1900
1900
|
(...t) => {
|
|
1901
1901
|
e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
|
|
1902
1902
|
},
|
|
1903
1903
|
[e]
|
|
1904
|
-
),
|
|
1905
|
-
throw new Error(
|
|
1906
|
-
},
|
|
1904
|
+
), x = () => {
|
|
1905
|
+
throw new Error(Yn);
|
|
1906
|
+
}, mt = Nt({
|
|
1907
1907
|
isAuthenticated: !1,
|
|
1908
1908
|
isLoading: !1,
|
|
1909
1909
|
authenticationType: null,
|
|
1910
|
-
login:
|
|
1911
|
-
logout:
|
|
1912
|
-
getAccessToken:
|
|
1913
|
-
getIdToken:
|
|
1914
|
-
registeringForPasskey:
|
|
1915
|
-
loginWithPasskey:
|
|
1910
|
+
login: x,
|
|
1911
|
+
logout: x,
|
|
1912
|
+
getAccessToken: x,
|
|
1913
|
+
getIdToken: x,
|
|
1914
|
+
registeringForPasskey: x,
|
|
1915
|
+
loginWithPasskey: x,
|
|
1916
1916
|
logoutReason: ""
|
|
1917
|
-
}),
|
|
1918
|
-
state:
|
|
1917
|
+
}), br = Pt.createContext({
|
|
1918
|
+
state: yt,
|
|
1919
1919
|
dispatch: () => {
|
|
1920
1920
|
}
|
|
1921
|
-
}),
|
|
1921
|
+
}), Ir = (e, t) => t?.type === V ? {
|
|
1922
1922
|
...e,
|
|
1923
1923
|
isLoading: t.payload.isLoading
|
|
1924
1924
|
} : t?.type === j ? {
|
|
@@ -1928,74 +1928,82 @@ const Tr = (e) => x(
|
|
|
1928
1928
|
user: t.payload.user,
|
|
1929
1929
|
authenticationType: t.payload.authenticationType,
|
|
1930
1930
|
logoutReason: ""
|
|
1931
|
-
} : t?.type ===
|
|
1931
|
+
} : t?.type === st ? {
|
|
1932
1932
|
...e,
|
|
1933
1933
|
isLoading: !1,
|
|
1934
1934
|
isAuthenticated: !1,
|
|
1935
1935
|
user: void 0,
|
|
1936
1936
|
authenticationType: null,
|
|
1937
1937
|
logoutReason: t.payload.logoutReason
|
|
1938
|
-
} : e,
|
|
1938
|
+
} : e, $r = ({
|
|
1939
1939
|
children: e,
|
|
1940
1940
|
sessionExpiration: t,
|
|
1941
1941
|
clientId: n,
|
|
1942
1942
|
domain: r = "",
|
|
1943
1943
|
debug: a = !1
|
|
1944
1944
|
}) => {
|
|
1945
|
-
const [s, o] =
|
|
1946
|
-
...
|
|
1945
|
+
const [s, o] = Dt(Ir, {
|
|
1946
|
+
...yt,
|
|
1947
1947
|
debug: a
|
|
1948
|
-
}), i =
|
|
1948
|
+
}), i = Rr(a), c = ke(!1), y = ke(""), [l, h, , g] = te({
|
|
1949
1949
|
key: `${ae}::${n}::@@user@@`
|
|
1950
|
-
}), [
|
|
1950
|
+
}), [f, u, , m] = te({
|
|
1951
1951
|
key: `${ae}::${n}::@@access@@`
|
|
1952
|
-
}), [T, q, ,
|
|
1952
|
+
}), [T, q, , be] = te(
|
|
1953
1953
|
{
|
|
1954
1954
|
key: `${ae}::${n}::@@refresh@@`
|
|
1955
1955
|
}
|
|
1956
|
-
), [
|
|
1956
|
+
), [wt, Ie, , _e] = te({
|
|
1957
1957
|
key: `${ae}::${n}::@@nonce@@`
|
|
1958
|
-
}),
|
|
1958
|
+
}), Et = new Tr(f, T), z = D(() => {
|
|
1959
|
+
i("removeLocalStorage: removing local storage"), g(), m(), be(), _e();
|
|
1960
|
+
}, [
|
|
1961
|
+
m,
|
|
1962
|
+
g,
|
|
1963
|
+
_e,
|
|
1964
|
+
be,
|
|
1965
|
+
i
|
|
1966
|
+
]), $ = D(
|
|
1959
1967
|
(d) => {
|
|
1960
1968
|
i(
|
|
1961
1969
|
"removeStateAndLocalStorage: removing state and local storage with reason: ",
|
|
1962
1970
|
d
|
|
1963
1971
|
), o({
|
|
1964
|
-
type:
|
|
1972
|
+
type: st,
|
|
1965
1973
|
payload: {
|
|
1966
|
-
logoutReason: d ||
|
|
1974
|
+
logoutReason: d || K
|
|
1967
1975
|
}
|
|
1968
|
-
}),
|
|
1976
|
+
}), z(), o({ type: V, payload: { isLoading: !1 } });
|
|
1969
1977
|
},
|
|
1970
|
-
[
|
|
1971
|
-
), N =
|
|
1978
|
+
[z, i]
|
|
1979
|
+
), N = D(
|
|
1972
1980
|
async (d) => {
|
|
1973
1981
|
i("invalidateAndLogout: invalidating and logging out");
|
|
1974
|
-
const { user: R } = s,
|
|
1975
|
-
|
|
1982
|
+
const { user: R } = s, p = R?.userId || wr(l);
|
|
1983
|
+
p || i(
|
|
1976
1984
|
"invalidateAndLogout: user cannot be identified, logging out without userId"
|
|
1977
|
-
), await
|
|
1978
|
-
userId:
|
|
1985
|
+
), await Er({
|
|
1986
|
+
userId: p,
|
|
1979
1987
|
idToken: l,
|
|
1980
|
-
accessToken:
|
|
1988
|
+
accessToken: f,
|
|
1981
1989
|
refreshToken: T,
|
|
1982
1990
|
clientId: n,
|
|
1983
1991
|
domain: r
|
|
1984
|
-
}),
|
|
1992
|
+
}), $(d || K);
|
|
1985
1993
|
},
|
|
1986
1994
|
[
|
|
1987
|
-
|
|
1995
|
+
f,
|
|
1988
1996
|
s,
|
|
1989
1997
|
n,
|
|
1990
1998
|
r,
|
|
1991
1999
|
l,
|
|
1992
2000
|
T,
|
|
1993
|
-
|
|
2001
|
+
$,
|
|
1994
2002
|
i
|
|
1995
2003
|
]
|
|
1996
2004
|
);
|
|
1997
|
-
Ae(() => ((async () =>
|
|
1998
|
-
|
|
2005
|
+
Ae(() => ((async () => y.current = await gt())(), () => {
|
|
2006
|
+
y.current = "";
|
|
1999
2007
|
}), []), Ae(() => {
|
|
2000
2008
|
if (!c.current)
|
|
2001
2009
|
return s.isLoading && l !== null ? (async () => {
|
|
@@ -2010,110 +2018,107 @@ const Tr = (e) => x(
|
|
|
2010
2018
|
username: d.payload[A.USERNAME_KEY]
|
|
2011
2019
|
}
|
|
2012
2020
|
}
|
|
2013
|
-
})) : (i("useEffect: invalid JWT, invalidating and logging out"), await N(
|
|
2021
|
+
})) : (i("useEffect: invalid JWT, invalidating and logging out"), await N(K));
|
|
2014
2022
|
} catch {
|
|
2015
2023
|
i(
|
|
2016
2024
|
"useEffect: exception validating JWT, invalidating and logging out"
|
|
2017
|
-
), await N(
|
|
2025
|
+
), await N(K);
|
|
2018
2026
|
}
|
|
2019
2027
|
})() : (i("useEffect: setting the loading state to false"), o({ type: V, payload: { isLoading: !1 } })), () => {
|
|
2020
2028
|
c.current = !0;
|
|
2021
2029
|
};
|
|
2022
2030
|
}, [s.isLoading, l, N, i]);
|
|
2023
|
-
const
|
|
2031
|
+
const St = async (d, R, p = M.CODE) => {
|
|
2024
2032
|
const I = Se();
|
|
2025
|
-
if (
|
|
2026
|
-
const { code_verifier:
|
|
2033
|
+
if (Ie(I), o({ type: V, payload: { isLoading: !0 } }), z(), i("login: Logging in with type: ", p), p === M.CODE) {
|
|
2034
|
+
const { code_verifier: _t, code_challenge: vt } = await $n(), ve = await Sr({
|
|
2027
2035
|
nonce: I,
|
|
2028
2036
|
clientId: n,
|
|
2029
|
-
code_challenge:
|
|
2037
|
+
code_challenge: vt
|
|
2030
2038
|
});
|
|
2031
|
-
if (
|
|
2032
|
-
const Y = await
|
|
2039
|
+
if (ve.status) {
|
|
2040
|
+
const Y = await Ye({
|
|
2033
2041
|
username: d,
|
|
2034
2042
|
password: R,
|
|
2035
2043
|
clientId: n,
|
|
2036
2044
|
sessionExpiration: t,
|
|
2037
2045
|
nonce: I,
|
|
2038
|
-
type:
|
|
2039
|
-
code:
|
|
2040
|
-
code_verifier:
|
|
2046
|
+
type: p,
|
|
2047
|
+
code: ve.code,
|
|
2048
|
+
code_verifier: _t,
|
|
2041
2049
|
domain: r,
|
|
2042
|
-
fingerprint:
|
|
2050
|
+
fingerprint: y.current
|
|
2043
2051
|
});
|
|
2044
2052
|
return Y.status ? (h(Y.idToken), u(Y.accessToken), q(Y.refreshToken), o({
|
|
2045
2053
|
type: j,
|
|
2046
2054
|
payload: {
|
|
2047
|
-
authenticationType:
|
|
2055
|
+
authenticationType: p,
|
|
2048
2056
|
user: {
|
|
2049
2057
|
userId: Y.userId,
|
|
2050
2058
|
username: d
|
|
2051
2059
|
}
|
|
2052
2060
|
}
|
|
2053
|
-
}), !0) : (
|
|
2061
|
+
}), !0) : ($(re), !1);
|
|
2054
2062
|
}
|
|
2055
2063
|
return !1;
|
|
2056
2064
|
}
|
|
2057
|
-
const J = await
|
|
2065
|
+
const J = await Ye({
|
|
2058
2066
|
username: d,
|
|
2059
2067
|
password: R,
|
|
2060
2068
|
clientId: n,
|
|
2061
2069
|
sessionExpiration: t,
|
|
2062
2070
|
nonce: I,
|
|
2063
|
-
type:
|
|
2071
|
+
type: p,
|
|
2064
2072
|
domain: r,
|
|
2065
|
-
fingerprint:
|
|
2073
|
+
fingerprint: y.current
|
|
2066
2074
|
});
|
|
2067
2075
|
return J.status ? (h(J.idToken), u(J.accessToken), q(J.refreshToken), o({
|
|
2068
2076
|
type: j,
|
|
2069
2077
|
payload: {
|
|
2070
|
-
authenticationType:
|
|
2078
|
+
authenticationType: p,
|
|
2071
2079
|
user: {
|
|
2072
2080
|
userId: J.userId,
|
|
2073
2081
|
username: d
|
|
2074
2082
|
}
|
|
2075
2083
|
}
|
|
2076
|
-
}), !0) : (
|
|
2077
|
-
},
|
|
2078
|
-
d?.preventDefault(), await N(
|
|
2079
|
-
},
|
|
2084
|
+
}), !0) : ($(re), !1);
|
|
2085
|
+
}, At = async (d) => {
|
|
2086
|
+
d?.preventDefault(), await N(Gn);
|
|
2087
|
+
}, Tt = async () => {
|
|
2080
2088
|
const { isAuthenticated: d, user: R } = s;
|
|
2081
2089
|
try {
|
|
2082
2090
|
if (d && R && R.userId) {
|
|
2083
|
-
if (
|
|
2091
|
+
if (f) {
|
|
2084
2092
|
i("getAccessToken");
|
|
2085
|
-
const I = await G(
|
|
2093
|
+
const I = await G(f);
|
|
2086
2094
|
if (I && I.payload[A.USER_ID_KEY] !== "")
|
|
2087
|
-
return
|
|
2095
|
+
return f;
|
|
2088
2096
|
}
|
|
2089
2097
|
i("getAccessToken: invalid access token, trying to refresh it");
|
|
2090
|
-
const
|
|
2098
|
+
const p = await Et.refreshtoken({
|
|
2091
2099
|
clientId: n,
|
|
2092
2100
|
userId: R.userId,
|
|
2093
|
-
nonce:
|
|
2101
|
+
nonce: wt,
|
|
2094
2102
|
domain: r
|
|
2095
2103
|
});
|
|
2096
|
-
return
|
|
2104
|
+
return p.status && p.status === "success" && p.newAccessToken ? (u(p.newAccessToken), q(p.newRefreshToken), p.newAccessToken) : (i(
|
|
2097
2105
|
"getAccessToken: invalid refresh token, need to re-authenticate"
|
|
2098
|
-
), await N(
|
|
2106
|
+
), await N(K), "");
|
|
2099
2107
|
}
|
|
2100
2108
|
return i(
|
|
2101
2109
|
"getAccessToken: user is not authenticated, cannot get access token"
|
|
2102
|
-
), await N(
|
|
2110
|
+
), await N(K), "";
|
|
2103
2111
|
} catch {
|
|
2104
2112
|
return i(
|
|
2105
2113
|
"getAccessToken: exception occurred, invalidating and logging out"
|
|
2106
|
-
), await N(
|
|
2114
|
+
), await N(Jn), "";
|
|
2107
2115
|
}
|
|
2108
|
-
},
|
|
2109
|
-
if (s.isAuthenticated && l)
|
|
2110
|
-
return l;
|
|
2111
|
-
}, Rt = async () => {
|
|
2116
|
+
}, Rt = () => s.isAuthenticated && l ? l : "", bt = async () => {
|
|
2112
2117
|
const { user: d } = s;
|
|
2113
|
-
let R = await
|
|
2114
|
-
accessToken:
|
|
2118
|
+
let R = await W({
|
|
2119
|
+
accessToken: f,
|
|
2115
2120
|
clientId: n,
|
|
2116
|
-
type:
|
|
2121
|
+
type: L.GET_REGISTRATION_OPTIONS,
|
|
2117
2122
|
params: {
|
|
2118
2123
|
clientId: n,
|
|
2119
2124
|
id: d?.userId,
|
|
@@ -2122,23 +2127,23 @@ const Tr = (e) => x(
|
|
|
2122
2127
|
});
|
|
2123
2128
|
if (R.status)
|
|
2124
2129
|
try {
|
|
2125
|
-
const
|
|
2126
|
-
R = await
|
|
2127
|
-
accessToken:
|
|
2130
|
+
const p = await Lt(R.data);
|
|
2131
|
+
R = await W({
|
|
2132
|
+
accessToken: f,
|
|
2128
2133
|
clientId: n,
|
|
2129
|
-
type:
|
|
2134
|
+
type: L.VERIFY_REGISTRATION,
|
|
2130
2135
|
params: {
|
|
2131
2136
|
clientId: n,
|
|
2132
2137
|
id: d?.userId,
|
|
2133
2138
|
username: d?.username,
|
|
2134
|
-
registration:
|
|
2139
|
+
registration: p
|
|
2135
2140
|
}
|
|
2136
2141
|
});
|
|
2137
2142
|
} catch {
|
|
2138
|
-
return await
|
|
2139
|
-
accessToken:
|
|
2143
|
+
return await W({
|
|
2144
|
+
accessToken: f,
|
|
2140
2145
|
clientId: n,
|
|
2141
|
-
type:
|
|
2146
|
+
type: L.VERIFY_REGISTRATION,
|
|
2142
2147
|
params: {
|
|
2143
2148
|
clientId: n,
|
|
2144
2149
|
id: d?.userId,
|
|
@@ -2147,49 +2152,50 @@ const Tr = (e) => x(
|
|
|
2147
2152
|
}
|
|
2148
2153
|
}), !1;
|
|
2149
2154
|
}
|
|
2150
|
-
|
|
2155
|
+
return !1;
|
|
2156
|
+
}, It = async () => {
|
|
2151
2157
|
const d = Se();
|
|
2152
|
-
|
|
2158
|
+
Ie(d), o({ type: V, payload: { isLoading: !0 } }), z(), i("loginWithPasskey");
|
|
2153
2159
|
const R = Se();
|
|
2154
|
-
let
|
|
2155
|
-
accessToken:
|
|
2160
|
+
let p = await W({
|
|
2161
|
+
accessToken: f,
|
|
2156
2162
|
clientId: n,
|
|
2157
|
-
type:
|
|
2163
|
+
type: L.GET_AUTHENTICATION_OPTIONS,
|
|
2158
2164
|
params: {
|
|
2159
2165
|
id: R,
|
|
2160
2166
|
clientId: n
|
|
2161
2167
|
}
|
|
2162
2168
|
});
|
|
2163
|
-
if (
|
|
2169
|
+
if (p.status)
|
|
2164
2170
|
try {
|
|
2165
|
-
const I = await
|
|
2166
|
-
return
|
|
2167
|
-
accessToken:
|
|
2171
|
+
const I = await Mt(p.data);
|
|
2172
|
+
return p = await W({
|
|
2173
|
+
accessToken: f,
|
|
2168
2174
|
clientId: n,
|
|
2169
|
-
type:
|
|
2175
|
+
type: L.VERIFY_AUTHENTICATION,
|
|
2170
2176
|
params: {
|
|
2171
2177
|
clientId: n,
|
|
2172
2178
|
id: R,
|
|
2173
2179
|
authentication: I,
|
|
2174
2180
|
nonce: d,
|
|
2175
2181
|
domain: r,
|
|
2176
|
-
fingerprint:
|
|
2182
|
+
fingerprint: y.current
|
|
2177
2183
|
}
|
|
2178
|
-
}),
|
|
2184
|
+
}), p.data.status === "success" ? (h(p.data.idToken), u(p.data.accessToken), q(p.data.refreshToken), o({
|
|
2179
2185
|
type: j,
|
|
2180
2186
|
payload: {
|
|
2181
2187
|
authenticationType: M.PASSKEY,
|
|
2182
2188
|
user: {
|
|
2183
|
-
userId:
|
|
2184
|
-
username:
|
|
2189
|
+
userId: p.data.userId,
|
|
2190
|
+
username: p.data.username
|
|
2185
2191
|
}
|
|
2186
2192
|
}
|
|
2187
|
-
}), !0) : (
|
|
2193
|
+
}), !0) : ($(re), !1);
|
|
2188
2194
|
} catch {
|
|
2189
|
-
return await
|
|
2190
|
-
accessToken:
|
|
2195
|
+
return await W({
|
|
2196
|
+
accessToken: f,
|
|
2191
2197
|
clientId: n,
|
|
2192
|
-
type:
|
|
2198
|
+
type: L.VERIFY_AUTHENTICATION,
|
|
2193
2199
|
params: {
|
|
2194
2200
|
clientId: n,
|
|
2195
2201
|
id: R,
|
|
@@ -2197,28 +2203,29 @@ const Tr = (e) => x(
|
|
|
2197
2203
|
nonce: d,
|
|
2198
2204
|
domain: r
|
|
2199
2205
|
}
|
|
2200
|
-
}),
|
|
2206
|
+
}), $(re), !1;
|
|
2201
2207
|
}
|
|
2208
|
+
return !1;
|
|
2202
2209
|
};
|
|
2203
|
-
return /* @__PURE__ */
|
|
2204
|
-
|
|
2210
|
+
return /* @__PURE__ */ Ce(br.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ Ce(
|
|
2211
|
+
mt.Provider,
|
|
2205
2212
|
{
|
|
2206
2213
|
value: {
|
|
2207
2214
|
...s,
|
|
2208
|
-
login:
|
|
2209
|
-
logout:
|
|
2210
|
-
getAccessToken:
|
|
2211
|
-
getIdToken:
|
|
2212
|
-
registeringForPasskey:
|
|
2213
|
-
loginWithPasskey:
|
|
2215
|
+
login: St,
|
|
2216
|
+
logout: At,
|
|
2217
|
+
getAccessToken: Tt,
|
|
2218
|
+
getIdToken: Rt,
|
|
2219
|
+
registeringForPasskey: bt,
|
|
2220
|
+
loginWithPasskey: It
|
|
2214
2221
|
},
|
|
2215
2222
|
children: e
|
|
2216
2223
|
}
|
|
2217
2224
|
) });
|
|
2218
|
-
},
|
|
2225
|
+
}, Kr = (e = mt) => Ut(e);
|
|
2219
2226
|
export {
|
|
2220
2227
|
M as AUTH_TYPES,
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2228
|
+
$r as AuthProvider,
|
|
2229
|
+
Ur as isGranted,
|
|
2230
|
+
Kr as useAuth
|
|
2224
2231
|
};
|