@versini/auth-provider 6.4.0 → 6.4.2
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 +629 -622
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import
|
|
1
|
+
var Pt = Object.defineProperty;
|
|
2
|
+
var kt = (e, t, n) => t in e ? Pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var X = (e, t, n) => kt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsx as ke } from "react/jsx-runtime";
|
|
5
|
+
import Ot, { useSyncExternalStore as Nt, useCallback as U, useEffect as Re, createContext as Dt, useReducer as Ut, useRef as Oe, useContext as $t } from "react";
|
|
6
6
|
/*!
|
|
7
|
-
@versini/auth-provider v6.4.
|
|
7
|
+
@versini/auth-provider v6.4.2
|
|
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.2",
|
|
13
|
+
buildTime: "07/28/2024 07:43 PM EDT",
|
|
14
14
|
homepage: "https://github.com/aversini/auth-client",
|
|
15
15
|
license: "MIT"
|
|
16
16
|
});
|
|
@@ -23,24 +23,24 @@ function v(e) {
|
|
|
23
23
|
n += String.fromCharCode(a);
|
|
24
24
|
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function ce(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 be() {
|
|
33
33
|
return window?.PublicKeyCredential !== void 0 && typeof window.PublicKeyCredential == "function";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function je(e) {
|
|
36
36
|
const { id: t } = e;
|
|
37
37
|
return {
|
|
38
38
|
...e,
|
|
39
|
-
id:
|
|
39
|
+
id: ce(t),
|
|
40
40
|
transports: e.transports
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function Fe(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 Kt({ 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 (Fe(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 Ht {
|
|
129
129
|
createNewAbortSignal() {
|
|
130
130
|
if (this.controller) {
|
|
131
131
|
const n = new Error("Cancelling existing WebAuthn API call for new one");
|
|
@@ -141,56 +141,56 @@ class $t {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
function
|
|
146
|
-
if (e && !(
|
|
144
|
+
const Be = new Ht(), Lt = ["cross-platform", "platform"];
|
|
145
|
+
function qe(e) {
|
|
146
|
+
if (e && !(Lt.indexOf(e) < 0))
|
|
147
147
|
return e;
|
|
148
148
|
}
|
|
149
|
-
async function
|
|
150
|
-
if (!
|
|
149
|
+
async function Wt(e) {
|
|
150
|
+
if (!be())
|
|
151
151
|
throw new Error("WebAuthn is not supported in this browser");
|
|
152
152
|
const n = { publicKey: {
|
|
153
153
|
...e,
|
|
154
|
-
challenge:
|
|
154
|
+
challenge: ce(e.challenge),
|
|
155
155
|
user: {
|
|
156
156
|
...e.user,
|
|
157
|
-
id:
|
|
157
|
+
id: ce(e.user.id)
|
|
158
158
|
},
|
|
159
|
-
excludeCredentials: e.excludeCredentials?.map(
|
|
159
|
+
excludeCredentials: e.excludeCredentials?.map(je)
|
|
160
160
|
} };
|
|
161
|
-
n.signal =
|
|
161
|
+
n.signal = Be.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 Kt({ 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
|
-
|
|
176
|
+
y = o.getPublicKeyAlgorithm();
|
|
177
|
+
} catch (g) {
|
|
178
|
+
ge("getPublicKeyAlgorithm()", g);
|
|
179
179
|
}
|
|
180
180
|
let l;
|
|
181
181
|
if (typeof o.getPublicKey == "function")
|
|
182
182
|
try {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
} catch (
|
|
186
|
-
|
|
183
|
+
const g = o.getPublicKey();
|
|
184
|
+
g !== null && (l = v(g));
|
|
185
|
+
} catch (g) {
|
|
186
|
+
ge("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
|
-
|
|
192
|
+
} catch (g) {
|
|
193
|
+
ge("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: qe(r.authenticatorAttachment)
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function ge(e, t) {
|
|
212
212
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
|
|
213
213
|
`, t);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
if (!
|
|
215
|
+
function xt() {
|
|
216
|
+
if (!be())
|
|
217
217
|
return new Promise((t) => t(!1));
|
|
218
218
|
const e = window.PublicKeyCredential;
|
|
219
219
|
return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Mt({ 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 (Fe(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
|
|
263
|
-
if (!
|
|
262
|
+
async function Gt(e, t = !1) {
|
|
263
|
+
if (!be())
|
|
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(je));
|
|
267
267
|
const r = {
|
|
268
268
|
...e,
|
|
269
|
-
challenge:
|
|
269
|
+
challenge: ce(e.challenge),
|
|
270
270
|
allowCredentials: n
|
|
271
271
|
}, a = {};
|
|
272
272
|
if (t) {
|
|
273
|
-
if (!await
|
|
273
|
+
if (!await xt())
|
|
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 = Be.createNewAbortSignal();
|
|
280
280
|
let s;
|
|
281
281
|
try {
|
|
282
282
|
s = await navigator.credentials.get(a);
|
|
283
283
|
} catch (h) {
|
|
284
|
-
throw
|
|
284
|
+
throw Mt({ 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: qe(s.authenticatorAttachment)
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
304
|
/*!
|
|
@@ -308,22 +308,22 @@ 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/28/2024 07:43 PM EDT",
|
|
312
312
|
homepage: "https://github.com/aversini/auth-client",
|
|
313
313
|
license: "MIT"
|
|
314
314
|
});
|
|
315
315
|
} catch {
|
|
316
316
|
}
|
|
317
|
-
const
|
|
317
|
+
const G = {
|
|
318
318
|
ID_TOKEN: "id_token",
|
|
319
319
|
ACCESS_TOKEN: "token",
|
|
320
320
|
ID_AND_ACCESS_TOKEN: "id_token token",
|
|
321
321
|
CODE: "code",
|
|
322
322
|
REFRESH_TOKEN: "refresh_token",
|
|
323
323
|
PASSKEY: "passkey"
|
|
324
|
-
},
|
|
324
|
+
}, ze = {
|
|
325
325
|
CLIENT_ID: "X-Auth-ClientId"
|
|
326
|
-
},
|
|
326
|
+
}, T = {
|
|
327
327
|
ALG: "RS256",
|
|
328
328
|
USER_ID_KEY: "sub",
|
|
329
329
|
TOKEN_ID_KEY: "__raw",
|
|
@@ -334,7 +334,7 @@ const M = {
|
|
|
334
334
|
CREATED_AT_KEY: "iat",
|
|
335
335
|
SCOPES_KEY: "scopes",
|
|
336
336
|
ISSUER: "gizmette.com"
|
|
337
|
-
},
|
|
337
|
+
}, Jt = `-----BEGIN PUBLIC KEY-----
|
|
338
338
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
|
|
339
339
|
w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
|
|
340
340
|
i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
|
|
@@ -342,33 +342,33 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
|
|
|
342
342
|
l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
|
|
343
343
|
sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
|
|
344
344
|
awIDAQAB
|
|
345
|
-
-----END PUBLIC KEY-----`,
|
|
345
|
+
-----END PUBLIC KEY-----`, he = {
|
|
346
346
|
AUTHENTICATE: "authenticate",
|
|
347
347
|
CODE: "code",
|
|
348
348
|
LOGOUT: "logout"
|
|
349
|
-
},
|
|
350
|
-
function
|
|
349
|
+
}, pe = crypto, Qe = (e) => e instanceof CryptoKey, Z = new TextEncoder(), q = new TextDecoder();
|
|
350
|
+
function Yt(...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 Vt = (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);
|
|
361
361
|
return n;
|
|
362
|
-
},
|
|
362
|
+
}, B = (e) => {
|
|
363
363
|
let t = e;
|
|
364
|
-
t instanceof Uint8Array && (t =
|
|
364
|
+
t instanceof Uint8Array && (t = q.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
365
365
|
try {
|
|
366
|
-
return
|
|
366
|
+
return Vt(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 $ = 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 $ {
|
|
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
|
+
}, Ne = class extends $ {
|
|
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 $ {
|
|
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
|
|
402
|
+
let N = class extends $ {
|
|
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
|
|
410
|
+
class A extends $ {
|
|
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 $ {
|
|
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 Ft extends $ {
|
|
427
427
|
constructor() {
|
|
428
428
|
super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
|
|
429
429
|
}
|
|
@@ -431,16 +431,16 @@ class Vt extends D {
|
|
|
431
431
|
return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
function
|
|
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 ee(e, t) {
|
|
438
438
|
return e.name === t;
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function me(e) {
|
|
441
441
|
return parseInt(e.name.slice(4), 10);
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function Bt(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 qt(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,59 +462,59 @@ function Ft(e, t) {
|
|
|
462
462
|
throw new TypeError(n);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function zt(e, t, ...n) {
|
|
466
466
|
switch (t) {
|
|
467
467
|
case "HS256":
|
|
468
468
|
case "HS384":
|
|
469
469
|
case "HS512": {
|
|
470
|
-
if (!
|
|
471
|
-
throw
|
|
470
|
+
if (!ee(e.algorithm, "HMAC"))
|
|
471
|
+
throw P("HMAC");
|
|
472
472
|
const r = parseInt(t.slice(2), 10);
|
|
473
|
-
if (
|
|
474
|
-
throw
|
|
473
|
+
if (me(e.algorithm.hash) !== r)
|
|
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 (!
|
|
481
|
-
throw
|
|
480
|
+
if (!ee(e.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
481
|
+
throw P("RSASSA-PKCS1-v1_5");
|
|
482
482
|
const r = parseInt(t.slice(2), 10);
|
|
483
|
-
if (
|
|
484
|
-
throw
|
|
483
|
+
if (me(e.algorithm.hash) !== r)
|
|
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 (!
|
|
491
|
-
throw
|
|
490
|
+
if (!ee(e.algorithm, "RSA-PSS"))
|
|
491
|
+
throw P("RSA-PSS");
|
|
492
492
|
const r = parseInt(t.slice(2), 10);
|
|
493
|
-
if (
|
|
494
|
-
throw
|
|
493
|
+
if (me(e.algorithm.hash) !== r)
|
|
494
|
+
throw P(`SHA-${r}`, "algorithm.hash");
|
|
495
495
|
break;
|
|
496
496
|
}
|
|
497
497
|
case "EdDSA": {
|
|
498
498
|
if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
|
|
499
|
-
throw
|
|
499
|
+
throw P("Ed25519 or Ed448");
|
|
500
500
|
break;
|
|
501
501
|
}
|
|
502
502
|
case "ES256":
|
|
503
503
|
case "ES384":
|
|
504
504
|
case "ES512": {
|
|
505
|
-
if (!
|
|
506
|
-
throw
|
|
507
|
-
const r =
|
|
505
|
+
if (!ee(e.algorithm, "ECDSA"))
|
|
506
|
+
throw P("ECDSA");
|
|
507
|
+
const r = Bt(t);
|
|
508
508
|
if (e.algorithm.namedCurve !== r)
|
|
509
|
-
throw
|
|
509
|
+
throw P(r, "algorithm.namedCurve");
|
|
510
510
|
break;
|
|
511
511
|
}
|
|
512
512
|
default:
|
|
513
513
|
throw new TypeError("CryptoKey does not support this operation");
|
|
514
514
|
}
|
|
515
|
-
|
|
515
|
+
qt(e, n);
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Xe(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 De = (e, ...t) => Xe("Key must be ", e, ...t);
|
|
526
|
+
function Ze(e, t, ...n) {
|
|
527
|
+
return Xe(`Key for the ${e} algorithm must be `, t, ...n);
|
|
528
528
|
}
|
|
529
|
-
const
|
|
529
|
+
const et = (e) => Qe(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ue = ["CryptoKey"], Qt = (...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 Xt(e) {
|
|
549
549
|
return typeof e == "object" && e !== null;
|
|
550
550
|
}
|
|
551
|
-
function
|
|
552
|
-
if (!
|
|
551
|
+
function le(e) {
|
|
552
|
+
if (!Xt(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 Zt = (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 en(e) {
|
|
569
569
|
let t, n;
|
|
570
570
|
switch (e.kty) {
|
|
571
571
|
case "RSA": {
|
|
@@ -590,7 +590,7 @@ function Xt(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 Xt(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,71 +628,71 @@ function Xt(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
|
}
|
|
640
|
-
const
|
|
640
|
+
const tn = 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 } = en(e), r = [
|
|
644
644
|
t,
|
|
645
645
|
e.ext ?? !1,
|
|
646
646
|
e.key_ops ?? n
|
|
647
647
|
], a = { ...e };
|
|
648
|
-
return delete a.alg, delete a.use,
|
|
649
|
-
},
|
|
650
|
-
let
|
|
651
|
-
const
|
|
648
|
+
return delete a.alg, delete a.use, pe.subtle.importKey("jwk", a, ...r);
|
|
649
|
+
}, tt = (e) => B(e);
|
|
650
|
+
let we, Ee;
|
|
651
|
+
const nt = (e) => e?.[Symbol.toStringTag] === "KeyObject", rt = async (e, t, n, r) => {
|
|
652
652
|
let a = e.get(t);
|
|
653
653
|
if (a != null && a[r])
|
|
654
654
|
return a[r];
|
|
655
|
-
const s = await
|
|
655
|
+
const s = await tn({ ...n, alg: r });
|
|
656
656
|
return a ? a[r] = s : e.set(t, { [r]: s }), s;
|
|
657
|
-
},
|
|
658
|
-
if (
|
|
657
|
+
}, nn = (e, t) => {
|
|
658
|
+
if (nt(e)) {
|
|
659
659
|
let n = e.export({ format: "jwk" });
|
|
660
|
-
return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ?
|
|
660
|
+
return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? tt(n.k) : (Ee || (Ee = /* @__PURE__ */ new WeakMap()), rt(Ee, e, n, t));
|
|
661
661
|
}
|
|
662
662
|
return e;
|
|
663
|
-
},
|
|
664
|
-
if (
|
|
663
|
+
}, rn = (e, t) => {
|
|
664
|
+
if (nt(e)) {
|
|
665
665
|
let n = e.export({ format: "jwk" });
|
|
666
|
-
return n.k ?
|
|
666
|
+
return n.k ? tt(n.k) : (we || (we = /* @__PURE__ */ new WeakMap()), rt(we, e, n, t));
|
|
667
667
|
}
|
|
668
668
|
return e;
|
|
669
|
-
},
|
|
669
|
+
}, an = { normalizePublicKey: nn, normalizePrivateKey: rn }, 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
|
+
}, Ue = (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
|
+
}, on = 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 = Ue(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: Ue(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
|
|
742
|
-
},
|
|
743
|
-
async function
|
|
741
|
+
return pe.subtle.importKey(t, i, s, !1, o);
|
|
742
|
+
}, sn = (e, t, n) => on(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
|
|
743
|
+
async function cn(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 sn(e, t);
|
|
747
747
|
}
|
|
748
|
-
const
|
|
748
|
+
const ie = (e) => e?.[Symbol.toStringTag], un = (e, t) => {
|
|
749
749
|
if (!(t instanceof Uint8Array)) {
|
|
750
|
-
if (!
|
|
751
|
-
throw new TypeError(
|
|
750
|
+
if (!et(t))
|
|
751
|
+
throw new TypeError(Ze(e, t, ...ue, "Uint8Array"));
|
|
752
752
|
if (t.type !== "secret")
|
|
753
|
-
throw new TypeError(`${
|
|
753
|
+
throw new TypeError(`${ie(t)} instances for symmetric algorithms must be of type "secret"`);
|
|
754
754
|
}
|
|
755
|
-
},
|
|
756
|
-
if (!
|
|
757
|
-
throw new TypeError(
|
|
755
|
+
}, ln = (e, t, n) => {
|
|
756
|
+
if (!et(t))
|
|
757
|
+
throw new TypeError(Ze(e, t, ...ue));
|
|
758
758
|
if (t.type === "secret")
|
|
759
|
-
throw new TypeError(`${
|
|
759
|
+
throw new TypeError(`${ie(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(`${ie(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(`${
|
|
764
|
-
},
|
|
765
|
-
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ?
|
|
763
|
+
throw new TypeError(`${ie(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
764
|
+
}, dn = (e, t, n) => {
|
|
765
|
+
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? un(e, t) : ln(e, t, n);
|
|
766
766
|
};
|
|
767
|
-
function
|
|
767
|
+
function hn(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)
|
|
@@ -775,7 +775,7 @@ function ln(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)
|
|
@@ -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 pn = (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 fn(e, t) {
|
|
793
793
|
const n = `SHA-${e.slice(-3)}`;
|
|
794
794
|
switch (e) {
|
|
795
795
|
case "HS256":
|
|
@@ -811,103 +811,103 @@ function hn(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
|
-
async function
|
|
818
|
-
if (t = await
|
|
819
|
-
return
|
|
817
|
+
async function yn(e, t, n) {
|
|
818
|
+
if (t = await an.normalizePublicKey(t, e), Qe(t))
|
|
819
|
+
return zt(t, e, n), t;
|
|
820
820
|
if (t instanceof Uint8Array) {
|
|
821
821
|
if (!e.startsWith("HS"))
|
|
822
|
-
throw new TypeError(
|
|
823
|
-
return
|
|
822
|
+
throw new TypeError(De(t, ...ue));
|
|
823
|
+
return pe.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [n]);
|
|
824
824
|
}
|
|
825
|
-
throw new TypeError(
|
|
825
|
+
throw new TypeError(De(t, ...ue, "Uint8Array"));
|
|
826
826
|
}
|
|
827
|
-
const
|
|
828
|
-
const a = await
|
|
829
|
-
|
|
830
|
-
const s =
|
|
827
|
+
const gn = async (e, t, n, r) => {
|
|
828
|
+
const a = await yn(e, t, "verify");
|
|
829
|
+
Zt(e, a);
|
|
830
|
+
const s = fn(e, a.algorithm);
|
|
831
831
|
try {
|
|
832
|
-
return await
|
|
832
|
+
return await pe.subtle.verify(s, a, n, r);
|
|
833
833
|
} catch {
|
|
834
834
|
return !1;
|
|
835
835
|
}
|
|
836
836
|
};
|
|
837
|
-
async function
|
|
838
|
-
if (!
|
|
839
|
-
throw new
|
|
837
|
+
async function mn(e, t, n) {
|
|
838
|
+
if (!le(e))
|
|
839
|
+
throw new A("Flattened JWS must be an object");
|
|
840
840
|
if (e.protected === void 0 && e.header === void 0)
|
|
841
|
-
throw new
|
|
841
|
+
throw new A('Flattened JWS must have either of the "protected" or "header" members');
|
|
842
842
|
if (e.protected !== void 0 && typeof e.protected != "string")
|
|
843
|
-
throw new
|
|
843
|
+
throw new A("JWS Protected Header incorrect type");
|
|
844
844
|
if (e.payload === void 0)
|
|
845
|
-
throw new
|
|
845
|
+
throw new A("JWS Payload missing");
|
|
846
846
|
if (typeof e.signature != "string")
|
|
847
|
-
throw new
|
|
848
|
-
if (e.header !== void 0 && !
|
|
849
|
-
throw new
|
|
847
|
+
throw new A("JWS Signature missing or incorrect type");
|
|
848
|
+
if (e.header !== void 0 && !le(e.header))
|
|
849
|
+
throw new A("JWS Unprotected Header incorrect type");
|
|
850
850
|
let r = {};
|
|
851
851
|
if (e.protected)
|
|
852
852
|
try {
|
|
853
|
-
const u =
|
|
854
|
-
r = JSON.parse(
|
|
853
|
+
const u = B(e.protected);
|
|
854
|
+
r = JSON.parse(q.decode(u));
|
|
855
855
|
} catch {
|
|
856
|
-
throw new
|
|
856
|
+
throw new A("JWS Protected Header is invalid");
|
|
857
857
|
}
|
|
858
|
-
if (!
|
|
859
|
-
throw new
|
|
858
|
+
if (!Qt(r, e.header))
|
|
859
|
+
throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
860
860
|
const a = {
|
|
861
861
|
...r,
|
|
862
862
|
...e.header
|
|
863
|
-
}, s =
|
|
863
|
+
}, s = hn(A, /* @__PURE__ */ new Map([["b64", !0]]), n?.crit, r, a);
|
|
864
864
|
let o = !0;
|
|
865
865
|
if (s.has("b64") && (o = r.b64, typeof o != "boolean"))
|
|
866
|
-
throw new
|
|
866
|
+
throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
867
867
|
const { alg: i } = a;
|
|
868
868
|
if (typeof i != "string" || !i)
|
|
869
|
-
throw new
|
|
870
|
-
const c = n &&
|
|
869
|
+
throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
870
|
+
const c = n && pn("algorithms", n.algorithms);
|
|
871
871
|
if (c && !c.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
|
-
throw new
|
|
875
|
+
throw new A("JWS Payload must be a string");
|
|
876
876
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
877
|
-
throw new
|
|
878
|
-
let
|
|
879
|
-
typeof t == "function" && (t = await t(r, e),
|
|
880
|
-
const l =
|
|
877
|
+
throw new A("JWS Payload must be a string or an Uint8Array instance");
|
|
878
|
+
let y = !1;
|
|
879
|
+
typeof t == "function" && (t = await t(r, e), y = !0), dn(i, t, "verify");
|
|
880
|
+
const l = Yt(Z.encode(e.protected ?? ""), Z.encode("."), typeof e.payload == "string" ? Z.encode(e.payload) : e.payload);
|
|
881
881
|
let h;
|
|
882
882
|
try {
|
|
883
|
-
h =
|
|
883
|
+
h = B(e.signature);
|
|
884
884
|
} catch {
|
|
885
|
-
throw new
|
|
885
|
+
throw new A("Failed to base64url decode the signature");
|
|
886
886
|
}
|
|
887
|
-
if (!await
|
|
888
|
-
throw new
|
|
889
|
-
let
|
|
887
|
+
if (!await gn(i, t, h, l))
|
|
888
|
+
throw new Ft();
|
|
889
|
+
let g;
|
|
890
890
|
if (o)
|
|
891
891
|
try {
|
|
892
|
-
|
|
892
|
+
g = B(e.payload);
|
|
893
893
|
} catch {
|
|
894
|
-
throw new
|
|
894
|
+
throw new A("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 = Z.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
|
|
901
|
-
if (e instanceof Uint8Array && (e =
|
|
902
|
-
throw new
|
|
900
|
+
async function wn(e, t, n) {
|
|
901
|
+
if (e instanceof Uint8Array && (e = q.decode(e)), typeof e != "string")
|
|
902
|
+
throw new A("Compact JWS must be a string or Uint8Array");
|
|
903
903
|
const { 0: r, 1: a, 2: s, length: o } = e.split(".");
|
|
904
904
|
if (o !== 3)
|
|
905
|
-
throw new
|
|
906
|
-
const i = await
|
|
905
|
+
throw new A("Invalid Compact JWS");
|
|
906
|
+
const i = await mn({ 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 En = (e) => Math.floor(e.getTime() / 1e3), at = 60, ot = at * 60, Ie = ot * 24, Sn = Ie * 7, An = Ie * 365.25, Tn = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, $e = (e) => {
|
|
910
|
+
const t = Tn.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,43 +925,43 @@ 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 * at);
|
|
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 * ot);
|
|
936
936
|
break;
|
|
937
937
|
case "day":
|
|
938
938
|
case "days":
|
|
939
939
|
case "d":
|
|
940
|
-
a = Math.round(n *
|
|
940
|
+
a = Math.round(n * Ie);
|
|
941
941
|
break;
|
|
942
942
|
case "week":
|
|
943
943
|
case "weeks":
|
|
944
944
|
case "w":
|
|
945
|
-
a = Math.round(n *
|
|
945
|
+
a = Math.round(n * Sn);
|
|
946
946
|
break;
|
|
947
947
|
default:
|
|
948
|
-
a = Math.round(n *
|
|
948
|
+
a = Math.round(n * An);
|
|
949
949
|
break;
|
|
950
950
|
}
|
|
951
951
|
return t[1] === "-" || t[4] === "ago" ? -a : a;
|
|
952
|
-
},
|
|
952
|
+
}, Ke = (e) => e.toLowerCase().replace(/^application\//, ""), Rn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, bn = (e, t, n = {}) => {
|
|
953
953
|
let r;
|
|
954
954
|
try {
|
|
955
|
-
r = JSON.parse(
|
|
955
|
+
r = JSON.parse(q.decode(t));
|
|
956
956
|
} catch {
|
|
957
957
|
}
|
|
958
|
-
if (!
|
|
959
|
-
throw new
|
|
958
|
+
if (!le(r))
|
|
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" || Ke(e.typ) !== Ke(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 && !Rn(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 = $e(n.clockTolerance);
|
|
978
978
|
break;
|
|
979
979
|
case "number":
|
|
980
980
|
h = n.clockTolerance;
|
|
@@ -985,197 +985,197 @@ 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 = En(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 <=
|
|
1001
|
-
throw new
|
|
1000
|
+
if (r.exp <= f - h)
|
|
1001
|
+
throw new Ne('"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 : $e(y);
|
|
1005
1005
|
if (u - h > m)
|
|
1006
|
-
throw new
|
|
1006
|
+
throw new Ne('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
|
|
1007
1007
|
if (u < 0 - h)
|
|
1008
1008
|
throw new _('"iat" claim timestamp check failed (it should be in the past)', r, "iat", "check_failed");
|
|
1009
1009
|
}
|
|
1010
1010
|
return r;
|
|
1011
1011
|
};
|
|
1012
|
-
async function
|
|
1012
|
+
async function In(e, t, n) {
|
|
1013
1013
|
var r;
|
|
1014
|
-
const a = await
|
|
1014
|
+
const a = await wn(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: bn(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 _n = B;
|
|
1021
|
+
function vn(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 = _n(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
|
-
a = JSON.parse(
|
|
1039
|
+
a = JSON.parse(q.decode(r));
|
|
1040
1040
|
} catch {
|
|
1041
|
-
throw new
|
|
1041
|
+
throw new k("Failed to parse the decoded payload as JSON");
|
|
1042
1042
|
}
|
|
1043
|
-
if (!
|
|
1044
|
-
throw new
|
|
1043
|
+
if (!le(a))
|
|
1044
|
+
throw new k("Invalid JWT Claims Set");
|
|
1045
1045
|
return a;
|
|
1046
1046
|
}
|
|
1047
|
-
const
|
|
1047
|
+
const J = async (e) => {
|
|
1048
1048
|
try {
|
|
1049
|
-
const t =
|
|
1050
|
-
return await
|
|
1051
|
-
issuer:
|
|
1049
|
+
const t = T.ALG, n = await cn(Jt, t);
|
|
1050
|
+
return await In(e, n, {
|
|
1051
|
+
issuer: T.ISSUER
|
|
1052
1052
|
});
|
|
1053
1053
|
} catch {
|
|
1054
1054
|
return;
|
|
1055
1055
|
}
|
|
1056
|
-
},
|
|
1056
|
+
}, Cn = (e) => {
|
|
1057
1057
|
try {
|
|
1058
|
-
return
|
|
1058
|
+
return vn(e);
|
|
1059
1059
|
} catch {
|
|
1060
1060
|
return;
|
|
1061
1061
|
}
|
|
1062
1062
|
};
|
|
1063
|
-
var
|
|
1064
|
-
for (var
|
|
1065
|
-
|
|
1066
|
-
function
|
|
1067
|
-
return (
|
|
1063
|
+
var E = [];
|
|
1064
|
+
for (var Se = 0; Se < 256; ++Se)
|
|
1065
|
+
E.push((Se + 256).toString(16).slice(1));
|
|
1066
|
+
function Pn(e, t = 0) {
|
|
1067
|
+
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();
|
|
1068
1068
|
}
|
|
1069
|
-
var
|
|
1070
|
-
function
|
|
1071
|
-
if (!
|
|
1069
|
+
var te, kn = new Uint8Array(16);
|
|
1070
|
+
function On() {
|
|
1071
|
+
if (!te && (te = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !te))
|
|
1072
1072
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1073
|
-
return
|
|
1073
|
+
return te(kn);
|
|
1074
1074
|
}
|
|
1075
|
-
var
|
|
1076
|
-
const
|
|
1077
|
-
randomUUID:
|
|
1075
|
+
var Nn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1076
|
+
const He = {
|
|
1077
|
+
randomUUID: Nn
|
|
1078
1078
|
};
|
|
1079
|
-
function
|
|
1080
|
-
if (
|
|
1081
|
-
return
|
|
1079
|
+
function Le(e, t, n) {
|
|
1080
|
+
if (He.randomUUID && !t && !e)
|
|
1081
|
+
return He.randomUUID();
|
|
1082
1082
|
e = e || {};
|
|
1083
|
-
var r = e.random || (e.rng ||
|
|
1084
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1083
|
+
var r = e.random || (e.rng || On)();
|
|
1084
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Pn(r);
|
|
1085
1085
|
}
|
|
1086
|
-
const
|
|
1086
|
+
const We = globalThis.crypto, Dn = (e) => `${Le()}${Le()}`.slice(0, e), Un = (e) => btoa(
|
|
1087
1087
|
[...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
|
|
1088
1088
|
);
|
|
1089
|
-
async function
|
|
1090
|
-
if (!
|
|
1089
|
+
async function $n(e) {
|
|
1090
|
+
if (!We.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 We.subtle.digest("SHA-256", t);
|
|
1095
|
+
return Un(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1096
1096
|
}
|
|
1097
|
-
async function
|
|
1098
|
-
const n =
|
|
1097
|
+
async function Kn(e) {
|
|
1098
|
+
const n = Dn(43), r = await $n(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
|
-
const r = await
|
|
1107
|
-
if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[
|
|
1106
|
+
const r = await J(e);
|
|
1107
|
+
if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[T.SCOPES_KEY]))
|
|
1108
1108
|
return !1;
|
|
1109
|
-
const a = r.payload[
|
|
1109
|
+
const a = r.payload[T.SCOPES_KEY];
|
|
1110
1110
|
return Array.isArray(t) ? t.every((s) => a.includes(s)) : Object.keys(t).some(
|
|
1111
1111
|
(s) => t[s].every((o) => a.includes(o))
|
|
1112
1112
|
);
|
|
1113
1113
|
};
|
|
1114
|
-
function
|
|
1114
|
+
function st(e, t) {
|
|
1115
1115
|
window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
|
|
1116
1116
|
}
|
|
1117
|
-
const
|
|
1117
|
+
const xe = (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
|
-
},
|
|
1125
|
-
function
|
|
1121
|
+
window.localStorage.setItem(e, n), st(e, n);
|
|
1122
|
+
}, Hn = (e) => {
|
|
1123
|
+
window.localStorage.removeItem(e), st(e, null);
|
|
1124
|
+
}, Me = (e) => window.localStorage.getItem(e), Ln = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
|
|
1125
|
+
function ne({
|
|
1126
1126
|
key: e,
|
|
1127
1127
|
initialValue: t
|
|
1128
1128
|
}) {
|
|
1129
|
-
const n =
|
|
1129
|
+
const n = Nt(Ln, () => Me(e)), r = U(
|
|
1130
1130
|
(o) => {
|
|
1131
1131
|
try {
|
|
1132
1132
|
const i = typeof o == "function" ? o(JSON.parse(n)) : o;
|
|
1133
|
-
i == null ?
|
|
1133
|
+
i == null ? Hn(e) : xe(e, i);
|
|
1134
1134
|
} catch (i) {
|
|
1135
1135
|
console.warn(i);
|
|
1136
1136
|
}
|
|
1137
1137
|
},
|
|
1138
1138
|
[e, n]
|
|
1139
|
-
), a =
|
|
1139
|
+
), a = U(() => {
|
|
1140
1140
|
r(t);
|
|
1141
|
-
}, [t, r]), s =
|
|
1141
|
+
}, [t, r]), s = U(() => {
|
|
1142
1142
|
r(null);
|
|
1143
1143
|
}, [r]);
|
|
1144
|
-
return
|
|
1144
|
+
return Re(() => {
|
|
1145
1145
|
try {
|
|
1146
|
-
|
|
1146
|
+
Me(e) === null && typeof t < "u" && xe(e, t);
|
|
1147
1147
|
} catch (o) {
|
|
1148
1148
|
console.warn(o);
|
|
1149
1149
|
}
|
|
1150
1150
|
}, [e, t]), [n ? JSON.parse(n) : null, r, a, s];
|
|
1151
1151
|
}
|
|
1152
|
-
var
|
|
1153
|
-
for (var
|
|
1154
|
-
|
|
1155
|
-
function
|
|
1156
|
-
return (
|
|
1152
|
+
var S = [];
|
|
1153
|
+
for (var Ae = 0; Ae < 256; ++Ae)
|
|
1154
|
+
S.push((Ae + 256).toString(16).slice(1));
|
|
1155
|
+
function Wn(e, t = 0) {
|
|
1156
|
+
return (S[e[t + 0]] + S[e[t + 1]] + S[e[t + 2]] + S[e[t + 3]] + "-" + S[e[t + 4]] + S[e[t + 5]] + "-" + S[e[t + 6]] + S[e[t + 7]] + "-" + S[e[t + 8]] + S[e[t + 9]] + "-" + S[e[t + 10]] + S[e[t + 11]] + S[e[t + 12]] + S[e[t + 13]] + S[e[t + 14]] + S[e[t + 15]]).toLowerCase();
|
|
1157
1157
|
}
|
|
1158
|
-
var
|
|
1159
|
-
function
|
|
1160
|
-
if (!
|
|
1158
|
+
var re, xn = new Uint8Array(16);
|
|
1159
|
+
function Mn() {
|
|
1160
|
+
if (!re && (re = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !re))
|
|
1161
1161
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1162
|
-
return
|
|
1162
|
+
return re(xn);
|
|
1163
1163
|
}
|
|
1164
|
-
var
|
|
1165
|
-
const
|
|
1166
|
-
randomUUID:
|
|
1164
|
+
var Gn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1165
|
+
const Ge = {
|
|
1166
|
+
randomUUID: Gn
|
|
1167
1167
|
};
|
|
1168
|
-
function
|
|
1169
|
-
if (
|
|
1170
|
-
return
|
|
1168
|
+
function Te(e, t, n) {
|
|
1169
|
+
if (Ge.randomUUID && !t && !e)
|
|
1170
|
+
return Ge.randomUUID();
|
|
1171
1171
|
e = e || {};
|
|
1172
|
-
var r = e.random || (e.rng ||
|
|
1173
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1172
|
+
var r = e.random || (e.rng || Mn)();
|
|
1173
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Wn(r);
|
|
1174
1174
|
}
|
|
1175
|
-
const
|
|
1175
|
+
const H = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Jn = "Your session has been successfully terminated.", ae = "Login failed. Please try again.", Yn = "Error getting access token, please re-authenticate.", Vn = "You forgot to wrap your component in <AuthProvider>.", de = {
|
|
1176
1176
|
dev: "https://auth.gizmette.local.com:3003",
|
|
1177
1177
|
prod: "https://mylogin.gizmette.com/auth"
|
|
1178
|
-
},
|
|
1178
|
+
}, oe = "@@auth@@", j = "LOADING", F = "LOGIN", it = "LOGOUT", fe = "success", C = "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(""), ct = 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 Je(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 Je(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
|
-
var m,
|
|
1220
|
-
l || (((
|
|
1219
|
+
var m, R;
|
|
1220
|
+
l || (((R = (m = i.contentWindow) == null ? void 0 : m.document) == null ? void 0 : R.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 Je(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
|
+
}), ut = { browser: "" }, zn = async (e) => typeof navigator > "u" ? ut : { browser: navigator.userAgent }, lt = {
|
|
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 ct(n.data.toString())).toString()
|
|
1276
1276
|
}
|
|
1277
1277
|
};
|
|
1278
1278
|
} catch {
|
|
1279
|
-
return
|
|
1279
|
+
return lt;
|
|
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", L = ["monospace", "sans-serif", "serif"], Ye = [
|
|
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
|
-
const m = n.createElement("span"), { style:
|
|
1355
|
-
return
|
|
1356
|
-
}, c = (u, m) => i(`'${u}',${m}`),
|
|
1354
|
+
const m = n.createElement("span"), { style: R } = m;
|
|
1355
|
+
return R.position = "absolute", R.top = "0", R.left = "0", R.fontFamily = u, m.textContent = nr, a.appendChild(m), m;
|
|
1356
|
+
}, c = (u, m) => i(`'${u}',${m}`), y = () => L.map(i), l = () => {
|
|
1357
1357
|
const u = {};
|
|
1358
|
-
for (const m of
|
|
1359
|
-
u[m] =
|
|
1360
|
-
(
|
|
1358
|
+
for (const m of Ye)
|
|
1359
|
+
u[m] = L.map(
|
|
1360
|
+
(R) => c(m, R)
|
|
1361
1361
|
);
|
|
1362
1362
|
return u;
|
|
1363
|
-
}, h = (u) =>
|
|
1364
|
-
(m,
|
|
1365
|
-
),
|
|
1363
|
+
}, h = (u) => L.some(
|
|
1364
|
+
(m, R) => u[R].offsetWidth !== s[m] || u[R].offsetHeight !== o[m]
|
|
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 < L.length; u++)
|
|
1368
|
+
s[L[u]] = g[u].offsetWidth, o[L[u]] = g[u].offsetHeight;
|
|
1369
|
+
return Ye.filter((u) => h(f[u]));
|
|
1370
|
+
}), dt = {
|
|
1371
1371
|
vendor: "",
|
|
1372
1372
|
vendorUnmasked: "",
|
|
1373
1373
|
renderer: "",
|
|
1374
1374
|
rendererUnmasked: "",
|
|
1375
1375
|
version: "",
|
|
1376
1376
|
shadingLanguageVersion: ""
|
|
1377
|
-
},
|
|
1377
|
+
}, ht = {
|
|
1378
1378
|
hardware: {
|
|
1379
|
-
videocard:
|
|
1379
|
+
videocard: dt,
|
|
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 dt;
|
|
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(ht);
|
|
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
|
+
}), pt = {
|
|
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(pt);
|
|
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,47 +1492,47 @@ const pr = async (e) => {
|
|
|
1492
1492
|
}
|
|
1493
1493
|
};
|
|
1494
1494
|
} catch {
|
|
1495
|
-
return
|
|
1495
|
+
return ft;
|
|
1496
1496
|
}
|
|
1497
|
-
},
|
|
1497
|
+
}, ft = {
|
|
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
|
-
|
|
1520
|
-
ct,
|
|
1521
|
-
er,
|
|
1518
|
+
Bn,
|
|
1519
|
+
ut,
|
|
1522
1520
|
lt,
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1521
|
+
tr,
|
|
1522
|
+
ht,
|
|
1523
|
+
lr,
|
|
1524
|
+
pt,
|
|
1525
|
+
ft
|
|
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 ct(JSON.stringify(t));
|
|
1532
1532
|
} catch {
|
|
1533
1533
|
return "";
|
|
1534
1534
|
}
|
|
1535
|
-
},
|
|
1535
|
+
}, se = {
|
|
1536
1536
|
GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
|
|
1537
1537
|
$clientId: String!,
|
|
1538
1538
|
$username: String!,
|
|
@@ -1610,24 +1610,24 @@ const pr = async (e) => {
|
|
|
1610
1610
|
username,
|
|
1611
1611
|
}
|
|
1612
1612
|
}`
|
|
1613
|
-
},
|
|
1613
|
+
}, W = {
|
|
1614
1614
|
GET_REGISTRATION_OPTIONS: {
|
|
1615
|
-
schema:
|
|
1615
|
+
schema: se.GET_REGISTRATION_OPTIONS,
|
|
1616
1616
|
method: "getPasskeyRegistrationOptions"
|
|
1617
1617
|
},
|
|
1618
1618
|
VERIFY_REGISTRATION: {
|
|
1619
|
-
schema:
|
|
1619
|
+
schema: se.VERIFY_REGISTRATION,
|
|
1620
1620
|
method: "verifyPasskeyRegistration"
|
|
1621
1621
|
},
|
|
1622
1622
|
GET_AUTHENTICATION_OPTIONS: {
|
|
1623
|
-
schema:
|
|
1623
|
+
schema: se.GET_AUTHENTICATION_OPTIONS,
|
|
1624
1624
|
method: "getPasskeyAuthenticationOptions"
|
|
1625
1625
|
},
|
|
1626
1626
|
VERIFY_AUTHENTICATION: {
|
|
1627
|
-
schema:
|
|
1627
|
+
schema: se.VERIFY_AUTHENTICATION,
|
|
1628
1628
|
method: "verifyPasskeyAuthentication"
|
|
1629
1629
|
}
|
|
1630
|
-
},
|
|
1630
|
+
}, x = 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
|
+
yt ? `${de.dev}/graphql` : `${de.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
|
+
[ze.CLIENT_ID]: `${n}`
|
|
1647
1647
|
},
|
|
1648
1648
|
body: JSON.stringify({
|
|
1649
1649
|
query: t.schema,
|
|
@@ -1652,60 +1652,58 @@ const pr = async (e) => {
|
|
|
1652
1652
|
}
|
|
1653
1653
|
);
|
|
1654
1654
|
if (o.status !== 200)
|
|
1655
|
-
return { status:
|
|
1656
|
-
const { data: i
|
|
1655
|
+
return { status: C, data: [] };
|
|
1656
|
+
const { data: i } = await o.json();
|
|
1657
1657
|
return {
|
|
1658
|
-
status:
|
|
1659
|
-
data: i[t.method]
|
|
1660
|
-
errors: c
|
|
1658
|
+
status: fe,
|
|
1659
|
+
data: i[t.method]
|
|
1661
1660
|
};
|
|
1662
1661
|
} catch (a) {
|
|
1663
|
-
return console.error(a), { status:
|
|
1662
|
+
return console.error(a), { status: C, data: [] };
|
|
1664
1663
|
}
|
|
1665
|
-
},
|
|
1664
|
+
}, ye = async ({
|
|
1666
1665
|
type: e,
|
|
1667
1666
|
clientId: t,
|
|
1668
1667
|
params: n = {}
|
|
1669
1668
|
}) => {
|
|
1670
1669
|
try {
|
|
1671
1670
|
const r = await fetch(
|
|
1672
|
-
|
|
1671
|
+
yt ? `${de.dev}/${e}` : `${de.prod}/${e}`,
|
|
1673
1672
|
{
|
|
1674
1673
|
credentials: "include",
|
|
1675
1674
|
method: "POST",
|
|
1676
1675
|
headers: {
|
|
1677
1676
|
"Content-Type": "application/json",
|
|
1678
|
-
[
|
|
1677
|
+
[ze.CLIENT_ID]: `${t}`
|
|
1679
1678
|
},
|
|
1680
1679
|
body: JSON.stringify(n)
|
|
1681
1680
|
}
|
|
1682
1681
|
);
|
|
1683
1682
|
if (r.status !== 200)
|
|
1684
|
-
return { status:
|
|
1685
|
-
const { data: a
|
|
1683
|
+
return { status: C, data: [] };
|
|
1684
|
+
const { data: a } = await r.json();
|
|
1686
1685
|
return {
|
|
1687
|
-
status:
|
|
1688
|
-
data: a
|
|
1689
|
-
errors: s
|
|
1686
|
+
status: fe,
|
|
1687
|
+
data: a || []
|
|
1690
1688
|
};
|
|
1691
1689
|
} catch (r) {
|
|
1692
|
-
return console.error(r), { status:
|
|
1690
|
+
return console.error(r), { status: C, data: [] };
|
|
1693
1691
|
}
|
|
1694
|
-
},
|
|
1692
|
+
}, mr = process.env.NODE_ENV === "production", yt = !mr, gt = {
|
|
1695
1693
|
isLoading: !0,
|
|
1696
1694
|
isAuthenticated: !1,
|
|
1697
1695
|
authenticationType: null,
|
|
1698
1696
|
user: void 0,
|
|
1699
1697
|
logoutReason: "",
|
|
1700
1698
|
debug: !1
|
|
1701
|
-
},
|
|
1699
|
+
}, wr = (e) => {
|
|
1702
1700
|
try {
|
|
1703
|
-
const t =
|
|
1704
|
-
return t ? t[
|
|
1701
|
+
const t = Cn(e);
|
|
1702
|
+
return t ? t[T.USER_ID_KEY] : "";
|
|
1705
1703
|
} catch {
|
|
1706
1704
|
return "";
|
|
1707
1705
|
}
|
|
1708
|
-
},
|
|
1706
|
+
}, Er = async ({
|
|
1709
1707
|
userId: e,
|
|
1710
1708
|
idToken: t,
|
|
1711
1709
|
accessToken: n,
|
|
@@ -1715,8 +1713,8 @@ const pr = async (e) => {
|
|
|
1715
1713
|
}) => {
|
|
1716
1714
|
try {
|
|
1717
1715
|
return {
|
|
1718
|
-
status: (await
|
|
1719
|
-
type:
|
|
1716
|
+
status: (await ye({
|
|
1717
|
+
type: he.LOGOUT,
|
|
1720
1718
|
clientId: a,
|
|
1721
1719
|
params: {
|
|
1722
1720
|
userId: e,
|
|
@@ -1725,14 +1723,14 @@ const pr = async (e) => {
|
|
|
1725
1723
|
refreshToken: r,
|
|
1726
1724
|
domain: s
|
|
1727
1725
|
}
|
|
1728
|
-
}))?.status
|
|
1726
|
+
}))?.status || C
|
|
1729
1727
|
};
|
|
1730
1728
|
} catch {
|
|
1731
1729
|
return {
|
|
1732
|
-
status:
|
|
1730
|
+
status: C
|
|
1733
1731
|
};
|
|
1734
1732
|
}
|
|
1735
|
-
},
|
|
1733
|
+
}, Ve = async ({
|
|
1736
1734
|
username: e,
|
|
1737
1735
|
password: t,
|
|
1738
1736
|
clientId: n,
|
|
@@ -1742,14 +1740,14 @@ const pr = async (e) => {
|
|
|
1742
1740
|
code: o,
|
|
1743
1741
|
code_verifier: i,
|
|
1744
1742
|
domain: c,
|
|
1745
|
-
fingerprint:
|
|
1743
|
+
fingerprint: y
|
|
1746
1744
|
}) => {
|
|
1747
1745
|
try {
|
|
1748
|
-
const l = await
|
|
1749
|
-
type:
|
|
1746
|
+
const l = await ye({
|
|
1747
|
+
type: he.AUTHENTICATE,
|
|
1750
1748
|
clientId: n,
|
|
1751
1749
|
params: {
|
|
1752
|
-
type: a ||
|
|
1750
|
+
type: a || G.ID_AND_ACCESS_TOKEN,
|
|
1753
1751
|
username: e,
|
|
1754
1752
|
password: t,
|
|
1755
1753
|
sessionExpiration: s,
|
|
@@ -1757,14 +1755,14 @@ const pr = async (e) => {
|
|
|
1757
1755
|
code: o,
|
|
1758
1756
|
code_verifier: i,
|
|
1759
1757
|
domain: c,
|
|
1760
|
-
fingerprint:
|
|
1758
|
+
fingerprint: y
|
|
1761
1759
|
}
|
|
1762
|
-
}), h = await
|
|
1763
|
-
return h && h.payload[
|
|
1760
|
+
}), h = await J(l?.data?.idToken);
|
|
1761
|
+
return h && h.payload[T.USER_ID_KEY] !== "" && h.payload[T.NONCE_KEY] === r ? {
|
|
1764
1762
|
idToken: l.data.idToken,
|
|
1765
1763
|
accessToken: l.data.accessToken,
|
|
1766
1764
|
refreshToken: l.data.refreshToken,
|
|
1767
|
-
userId: h.payload[
|
|
1765
|
+
userId: h.payload[T.USER_ID_KEY],
|
|
1768
1766
|
status: !0
|
|
1769
1767
|
} : {
|
|
1770
1768
|
status: !1
|
|
@@ -1774,33 +1772,35 @@ const pr = async (e) => {
|
|
|
1774
1772
|
status: !1
|
|
1775
1773
|
};
|
|
1776
1774
|
}
|
|
1777
|
-
},
|
|
1775
|
+
}, Sr = async ({
|
|
1778
1776
|
nonce: e,
|
|
1779
1777
|
clientId: t,
|
|
1780
1778
|
code_challenge: n
|
|
1781
1779
|
}) => {
|
|
1782
1780
|
try {
|
|
1783
|
-
const r = await
|
|
1784
|
-
type:
|
|
1781
|
+
const r = await ye({
|
|
1782
|
+
type: he.CODE,
|
|
1785
1783
|
clientId: t,
|
|
1786
1784
|
params: {
|
|
1787
|
-
type:
|
|
1785
|
+
type: G.CODE,
|
|
1788
1786
|
nonce: e,
|
|
1789
1787
|
code_challenge: n
|
|
1790
1788
|
}
|
|
1791
1789
|
});
|
|
1792
1790
|
return r?.data?.code ? {
|
|
1793
|
-
status:
|
|
1794
|
-
|
|
1791
|
+
status: fe,
|
|
1792
|
+
data: r.data.code
|
|
1795
1793
|
} : {
|
|
1796
|
-
status:
|
|
1794
|
+
status: C,
|
|
1795
|
+
data: ""
|
|
1797
1796
|
};
|
|
1798
1797
|
} catch {
|
|
1799
1798
|
return {
|
|
1800
|
-
status:
|
|
1799
|
+
status: C,
|
|
1800
|
+
data: ""
|
|
1801
1801
|
};
|
|
1802
1802
|
}
|
|
1803
|
-
},
|
|
1803
|
+
}, Ar = async ({
|
|
1804
1804
|
clientId: e,
|
|
1805
1805
|
userId: t,
|
|
1806
1806
|
nonce: n,
|
|
@@ -1809,23 +1809,23 @@ const pr = async (e) => {
|
|
|
1809
1809
|
domain: s
|
|
1810
1810
|
}) => {
|
|
1811
1811
|
try {
|
|
1812
|
-
const o = await
|
|
1813
|
-
type:
|
|
1812
|
+
const o = await ye({
|
|
1813
|
+
type: he.AUTHENTICATE,
|
|
1814
1814
|
clientId: e,
|
|
1815
1815
|
params: {
|
|
1816
|
-
type:
|
|
1816
|
+
type: G.REFRESH_TOKEN,
|
|
1817
1817
|
userId: t,
|
|
1818
1818
|
nonce: n,
|
|
1819
1819
|
refreshToken: r,
|
|
1820
1820
|
accessToken: a,
|
|
1821
1821
|
domain: s,
|
|
1822
|
-
fingerprint: await
|
|
1822
|
+
fingerprint: await mt()
|
|
1823
1823
|
}
|
|
1824
|
-
}), i = await
|
|
1825
|
-
return i && i.payload[
|
|
1824
|
+
}), i = await J(o?.data?.accessToken);
|
|
1825
|
+
return i && i.payload[T.USER_ID_KEY] !== "" && i.payload[T.NONCE_KEY] === n ? {
|
|
1826
1826
|
accessToken: o.data.accessToken,
|
|
1827
1827
|
refreshToken: o.data.refreshToken,
|
|
1828
|
-
userId: i.payload[
|
|
1828
|
+
userId: i.payload[T.USER_ID_KEY],
|
|
1829
1829
|
status: !0
|
|
1830
1830
|
} : {
|
|
1831
1831
|
status: !1
|
|
@@ -1835,18 +1835,18 @@ const pr = async (e) => {
|
|
|
1835
1835
|
status: !1
|
|
1836
1836
|
};
|
|
1837
1837
|
}
|
|
1838
|
-
},
|
|
1838
|
+
}, mt = 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
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1847
|
+
X(this, "refreshTokenPromise", null);
|
|
1848
|
+
X(this, "accessToken");
|
|
1849
|
+
X(this, "refreshToken");
|
|
1850
1850
|
this.accessToken = t || "", this.refreshToken = n || "";
|
|
1851
1851
|
}
|
|
1852
1852
|
async refreshtoken({
|
|
@@ -1873,9 +1873,9 @@ class Ar {
|
|
|
1873
1873
|
nonce: r,
|
|
1874
1874
|
domain: a
|
|
1875
1875
|
}) {
|
|
1876
|
-
const s = await
|
|
1877
|
-
if (s && s.payload[
|
|
1878
|
-
const o = await
|
|
1876
|
+
const s = await J(this.refreshToken);
|
|
1877
|
+
if (s && s.payload[T.USER_ID_KEY] !== "") {
|
|
1878
|
+
const o = await Ar({
|
|
1879
1879
|
clientId: t,
|
|
1880
1880
|
userId: n,
|
|
1881
1881
|
nonce: r,
|
|
@@ -1884,261 +1884,266 @@ 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: fe,
|
|
1888
1888
|
newAccessToken: o.accessToken,
|
|
1889
1889
|
newRefreshToken: o.refreshToken
|
|
1890
1890
|
}) : {
|
|
1891
|
-
status:
|
|
1891
|
+
status: C
|
|
1892
1892
|
};
|
|
1893
1893
|
} else
|
|
1894
1894
|
return {
|
|
1895
|
-
status:
|
|
1895
|
+
status: C
|
|
1896
1896
|
};
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
|
-
const
|
|
1899
|
+
const Rr = (e) => U(
|
|
1900
1900
|
(...t) => {
|
|
1901
1901
|
e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
|
|
1902
1902
|
},
|
|
1903
1903
|
[e]
|
|
1904
|
-
),
|
|
1905
|
-
throw new Error(
|
|
1906
|
-
},
|
|
1904
|
+
), M = () => {
|
|
1905
|
+
throw new Error(Vn);
|
|
1906
|
+
}, wt = Dt({
|
|
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: M,
|
|
1911
|
+
logout: M,
|
|
1912
|
+
getAccessToken: M,
|
|
1913
|
+
getIdToken: M,
|
|
1914
|
+
registeringForPasskey: M,
|
|
1915
|
+
loginWithPasskey: M,
|
|
1916
1916
|
logoutReason: ""
|
|
1917
|
-
}),
|
|
1918
|
-
state:
|
|
1917
|
+
}), br = Ot.createContext({
|
|
1918
|
+
state: gt,
|
|
1919
1919
|
dispatch: () => {
|
|
1920
1920
|
}
|
|
1921
|
-
}),
|
|
1921
|
+
}), Ir = (e, t) => t?.type === j ? {
|
|
1922
1922
|
...e,
|
|
1923
1923
|
isLoading: t.payload.isLoading
|
|
1924
|
-
} : t?.type ===
|
|
1924
|
+
} : t?.type === F ? {
|
|
1925
1925
|
...e,
|
|
1926
1926
|
isLoading: !1,
|
|
1927
1927
|
isAuthenticated: !0,
|
|
1928
1928
|
user: t.payload.user,
|
|
1929
1929
|
authenticationType: t.payload.authenticationType,
|
|
1930
1930
|
logoutReason: ""
|
|
1931
|
-
} : t?.type ===
|
|
1931
|
+
} : t?.type === it ? {
|
|
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] = Ut(Ir, {
|
|
1946
|
+
...gt,
|
|
1947
1947
|
debug: a
|
|
1948
|
-
}), i =
|
|
1949
|
-
key: `${
|
|
1950
|
-
}), [
|
|
1951
|
-
key: `${
|
|
1952
|
-
}), [
|
|
1948
|
+
}), i = Rr(a), c = Oe(!1), y = Oe(""), [l, h, , g] = ne({
|
|
1949
|
+
key: `${oe}::${n}::@@user@@`
|
|
1950
|
+
}), [f, u, , m] = ne({
|
|
1951
|
+
key: `${oe}::${n}::@@access@@`
|
|
1952
|
+
}), [R, z, , _e] = ne(
|
|
1953
1953
|
{
|
|
1954
|
-
key: `${
|
|
1954
|
+
key: `${oe}::${n}::@@refresh@@`
|
|
1955
1955
|
}
|
|
1956
|
-
), [
|
|
1957
|
-
key: `${
|
|
1958
|
-
}),
|
|
1956
|
+
), [Et, ve, , Ce] = ne({
|
|
1957
|
+
key: `${oe}::${n}::@@nonce@@`
|
|
1958
|
+
}), St = new Tr(f, R), Q = U(() => {
|
|
1959
|
+
i("removeLocalStorage: removing local storage"), g(), m(), _e(), Ce();
|
|
1960
|
+
}, [
|
|
1961
|
+
m,
|
|
1962
|
+
g,
|
|
1963
|
+
Ce,
|
|
1964
|
+
_e,
|
|
1965
|
+
i
|
|
1966
|
+
]), K = U(
|
|
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: it,
|
|
1965
1973
|
payload: {
|
|
1966
|
-
logoutReason: d ||
|
|
1974
|
+
logoutReason: d || H
|
|
1967
1975
|
}
|
|
1968
|
-
}),
|
|
1976
|
+
}), Q(), o({ type: j, payload: { isLoading: !1 } });
|
|
1969
1977
|
},
|
|
1970
|
-
[
|
|
1971
|
-
),
|
|
1978
|
+
[Q, i]
|
|
1979
|
+
), D = U(
|
|
1972
1980
|
async (d) => {
|
|
1973
1981
|
i("invalidateAndLogout: invalidating and logging out");
|
|
1974
|
-
const { user:
|
|
1975
|
-
|
|
1982
|
+
const { user: w } = s, p = w?.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:
|
|
1981
|
-
refreshToken:
|
|
1988
|
+
accessToken: f,
|
|
1989
|
+
refreshToken: R,
|
|
1982
1990
|
clientId: n,
|
|
1983
1991
|
domain: r
|
|
1984
|
-
}),
|
|
1992
|
+
}), K(d || H);
|
|
1985
1993
|
},
|
|
1986
1994
|
[
|
|
1987
|
-
|
|
1995
|
+
f,
|
|
1988
1996
|
s,
|
|
1989
1997
|
n,
|
|
1990
1998
|
r,
|
|
1991
1999
|
l,
|
|
1992
|
-
|
|
1993
|
-
|
|
2000
|
+
R,
|
|
2001
|
+
K,
|
|
1994
2002
|
i
|
|
1995
2003
|
]
|
|
1996
2004
|
);
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
}), []),
|
|
2005
|
+
Re(() => ((async () => y.current = await mt())(), () => {
|
|
2006
|
+
y.current = "";
|
|
2007
|
+
}), []), Re(() => {
|
|
2000
2008
|
if (!c.current)
|
|
2001
2009
|
return s.isLoading && l !== null ? (async () => {
|
|
2002
2010
|
try {
|
|
2003
|
-
const d = await
|
|
2004
|
-
d && d.payload[
|
|
2005
|
-
type:
|
|
2011
|
+
const d = await J(l);
|
|
2012
|
+
d && d.payload[T.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), o({
|
|
2013
|
+
type: F,
|
|
2006
2014
|
payload: {
|
|
2007
|
-
authenticationType: d.payload[
|
|
2015
|
+
authenticationType: d.payload[T.AUTH_TYPE_KEY],
|
|
2008
2016
|
user: {
|
|
2009
|
-
userId: d.payload[
|
|
2010
|
-
username: d.payload[
|
|
2017
|
+
userId: d.payload[T.USER_ID_KEY],
|
|
2018
|
+
username: d.payload[T.USERNAME_KEY]
|
|
2011
2019
|
}
|
|
2012
2020
|
}
|
|
2013
|
-
})) : (i("useEffect: invalid JWT, invalidating and logging out"), await
|
|
2021
|
+
})) : (i("useEffect: invalid JWT, invalidating and logging out"), await D(H));
|
|
2014
2022
|
} catch {
|
|
2015
2023
|
i(
|
|
2016
2024
|
"useEffect: exception validating JWT, invalidating and logging out"
|
|
2017
|
-
), await
|
|
2025
|
+
), await D(H);
|
|
2018
2026
|
}
|
|
2019
|
-
})() : (i("useEffect: setting the loading state to false"), o({ type:
|
|
2027
|
+
})() : (i("useEffect: setting the loading state to false"), o({ type: j, payload: { isLoading: !1 } })), () => {
|
|
2020
2028
|
c.current = !0;
|
|
2021
2029
|
};
|
|
2022
|
-
}, [s.isLoading, l,
|
|
2023
|
-
const
|
|
2024
|
-
const I =
|
|
2025
|
-
if (
|
|
2026
|
-
const { code_verifier:
|
|
2030
|
+
}, [s.isLoading, l, D, i]);
|
|
2031
|
+
const At = async (d, w, p = G.CODE) => {
|
|
2032
|
+
const I = Te();
|
|
2033
|
+
if (ve(I), o({ type: j, payload: { isLoading: !0 } }), Q(), i("login: Logging in with type: ", p), p === G.CODE) {
|
|
2034
|
+
const { code_verifier: vt, code_challenge: Ct } = await Kn(), Pe = await Sr({
|
|
2027
2035
|
nonce: I,
|
|
2028
2036
|
clientId: n,
|
|
2029
|
-
code_challenge:
|
|
2037
|
+
code_challenge: Ct
|
|
2030
2038
|
});
|
|
2031
|
-
if (
|
|
2032
|
-
const
|
|
2039
|
+
if (Pe.status) {
|
|
2040
|
+
const V = await Ve({
|
|
2033
2041
|
username: d,
|
|
2034
|
-
password:
|
|
2042
|
+
password: w,
|
|
2035
2043
|
clientId: n,
|
|
2036
2044
|
sessionExpiration: t,
|
|
2037
2045
|
nonce: I,
|
|
2038
|
-
type:
|
|
2039
|
-
code:
|
|
2040
|
-
code_verifier:
|
|
2046
|
+
type: p,
|
|
2047
|
+
code: Pe.data,
|
|
2048
|
+
code_verifier: vt,
|
|
2041
2049
|
domain: r,
|
|
2042
|
-
fingerprint:
|
|
2050
|
+
fingerprint: y.current
|
|
2043
2051
|
});
|
|
2044
|
-
return
|
|
2045
|
-
type:
|
|
2052
|
+
return V.status ? (h(V.idToken), u(V.accessToken), z(V.refreshToken), o({
|
|
2053
|
+
type: F,
|
|
2046
2054
|
payload: {
|
|
2047
|
-
authenticationType:
|
|
2055
|
+
authenticationType: p,
|
|
2048
2056
|
user: {
|
|
2049
|
-
userId:
|
|
2057
|
+
userId: V.userId,
|
|
2050
2058
|
username: d
|
|
2051
2059
|
}
|
|
2052
2060
|
}
|
|
2053
|
-
}), !0) : (
|
|
2061
|
+
}), !0) : (K(ae), !1);
|
|
2054
2062
|
}
|
|
2055
2063
|
return !1;
|
|
2056
2064
|
}
|
|
2057
|
-
const
|
|
2065
|
+
const Y = await Ve({
|
|
2058
2066
|
username: d,
|
|
2059
|
-
password:
|
|
2067
|
+
password: w,
|
|
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
|
-
return
|
|
2068
|
-
type:
|
|
2075
|
+
return Y.status ? (h(Y.idToken), u(Y.accessToken), z(Y.refreshToken), o({
|
|
2076
|
+
type: F,
|
|
2069
2077
|
payload: {
|
|
2070
|
-
authenticationType:
|
|
2078
|
+
authenticationType: p,
|
|
2071
2079
|
user: {
|
|
2072
|
-
userId:
|
|
2080
|
+
userId: Y.userId,
|
|
2073
2081
|
username: d
|
|
2074
2082
|
}
|
|
2075
2083
|
}
|
|
2076
|
-
}), !0) : (
|
|
2077
|
-
},
|
|
2078
|
-
d?.preventDefault(), await
|
|
2079
|
-
},
|
|
2080
|
-
const { isAuthenticated: d, user:
|
|
2084
|
+
}), !0) : (K(ae), !1);
|
|
2085
|
+
}, Tt = async (d) => {
|
|
2086
|
+
d?.preventDefault(), await D(Jn);
|
|
2087
|
+
}, Rt = async () => {
|
|
2088
|
+
const { isAuthenticated: d, user: w } = s;
|
|
2081
2089
|
try {
|
|
2082
|
-
if (d &&
|
|
2083
|
-
if (
|
|
2090
|
+
if (d && w && w.userId) {
|
|
2091
|
+
if (f) {
|
|
2084
2092
|
i("getAccessToken");
|
|
2085
|
-
const I = await
|
|
2086
|
-
if (I && I.payload[
|
|
2087
|
-
return
|
|
2093
|
+
const I = await J(f);
|
|
2094
|
+
if (I && I.payload[T.USER_ID_KEY] !== "")
|
|
2095
|
+
return f;
|
|
2088
2096
|
}
|
|
2089
2097
|
i("getAccessToken: invalid access token, trying to refresh it");
|
|
2090
|
-
const
|
|
2098
|
+
const p = await St.refreshtoken({
|
|
2091
2099
|
clientId: n,
|
|
2092
|
-
userId:
|
|
2093
|
-
nonce:
|
|
2100
|
+
userId: w.userId,
|
|
2101
|
+
nonce: Et,
|
|
2094
2102
|
domain: r
|
|
2095
2103
|
});
|
|
2096
|
-
return
|
|
2104
|
+
return p.status && p.status === "success" && p.newAccessToken ? (u(p.newAccessToken), z(p.newRefreshToken), p.newAccessToken) : (i(
|
|
2097
2105
|
"getAccessToken: invalid refresh token, need to re-authenticate"
|
|
2098
|
-
), await
|
|
2106
|
+
), await D(H), "");
|
|
2099
2107
|
}
|
|
2100
2108
|
return i(
|
|
2101
2109
|
"getAccessToken: user is not authenticated, cannot get access token"
|
|
2102
|
-
), await
|
|
2110
|
+
), await D(H), "";
|
|
2103
2111
|
} catch {
|
|
2104
2112
|
return i(
|
|
2105
2113
|
"getAccessToken: exception occurred, invalidating and logging out"
|
|
2106
|
-
), await
|
|
2114
|
+
), await D(Yn), "";
|
|
2107
2115
|
}
|
|
2108
|
-
},
|
|
2109
|
-
if (s.isAuthenticated && l)
|
|
2110
|
-
return l;
|
|
2111
|
-
}, Rt = async () => {
|
|
2116
|
+
}, bt = () => s.isAuthenticated && l ? l : "", It = async () => {
|
|
2112
2117
|
const { user: d } = s;
|
|
2113
|
-
let
|
|
2114
|
-
accessToken:
|
|
2118
|
+
let w = await x({
|
|
2119
|
+
accessToken: f,
|
|
2115
2120
|
clientId: n,
|
|
2116
|
-
type:
|
|
2121
|
+
type: W.GET_REGISTRATION_OPTIONS,
|
|
2117
2122
|
params: {
|
|
2118
2123
|
clientId: n,
|
|
2119
2124
|
id: d?.userId,
|
|
2120
2125
|
username: d?.username
|
|
2121
2126
|
}
|
|
2122
2127
|
});
|
|
2123
|
-
if (
|
|
2128
|
+
if (w.status)
|
|
2124
2129
|
try {
|
|
2125
|
-
const
|
|
2126
|
-
|
|
2127
|
-
accessToken:
|
|
2130
|
+
const p = await Wt(w.data);
|
|
2131
|
+
return w = await x({
|
|
2132
|
+
accessToken: f,
|
|
2128
2133
|
clientId: n,
|
|
2129
|
-
type:
|
|
2134
|
+
type: W.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
|
+
}), !!(w.status && w.data.length > 0);
|
|
2137
2142
|
} catch {
|
|
2138
|
-
return await
|
|
2139
|
-
accessToken:
|
|
2143
|
+
return await x({
|
|
2144
|
+
accessToken: f,
|
|
2140
2145
|
clientId: n,
|
|
2141
|
-
type:
|
|
2146
|
+
type: W.VERIFY_REGISTRATION,
|
|
2142
2147
|
params: {
|
|
2143
2148
|
clientId: n,
|
|
2144
2149
|
id: d?.userId,
|
|
@@ -2147,78 +2152,80 @@ const Tr = (e) => x(
|
|
|
2147
2152
|
}
|
|
2148
2153
|
}), !1;
|
|
2149
2154
|
}
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2155
|
+
return !1;
|
|
2156
|
+
}, _t = async () => {
|
|
2157
|
+
const d = Te();
|
|
2158
|
+
ve(d), o({ type: j, payload: { isLoading: !0 } }), Q(), i("loginWithPasskey");
|
|
2159
|
+
const w = Te();
|
|
2160
|
+
let p = await x({
|
|
2161
|
+
accessToken: f,
|
|
2156
2162
|
clientId: n,
|
|
2157
|
-
type:
|
|
2163
|
+
type: W.GET_AUTHENTICATION_OPTIONS,
|
|
2158
2164
|
params: {
|
|
2159
|
-
id:
|
|
2165
|
+
id: w,
|
|
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 Gt(p.data);
|
|
2172
|
+
return p = await x({
|
|
2173
|
+
accessToken: f,
|
|
2168
2174
|
clientId: n,
|
|
2169
|
-
type:
|
|
2175
|
+
type: W.VERIFY_AUTHENTICATION,
|
|
2170
2176
|
params: {
|
|
2171
2177
|
clientId: n,
|
|
2172
|
-
id:
|
|
2178
|
+
id: w,
|
|
2173
2179
|
authentication: I,
|
|
2174
2180
|
nonce: d,
|
|
2175
2181
|
domain: r,
|
|
2176
|
-
fingerprint:
|
|
2182
|
+
fingerprint: y.current
|
|
2177
2183
|
}
|
|
2178
|
-
}),
|
|
2179
|
-
type:
|
|
2184
|
+
}), p.data.status === "success" ? (h(p.data.idToken), u(p.data.accessToken), z(p.data.refreshToken), o({
|
|
2185
|
+
type: F,
|
|
2180
2186
|
payload: {
|
|
2181
|
-
authenticationType:
|
|
2187
|
+
authenticationType: G.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) : (K(ae), !1);
|
|
2188
2194
|
} catch {
|
|
2189
|
-
return await
|
|
2190
|
-
accessToken:
|
|
2195
|
+
return await x({
|
|
2196
|
+
accessToken: f,
|
|
2191
2197
|
clientId: n,
|
|
2192
|
-
type:
|
|
2198
|
+
type: W.VERIFY_AUTHENTICATION,
|
|
2193
2199
|
params: {
|
|
2194
2200
|
clientId: n,
|
|
2195
|
-
id:
|
|
2201
|
+
id: w,
|
|
2196
2202
|
authentication: {},
|
|
2197
2203
|
nonce: d,
|
|
2198
2204
|
domain: r
|
|
2199
2205
|
}
|
|
2200
|
-
}),
|
|
2206
|
+
}), K(ae), !1;
|
|
2201
2207
|
}
|
|
2208
|
+
return !1;
|
|
2202
2209
|
};
|
|
2203
|
-
return /* @__PURE__ */
|
|
2204
|
-
|
|
2210
|
+
return /* @__PURE__ */ ke(br.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ke(
|
|
2211
|
+
wt.Provider,
|
|
2205
2212
|
{
|
|
2206
2213
|
value: {
|
|
2207
2214
|
...s,
|
|
2208
|
-
login:
|
|
2209
|
-
logout:
|
|
2210
|
-
getAccessToken:
|
|
2211
|
-
getIdToken:
|
|
2212
|
-
registeringForPasskey:
|
|
2213
|
-
loginWithPasskey:
|
|
2215
|
+
login: At,
|
|
2216
|
+
logout: Tt,
|
|
2217
|
+
getAccessToken: Rt,
|
|
2218
|
+
getIdToken: bt,
|
|
2219
|
+
registeringForPasskey: It,
|
|
2220
|
+
loginWithPasskey: _t
|
|
2214
2221
|
},
|
|
2215
2222
|
children: e
|
|
2216
2223
|
}
|
|
2217
2224
|
) });
|
|
2218
|
-
},
|
|
2225
|
+
}, Kr = (e = wt) => $t(e);
|
|
2219
2226
|
export {
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2227
|
+
G as AUTH_TYPES,
|
|
2228
|
+
$r as AuthProvider,
|
|
2229
|
+
Ur as isGranted,
|
|
2230
|
+
Kr as useAuth
|
|
2224
2231
|
};
|