@versini/auth-provider 7.1.2 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- var Et = Object.defineProperty;
2
- var mt = (e, t, r) => t in e ? Et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var j = (e, t, r) => mt(e, typeof t != "symbol" ? t + "" : t, r);
1
+ var gt = Object.defineProperty;
2
+ var Et = (e, t, r) => t in e ? gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var F = (e, t, r) => Et(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { jsx as be } from "react/jsx-runtime";
5
- import wt, { useSyncExternalStore as St, useCallback as N, useEffect as He, createContext as At, useReducer as Tt, useRef as Rt, useContext as _t } from "react";
5
+ import mt, { useSyncExternalStore as wt, useCallback as N, useEffect as He, createContext as St, useReducer as At, useRef as Tt, useContext as Rt } from "react";
6
6
  /*!
7
- @versini/auth-provider v7.1.2
7
+ @versini/auth-provider v7.2.0
8
8
  © 2024 gizmette.com
9
9
  */
10
10
  try {
11
11
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
12
- version: "7.1.2",
13
- buildTime: "08/26/2024 06:52 PM EDT",
12
+ version: "7.2.0",
13
+ buildTime: "09/01/2024 02:27 PM EDT",
14
14
  homepage: "https://github.com/aversini/auth-client",
15
15
  license: "MIT"
16
16
  });
@@ -23,7 +23,7 @@ function _(e) {
23
23
  r += String.fromCharCode(a);
24
24
  return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
25
25
  }
26
- function re(e) {
26
+ function ne(e) {
27
27
  const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - t.length % 4) % 4, n = t.padEnd(t.length + r, "="), a = atob(n), o = new ArrayBuffer(a.length), s = new Uint8Array(o);
28
28
  for (let i = 0; i < a.length; i++)
29
29
  s[i] = a.charCodeAt(i);
@@ -36,88 +36,88 @@ function We(e) {
36
36
  const { id: t } = e;
37
37
  return {
38
38
  ...e,
39
- id: re(t),
39
+ id: ne(t),
40
40
  transports: e.transports
41
41
  };
42
42
  }
43
- function xe(e) {
43
+ function Ye(e) {
44
44
  return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
45
45
  }
46
- class w extends Error {
46
+ class S extends Error {
47
47
  constructor({ message: t, code: r, cause: n, name: a }) {
48
48
  super(t, { cause: n }), this.name = a ?? n.name, this.code = r;
49
49
  }
50
50
  }
51
- function It({ error: e, options: t }) {
51
+ function _t({ error: e, options: t }) {
52
52
  const { publicKey: r } = t;
53
53
  if (!r)
54
54
  throw Error("options was missing required publicKey property");
55
55
  if (e.name === "AbortError") {
56
56
  if (t.signal instanceof AbortSignal)
57
- return new w({
57
+ return new S({
58
58
  message: "Registration ceremony was sent an abort signal",
59
59
  code: "ERROR_CEREMONY_ABORTED",
60
60
  cause: e
61
61
  });
62
62
  } else if (e.name === "ConstraintError") {
63
63
  if (r.authenticatorSelection?.requireResidentKey === !0)
64
- return new w({
64
+ return new S({
65
65
  message: "Discoverable credentials were required but no available authenticator supported it",
66
66
  code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
67
67
  cause: e
68
68
  });
69
69
  if (r.authenticatorSelection?.userVerification === "required")
70
- return new w({
70
+ return new S({
71
71
  message: "User verification was required but no available authenticator supported it",
72
72
  code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
73
73
  cause: e
74
74
  });
75
75
  } else {
76
76
  if (e.name === "InvalidStateError")
77
- return new w({
77
+ return new S({
78
78
  message: "The authenticator was previously registered",
79
79
  code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
80
80
  cause: e
81
81
  });
82
82
  if (e.name === "NotAllowedError")
83
- return new w({
83
+ return new S({
84
84
  message: e.message,
85
85
  code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
86
86
  cause: e
87
87
  });
88
88
  if (e.name === "NotSupportedError")
89
- return r.pubKeyCredParams.filter((a) => a.type === "public-key").length === 0 ? new w({
89
+ return r.pubKeyCredParams.filter((a) => a.type === "public-key").length === 0 ? new S({
90
90
  message: 'No entry in pubKeyCredParams was of type "public-key"',
91
91
  code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
92
92
  cause: e
93
- }) : new w({
93
+ }) : new S({
94
94
  message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
95
95
  code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
96
96
  cause: e
97
97
  });
98
98
  if (e.name === "SecurityError") {
99
99
  const n = window.location.hostname;
100
- if (xe(n)) {
100
+ if (Ye(n)) {
101
101
  if (r.rp.id !== n)
102
- return new w({
102
+ return new S({
103
103
  message: `The RP ID "${r.rp.id}" is invalid for this domain`,
104
104
  code: "ERROR_INVALID_RP_ID",
105
105
  cause: e
106
106
  });
107
- } else return new w({
107
+ } else return new S({
108
108
  message: `${window.location.hostname} is an invalid domain`,
109
109
  code: "ERROR_INVALID_DOMAIN",
110
110
  cause: e
111
111
  });
112
112
  } else if (e.name === "TypeError") {
113
113
  if (r.user.id.byteLength < 1 || r.user.id.byteLength > 64)
114
- return new w({
114
+ return new S({
115
115
  message: "User ID was not between 1 and 64 characters",
116
116
  code: "ERROR_INVALID_USER_ID_LENGTH",
117
117
  cause: e
118
118
  });
119
119
  } else if (e.name === "UnknownError")
120
- return new w({
120
+ return new S({
121
121
  message: "The authenticator was unable to process the specified options, or could not create a new credential",
122
122
  code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
123
123
  cause: e
@@ -125,7 +125,7 @@ function It({ error: e, options: t }) {
125
125
  }
126
126
  return e;
127
127
  }
128
- class bt {
128
+ class It {
129
129
  createNewAbortSignal() {
130
130
  if (this.controller) {
131
131
  const r = new Error("Cancelling existing WebAuthn API call for new one");
@@ -141,29 +141,29 @@ class bt {
141
141
  }
142
142
  }
143
143
  }
144
- const Je = new bt(), vt = ["cross-platform", "platform"];
145
- function Ye(e) {
146
- if (e && !(vt.indexOf(e) < 0))
144
+ const xe = new It(), bt = ["cross-platform", "platform"];
145
+ function Je(e) {
146
+ if (e && !(bt.indexOf(e) < 0))
147
147
  return e;
148
148
  }
149
- async function Ot(e) {
149
+ async function vt(e) {
150
150
  if (!Se())
151
151
  throw new Error("WebAuthn is not supported in this browser");
152
152
  const r = { publicKey: {
153
153
  ...e,
154
- challenge: re(e.challenge),
154
+ challenge: ne(e.challenge),
155
155
  user: {
156
156
  ...e.user,
157
- id: re(e.user.id)
157
+ id: ne(e.user.id)
158
158
  },
159
159
  excludeCredentials: e.excludeCredentials?.map(We)
160
160
  } };
161
- r.signal = Je.createNewAbortSignal();
161
+ r.signal = xe.createNewAbortSignal();
162
162
  let n;
163
163
  try {
164
164
  n = await navigator.credentials.create(r);
165
- } catch (u) {
166
- throw It({ error: u, options: r });
165
+ } catch (l) {
166
+ throw _t({ error: l, options: r });
167
167
  }
168
168
  if (!n)
169
169
  throw new Error("Registration was not completed");
@@ -174,23 +174,23 @@ async function Ot(e) {
174
174
  if (typeof s.getPublicKeyAlgorithm == "function")
175
175
  try {
176
176
  h = s.getPublicKeyAlgorithm();
177
- } catch (u) {
178
- he("getPublicKeyAlgorithm()", u);
177
+ } catch (l) {
178
+ he("getPublicKeyAlgorithm()", l);
179
179
  }
180
180
  let f;
181
181
  if (typeof s.getPublicKey == "function")
182
182
  try {
183
- const u = s.getPublicKey();
184
- u !== null && (f = _(u));
185
- } catch (u) {
186
- he("getPublicKey()", u);
183
+ const l = s.getPublicKey();
184
+ l !== null && (f = _(l));
185
+ } catch (l) {
186
+ he("getPublicKey()", l);
187
187
  }
188
188
  let p;
189
189
  if (typeof s.getAuthenticatorData == "function")
190
190
  try {
191
191
  p = _(s.getAuthenticatorData());
192
- } catch (u) {
193
- he("getAuthenticatorData()", u);
192
+ } catch (l) {
193
+ he("getAuthenticatorData()", l);
194
194
  }
195
195
  return {
196
196
  id: a,
@@ -205,53 +205,53 @@ async function Ot(e) {
205
205
  },
206
206
  type: i,
207
207
  clientExtensionResults: n.getClientExtensionResults(),
208
- authenticatorAttachment: Ye(n.authenticatorAttachment)
208
+ authenticatorAttachment: Je(n.authenticatorAttachment)
209
209
  };
210
210
  }
211
211
  function he(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 kt() {
215
+ function Ot() {
216
216
  if (!Se())
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 Pt({ error: e, options: t }) {
221
+ function kt({ error: e, options: t }) {
222
222
  const { publicKey: r } = t;
223
223
  if (!r)
224
224
  throw Error("options was missing required publicKey property");
225
225
  if (e.name === "AbortError") {
226
226
  if (t.signal instanceof AbortSignal)
227
- return new w({
227
+ return new S({
228
228
  message: "Authentication ceremony was sent an abort signal",
229
229
  code: "ERROR_CEREMONY_ABORTED",
230
230
  cause: e
231
231
  });
232
232
  } else {
233
233
  if (e.name === "NotAllowedError")
234
- return new w({
234
+ return new S({
235
235
  message: e.message,
236
236
  code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
237
237
  cause: e
238
238
  });
239
239
  if (e.name === "SecurityError") {
240
240
  const n = window.location.hostname;
241
- if (xe(n)) {
241
+ if (Ye(n)) {
242
242
  if (r.rpId !== n)
243
- return new w({
243
+ return new S({
244
244
  message: `The RP ID "${r.rpId}" is invalid for this domain`,
245
245
  code: "ERROR_INVALID_RP_ID",
246
246
  cause: e
247
247
  });
248
- } else return new w({
248
+ } else return new S({
249
249
  message: `${window.location.hostname} is an invalid domain`,
250
250
  code: "ERROR_INVALID_DOMAIN",
251
251
  cause: e
252
252
  });
253
253
  } else if (e.name === "UnknownError")
254
- return new w({
254
+ return new S({
255
255
  message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
256
256
  code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
257
257
  cause: e
@@ -259,29 +259,29 @@ function Pt({ error: e, options: t }) {
259
259
  }
260
260
  return e;
261
261
  }
262
- async function Ct(e, t = !1) {
262
+ async function Pt(e, t = !1) {
263
263
  if (!Se())
264
264
  throw new Error("WebAuthn is not supported in this browser");
265
265
  let r;
266
266
  e.allowCredentials?.length !== 0 && (r = e.allowCredentials?.map(We));
267
267
  const n = {
268
268
  ...e,
269
- challenge: re(e.challenge),
269
+ challenge: ne(e.challenge),
270
270
  allowCredentials: r
271
271
  }, a = {};
272
272
  if (t) {
273
- if (!await kt())
273
+ if (!await Ot())
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", n.allowCredentials = [];
278
278
  }
279
- a.publicKey = n, a.signal = Je.createNewAbortSignal();
279
+ a.publicKey = n, a.signal = xe.createNewAbortSignal();
280
280
  let o;
281
281
  try {
282
282
  o = await navigator.credentials.get(a);
283
283
  } catch (p) {
284
- throw Pt({ error: p, options: a });
284
+ throw kt({ error: p, options: a });
285
285
  }
286
286
  if (!o)
287
287
  throw new Error("Authentication was not completed");
@@ -298,7 +298,7 @@ async function Ct(e, t = !1) {
298
298
  },
299
299
  type: h,
300
300
  clientExtensionResults: o.getClientExtensionResults(),
301
- authenticatorAttachment: Ye(o.authenticatorAttachment)
301
+ authenticatorAttachment: Je(o.authenticatorAttachment)
302
302
  };
303
303
  }
304
304
  /*!
@@ -308,13 +308,13 @@ async function Ct(e, t = !1) {
308
308
  try {
309
309
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
310
310
  version: "4.0.0",
311
- buildTime: "08/26/2024 06:51 PM EDT",
311
+ buildTime: "09/01/2024 02:27 PM EDT",
312
312
  homepage: "https://github.com/aversini/auth-client",
313
313
  license: "MIT"
314
314
  });
315
315
  } catch {
316
316
  }
317
- const oe = {
317
+ const H = {
318
318
  ID_TOKEN: "id_token",
319
319
  ACCESS_TOKEN: "token",
320
320
  ID_AND_ACCESS_TOKEN: "id_token token",
@@ -323,7 +323,7 @@ const oe = {
323
323
  PASSKEY: "passkey"
324
324
  }, Ge = {
325
325
  CLIENT_ID: "X-Auth-ClientId"
326
- }, S = {
326
+ }, w = {
327
327
  ALG: "RS256",
328
328
  USER_ID_KEY: "sub",
329
329
  TOKEN_ID_KEY: "__raw",
@@ -335,7 +335,7 @@ const oe = {
335
335
  SCOPES_KEY: "scopes",
336
336
  CLIENT_ID_KEY: "aud",
337
337
  ISSUER: "gizmette.com"
338
- }, Nt = `-----BEGIN PUBLIC KEY-----
338
+ }, Ct = `-----BEGIN PUBLIC KEY-----
339
339
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
340
340
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
341
341
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -348,24 +348,24 @@ awIDAQAB
348
348
  LOGOUT: "logout",
349
349
  LOGIN: "login",
350
350
  REFRESH: "refresh"
351
- }, ce = crypto, Me = (e) => e instanceof CryptoKey, F = new TextEncoder(), G = new TextDecoder();
352
- function Dt(...e) {
351
+ }, ce = crypto, Me = (e) => e instanceof CryptoKey, B = new TextEncoder(), M = new TextDecoder();
352
+ function Nt(...e) {
353
353
  const t = e.reduce((a, { length: o }) => a + o, 0), r = new Uint8Array(t);
354
354
  let n = 0;
355
355
  for (const a of e)
356
356
  r.set(a, n), n += a.length;
357
357
  return r;
358
358
  }
359
- const Ut = (e) => {
359
+ const Dt = (e) => {
360
360
  const t = atob(e), r = new Uint8Array(t.length);
361
361
  for (let n = 0; n < t.length; n++)
362
362
  r[n] = t.charCodeAt(n);
363
363
  return r;
364
- }, Y = (e) => {
364
+ }, G = (e) => {
365
365
  let t = e;
366
- t instanceof Uint8Array && (t = G.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
366
+ t instanceof Uint8Array && (t = M.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
367
367
  try {
368
- return Ut(t);
368
+ return Dt(t);
369
369
  } catch {
370
370
  throw new TypeError("The input to be decoded is not correctly encoded.");
371
371
  }
@@ -395,7 +395,7 @@ class ve extends D {
395
395
  super(t), this.code = "ERR_JWT_EXPIRED", this.claim = n, this.reason = a, this.payload = r;
396
396
  }
397
397
  }
398
- class Kt extends D {
398
+ class Ut extends D {
399
399
  constructor() {
400
400
  super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
401
401
  }
@@ -427,7 +427,7 @@ let v = class extends D {
427
427
  return "ERR_JWT_INVALID";
428
428
  }
429
429
  };
430
- class $t extends D {
430
+ class Kt extends D {
431
431
  constructor() {
432
432
  super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
433
433
  }
@@ -438,13 +438,13 @@ class $t extends D {
438
438
  function b(e, t = "algorithm.name") {
439
439
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
440
440
  }
441
- function B(e, t) {
441
+ function q(e, t) {
442
442
  return e.name === t;
443
443
  }
444
444
  function pe(e) {
445
445
  return parseInt(e.name.slice(4), 10);
446
446
  }
447
- function Lt(e) {
447
+ function $t(e) {
448
448
  switch (e) {
449
449
  case "ES256":
450
450
  return "P-256";
@@ -456,7 +456,7 @@ function Lt(e) {
456
456
  throw new Error("unreachable");
457
457
  }
458
458
  }
459
- function Ht(e, t) {
459
+ function Lt(e, t) {
460
460
  if (t.length && !t.some((r) => e.usages.includes(r))) {
461
461
  let r = "CryptoKey does not support this operation, its usages must include ";
462
462
  if (t.length > 2) {
@@ -466,12 +466,12 @@ function Ht(e, t) {
466
466
  throw new TypeError(r);
467
467
  }
468
468
  }
469
- function Wt(e, t, ...r) {
469
+ function Ht(e, t, ...r) {
470
470
  switch (t) {
471
471
  case "HS256":
472
472
  case "HS384":
473
473
  case "HS512": {
474
- if (!B(e.algorithm, "HMAC"))
474
+ if (!q(e.algorithm, "HMAC"))
475
475
  throw b("HMAC");
476
476
  const n = parseInt(t.slice(2), 10);
477
477
  if (pe(e.algorithm.hash) !== n)
@@ -481,7 +481,7 @@ function Wt(e, t, ...r) {
481
481
  case "RS256":
482
482
  case "RS384":
483
483
  case "RS512": {
484
- if (!B(e.algorithm, "RSASSA-PKCS1-v1_5"))
484
+ if (!q(e.algorithm, "RSASSA-PKCS1-v1_5"))
485
485
  throw b("RSASSA-PKCS1-v1_5");
486
486
  const n = parseInt(t.slice(2), 10);
487
487
  if (pe(e.algorithm.hash) !== n)
@@ -491,7 +491,7 @@ function Wt(e, t, ...r) {
491
491
  case "PS256":
492
492
  case "PS384":
493
493
  case "PS512": {
494
- if (!B(e.algorithm, "RSA-PSS"))
494
+ if (!q(e.algorithm, "RSA-PSS"))
495
495
  throw b("RSA-PSS");
496
496
  const n = parseInt(t.slice(2), 10);
497
497
  if (pe(e.algorithm.hash) !== n)
@@ -506,9 +506,9 @@ function Wt(e, t, ...r) {
506
506
  case "ES256":
507
507
  case "ES384":
508
508
  case "ES512": {
509
- if (!B(e.algorithm, "ECDSA"))
509
+ if (!q(e.algorithm, "ECDSA"))
510
510
  throw b("ECDSA");
511
- const n = Lt(t);
511
+ const n = $t(t);
512
512
  if (e.algorithm.namedCurve !== n)
513
513
  throw b(n, "algorithm.namedCurve");
514
514
  break;
@@ -516,7 +516,7 @@ function Wt(e, t, ...r) {
516
516
  default:
517
517
  throw new TypeError("CryptoKey does not support this operation");
518
518
  }
519
- Ht(e, r);
519
+ Lt(e, r);
520
520
  }
521
521
  function Ve(e, t, ...r) {
522
522
  var n;
@@ -530,7 +530,7 @@ const Oe = (e, ...t) => Ve("Key must be ", e, ...t);
530
530
  function je(e, t, ...r) {
531
531
  return Ve(`Key for the ${e} algorithm must be `, t, ...r);
532
532
  }
533
- const Fe = (e) => Me(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ne = ["CryptoKey"], xt = (...e) => {
533
+ const Fe = (e) => Me(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ae = ["CryptoKey"], Wt = (...e) => {
534
534
  const t = e.filter(Boolean);
535
535
  if (t.length === 0 || t.length === 1)
536
536
  return !0;
@@ -549,11 +549,11 @@ const Fe = (e) => Me(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ne = ["C
549
549
  }
550
550
  return !0;
551
551
  };
552
- function Jt(e) {
552
+ function Yt(e) {
553
553
  return typeof e == "object" && e !== null;
554
554
  }
555
- function ae(e) {
556
- if (!Jt(e) || Object.prototype.toString.call(e) !== "[object Object]")
555
+ function se(e) {
556
+ if (!Yt(e) || Object.prototype.toString.call(e) !== "[object Object]")
557
557
  return !1;
558
558
  if (Object.getPrototypeOf(e) === null)
559
559
  return !0;
@@ -562,14 +562,14 @@ function ae(e) {
562
562
  t = Object.getPrototypeOf(t);
563
563
  return Object.getPrototypeOf(e) === t;
564
564
  }
565
- const Yt = (e, t) => {
565
+ const xt = (e, t) => {
566
566
  if (e.startsWith("RS") || e.startsWith("PS")) {
567
567
  const { modulusLength: r } = t.algorithm;
568
568
  if (typeof r != "number" || r < 2048)
569
569
  throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
570
570
  }
571
571
  };
572
- function Gt(e) {
572
+ function Jt(e) {
573
573
  let t, r;
574
574
  switch (e.kty) {
575
575
  case "RSA": {
@@ -641,36 +641,36 @@ function Gt(e) {
641
641
  }
642
642
  return { algorithm: t, keyUsages: r };
643
643
  }
644
- const Mt = async (e) => {
644
+ const Gt = async (e) => {
645
645
  if (!e.alg)
646
646
  throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
647
- const { algorithm: t, keyUsages: r } = Gt(e), n = [
647
+ const { algorithm: t, keyUsages: r } = Jt(e), n = [
648
648
  t,
649
649
  e.ext ?? !1,
650
650
  e.key_ops ?? r
651
651
  ], a = { ...e };
652
652
  return delete a.alg, delete a.use, ce.subtle.importKey("jwk", a, ...n);
653
- }, Be = (e) => Y(e);
653
+ }, Be = (e) => G(e);
654
654
  let fe, ye;
655
655
  const qe = (e) => e?.[Symbol.toStringTag] === "KeyObject", ze = async (e, t, r, n) => {
656
656
  let a = e.get(t);
657
657
  if (a != null && a[n])
658
658
  return a[n];
659
- const o = await Mt({ ...r, alg: n });
659
+ const o = await Gt({ ...r, alg: n });
660
660
  return a ? a[n] = o : e.set(t, { [n]: o }), o;
661
- }, Vt = (e, t) => {
661
+ }, Mt = (e, t) => {
662
662
  if (qe(e)) {
663
663
  let r = e.export({ format: "jwk" });
664
664
  return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Be(r.k) : (ye || (ye = /* @__PURE__ */ new WeakMap()), ze(ye, e, r, t));
665
665
  }
666
666
  return e;
667
- }, jt = (e, t) => {
667
+ }, Vt = (e, t) => {
668
668
  if (qe(e)) {
669
669
  let r = e.export({ format: "jwk" });
670
670
  return r.k ? Be(r.k) : (fe || (fe = /* @__PURE__ */ new WeakMap()), ze(fe, e, r, t));
671
671
  }
672
672
  return e;
673
- }, Ft = { normalizePublicKey: Vt, normalizePrivateKey: jt }, O = (e, t, r = 0) => {
673
+ }, jt = { normalizePublicKey: Mt, normalizePrivateKey: Vt }, O = (e, t, r = 0) => {
674
674
  r === 0 && (t.unshift(t.length), t.unshift(6));
675
675
  const n = e.indexOf(t[0], r);
676
676
  if (n === -1)
@@ -696,7 +696,7 @@ const qe = (e) => e?.[Symbol.toStringTag] === "KeyObject", ze = async (e, t, r,
696
696
  default:
697
697
  throw new k("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
698
698
  }
699
- }, Bt = async (e, t, r, n, a) => {
699
+ }, Ft = async (e, t, r, n, a) => {
700
700
  let o, s;
701
701
  const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
702
702
  switch (n) {
@@ -743,32 +743,32 @@ const qe = (e) => e?.[Symbol.toStringTag] === "KeyObject", ze = async (e, t, r,
743
743
  throw new k('Invalid or unsupported "alg" (Algorithm) value');
744
744
  }
745
745
  return ce.subtle.importKey(t, i, o, !1, s);
746
- }, qt = (e, t, r) => Bt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
747
- async function zt(e, t, r) {
746
+ }, Bt = (e, t, r) => Ft(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
747
+ async function qt(e, t, r) {
748
748
  if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
749
749
  throw new TypeError('"spki" must be SPKI formatted string');
750
- return qt(e, t);
750
+ return Bt(e, t);
751
751
  }
752
- const ee = (e) => e?.[Symbol.toStringTag], Qt = (e, t) => {
752
+ const te = (e) => e?.[Symbol.toStringTag], zt = (e, t) => {
753
753
  if (!(t instanceof Uint8Array)) {
754
754
  if (!Fe(t))
755
- throw new TypeError(je(e, t, ...ne, "Uint8Array"));
755
+ throw new TypeError(je(e, t, ...ae, "Uint8Array"));
756
756
  if (t.type !== "secret")
757
- throw new TypeError(`${ee(t)} instances for symmetric algorithms must be of type "secret"`);
757
+ throw new TypeError(`${te(t)} instances for symmetric algorithms must be of type "secret"`);
758
758
  }
759
- }, Xt = (e, t, r) => {
759
+ }, Qt = (e, t, r) => {
760
760
  if (!Fe(t))
761
- throw new TypeError(je(e, t, ...ne));
761
+ throw new TypeError(je(e, t, ...ae));
762
762
  if (t.type === "secret")
763
- throw new TypeError(`${ee(t)} instances for asymmetric algorithms must not be of type "secret"`);
763
+ throw new TypeError(`${te(t)} instances for asymmetric algorithms must not be of type "secret"`);
764
764
  if (t.algorithm && r === "verify" && t.type === "private")
765
- throw new TypeError(`${ee(t)} instances for asymmetric algorithm verifying must be of type "public"`);
765
+ throw new TypeError(`${te(t)} instances for asymmetric algorithm verifying must be of type "public"`);
766
766
  if (t.algorithm && r === "encrypt" && t.type === "private")
767
- throw new TypeError(`${ee(t)} instances for asymmetric algorithm encryption must be of type "public"`);
768
- }, Zt = (e, t, r) => {
769
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? Qt(e, t) : Xt(e, t, r);
767
+ throw new TypeError(`${te(t)} instances for asymmetric algorithm encryption must be of type "public"`);
768
+ }, Xt = (e, t, r) => {
769
+ e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? zt(e, t) : Qt(e, t, r);
770
770
  };
771
- function er(e, t, r, n, a) {
771
+ function Zt(e, t, r, n, a) {
772
772
  if (a.crit !== void 0 && n?.crit === void 0)
773
773
  throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
774
774
  if (!n || n.crit === void 0)
@@ -787,13 +787,13 @@ function er(e, t, r, n, a) {
787
787
  }
788
788
  return new Set(n.crit);
789
789
  }
790
- const tr = (e, t) => {
790
+ const er = (e, t) => {
791
791
  if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
792
792
  throw new TypeError(`"${e}" option must be an array of strings`);
793
793
  if (t)
794
794
  return new Set(t);
795
795
  };
796
- function rr(e, t) {
796
+ function tr(e, t) {
797
797
  const r = `SHA-${e.slice(-3)}`;
798
798
  switch (e) {
799
799
  case "HS256":
@@ -818,28 +818,28 @@ function rr(e, t) {
818
818
  throw new k(`alg ${e} is not supported either by JOSE or your javascript runtime`);
819
819
  }
820
820
  }
821
- async function nr(e, t, r) {
822
- if (t = await Ft.normalizePublicKey(t, e), Me(t))
823
- return Wt(t, e, r), t;
821
+ async function rr(e, t, r) {
822
+ if (t = await jt.normalizePublicKey(t, e), Me(t))
823
+ return Ht(t, e, r), t;
824
824
  if (t instanceof Uint8Array) {
825
825
  if (!e.startsWith("HS"))
826
- throw new TypeError(Oe(t, ...ne));
826
+ throw new TypeError(Oe(t, ...ae));
827
827
  return ce.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
828
828
  }
829
- throw new TypeError(Oe(t, ...ne, "Uint8Array"));
829
+ throw new TypeError(Oe(t, ...ae, "Uint8Array"));
830
830
  }
831
- const ar = async (e, t, r, n) => {
832
- const a = await nr(e, t, "verify");
833
- Yt(e, a);
834
- const o = rr(e, a.algorithm);
831
+ const nr = async (e, t, r, n) => {
832
+ const a = await rr(e, t, "verify");
833
+ xt(e, a);
834
+ const o = tr(e, a.algorithm);
835
835
  try {
836
836
  return await ce.subtle.verify(o, a, r, n);
837
837
  } catch {
838
838
  return !1;
839
839
  }
840
840
  };
841
- async function sr(e, t, r) {
842
- if (!ae(e))
841
+ async function ar(e, t, r) {
842
+ if (!se(e))
843
843
  throw new m("Flattened JWS must be an object");
844
844
  if (e.protected === void 0 && e.header === void 0)
845
845
  throw new m('Flattened JWS must have either of the "protected" or "header" members');
@@ -849,69 +849,69 @@ async function sr(e, t, r) {
849
849
  throw new m("JWS Payload missing");
850
850
  if (typeof e.signature != "string")
851
851
  throw new m("JWS Signature missing or incorrect type");
852
- if (e.header !== void 0 && !ae(e.header))
852
+ if (e.header !== void 0 && !se(e.header))
853
853
  throw new m("JWS Unprotected Header incorrect type");
854
854
  let n = {};
855
855
  if (e.protected)
856
856
  try {
857
- const T = Y(e.protected);
858
- n = JSON.parse(G.decode(T));
857
+ const T = G(e.protected);
858
+ n = JSON.parse(M.decode(T));
859
859
  } catch {
860
860
  throw new m("JWS Protected Header is invalid");
861
861
  }
862
- if (!xt(n, e.header))
862
+ if (!Wt(n, e.header))
863
863
  throw new m("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
864
864
  const a = {
865
865
  ...n,
866
866
  ...e.header
867
- }, o = er(m, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, n, a);
867
+ }, o = Zt(m, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, n, a);
868
868
  let s = !0;
869
869
  if (o.has("b64") && (s = n.b64, typeof s != "boolean"))
870
870
  throw new m('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
871
871
  const { alg: i } = a;
872
872
  if (typeof i != "string" || !i)
873
873
  throw new m('JWS "alg" (Algorithm) Header Parameter missing or invalid');
874
- const c = r && tr("algorithms", r.algorithms);
874
+ const c = r && er("algorithms", r.algorithms);
875
875
  if (c && !c.has(i))
876
- throw new Kt('"alg" (Algorithm) Header Parameter value not allowed');
876
+ throw new Ut('"alg" (Algorithm) Header Parameter value not allowed');
877
877
  if (s) {
878
878
  if (typeof e.payload != "string")
879
879
  throw new m("JWS Payload must be a string");
880
880
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
881
881
  throw new m("JWS Payload must be a string or an Uint8Array instance");
882
882
  let h = !1;
883
- typeof t == "function" && (t = await t(n, e), h = !0), Zt(i, t, "verify");
884
- const f = Dt(F.encode(e.protected ?? ""), F.encode("."), typeof e.payload == "string" ? F.encode(e.payload) : e.payload);
883
+ typeof t == "function" && (t = await t(n, e), h = !0), Xt(i, t, "verify");
884
+ const f = Nt(B.encode(e.protected ?? ""), B.encode("."), typeof e.payload == "string" ? B.encode(e.payload) : e.payload);
885
885
  let p;
886
886
  try {
887
- p = Y(e.signature);
887
+ p = G(e.signature);
888
888
  } catch {
889
889
  throw new m("Failed to base64url decode the signature");
890
890
  }
891
- if (!await ar(i, t, p, f))
892
- throw new $t();
893
- let u;
891
+ if (!await nr(i, t, p, f))
892
+ throw new Kt();
893
+ let l;
894
894
  if (s)
895
895
  try {
896
- u = Y(e.payload);
896
+ l = G(e.payload);
897
897
  } catch {
898
898
  throw new m("Failed to base64url decode the payload");
899
899
  }
900
- else typeof e.payload == "string" ? u = F.encode(e.payload) : u = e.payload;
901
- const A = { payload: u };
900
+ else typeof e.payload == "string" ? l = B.encode(e.payload) : l = e.payload;
901
+ const A = { payload: l };
902
902
  return e.protected !== void 0 && (A.protectedHeader = n), e.header !== void 0 && (A.unprotectedHeader = e.header), h ? { ...A, key: t } : A;
903
903
  }
904
- async function or(e, t, r) {
905
- if (e instanceof Uint8Array && (e = G.decode(e)), typeof e != "string")
904
+ async function sr(e, t, r) {
905
+ if (e instanceof Uint8Array && (e = M.decode(e)), typeof e != "string")
906
906
  throw new m("Compact JWS must be a string or Uint8Array");
907
907
  const { 0: n, 1: a, 2: o, length: s } = e.split(".");
908
908
  if (s !== 3)
909
909
  throw new m("Invalid Compact JWS");
910
- const i = await sr({ payload: a, protected: n, signature: o }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
910
+ const i = await ar({ payload: a, protected: n, signature: o }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
911
911
  return typeof t == "function" ? { ...c, key: i.key } : c;
912
912
  }
913
- const ir = (e) => Math.floor(e.getTime() / 1e3), Qe = 60, Xe = Qe * 60, Ae = Xe * 24, cr = Ae * 7, ur = Ae * 365.25, lr = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Pe = (e) => {
914
- const t = lr.exec(e);
913
+ const or = (e) => Math.floor(e.getTime() / 1e3), Qe = 60, Xe = Qe * 60, Ae = Xe * 24, ir = Ae * 7, cr = Ae * 365.25, ur = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Pe = (e) => {
914
+ const t = ur.exec(e);
915
915
  if (!t || t[4] && t[1])
916
916
  throw new TypeError("Invalid time period format");
917
917
  const r = parseFloat(t[2]), n = t[3].toLowerCase();
@@ -946,20 +946,20 @@ const ir = (e) => Math.floor(e.getTime() / 1e3), Qe = 60, Xe = Qe * 60, Ae = Xe
946
946
  case "week":
947
947
  case "weeks":
948
948
  case "w":
949
- a = Math.round(r * cr);
949
+ a = Math.round(r * ir);
950
950
  break;
951
951
  default:
952
- a = Math.round(r * ur);
952
+ a = Math.round(r * cr);
953
953
  break;
954
954
  }
955
955
  return t[1] === "-" || t[4] === "ago" ? -a : a;
956
- }, Ce = (e) => e.toLowerCase().replace(/^application\//, ""), dr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, hr = (e, t, r = {}) => {
956
+ }, Ce = (e) => e.toLowerCase().replace(/^application\//, ""), lr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, dr = (e, t, r = {}) => {
957
957
  let n;
958
958
  try {
959
- n = JSON.parse(G.decode(t));
959
+ n = JSON.parse(M.decode(t));
960
960
  } catch {
961
961
  }
962
- if (!ae(n))
962
+ if (!se(n))
963
963
  throw new v("JWT Claims Set must be a top-level JSON object");
964
964
  const { typ: a } = r;
965
965
  if (a && (typeof e.typ != "string" || Ce(e.typ) !== Ce(a)))
@@ -973,7 +973,7 @@ const ir = (e) => Math.floor(e.getTime() / 1e3), Qe = 60, Xe = Qe * 60, Ae = Xe
973
973
  throw new R('unexpected "iss" claim value', n, "iss", "check_failed");
974
974
  if (i && n.sub !== i)
975
975
  throw new R('unexpected "sub" claim value', n, "sub", "check_failed");
976
- if (c && !dr(n.aud, typeof c == "string" ? [c] : c))
976
+ if (c && !lr(n.aud, typeof c == "string" ? [c] : c))
977
977
  throw new R('unexpected "aud" claim value', n, "aud", "check_failed");
978
978
  let p;
979
979
  switch (typeof r.clockTolerance) {
@@ -989,7 +989,7 @@ const ir = (e) => Math.floor(e.getTime() / 1e3), Qe = 60, Xe = Qe * 60, Ae = Xe
989
989
  default:
990
990
  throw new TypeError("Invalid clockTolerance option type");
991
991
  }
992
- const { currentDate: u } = r, A = ir(u || /* @__PURE__ */ new Date());
992
+ const { currentDate: l } = r, A = or(l || /* @__PURE__ */ new Date());
993
993
  if ((n.iat !== void 0 || h) && typeof n.iat != "number")
994
994
  throw new R('"iat" claim must be a number', n, "iat", "invalid");
995
995
  if (n.nbf !== void 0) {
@@ -1013,16 +1013,16 @@ const ir = (e) => Math.floor(e.getTime() / 1e3), Qe = 60, Xe = Qe * 60, Ae = Xe
1013
1013
  }
1014
1014
  return n;
1015
1015
  };
1016
- async function pr(e, t, r) {
1016
+ async function hr(e, t, r) {
1017
1017
  var n;
1018
- const a = await or(e, t, r);
1018
+ const a = await sr(e, t, r);
1019
1019
  if ((n = a.protectedHeader.crit) != null && n.includes("b64") && a.protectedHeader.b64 === !1)
1020
1020
  throw new v("JWTs MUST NOT use unencoded payload");
1021
- const o = { payload: hr(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
1021
+ const o = { payload: dr(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
1022
1022
  return typeof t == "function" ? { ...o, key: a.key } : o;
1023
1023
  }
1024
- const fr = Y;
1025
- function yr(e) {
1024
+ const pr = G;
1025
+ function fr(e) {
1026
1026
  if (typeof e != "string")
1027
1027
  throw new v("JWTs must use Compact JWS serialization, JWT must be a string");
1028
1028
  const { 1: t, length: r } = e.split(".");
@@ -1034,32 +1034,32 @@ function yr(e) {
1034
1034
  throw new v("JWTs must contain a payload");
1035
1035
  let n;
1036
1036
  try {
1037
- n = fr(t);
1037
+ n = pr(t);
1038
1038
  } catch {
1039
1039
  throw new v("Failed to base64url decode the payload");
1040
1040
  }
1041
1041
  let a;
1042
1042
  try {
1043
- a = JSON.parse(G.decode(n));
1043
+ a = JSON.parse(M.decode(n));
1044
1044
  } catch {
1045
1045
  throw new v("Failed to parse the decoded payload as JSON");
1046
1046
  }
1047
- if (!ae(a))
1047
+ if (!se(a))
1048
1048
  throw new v("Invalid JWT Claims Set");
1049
1049
  return a;
1050
1050
  }
1051
- const H = async (e) => {
1051
+ const W = async (e) => {
1052
1052
  try {
1053
- const t = S.ALG, r = await zt(Nt, t);
1054
- return await pr(e, r, {
1055
- issuer: S.ISSUER
1053
+ const t = w.ALG, r = await qt(Ct, t);
1054
+ return await hr(e, r, {
1055
+ issuer: w.ISSUER
1056
1056
  });
1057
1057
  } catch {
1058
1058
  return;
1059
1059
  }
1060
- }, gr = (e) => {
1060
+ }, yr = (e) => {
1061
1061
  try {
1062
- return yr(e);
1062
+ return fr(e);
1063
1063
  } catch {
1064
1064
  return;
1065
1065
  }
@@ -1067,50 +1067,50 @@ const H = async (e) => {
1067
1067
  var g = [];
1068
1068
  for (var ge = 0; ge < 256; ++ge)
1069
1069
  g.push((ge + 256).toString(16).slice(1));
1070
- function Er(e, t = 0) {
1070
+ function gr(e, t = 0) {
1071
1071
  return (g[e[t + 0]] + g[e[t + 1]] + g[e[t + 2]] + g[e[t + 3]] + "-" + g[e[t + 4]] + g[e[t + 5]] + "-" + g[e[t + 6]] + g[e[t + 7]] + "-" + g[e[t + 8]] + g[e[t + 9]] + "-" + g[e[t + 10]] + g[e[t + 11]] + g[e[t + 12]] + g[e[t + 13]] + g[e[t + 14]] + g[e[t + 15]]).toLowerCase();
1072
1072
  }
1073
- var q, mr = new Uint8Array(16);
1074
- function wr() {
1075
- if (!q && (q = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !q))
1073
+ var z, Er = new Uint8Array(16);
1074
+ function mr() {
1075
+ if (!z && (z = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !z))
1076
1076
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1077
- return q(mr);
1077
+ return z(Er);
1078
1078
  }
1079
- var Sr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1079
+ var wr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1080
1080
  const Ne = {
1081
- randomUUID: Sr
1081
+ randomUUID: wr
1082
1082
  };
1083
1083
  function De(e, t, r) {
1084
1084
  if (Ne.randomUUID && !t && !e)
1085
1085
  return Ne.randomUUID();
1086
1086
  e = e || {};
1087
- var n = e.random || (e.rng || wr)();
1088
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Er(n);
1087
+ var n = e.random || (e.rng || mr)();
1088
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, gr(n);
1089
1089
  }
1090
- const Ue = globalThis.crypto, Ar = (e) => `${De()}${De()}`.slice(0, e), Tr = (e) => btoa(
1090
+ const Ue = globalThis.crypto, Sr = (e) => `${De()}${De()}`.slice(0, e), Ar = (e) => btoa(
1091
1091
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1092
1092
  );
1093
- async function Rr(e) {
1093
+ async function Tr(e) {
1094
1094
  if (!Ue.subtle)
1095
1095
  throw new Error(
1096
1096
  "crypto.subtle is available only in secure contexts (HTTPS)."
1097
1097
  );
1098
1098
  const t = new TextEncoder().encode(e), r = await Ue.subtle.digest("SHA-256", t);
1099
- return Tr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1099
+ return Ar(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1100
1100
  }
1101
- async function _r(e) {
1102
- const r = Ar(43), n = await Rr(r);
1101
+ async function Rr(e) {
1102
+ const r = Sr(43), n = await Tr(r);
1103
1103
  return {
1104
1104
  code_verifier: r,
1105
1105
  code_challenge: n
1106
1106
  };
1107
1107
  }
1108
- const Br = async (e, t) => {
1108
+ const Fr = async (e, t) => {
1109
1109
  var r;
1110
- const n = await H(e);
1111
- if (!n || !Array.isArray((r = n.payload) == null ? void 0 : r[S.SCOPES_KEY]))
1110
+ const n = await W(e);
1111
+ if (!n || !Array.isArray((r = n.payload) == null ? void 0 : r[w.SCOPES_KEY]))
1112
1112
  return !1;
1113
- const a = n.payload[S.SCOPES_KEY];
1113
+ const a = n.payload[w.SCOPES_KEY];
1114
1114
  return Array.isArray(t) ? t.every((o) => a.includes(o)) : Object.keys(t).some(
1115
1115
  (o) => t[o].every((s) => a.includes(s))
1116
1116
  );
@@ -1123,18 +1123,18 @@ const Ke = (e, t) => {
1123
1123
  typeof t == "function" ? t() : t
1124
1124
  );
1125
1125
  window.localStorage.setItem(e, r), Ze(e, r);
1126
- }, Ir = (e) => {
1126
+ }, _r = (e) => {
1127
1127
  window.localStorage.removeItem(e), Ze(e, null);
1128
- }, $e = (e) => window.localStorage.getItem(e), br = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1129
- function z({
1128
+ }, $e = (e) => window.localStorage.getItem(e), Ir = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1129
+ function Q({
1130
1130
  key: e,
1131
1131
  initialValue: t
1132
1132
  }) {
1133
- const r = St(br, () => $e(e)), n = N(
1133
+ const r = wt(Ir, () => $e(e)), n = N(
1134
1134
  (s) => {
1135
1135
  try {
1136
1136
  const i = typeof s == "function" ? s(JSON.parse(r)) : s;
1137
- i == null ? Ir(e) : Ke(e, i);
1137
+ i == null ? _r(e) : Ke(e, i);
1138
1138
  } catch (i) {
1139
1139
  console.warn(i);
1140
1140
  }
@@ -1156,30 +1156,30 @@ function z({
1156
1156
  var E = [];
1157
1157
  for (var Ee = 0; Ee < 256; ++Ee)
1158
1158
  E.push((Ee + 256).toString(16).slice(1));
1159
- function vr(e, t = 0) {
1159
+ function br(e, t = 0) {
1160
1160
  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();
1161
1161
  }
1162
- var Q, Or = new Uint8Array(16);
1163
- function kr() {
1164
- if (!Q && (Q = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Q))
1162
+ var X, vr = new Uint8Array(16);
1163
+ function Or() {
1164
+ if (!X && (X = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !X))
1165
1165
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1166
- return Q(Or);
1166
+ return X(vr);
1167
1167
  }
1168
- var Pr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1168
+ var kr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1169
1169
  const Le = {
1170
- randomUUID: Pr
1170
+ randomUUID: kr
1171
1171
  };
1172
1172
  function me(e, t, r) {
1173
1173
  if (Le.randomUUID && !t && !e)
1174
1174
  return Le.randomUUID();
1175
1175
  e = e || {};
1176
- var n = e.random || (e.rng || kr)();
1177
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, vr(n);
1176
+ var n = e.random || (e.rng || Or)();
1177
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, br(n);
1178
1178
  }
1179
- const U = "Your session has expired. For your security, please log in again to continue.", Cr = "Your session has been successfully terminated.", we = "Login failed. Please try again.", Nr = "Error getting access token, please re-authenticate.", Dr = "You forgot to wrap your component in <AuthProvider>.", se = {
1179
+ const U = "Your session has expired. For your security, please log in again to continue.", Pr = "Your session has been successfully terminated.", we = "Login failed. Please try again.", Cr = "Error getting access token, please re-authenticate.", Nr = "You forgot to wrap your component in <AuthProvider>.", oe = {
1180
1180
  dev: "https://auth.gizmette.local.com:3003",
1181
1181
  prod: "https://mylogin.gizmette.com/auth"
1182
- }, X = "@@auth@@", J = "LOADING", te = "LOGIN", et = "LOGOUT", M = "success", I = "failure", tt = "include", rt = "POST", nt = "application/json", Z = {
1182
+ }, Z = "@@auth@@", J = "LOADING", re = "LOGIN", et = "LOGOUT", V = "success", I = "failure", tt = "include", rt = "POST", nt = "application/json", ee = {
1183
1183
  GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1184
1184
  $clientId: String!,
1185
1185
  $username: String!,
@@ -1261,19 +1261,19 @@ const U = "Your session has expired. For your security, please log in again to c
1261
1261
  }`
1262
1262
  }, K = {
1263
1263
  GET_REGISTRATION_OPTIONS: {
1264
- schema: Z.GET_REGISTRATION_OPTIONS,
1264
+ schema: ee.GET_REGISTRATION_OPTIONS,
1265
1265
  method: "getPasskeyRegistrationOptions"
1266
1266
  },
1267
1267
  VERIFY_REGISTRATION: {
1268
- schema: Z.VERIFY_REGISTRATION,
1268
+ schema: ee.VERIFY_REGISTRATION,
1269
1269
  method: "verifyPasskeyRegistration"
1270
1270
  },
1271
1271
  GET_AUTHENTICATION_OPTIONS: {
1272
- schema: Z.GET_AUTHENTICATION_OPTIONS,
1272
+ schema: ee.GET_AUTHENTICATION_OPTIONS,
1273
1273
  method: "getPasskeyAuthenticationOptions"
1274
1274
  },
1275
1275
  VERIFY_AUTHENTICATION: {
1276
- schema: Z.VERIFY_AUTHENTICATION,
1276
+ schema: ee.VERIFY_AUTHENTICATION,
1277
1277
  method: "verifyPasskeyAuthentication"
1278
1278
  }
1279
1279
  }, $ = async ({
@@ -1284,7 +1284,7 @@ const U = "Your session has expired. For your security, please log in again to c
1284
1284
  }) => {
1285
1285
  try {
1286
1286
  const a = `Bearer ${e}`, o = await fetch(
1287
- at ? `${se.dev}/graphql` : `${se.prod}/graphql`,
1287
+ at ? `${oe.dev}/graphql` : `${oe.prod}/graphql`,
1288
1288
  {
1289
1289
  credentials: tt,
1290
1290
  method: rt,
@@ -1303,7 +1303,7 @@ const U = "Your session has expired. For your security, please log in again to c
1303
1303
  return { status: I, data: [] };
1304
1304
  const { data: s } = await o.json();
1305
1305
  return {
1306
- status: M,
1306
+ status: V,
1307
1307
  data: s[t.method]
1308
1308
  };
1309
1309
  } catch (a) {
@@ -1316,7 +1316,7 @@ const U = "Your session has expired. For your security, please log in again to c
1316
1316
  }) => {
1317
1317
  try {
1318
1318
  const n = await fetch(
1319
- at ? `${se.dev}/${e}` : `${se.prod}/${e}`,
1319
+ at ? `${oe.dev}/${e}` : `${oe.prod}/${e}`,
1320
1320
  {
1321
1321
  credentials: tt,
1322
1322
  method: rt,
@@ -1331,26 +1331,27 @@ const U = "Your session has expired. For your security, please log in again to c
1331
1331
  return { status: I, data: [] };
1332
1332
  const { data: a } = await n.json();
1333
1333
  return {
1334
- status: M,
1334
+ status: V,
1335
1335
  data: a || []
1336
1336
  };
1337
1337
  } catch (n) {
1338
1338
  return console.error(n), { status: I, data: [] };
1339
1339
  }
1340
- }, Ur = process.env.NODE_ENV === "production", at = !Ur, st = {
1340
+ }, Dr = process.env.NODE_ENV === "production", at = !Dr, st = {
1341
1341
  isLoading: !0,
1342
1342
  isAuthenticated: !1,
1343
1343
  user: void 0,
1344
1344
  logoutReason: "",
1345
- debug: !1
1346
- }, Kr = (e) => {
1345
+ debug: !1,
1346
+ authenticationType: ""
1347
+ }, Ur = (e) => {
1347
1348
  try {
1348
- const t = gr(e);
1349
- return t ? t[S.USER_ID_KEY] : "";
1349
+ const t = yr(e);
1350
+ return t ? t[w.USER_ID_KEY] : "";
1350
1351
  } catch {
1351
1352
  return "";
1352
1353
  }
1353
- }, $r = async ({
1354
+ }, Kr = async ({
1354
1355
  userId: e,
1355
1356
  clientId: t,
1356
1357
  domain: r,
@@ -1373,7 +1374,7 @@ const U = "Your session has expired. For your security, please log in again to c
1373
1374
  status: I
1374
1375
  };
1375
1376
  }
1376
- }, Lr = async ({
1377
+ }, $r = async ({
1377
1378
  username: e,
1378
1379
  password: t,
1379
1380
  clientId: r,
@@ -1390,7 +1391,7 @@ const U = "Your session has expired. For your security, please log in again to c
1390
1391
  type: ie.LOGIN,
1391
1392
  clientId: r,
1392
1393
  params: {
1393
- type: a || oe.ID_AND_ACCESS_TOKEN,
1394
+ type: a || H.ID_AND_ACCESS_TOKEN,
1394
1395
  username: e,
1395
1396
  password: t,
1396
1397
  sessionExpiration: o,
@@ -1400,12 +1401,12 @@ const U = "Your session has expired. For your security, please log in again to c
1400
1401
  domain: c,
1401
1402
  ua: h
1402
1403
  }
1403
- }), p = await H(f?.data?.idToken);
1404
- return p && p.payload[S.USER_ID_KEY] !== "" && p.payload[S.NONCE_KEY] === n ? {
1404
+ }), p = await W(f?.data?.idToken);
1405
+ return p && p.payload[w.USER_ID_KEY] !== "" && p.payload[w.NONCE_KEY] === n ? {
1405
1406
  idToken: f.data.idToken,
1406
1407
  accessToken: f.data.accessToken,
1407
1408
  refreshToken: f.data.refreshToken,
1408
- userId: p.payload[S.USER_ID_KEY],
1409
+ userId: p.payload[w.USER_ID_KEY],
1409
1410
  status: !0
1410
1411
  } : {
1411
1412
  status: !1
@@ -1415,7 +1416,7 @@ const U = "Your session has expired. For your security, please log in again to c
1415
1416
  status: !1
1416
1417
  };
1417
1418
  }
1418
- }, Hr = async ({
1419
+ }, Lr = async ({
1419
1420
  nonce: e,
1420
1421
  clientId: t,
1421
1422
  code_challenge: r
@@ -1425,13 +1426,13 @@ const U = "Your session has expired. For your security, please log in again to c
1425
1426
  type: ie.CODE,
1426
1427
  clientId: t,
1427
1428
  params: {
1428
- type: oe.CODE,
1429
+ type: H.CODE,
1429
1430
  nonce: e,
1430
1431
  code_challenge: r
1431
1432
  }
1432
1433
  });
1433
1434
  return n?.data?.code ? {
1434
- status: M,
1435
+ status: V,
1435
1436
  data: n.data.code
1436
1437
  } : {
1437
1438
  status: I,
@@ -1443,7 +1444,7 @@ const U = "Your session has expired. For your security, please log in again to c
1443
1444
  data: ""
1444
1445
  };
1445
1446
  }
1446
- }, Wr = async ({
1447
+ }, Hr = async ({
1447
1448
  clientId: e,
1448
1449
  userId: t,
1449
1450
  nonce: r,
@@ -1456,18 +1457,18 @@ const U = "Your session has expired. For your security, please log in again to c
1456
1457
  type: ie.REFRESH,
1457
1458
  clientId: e,
1458
1459
  params: {
1459
- type: oe.REFRESH_TOKEN,
1460
+ type: H.REFRESH_TOKEN,
1460
1461
  userId: t,
1461
1462
  nonce: r,
1462
1463
  refreshToken: n,
1463
1464
  accessToken: a,
1464
1465
  domain: o
1465
1466
  }
1466
- }), i = await H(s?.data?.accessToken);
1467
- return i && i.payload[S.USER_ID_KEY] !== "" && i.payload[S.NONCE_KEY] === r ? {
1467
+ }), i = await W(s?.data?.accessToken);
1468
+ return i && i.payload[w.USER_ID_KEY] !== "" && i.payload[w.NONCE_KEY] === r ? {
1468
1469
  accessToken: s.data.accessToken,
1469
1470
  refreshToken: s.data.refreshToken,
1470
- userId: i.payload[S.USER_ID_KEY],
1471
+ userId: i.payload[w.USER_ID_KEY],
1471
1472
  status: !0
1472
1473
  } : {
1473
1474
  status: !1
@@ -1478,11 +1479,11 @@ const U = "Your session has expired. For your security, please log in again to c
1478
1479
  };
1479
1480
  }
1480
1481
  };
1481
- class xr {
1482
+ class Wr {
1482
1483
  constructor(t = null, r = null) {
1483
- j(this, "refreshTokenPromise", null);
1484
- j(this, "accessToken");
1485
- j(this, "refreshToken");
1484
+ F(this, "refreshTokenPromise", null);
1485
+ F(this, "accessToken");
1486
+ F(this, "refreshToken");
1486
1487
  this.accessToken = t || "", this.refreshToken = r || "";
1487
1488
  }
1488
1489
  async refreshtoken({
@@ -1509,9 +1510,9 @@ class xr {
1509
1510
  nonce: n,
1510
1511
  domain: a
1511
1512
  }) {
1512
- const o = await H(this.refreshToken);
1513
- if (o && o.payload[S.USER_ID_KEY] !== "") {
1514
- const s = await Wr({
1513
+ const o = await W(this.refreshToken);
1514
+ if (o && o.payload[w.USER_ID_KEY] !== "") {
1515
+ const s = await Hr({
1515
1516
  clientId: t,
1516
1517
  userId: r,
1517
1518
  nonce: n,
@@ -1520,7 +1521,7 @@ class xr {
1520
1521
  domain: a
1521
1522
  });
1522
1523
  return s.status ? (this.accessToken = s.accessToken, this.refreshToken = s.refreshToken, {
1523
- status: M,
1524
+ status: V,
1524
1525
  newAccessToken: s.accessToken,
1525
1526
  newRefreshToken: s.refreshToken
1526
1527
  }) : {
@@ -1532,14 +1533,14 @@ class xr {
1532
1533
  };
1533
1534
  }
1534
1535
  }
1535
- const Jr = (e) => N(
1536
+ const Yr = (e) => N(
1536
1537
  (...t) => {
1537
1538
  e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
1538
1539
  },
1539
1540
  [e]
1540
1541
  ), L = () => {
1541
- throw new Error(Dr);
1542
- }, ot = At({
1542
+ throw new Error(Nr);
1543
+ }, ot = St({
1543
1544
  isAuthenticated: !1,
1544
1545
  isLoading: !1,
1545
1546
  login: L,
@@ -1548,47 +1549,50 @@ const Jr = (e) => N(
1548
1549
  getIdToken: L,
1549
1550
  registeringForPasskey: L,
1550
1551
  loginWithPasskey: L,
1551
- logoutReason: ""
1552
- }), Yr = wt.createContext({
1552
+ logoutReason: "",
1553
+ authenticationType: ""
1554
+ }), xr = mt.createContext({
1553
1555
  state: st,
1554
1556
  dispatch: () => {
1555
1557
  }
1556
- }), Gr = (e, t) => t?.type === J ? {
1558
+ }), Jr = (e, t) => t?.type === J ? {
1557
1559
  ...e,
1558
1560
  isLoading: t.payload.isLoading
1559
- } : t?.type === te ? {
1561
+ } : t?.type === re ? {
1560
1562
  ...e,
1561
1563
  isLoading: !1,
1562
1564
  isAuthenticated: !0,
1563
1565
  user: t.payload.user,
1566
+ authenticationType: t.payload.authenticationType,
1564
1567
  logoutReason: ""
1565
1568
  } : t?.type === et ? {
1566
1569
  ...e,
1567
1570
  isLoading: !1,
1568
1571
  isAuthenticated: !1,
1569
1572
  user: void 0,
1573
+ authenticationType: "",
1570
1574
  logoutReason: t.payload.logoutReason
1571
- } : e, qr = ({
1575
+ } : e, Br = ({
1572
1576
  children: e,
1573
1577
  sessionExpiration: t,
1574
1578
  clientId: r,
1575
1579
  domain: n = "",
1576
1580
  debug: a = !1
1577
1581
  }) => {
1578
- const [o, s] = Tt(Gr, {
1582
+ const [o, s] = At(Jr, {
1579
1583
  ...st,
1580
1584
  debug: a
1581
- }), i = Jr(a), c = Rt(!1), [h, f, , p] = z({
1582
- key: `${X}::${r}::@@user@@`
1583
- }), [u, A, , T] = z({
1584
- key: `${X}::${r}::@@access@@`
1585
- }), [le, de, , Te] = z(
1585
+ }), i = Yr(a), c = Tt(!1), [h, f, , p] = Q({
1586
+ key: `${Z}::${r}::@@user@@`
1587
+ }), [l, A, , T] = Q({
1588
+ key: `${Z}::${r}::@@access@@`
1589
+ }), [le, de, , Te] = Q(
1586
1590
  {
1587
- key: `${X}::${r}::@@refresh@@`
1591
+ key: `${Z}::${r}::@@refresh@@`
1588
1592
  }
1589
- ), [it, Re, , _e] = z({
1590
- key: `${X}::${r}::@@nonce@@`
1591
- }), ct = new xr(u, le), V = N(() => {
1593
+ ), [it, Re, , _e] = Q({
1594
+ key: `${Z}::${r}::@@nonce@@`
1595
+ }), ct = new Wr(l, le), j = N(() => {
1592
1596
  i("removeLocalStorage: removing local storage"), p(), T(), Te(), _e();
1593
1597
  }, [
1594
1598
  T,
@@ -1596,45 +1600,46 @@ const Jr = (e) => N(
1596
1600
  _e,
1597
1601
  Te,
1598
1602
  i
1599
- ]), W = N(
1600
- (l) => {
1603
+ ]), Y = N(
1604
+ (u) => {
1601
1605
  i(
1602
1606
  "removeStateAndLocalStorage: removing state and local storage with reason: ",
1603
- l
1607
+ u
1604
1608
  ), s({
1605
1609
  type: et,
1606
1610
  payload: {
1607
- logoutReason: l || U
1611
+ logoutReason: u || U
1608
1612
  }
1609
- }), V(), s({ type: J, payload: { isLoading: !1 } });
1613
+ }), j(), s({ type: J, payload: { isLoading: !1 } });
1610
1614
  },
1611
- [V, i]
1615
+ [j, i]
1612
1616
  ), P = N(
1613
- async (l) => {
1617
+ async (u) => {
1614
1618
  i("invalidateAndLogout: invalidating and logging out");
1615
- const { user: y } = o, d = y?.userId || Kr(h);
1619
+ const { user: y } = o, d = y?.userId || Ur(h);
1616
1620
  d || i(
1617
1621
  "invalidateAndLogout: user cannot be identified, logging out without userId"
1618
- ), await $r({
1622
+ ), await Kr({
1619
1623
  userId: d,
1620
1624
  clientId: r,
1621
1625
  domain: n,
1622
1626
  idToken: h
1623
- }), W(l || U);
1627
+ }), Y(u || U);
1624
1628
  },
1625
- [h, o, r, n, W, i]
1629
+ [h, o, r, n, Y, i]
1626
1630
  );
1627
1631
  He(() => {
1628
1632
  if (!c.current)
1629
1633
  return o.isLoading && h !== null ? (async () => {
1630
1634
  try {
1631
- const l = await H(h);
1632
- l && l.payload[S.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), s({
1633
- type: te,
1635
+ const u = await W(h);
1636
+ u && u.payload[w.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), s({
1637
+ type: re,
1634
1638
  payload: {
1639
+ authenticationType: u.payload[w.AUTH_TYPE_KEY],
1635
1640
  user: {
1636
- userId: l.payload[S.USER_ID_KEY],
1637
- username: l.payload[S.USERNAME_KEY]
1641
+ userId: u.payload[w.USER_ID_KEY],
1642
+ username: u.payload[w.USERNAME_KEY]
1638
1643
  }
1639
1644
  }
1640
1645
  })) : (i("useEffect: invalid JWT, invalidating and logging out"), await P(U));
@@ -1647,50 +1652,51 @@ const Jr = (e) => N(
1647
1652
  c.current = !0;
1648
1653
  };
1649
1654
  }, [o.isLoading, h, P, i]);
1650
- const ut = async (l, y) => {
1651
- s({ type: J, payload: { isLoading: !0 } }), V();
1655
+ const ut = async (u, y) => {
1656
+ s({ type: J, payload: { isLoading: !0 } }), j();
1652
1657
  const d = me();
1653
1658
  Re(d), i("login: Logging in with password");
1654
- const C = oe.CODE, { code_verifier: yt, code_challenge: gt } = await _r(), Ie = await Hr({
1659
+ const { code_verifier: C, code_challenge: yt } = await Rr(), Ie = await Lr({
1655
1660
  nonce: d,
1656
1661
  clientId: r,
1657
- code_challenge: gt
1662
+ code_challenge: yt
1658
1663
  });
1659
1664
  if (Ie.status) {
1660
- const x = await Lr({
1661
- username: l,
1665
+ const x = await $r({
1666
+ username: u,
1662
1667
  password: y,
1663
1668
  clientId: r,
1664
1669
  sessionExpiration: t,
1665
1670
  nonce: d,
1666
- type: C,
1671
+ type: H.CODE,
1667
1672
  code: Ie.data,
1668
- code_verifier: yt,
1673
+ code_verifier: C,
1669
1674
  domain: n,
1670
1675
  ua: navigator.userAgent
1671
1676
  });
1672
1677
  return x.status ? (f(x.idToken), A(x.accessToken), de(x.refreshToken), s({
1673
- type: te,
1678
+ type: re,
1674
1679
  payload: {
1680
+ authenticationType: H.CODE,
1675
1681
  user: {
1676
1682
  userId: x.userId,
1677
- username: l
1683
+ username: u
1678
1684
  }
1679
1685
  }
1680
- }), !0) : (W(we), !1);
1686
+ }), !0) : (Y(we), !1);
1681
1687
  }
1682
1688
  return !1;
1683
- }, lt = async (l) => {
1684
- l?.preventDefault(), await P(Cr);
1689
+ }, lt = async (u) => {
1690
+ u?.preventDefault(), await P(Pr);
1685
1691
  }, dt = async () => {
1686
- const { isAuthenticated: l, user: y } = o;
1692
+ const { isAuthenticated: u, user: y } = o;
1687
1693
  try {
1688
- if (l && y && y.userId) {
1689
- if (u) {
1694
+ if (u && y && y.userId) {
1695
+ if (l) {
1690
1696
  i("getAccessToken");
1691
- const C = await H(u);
1692
- if (C && C.payload[S.USER_ID_KEY] !== "")
1693
- return u;
1697
+ const C = await W(l);
1698
+ if (C && C.payload[w.USER_ID_KEY] !== "")
1699
+ return l;
1694
1700
  }
1695
1701
  i("getAccessToken: invalid access token, trying to refresh it");
1696
1702
  const d = await ct.refreshtoken({
@@ -1709,55 +1715,55 @@ const Jr = (e) => N(
1709
1715
  } catch {
1710
1716
  return i(
1711
1717
  "getAccessToken: exception occurred, invalidating and logging out"
1712
- ), await P(Nr), "";
1718
+ ), await P(Cr), "";
1713
1719
  }
1714
1720
  }, ht = () => o.isAuthenticated && h ? h : "", pt = async () => {
1715
- const { user: l } = o;
1721
+ const { user: u } = o;
1716
1722
  let y = await $({
1717
- accessToken: u,
1723
+ accessToken: l,
1718
1724
  clientId: r,
1719
1725
  type: K.GET_REGISTRATION_OPTIONS,
1720
1726
  params: {
1721
1727
  clientId: r,
1722
- id: l?.userId,
1723
- username: l?.username
1728
+ id: u?.userId,
1729
+ username: u?.username
1724
1730
  }
1725
1731
  });
1726
1732
  if (y.status)
1727
1733
  try {
1728
- const d = await Ot(y.data);
1734
+ const d = await vt(y.data);
1729
1735
  return y = await $({
1730
- accessToken: u,
1736
+ accessToken: l,
1731
1737
  clientId: r,
1732
1738
  type: K.VERIFY_REGISTRATION,
1733
1739
  params: {
1734
1740
  clientId: r,
1735
- id: l?.userId,
1736
- username: l?.username,
1741
+ id: u?.userId,
1742
+ username: u?.username,
1737
1743
  registration: d
1738
1744
  }
1739
1745
  }), !!(y.status && y.data.length > 0);
1740
1746
  } catch {
1741
1747
  return await $({
1742
- accessToken: u,
1748
+ accessToken: l,
1743
1749
  clientId: r,
1744
1750
  type: K.VERIFY_REGISTRATION,
1745
1751
  params: {
1746
1752
  clientId: r,
1747
- id: l?.userId,
1748
- username: l?.username,
1753
+ id: u?.userId,
1754
+ username: u?.username,
1749
1755
  registration: {}
1750
1756
  }
1751
1757
  }), !1;
1752
1758
  }
1753
1759
  return !1;
1754
1760
  }, ft = async () => {
1755
- s({ type: J, payload: { isLoading: !0 } }), V();
1756
- const l = me();
1757
- Re(l), i("loginWithPasskey");
1761
+ s({ type: J, payload: { isLoading: !0 } }), j();
1762
+ const u = me();
1763
+ Re(u), i("loginWithPasskey");
1758
1764
  const y = me();
1759
1765
  let d = await $({
1760
- accessToken: u,
1766
+ accessToken: l,
1761
1767
  clientId: r,
1762
1768
  type: K.GET_AUTHENTICATION_OPTIONS,
1763
1769
  params: {
@@ -1767,47 +1773,48 @@ const Jr = (e) => N(
1767
1773
  });
1768
1774
  if (d.status)
1769
1775
  try {
1770
- const C = await Ct(d.data);
1776
+ const C = await Pt(d.data);
1771
1777
  return d = await $({
1772
- accessToken: u,
1778
+ accessToken: l,
1773
1779
  clientId: r,
1774
1780
  type: K.VERIFY_AUTHENTICATION,
1775
1781
  params: {
1776
1782
  clientId: r,
1777
1783
  id: y,
1778
1784
  authentication: C,
1779
- nonce: l,
1785
+ nonce: u,
1780
1786
  domain: n,
1781
1787
  sessionExpiration: t,
1782
1788
  ua: navigator.userAgent
1783
1789
  }
1784
- }), d.data.status === M ? (f(d.data.idToken), A(d.data.accessToken), de(d.data.refreshToken), s({
1785
- type: te,
1790
+ }), d.data.status === V ? (f(d.data.idToken), A(d.data.accessToken), de(d.data.refreshToken), s({
1791
+ type: re,
1786
1792
  payload: {
1793
+ authenticationType: H.PASSKEY,
1787
1794
  user: {
1788
1795
  userId: d.data.userId,
1789
1796
  username: d.data.username
1790
1797
  }
1791
1798
  }
1792
- }), !0) : (W(we), !1);
1799
+ }), !0) : (Y(we), !1);
1793
1800
  } catch {
1794
1801
  return await $({
1795
- accessToken: u,
1802
+ accessToken: l,
1796
1803
  clientId: r,
1797
1804
  type: K.VERIFY_AUTHENTICATION,
1798
1805
  params: {
1799
1806
  clientId: r,
1800
1807
  id: y,
1801
1808
  authentication: {},
1802
- nonce: l,
1809
+ nonce: u,
1803
1810
  domain: n,
1804
1811
  sessionExpiration: t
1805
1812
  }
1806
- }), W(we), !1;
1813
+ }), Y(we), !1;
1807
1814
  }
1808
1815
  return !1;
1809
1816
  };
1810
- return /* @__PURE__ */ be(Yr.Provider, { value: { state: o, dispatch: s }, children: /* @__PURE__ */ be(
1817
+ return /* @__PURE__ */ be(xr.Provider, { value: { state: o, dispatch: s }, children: /* @__PURE__ */ be(
1811
1818
  ot.Provider,
1812
1819
  {
1813
1820
  value: {
@@ -1822,10 +1829,10 @@ const Jr = (e) => N(
1822
1829
  children: e
1823
1830
  }
1824
1831
  ) });
1825
- }, zr = (e = ot) => _t(e);
1832
+ }, qr = (e = ot) => Rt(e);
1826
1833
  export {
1827
- oe as AUTH_TYPES,
1828
- qr as AuthProvider,
1829
- Br as isGranted,
1830
- zr as useAuth
1834
+ H as AUTH_TYPES,
1835
+ Br as AuthProvider,
1836
+ Fr as isGranted,
1837
+ qr as useAuth
1831
1838
  };