@crossauth/frontend 0.0.30 → 0.0.33

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,13 +1,13 @@
1
- var Ie = Object.defineProperty;
1
+ var Ue = Object.defineProperty;
2
2
  var ce = (r) => {
3
3
  throw TypeError(r);
4
4
  };
5
- var Ue = (r, e, t) => e in r ? Ie(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
6
- var f = (r, e, t) => Ue(r, typeof e != "symbol" ? e + "" : e, t), de = (r, e, t) => e.has(r) || ce("Cannot " + t);
7
- var w = (r, e, t) => (de(r, e, "read from private field"), t ? t.call(r) : e.get(r)), N = (r, e, t) => e.has(r) ? ce("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), b = (r, e, t, o) => (de(r, e, "write to private field"), o ? o.call(r, t) : e.set(r, t), t);
8
- var Oe = Object.defineProperty, ge = (r) => {
5
+ var Oe = (r, e, t) => e in r ? Ue(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
6
+ var f = (r, e, t) => Oe(r, typeof e != "symbol" ? e + "" : e, t), de = (r, e, t) => e.has(r) || ce("Cannot " + t);
7
+ var p = (r, e, t) => (de(r, e, "read from private field"), t ? t.call(r) : e.get(r)), A = (r, e, t) => e.has(r) ? ce("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), T = (r, e, t, o) => (de(r, e, "write to private field"), o ? o.call(r, t) : e.set(r, t), t);
8
+ var Ne = Object.defineProperty, ye = (r) => {
9
9
  throw TypeError(r);
10
- }, Ne = (r, e, t) => e in r ? Oe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, l = (r, e, t) => Ne(r, typeof e != "symbol" ? e + "" : e, t), pe = (r, e, t) => e.has(r) || ge("Cannot " + t), p = (r, e, t) => (pe(r, e, "read from private field"), t ? t.call(r) : e.get(r)), $ = (r, e, t) => e.has(r) ? ge("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), A = (r, e, t, o) => (pe(r, e, "write to private field"), e.set(r, t), t);
10
+ }, He = (r, e, t) => e in r ? Ne(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, l = (r, e, t) => He(r, typeof e != "symbol" ? e + "" : e, t), we = (r, e, t) => e.has(r) || ye("Cannot " + t), w = (r, e, t) => (we(r, e, "read from private field"), e.get(r)), he = (r, e, t) => e.has(r) ? ye("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), Y = (r, e, t, o) => (we(r, e, "write to private field"), e.set(r, t), t);
11
11
  class H {
12
12
  }
13
13
  l(H, "active", "active"), /** Deactivated account. User cannot log in */
@@ -52,18 +52,18 @@ l(H, "factor2ResetNeeded", "factor2resetneeded"), /**
52
52
  * Upon login, the user is redirected to the reset password page.
53
53
  */
54
54
  l(H, "passwordAndFactor2ResetNeeded", "passwordandfactor2resetneeded");
55
- class P {
55
+ class R {
56
56
  }
57
- l(P, "session", "s:"), /** Password Reset Token */
58
- l(P, "passwordResetToken", "p:"), /** Email verification token */
59
- l(P, "emailVerificationToken", "e:"), /** API key */
60
- l(P, "apiKey", "api:"), /** OAuth authorization code */
61
- l(P, "authorizationCode", "authz:"), /** OAuth access token */
62
- l(P, "accessToken", "access:"), /** OAuth refresh token */
63
- l(P, "refreshToken", "refresh:"), /** OAuth MFA key (used by the password MFA flow) */
64
- l(P, "mfaToken", "omfa:"), /** Device code device code */
65
- l(P, "deviceCode", "dc:"), /** Device code flow user code */
66
- l(P, "userCode", "uc:");
57
+ l(R, "session", "s:"), /** Password Reset Token */
58
+ l(R, "passwordResetToken", "p:"), /** Email verification token */
59
+ l(R, "emailVerificationToken", "e:"), /** API key */
60
+ l(R, "apiKey", "api:"), /** OAuth authorization code */
61
+ l(R, "authorizationCode", "authz:"), /** OAuth access token */
62
+ l(R, "accessToken", "access:"), /** OAuth refresh token */
63
+ l(R, "refreshToken", "refresh:"), /** OAuth MFA key (used by the password MFA flow) */
64
+ l(R, "mfaToken", "omfa:"), /** Device code device code */
65
+ l(R, "deviceCode", "dc:"), /** Device code flow user code */
66
+ l(R, "userCode", "uc:");
67
67
  var m = /* @__PURE__ */ ((r) => (r[r.UserNotExist = 0] = "UserNotExist", r[r.PasswordInvalid = 1] = "PasswordInvalid", r[r.EmailNotExist = 2] = "EmailNotExist", r[r.UsernameOrPasswordInvalid = 3] = "UsernameOrPasswordInvalid", r[r.InvalidClientId = 4] = "InvalidClientId", r[r.ClientExists = 5] = "ClientExists", r[r.InvalidClientSecret = 6] = "InvalidClientSecret", r[r.InvalidClientIdOrSecret = 7] = "InvalidClientIdOrSecret", r[r.InvalidRedirectUri = 8] = "InvalidRedirectUri", r[r.InvalidOAuthFlow = 9] = "InvalidOAuthFlow", r[r.UserNotActive = 10] = "UserNotActive", r[r.EmailNotVerified = 11] = "EmailNotVerified", r[r.TwoFactorIncomplete = 12] = "TwoFactorIncomplete", r[r.Unauthorized = 13] = "Unauthorized", r[r.UnauthorizedClient = 14] = "UnauthorizedClient", r[r.InvalidScope = 15] = "InvalidScope", r[r.InsufficientScope = 16] = "InsufficientScope", r[r.InsufficientPriviledges = 17] = "InsufficientPriviledges", r[r.Forbidden = 18] = "Forbidden", r[r.InvalidKey = 19] = "InvalidKey", r[r.InvalidCsrf = 20] = "InvalidCsrf", r[r.InvalidSession = 21] = "InvalidSession", r[r.Expired = 22] = "Expired", r[r.Connection = 23] = "Connection", r[r.InvalidHash = 24] = "InvalidHash", r[r.UnsupportedAlgorithm = 25] = "UnsupportedAlgorithm", r[r.KeyExists = 26] = "KeyExists", r[r.PasswordChangeNeeded = 27] = "PasswordChangeNeeded", r[r.PasswordResetNeeded = 28] = "PasswordResetNeeded", r[r.Factor2ResetNeeded = 29] = "Factor2ResetNeeded", r[r.Configuration = 30] = "Configuration", r[r.InvalidEmail = 31] = "InvalidEmail", r[r.InvalidPhoneNumber = 32] = "InvalidPhoneNumber", r[r.InvalidUsername = 33] = "InvalidUsername", r[r.PasswordMatch = 34] = "PasswordMatch", r[r.InvalidToken = 35] = "InvalidToken", r[r.MfaRequired = 36] = "MfaRequired", r[r.PasswordFormat = 37] = "PasswordFormat", r[r.DataFormat = 38] = "DataFormat", r[r.FetchError = 39] = "FetchError", r[r.UserExists = 40] = "UserExists", r[r.FormEntry = 41] = "FormEntry", r[r.BadRequest = 42] = "BadRequest", r[r.AuthorizationPending = 43] = "AuthorizationPending", r[r.SlowDown = 44] = "SlowDown", r[r.ExpiredToken = 45] = "ExpiredToken", r[r.ConstraintViolation = 46] = "ConstraintViolation", r[r.NotImplemented = 47] = "NotImplemented", r[r.UnknownError = 48] = "UnknownError", r))(m || {});
68
68
  class g extends Error {
69
69
  /**
@@ -189,7 +189,7 @@ class g extends Error {
189
189
  return "message" in e && (o = e.message), new g(48, o);
190
190
  }
191
191
  }
192
- const W = class E {
192
+ const W = class P {
193
193
  /**
194
194
  * Create a logger with the given level
195
195
  * @param level the level to report to
@@ -198,9 +198,9 @@ const W = class E {
198
198
  if (l(this, "level"), e) this.level = e;
199
199
  else if (typeof process < "u" && "CROSSAUTH_LOG_LEVEL" in process.env) {
200
200
  const t = (process.env.CROSSAUTH_LOG_LEVEL ?? "ERROR").toUpperCase();
201
- E.levelName.includes(t) ? this.level = E.levelName.indexOf(t) : this.level = E.Error;
201
+ P.levelName.includes(t) ? this.level = P.levelName.indexOf(t) : this.level = P.Error;
202
202
  } else
203
- this.level = E.Error;
203
+ this.level = P.Error;
204
204
  }
205
205
  /**
206
206
  * Return the singleton instance of the logger.
@@ -213,35 +213,35 @@ const W = class E {
213
213
  this.level = e;
214
214
  }
215
215
  log(e, t) {
216
- e <= this.level && (typeof t == "string" ? console.log("Crossauth " + E.levelName[e] + " " + (/* @__PURE__ */ new Date()).toISOString(), t) : console.log(JSON.stringify({ level: E.levelName[e], time: (/* @__PURE__ */ new Date()).toISOString(), ...t })));
216
+ e <= this.level && (typeof t == "string" ? console.log("Crossauth " + P.levelName[e] + " " + (/* @__PURE__ */ new Date()).toISOString(), t) : console.log(JSON.stringify({ level: P.levelName[e], time: (/* @__PURE__ */ new Date()).toISOString(), ...t })));
217
217
  }
218
218
  /**
219
219
  * Report an error
220
220
  * @param output object to output
221
221
  */
222
222
  error(e) {
223
- this.log(E.Error, e);
223
+ this.log(P.Error, e);
224
224
  }
225
225
  /**
226
226
  * Report an warning
227
227
  * @param output object to output
228
228
  */
229
229
  warn(e) {
230
- this.log(E.Warn, e);
230
+ this.log(P.Warn, e);
231
231
  }
232
232
  /**
233
233
  * Report information
234
234
  * @param output object to output
235
235
  */
236
236
  info(e) {
237
- this.log(E.Info, e);
237
+ this.log(P.Info, e);
238
238
  }
239
239
  /**
240
240
  * Print a debugging message
241
241
  * @param output object to output
242
242
  */
243
243
  debug(e) {
244
- this.log(E.Debug, e);
244
+ this.log(P.Debug, e);
245
245
  }
246
246
  /**
247
247
  * Override the default logger.
@@ -262,7 +262,7 @@ l(W, "Error", 1), /** Log errors and warning */
262
262
  l(W, "Warn", 2), /** Log errors, warnings and info messages */
263
263
  l(W, "Info", 3), /** Log everything */
264
264
  l(W, "Debug", 4), l(W, "levelName", ["NONE", "ERROR", "WARN", "INFO", "DEBUG"]);
265
- let c = W;
265
+ let d = W;
266
266
  function h(r) {
267
267
  let e;
268
268
  typeof r == "object" && "err" in r && typeof r.err == "object" && (e = r.err.stack);
@@ -284,9 +284,9 @@ function h(r) {
284
284
  }
285
285
  return typeof r == "string" || globalThis.crossauthLoggerAcceptsJson ? r : JSON.stringify(r);
286
286
  }
287
- globalThis.crossauthLogger = new c(c.None);
287
+ globalThis.crossauthLogger = new d(d.None);
288
288
  globalThis.crossauthLoggerAcceptsJson = !0;
289
- const ye = {
289
+ const me = {
290
290
  issuer: "",
291
291
  authorization_endpoint: "",
292
292
  token_endpoint: "",
@@ -301,8 +301,8 @@ const ye = {
301
301
  request_parameter_supported: !1,
302
302
  request_uri_parameter_supported: !0,
303
303
  require_request_uri_registration: !1
304
- }, te = crypto, we = (r) => r instanceof CryptoKey, X = new TextEncoder(), G = new TextDecoder();
305
- function He(...r) {
304
+ }, te = crypto, ve = (r) => r instanceof CryptoKey, X = new TextEncoder(), G = new TextDecoder();
305
+ function je(...r) {
306
306
  const e = r.reduce((i, { length: n }) => i + n, 0), t = new Uint8Array(e);
307
307
  let o = 0;
308
308
  for (const i of r)
@@ -314,7 +314,7 @@ const xe = (r) => {
314
314
  for (let o = 0; o < e.length; o++)
315
315
  t[o] = e.charCodeAt(o);
316
316
  return t;
317
- }, M = (r) => {
317
+ }, F = (r) => {
318
318
  let e = r;
319
319
  e instanceof Uint8Array && (e = G.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
320
320
  try {
@@ -332,7 +332,7 @@ class oe extends Error {
332
332
  super(e), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (t = Error.captureStackTrace) == null || t.call(Error, this, this.constructor);
333
333
  }
334
334
  }
335
- class I extends oe {
335
+ class U extends oe {
336
336
  constructor() {
337
337
  super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
338
338
  }
@@ -348,7 +348,7 @@ class S extends oe {
348
348
  return "ERR_JWS_INVALID";
349
349
  }
350
350
  }
351
- class z extends oe {
351
+ class D extends oe {
352
352
  constructor() {
353
353
  super(...arguments), this.code = "ERR_JWT_INVALID";
354
354
  }
@@ -356,7 +356,7 @@ class z extends oe {
356
356
  return "ERR_JWT_INVALID";
357
357
  }
358
358
  }
359
- class je extends oe {
359
+ class Ke extends oe {
360
360
  constructor() {
361
361
  super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
362
362
  }
@@ -364,16 +364,16 @@ class je extends oe {
364
364
  return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
365
365
  }
366
366
  }
367
- function U(r, e = "algorithm.name") {
367
+ function O(r, e = "algorithm.name") {
368
368
  return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${r}`);
369
369
  }
370
- function Q(r, e) {
370
+ function Z(r, e) {
371
371
  return r.name === e;
372
372
  }
373
373
  function ie(r) {
374
374
  return parseInt(r.name.slice(4), 10);
375
375
  }
376
- function Ke(r) {
376
+ function ze(r) {
377
377
  switch (r) {
378
378
  case "ES256":
379
379
  return "P-256";
@@ -395,51 +395,51 @@ function De(r, e) {
395
395
  throw new TypeError(t);
396
396
  }
397
397
  }
398
- function ze(r, e, ...t) {
398
+ function We(r, e, ...t) {
399
399
  switch (e) {
400
400
  case "HS256":
401
401
  case "HS384":
402
402
  case "HS512": {
403
- if (!Q(r.algorithm, "HMAC"))
404
- throw U("HMAC");
403
+ if (!Z(r.algorithm, "HMAC"))
404
+ throw O("HMAC");
405
405
  const o = parseInt(e.slice(2), 10);
406
406
  if (ie(r.algorithm.hash) !== o)
407
- throw U(`SHA-${o}`, "algorithm.hash");
407
+ throw O(`SHA-${o}`, "algorithm.hash");
408
408
  break;
409
409
  }
410
410
  case "RS256":
411
411
  case "RS384":
412
412
  case "RS512": {
413
- if (!Q(r.algorithm, "RSASSA-PKCS1-v1_5"))
414
- throw U("RSASSA-PKCS1-v1_5");
413
+ if (!Z(r.algorithm, "RSASSA-PKCS1-v1_5"))
414
+ throw O("RSASSA-PKCS1-v1_5");
415
415
  const o = parseInt(e.slice(2), 10);
416
416
  if (ie(r.algorithm.hash) !== o)
417
- throw U(`SHA-${o}`, "algorithm.hash");
417
+ throw O(`SHA-${o}`, "algorithm.hash");
418
418
  break;
419
419
  }
420
420
  case "PS256":
421
421
  case "PS384":
422
422
  case "PS512": {
423
- if (!Q(r.algorithm, "RSA-PSS"))
424
- throw U("RSA-PSS");
423
+ if (!Z(r.algorithm, "RSA-PSS"))
424
+ throw O("RSA-PSS");
425
425
  const o = parseInt(e.slice(2), 10);
426
426
  if (ie(r.algorithm.hash) !== o)
427
- throw U(`SHA-${o}`, "algorithm.hash");
427
+ throw O(`SHA-${o}`, "algorithm.hash");
428
428
  break;
429
429
  }
430
430
  case "EdDSA": {
431
431
  if (r.algorithm.name !== "Ed25519" && r.algorithm.name !== "Ed448")
432
- throw U("Ed25519 or Ed448");
432
+ throw O("Ed25519 or Ed448");
433
433
  break;
434
434
  }
435
435
  case "ES256":
436
436
  case "ES384":
437
437
  case "ES512": {
438
- if (!Q(r.algorithm, "ECDSA"))
439
- throw U("ECDSA");
440
- const o = Ke(e);
438
+ if (!Z(r.algorithm, "ECDSA"))
439
+ throw O("ECDSA");
440
+ const o = ze(e);
441
441
  if (r.algorithm.namedCurve !== o)
442
- throw U(o, "algorithm.namedCurve");
442
+ throw O(o, "algorithm.namedCurve");
443
443
  break;
444
444
  }
445
445
  default:
@@ -447,7 +447,7 @@ function ze(r, e, ...t) {
447
447
  }
448
448
  De(r, t);
449
449
  }
450
- function me(r, e, ...t) {
450
+ function ke(r, e, ...t) {
451
451
  var o;
452
452
  if (t.length > 2) {
453
453
  const i = t.pop();
@@ -455,11 +455,11 @@ function me(r, e, ...t) {
455
455
  } else t.length === 2 ? r += `one of type ${t[0]} or ${t[1]}.` : r += `of type ${t[0]}.`;
456
456
  return e == null ? r += ` Received ${e}` : typeof e == "function" && e.name ? r += ` Received function ${e.name}` : typeof e == "object" && e != null && (o = e.constructor) != null && o.name && (r += ` Received an instance of ${e.constructor.name}`), r;
457
457
  }
458
- const he = (r, ...e) => me("Key must be ", r, ...e);
459
- function ve(r, e, ...t) {
460
- return me(`Key for the ${r} algorithm must be `, e, ...t);
458
+ const le = (r, ...e) => ke("Key must be ", r, ...e);
459
+ function Ce(r, e, ...t) {
460
+ return ke(`Key for the ${r} algorithm must be `, e, ...t);
461
461
  }
462
- const ke = (r) => we(r) ? !0 : (r == null ? void 0 : r[Symbol.toStringTag]) === "KeyObject", re = ["CryptoKey"], We = (...r) => {
462
+ const _e = (r) => ve(r) ? !0 : (r == null ? void 0 : r[Symbol.toStringTag]) === "KeyObject", re = ["CryptoKey"], Fe = (...r) => {
463
463
  const e = r.filter(Boolean);
464
464
  if (e.length === 0 || e.length === 1)
465
465
  return !0;
@@ -478,11 +478,11 @@ const ke = (r) => we(r) ? !0 : (r == null ? void 0 : r[Symbol.toStringTag]) ===
478
478
  }
479
479
  return !0;
480
480
  };
481
- function Fe(r) {
481
+ function Je(r) {
482
482
  return typeof r == "object" && r !== null;
483
483
  }
484
- function V(r) {
485
- if (!Fe(r) || Object.prototype.toString.call(r) !== "[object Object]")
484
+ function $(r) {
485
+ if (!Je(r) || Object.prototype.toString.call(r) !== "[object Object]")
486
486
  return !1;
487
487
  if (Object.getPrototypeOf(r) === null)
488
488
  return !0;
@@ -491,14 +491,14 @@ function V(r) {
491
491
  e = Object.getPrototypeOf(e);
492
492
  return Object.getPrototypeOf(r) === e;
493
493
  }
494
- const Je = (r, e) => {
494
+ const Me = (r, e) => {
495
495
  if (r.startsWith("RS") || r.startsWith("PS")) {
496
496
  const { modulusLength: t } = e.algorithm;
497
497
  if (typeof t != "number" || t < 2048)
498
498
  throw new TypeError(`${r} requires key modulusLength to be 2048 bits or larger`);
499
499
  }
500
500
  };
501
- function Me(r) {
501
+ function Be(r) {
502
502
  let e, t;
503
503
  switch (r.kty) {
504
504
  case "RSA": {
@@ -523,7 +523,7 @@ function Me(r) {
523
523
  }, t = r.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
524
524
  break;
525
525
  default:
526
- throw new I('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
526
+ throw new U('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
527
527
  }
528
528
  break;
529
529
  }
@@ -545,7 +545,7 @@ function Me(r) {
545
545
  e = { name: "ECDH", namedCurve: r.crv }, t = r.d ? ["deriveBits"] : [];
546
546
  break;
547
547
  default:
548
- throw new I('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
548
+ throw new U('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
549
549
  }
550
550
  break;
551
551
  }
@@ -561,83 +561,83 @@ function Me(r) {
561
561
  e = { name: r.crv }, t = r.d ? ["deriveBits"] : [];
562
562
  break;
563
563
  default:
564
- throw new I('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
564
+ throw new U('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
565
565
  }
566
566
  break;
567
567
  }
568
568
  default:
569
- throw new I('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
569
+ throw new U('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
570
570
  }
571
571
  return { algorithm: e, keyUsages: t };
572
572
  }
573
- const Ce = async (r) => {
573
+ const Se = async (r) => {
574
574
  if (!r.alg)
575
575
  throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
576
- const { algorithm: e, keyUsages: t } = Me(r), o = [
576
+ const { algorithm: e, keyUsages: t } = Be(r), o = [
577
577
  e,
578
578
  r.ext ?? !1,
579
579
  r.key_ops ?? t
580
580
  ], i = { ...r };
581
581
  return delete i.alg, delete i.use, te.subtle.importKey("jwk", i, ...o);
582
- }, _e = (r) => M(r);
582
+ }, Te = (r) => F(r);
583
583
  let se, ne;
584
- const Se = (r) => (r == null ? void 0 : r[Symbol.toStringTag]) === "KeyObject", Te = async (r, e, t, o) => {
584
+ const be = (r) => (r == null ? void 0 : r[Symbol.toStringTag]) === "KeyObject", Ee = async (r, e, t, o) => {
585
585
  let i = r.get(e);
586
586
  if (i != null && i[o])
587
587
  return i[o];
588
- const n = await Ce({ ...t, alg: o });
588
+ const n = await Se({ ...t, alg: o });
589
589
  return i ? i[o] = n : r.set(e, { [o]: n }), n;
590
- }, Be = (r, e) => {
591
- if (Se(r)) {
590
+ }, Le = (r, e) => {
591
+ if (be(r)) {
592
592
  let t = r.export({ format: "jwk" });
593
- return delete t.d, delete t.dp, delete t.dq, delete t.p, delete t.q, delete t.qi, t.k ? _e(t.k) : (ne || (ne = /* @__PURE__ */ new WeakMap()), Te(ne, r, t, e));
593
+ return delete t.d, delete t.dp, delete t.dq, delete t.p, delete t.q, delete t.qi, t.k ? Te(t.k) : (ne || (ne = /* @__PURE__ */ new WeakMap()), Ee(ne, r, t, e));
594
594
  }
595
595
  return r;
596
- }, Le = (r, e) => {
597
- if (Se(r)) {
596
+ }, $e = (r, e) => {
597
+ if (be(r)) {
598
598
  let t = r.export({ format: "jwk" });
599
- return t.k ? _e(t.k) : (se || (se = /* @__PURE__ */ new WeakMap()), Te(se, r, t, e));
599
+ return t.k ? Te(t.k) : (se || (se = /* @__PURE__ */ new WeakMap()), Ee(se, r, t, e));
600
600
  }
601
601
  return r;
602
- }, $e = { normalizePublicKey: Be, normalizePrivateKey: Le }, x = (r, e, t = 0) => {
602
+ }, qe = { normalizePublicKey: Le, normalizePrivateKey: $e }, j = (r, e, t = 0) => {
603
603
  t === 0 && (e.unshift(e.length), e.unshift(6));
604
604
  const o = r.indexOf(e[0], t);
605
605
  if (o === -1)
606
606
  return !1;
607
607
  const i = r.subarray(o, o + e.length);
608
- return i.length !== e.length ? !1 : i.every((n, s) => n === e[s]) || x(r, e, o + 1);
609
- }, le = (r) => {
608
+ return i.length !== e.length ? !1 : i.every((n, s) => n === e[s]) || j(r, e, o + 1);
609
+ }, ue = (r) => {
610
610
  switch (!0) {
611
- case x(r, [42, 134, 72, 206, 61, 3, 1, 7]):
611
+ case j(r, [42, 134, 72, 206, 61, 3, 1, 7]):
612
612
  return "P-256";
613
- case x(r, [43, 129, 4, 0, 34]):
613
+ case j(r, [43, 129, 4, 0, 34]):
614
614
  return "P-384";
615
- case x(r, [43, 129, 4, 0, 35]):
615
+ case j(r, [43, 129, 4, 0, 35]):
616
616
  return "P-521";
617
- case x(r, [43, 101, 110]):
617
+ case j(r, [43, 101, 110]):
618
618
  return "X25519";
619
- case x(r, [43, 101, 111]):
619
+ case j(r, [43, 101, 111]):
620
620
  return "X448";
621
- case x(r, [43, 101, 112]):
621
+ case j(r, [43, 101, 112]):
622
622
  return "Ed25519";
623
- case x(r, [43, 101, 113]):
623
+ case j(r, [43, 101, 113]):
624
624
  return "Ed448";
625
625
  default:
626
- throw new I("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
626
+ throw new U("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
627
627
  }
628
- }, be = async (r, e, t, o, i) => {
628
+ }, Ae = async (r, e, t, o, i) => {
629
629
  let n, s;
630
- const a = new Uint8Array(atob(t.replace(r, "")).split("").map((u) => u.charCodeAt(0))), d = e === "spki";
630
+ const a = new Uint8Array(atob(t.replace(r, "")).split("").map((u) => u.charCodeAt(0))), c = e === "spki";
631
631
  switch (o) {
632
632
  case "PS256":
633
633
  case "PS384":
634
634
  case "PS512":
635
- n = { name: "RSA-PSS", hash: `SHA-${o.slice(-3)}` }, s = d ? ["verify"] : ["sign"];
635
+ n = { name: "RSA-PSS", hash: `SHA-${o.slice(-3)}` }, s = c ? ["verify"] : ["sign"];
636
636
  break;
637
637
  case "RS256":
638
638
  case "RS384":
639
639
  case "RS512":
640
- n = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${o.slice(-3)}` }, s = d ? ["verify"] : ["sign"];
640
+ n = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${o.slice(-3)}` }, s = c ? ["verify"] : ["sign"];
641
641
  break;
642
642
  case "RSA-OAEP":
643
643
  case "RSA-OAEP-256":
@@ -646,81 +646,81 @@ const Se = (r) => (r == null ? void 0 : r[Symbol.toStringTag]) === "KeyObject",
646
646
  n = {
647
647
  name: "RSA-OAEP",
648
648
  hash: `SHA-${parseInt(o.slice(-3), 10) || 1}`
649
- }, s = d ? ["encrypt", "wrapKey"] : ["decrypt", "unwrapKey"];
649
+ }, s = c ? ["encrypt", "wrapKey"] : ["decrypt", "unwrapKey"];
650
650
  break;
651
651
  case "ES256":
652
- n = { name: "ECDSA", namedCurve: "P-256" }, s = d ? ["verify"] : ["sign"];
652
+ n = { name: "ECDSA", namedCurve: "P-256" }, s = c ? ["verify"] : ["sign"];
653
653
  break;
654
654
  case "ES384":
655
- n = { name: "ECDSA", namedCurve: "P-384" }, s = d ? ["verify"] : ["sign"];
655
+ n = { name: "ECDSA", namedCurve: "P-384" }, s = c ? ["verify"] : ["sign"];
656
656
  break;
657
657
  case "ES512":
658
- n = { name: "ECDSA", namedCurve: "P-521" }, s = d ? ["verify"] : ["sign"];
658
+ n = { name: "ECDSA", namedCurve: "P-521" }, s = c ? ["verify"] : ["sign"];
659
659
  break;
660
660
  case "ECDH-ES":
661
661
  case "ECDH-ES+A128KW":
662
662
  case "ECDH-ES+A192KW":
663
663
  case "ECDH-ES+A256KW": {
664
- const u = le(a);
665
- n = u.startsWith("P-") ? { name: "ECDH", namedCurve: u } : { name: u }, s = d ? [] : ["deriveBits"];
664
+ const u = ue(a);
665
+ n = u.startsWith("P-") ? { name: "ECDH", namedCurve: u } : { name: u }, s = c ? [] : ["deriveBits"];
666
666
  break;
667
667
  }
668
668
  case "EdDSA":
669
- n = { name: le(a) }, s = d ? ["verify"] : ["sign"];
669
+ n = { name: ue(a) }, s = c ? ["verify"] : ["sign"];
670
670
  break;
671
671
  default:
672
- throw new I('Invalid or unsupported "alg" (Algorithm) value');
672
+ throw new U('Invalid or unsupported "alg" (Algorithm) value');
673
673
  }
674
674
  return te.subtle.importKey(e, a, n, !1, s);
675
- }, qe = (r, e, t) => be(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, "pkcs8", r, e), Ve = (r, e, t) => be(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", r, e);
676
- async function Ge(r, e, t) {
675
+ }, Ve = (r, e, t) => Ae(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, "pkcs8", r, e), Ge = (r, e, t) => Ae(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", r, e);
676
+ async function Ye(r, e, t) {
677
677
  if (typeof r != "string" || r.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
678
678
  throw new TypeError('"spki" must be SPKI formatted string');
679
- return Ve(r, e);
679
+ return Ge(r, e);
680
680
  }
681
- async function Ye(r, e, t) {
681
+ async function Xe(r, e, t) {
682
682
  if (typeof r != "string" || r.indexOf("-----BEGIN PRIVATE KEY-----") !== 0)
683
683
  throw new TypeError('"pkcs8" must be PKCS#8 formatted string');
684
- return qe(r, e);
684
+ return Ve(r, e);
685
685
  }
686
- async function ue(r, e) {
687
- if (!V(r))
686
+ async function fe(r, e) {
687
+ if (!$(r))
688
688
  throw new TypeError("JWK must be an object");
689
689
  switch (e || (e = r.alg), r.kty) {
690
690
  case "oct":
691
691
  if (typeof r.k != "string" || !r.k)
692
692
  throw new TypeError('missing "k" (Key Value) Parameter value');
693
- return M(r.k);
693
+ return F(r.k);
694
694
  case "RSA":
695
695
  if (r.oth !== void 0)
696
- throw new I('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
696
+ throw new U('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
697
697
  case "EC":
698
698
  case "OKP":
699
- return Ce({ ...r, alg: e });
699
+ return Se({ ...r, alg: e });
700
700
  default:
701
- throw new I('Unsupported "kty" (Key Type) Parameter value');
701
+ throw new U('Unsupported "kty" (Key Type) Parameter value');
702
702
  }
703
703
  }
704
- const ee = (r) => r == null ? void 0 : r[Symbol.toStringTag], Xe = (r, e) => {
704
+ const ee = (r) => r == null ? void 0 : r[Symbol.toStringTag], Ze = (r, e) => {
705
705
  if (!(e instanceof Uint8Array)) {
706
- if (!ke(e))
707
- throw new TypeError(ve(r, e, ...re, "Uint8Array"));
706
+ if (!_e(e))
707
+ throw new TypeError(Ce(r, e, ...re, "Uint8Array"));
708
708
  if (e.type !== "secret")
709
709
  throw new TypeError(`${ee(e)} instances for symmetric algorithms must be of type "secret"`);
710
710
  }
711
711
  }, Qe = (r, e, t) => {
712
- if (!ke(e))
713
- throw new TypeError(ve(r, e, ...re));
712
+ if (!_e(e))
713
+ throw new TypeError(Ce(r, e, ...re));
714
714
  if (e.type === "secret")
715
715
  throw new TypeError(`${ee(e)} instances for asymmetric algorithms must not be of type "secret"`);
716
716
  if (e.algorithm && t === "verify" && e.type === "private")
717
717
  throw new TypeError(`${ee(e)} instances for asymmetric algorithm verifying must be of type "public"`);
718
718
  if (e.algorithm && t === "encrypt" && e.type === "private")
719
719
  throw new TypeError(`${ee(e)} instances for asymmetric algorithm encryption must be of type "public"`);
720
- }, Ze = (r, e, t) => {
721
- r.startsWith("HS") || r === "dir" || r.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(r) ? Xe(r, e) : Qe(r, e, t);
720
+ }, er = (r, e, t) => {
721
+ r.startsWith("HS") || r === "dir" || r.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(r) ? Ze(r, e) : Qe(r, e, t);
722
722
  };
723
- function er(r, e, t, o, i) {
723
+ function rr(r, e, t, o, i) {
724
724
  if (i.crit !== void 0 && (o == null ? void 0 : o.crit) === void 0)
725
725
  throw new r('"crit" (Critical) Header Parameter MUST be integrity protected');
726
726
  if (!o || o.crit === void 0)
@@ -731,7 +731,7 @@ function er(r, e, t, o, i) {
731
731
  n = e;
732
732
  for (const s of o.crit) {
733
733
  if (!n.has(s))
734
- throw new I(`Extension Header Parameter "${s}" is not recognized`);
734
+ throw new U(`Extension Header Parameter "${s}" is not recognized`);
735
735
  if (i[s] === void 0)
736
736
  throw new r(`Extension Header Parameter "${s}" is missing`);
737
737
  if (n.get(s) && o[s] === void 0)
@@ -739,7 +739,7 @@ function er(r, e, t, o, i) {
739
739
  }
740
740
  return new Set(o.crit);
741
741
  }
742
- function rr(r, e) {
742
+ function tr(r, e) {
743
743
  const t = `SHA-${r.slice(-3)}`;
744
744
  switch (r) {
745
745
  case "HS256":
@@ -761,31 +761,31 @@ function rr(r, e) {
761
761
  case "EdDSA":
762
762
  return { name: e.name };
763
763
  default:
764
- throw new I(`alg ${r} is not supported either by JOSE or your javascript runtime`);
764
+ throw new U(`alg ${r} is not supported either by JOSE or your javascript runtime`);
765
765
  }
766
766
  }
767
- async function tr(r, e, t) {
768
- if (e = await $e.normalizePublicKey(e, r), we(e))
769
- return ze(e, r, t), e;
767
+ async function or(r, e, t) {
768
+ if (e = await qe.normalizePublicKey(e, r), ve(e))
769
+ return We(e, r, t), e;
770
770
  if (e instanceof Uint8Array) {
771
771
  if (!r.startsWith("HS"))
772
- throw new TypeError(he(e, ...re));
772
+ throw new TypeError(le(e, ...re));
773
773
  return te.subtle.importKey("raw", e, { hash: `SHA-${r.slice(-3)}`, name: "HMAC" }, !1, [t]);
774
774
  }
775
- throw new TypeError(he(e, ...re, "Uint8Array"));
775
+ throw new TypeError(le(e, ...re, "Uint8Array"));
776
776
  }
777
- const or = async (r, e, t, o) => {
778
- const i = await tr(r, e, "verify");
779
- Je(r, i);
780
- const n = rr(r, i.algorithm);
777
+ const ir = async (r, e, t, o) => {
778
+ const i = await or(r, e, "verify");
779
+ Me(r, i);
780
+ const n = tr(r, i.algorithm);
781
781
  try {
782
782
  return await te.subtle.verify(n, i, t, o);
783
783
  } catch {
784
784
  return !1;
785
785
  }
786
786
  };
787
- async function ir(r, e, t) {
788
- if (!V(r))
787
+ async function sr(r, e, t) {
788
+ if (!$(r))
789
789
  throw new S("Flattened JWS must be an object");
790
790
  if (r.protected === void 0 && r.header === void 0)
791
791
  throw new S('Flattened JWS must have either of the "protected" or "header" members');
@@ -795,22 +795,22 @@ async function ir(r, e, t) {
795
795
  throw new S("JWS Payload missing");
796
796
  if (typeof r.signature != "string")
797
797
  throw new S("JWS Signature missing or incorrect type");
798
- if (r.header !== void 0 && !V(r.header))
798
+ if (r.header !== void 0 && !$(r.header))
799
799
  throw new S("JWS Unprotected Header incorrect type");
800
800
  let o = {};
801
801
  if (r.protected)
802
802
  try {
803
- const Re = M(r.protected);
804
- o = JSON.parse(G.decode(Re));
803
+ const L = F(r.protected);
804
+ o = JSON.parse(G.decode(L));
805
805
  } catch {
806
806
  throw new S("JWS Protected Header is invalid");
807
807
  }
808
- if (!We(o, r.header))
808
+ if (!Fe(o, r.header))
809
809
  throw new S("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
810
810
  const i = {
811
811
  ...o,
812
812
  ...r.header
813
- }, n = er(S, /* @__PURE__ */ new Map([["b64", !0]]), void 0, o, i);
813
+ }, n = rr(S, /* @__PURE__ */ new Map([["b64", !0]]), void 0, o, i);
814
814
  let s = !0;
815
815
  if (n.has("b64") && (s = o.b64, typeof s != "boolean"))
816
816
  throw new S('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
@@ -822,39 +822,39 @@ async function ir(r, e, t) {
822
822
  throw new S("JWS Payload must be a string");
823
823
  } else if (typeof r.payload != "string" && !(r.payload instanceof Uint8Array))
824
824
  throw new S("JWS Payload must be a string or an Uint8Array instance");
825
- let d = !1;
826
- typeof e == "function" && (e = await e(o, r), d = !0), Ze(a, e, "verify");
827
- const u = He(X.encode(r.protected ?? ""), X.encode("."), typeof r.payload == "string" ? X.encode(r.payload) : r.payload);
825
+ let c = !1;
826
+ typeof e == "function" && (e = await e(o, r), c = !0), er(a, e, "verify");
827
+ const u = je(X.encode(r.protected ?? ""), X.encode("."), typeof r.payload == "string" ? X.encode(r.payload) : r.payload);
828
828
  let y;
829
829
  try {
830
- y = M(r.signature);
830
+ y = F(r.signature);
831
831
  } catch {
832
832
  throw new S("Failed to base64url decode the signature");
833
833
  }
834
- if (!await or(a, e, y, u))
835
- throw new je();
834
+ if (!await ir(a, e, y, u))
835
+ throw new Ke();
836
836
  let k;
837
837
  if (s)
838
838
  try {
839
- k = M(r.payload);
839
+ k = F(r.payload);
840
840
  } catch {
841
841
  throw new S("Failed to base64url decode the payload");
842
842
  }
843
843
  else typeof r.payload == "string" ? k = X.encode(r.payload) : k = r.payload;
844
- const Y = { payload: k };
845
- return r.protected !== void 0 && (Y.protectedHeader = o), r.header !== void 0 && (Y.unprotectedHeader = r.header), d ? { ...Y, key: e } : Y;
844
+ const E = { payload: k };
845
+ return r.protected !== void 0 && (E.protectedHeader = o), r.header !== void 0 && (E.unprotectedHeader = r.header), c ? { ...E, key: e } : E;
846
846
  }
847
- async function sr(r, e, t) {
847
+ async function nr(r, e, t) {
848
848
  if (r instanceof Uint8Array && (r = G.decode(r)), typeof r != "string")
849
849
  throw new S("Compact JWS must be a string or Uint8Array");
850
850
  const { 0: o, 1: i, 2: n, length: s } = r.split(".");
851
851
  if (s !== 3)
852
852
  throw new S("Invalid Compact JWS");
853
- const a = await ir({ payload: i, protected: o, signature: n }, e), d = { payload: a.payload, protectedHeader: a.protectedHeader };
854
- return typeof e == "function" ? { ...d, key: a.key } : d;
853
+ const a = await sr({ payload: i, protected: o, signature: n }, e), c = { payload: a.payload, protectedHeader: a.protectedHeader };
854
+ return typeof e == "function" ? { ...c, key: a.key } : c;
855
855
  }
856
- const Ee = M;
857
- function nr(r) {
856
+ const Pe = F;
857
+ function ge(r) {
858
858
  let e;
859
859
  if (typeof r == "string") {
860
860
  const t = r.split(".");
@@ -867,8 +867,8 @@ function nr(r) {
867
867
  try {
868
868
  if (typeof e != "string" || !e)
869
869
  throw new Error();
870
- const t = JSON.parse(G.decode(Ee(e)));
871
- if (!V(t))
870
+ const t = JSON.parse(G.decode(Pe(e)));
871
+ if (!$(t))
872
872
  throw new Error();
873
873
  return t;
874
874
  } catch {
@@ -877,28 +877,28 @@ function nr(r) {
877
877
  }
878
878
  function ar(r) {
879
879
  if (typeof r != "string")
880
- throw new z("JWTs must use Compact JWS serialization, JWT must be a string");
880
+ throw new D("JWTs must use Compact JWS serialization, JWT must be a string");
881
881
  const { 1: e, length: t } = r.split(".");
882
882
  if (t === 5)
883
- throw new z("Only JWTs using Compact JWS serialization can be decoded");
883
+ throw new D("Only JWTs using Compact JWS serialization can be decoded");
884
884
  if (t !== 3)
885
- throw new z("Invalid JWT");
885
+ throw new D("Invalid JWT");
886
886
  if (!e)
887
- throw new z("JWTs must contain a payload");
887
+ throw new D("JWTs must contain a payload");
888
888
  let o;
889
889
  try {
890
- o = Ee(e);
890
+ o = Pe(e);
891
891
  } catch {
892
- throw new z("Failed to base64url decode the payload");
892
+ throw new D("Failed to base64url decode the payload");
893
893
  }
894
894
  let i;
895
895
  try {
896
896
  i = JSON.parse(G.decode(o));
897
897
  } catch {
898
- throw new z("Failed to parse the decoded payload as JSON");
898
+ throw new D("Failed to parse the decoded payload as JSON");
899
899
  }
900
- if (!V(i))
901
- throw new z("Invalid JWT Claims Set");
900
+ if (!$(i))
901
+ throw new D("Invalid JWT Claims Set");
902
902
  return i;
903
903
  }
904
904
  const C = class v {
@@ -996,7 +996,7 @@ l(C, "flowName", {
996
996
  [C.PasswordMfa]: "Password MFA",
997
997
  [C.OidcAuthorizationCode]: "OIDC Authorization Code"
998
998
  });
999
- var _, T, q, F, J;
999
+ var _, b;
1000
1000
  class cr {
1001
1001
  /**
1002
1002
  * Constructor.
@@ -1033,27 +1033,18 @@ class cr {
1033
1033
  codeChallengeMethod: n,
1034
1034
  stateLength: s,
1035
1035
  verifierLength: a,
1036
- tokenConsumer: d,
1036
+ tokenConsumer: c,
1037
1037
  authServerCredentials: u,
1038
1038
  authServerMode: y,
1039
1039
  authServerHeaders: k
1040
1040
  }) {
1041
- l(this, "authServerBaseUrl", ""), $(this, _), $(this, T), $(this, q), l(this, "codeChallengeMethod", "S256"), $(this, F), l(this, "verifierLength", 32), l(this, "redirect_uri"), $(this, J, ""), l(this, "stateLength", 32), l(this, "authzCode", ""), l(this, "oidcConfig"), l(this, "tokenConsumer"), l(this, "authServerHeaders", {}), l(this, "authServerMode"), l(this, "authServerCredentials"), this.tokenConsumer = d, this.authServerBaseUrl = e, a && (this.verifierLength = a), s && (this.stateLength = s), t && A(this, _, t), o && A(this, T, o), i && (this.redirect_uri = i), n && (this.codeChallengeMethod = n), this.authServerBaseUrl = e, u && (this.authServerCredentials = u), y && (this.authServerMode = y), k && (this.authServerHeaders = k);
1041
+ l(this, "authServerBaseUrl", ""), he(this, _), he(this, b), l(this, "codeChallengeMethod", "S256"), l(this, "verifierLength", 32), l(this, "redirect_uri"), l(this, "stateLength", 32), l(this, "authzCode", ""), l(this, "oidcConfig"), l(this, "tokenConsumer"), l(this, "authServerHeaders", {}), l(this, "authServerMode"), l(this, "authServerCredentials"), l(this, "oauthPostType", "json"), l(this, "oauthLogFetch", !1), l(this, "oauthUseUserInfoEndpoint", !1), this.tokenConsumer = c, this.authServerBaseUrl = e, a && (this.verifierLength = a), s && (this.stateLength = s), t && Y(this, _, t), o && Y(this, b, o), i && (this.redirect_uri = i), n && (this.codeChallengeMethod = n), this.authServerBaseUrl = e, u && (this.authServerCredentials = u), y && (this.authServerMode = y), k && (this.authServerHeaders = k);
1042
1042
  }
1043
1043
  set client_id(e) {
1044
- A(this, _, e);
1044
+ Y(this, _, e);
1045
1045
  }
1046
1046
  set client_secret(e) {
1047
- A(this, T, e);
1048
- }
1049
- set codeVerifier(e) {
1050
- A(this, F, e);
1051
- }
1052
- set codeChallenge(e) {
1053
- A(this, q, e);
1054
- }
1055
- set state(e) {
1056
- A(this, J, e);
1047
+ Y(this, b, e);
1057
1048
  }
1058
1049
  /**
1059
1050
  * Loads OpenID Connect configuration so that the client can determine
@@ -1068,7 +1059,7 @@ class cr {
1068
1059
  */
1069
1060
  async loadConfig(e) {
1070
1061
  if (e) {
1071
- c.logger.debug(h({ msg: "Reading OIDC config locally" })), this.oidcConfig = e;
1062
+ d.logger.debug(h({ msg: "Reading OIDC config locally" })), this.oidcConfig = e;
1072
1063
  return;
1073
1064
  }
1074
1065
  let t;
@@ -1076,18 +1067,18 @@ class cr {
1076
1067
  const o = new URL(
1077
1068
  this.authServerBaseUrl + "/.well-known/openid-configuration"
1078
1069
  );
1079
- c.logger.debug(h({ msg: `Fetching OIDC config from ${o}` }));
1070
+ d.logger.debug(h({ msg: `Fetching OIDC config from ${o}` }));
1080
1071
  let i = { headers: this.authServerHeaders };
1081
1072
  this.authServerMode && (i.mode = this.authServerMode), this.authServerCredentials && (i.credentials = this.authServerCredentials), t = await fetch(o, i);
1082
1073
  } catch (o) {
1083
- c.logger.error(h({ err: o }));
1074
+ d.logger.error(h({ err: o }));
1084
1075
  }
1085
1076
  if (!t || !t.ok)
1086
1077
  throw new g(
1087
1078
  m.Connection,
1088
1079
  "Couldn't get OIDC configuration from URL" + this.authServerBaseUrl + "/.well-known/openid-configuration"
1089
1080
  );
1090
- this.oidcConfig = { ...ye };
1081
+ this.oidcConfig = { ...me };
1091
1082
  try {
1092
1083
  const o = await t.json();
1093
1084
  for (const [i, n] of Object.entries(o))
@@ -1121,19 +1112,19 @@ class cr {
1121
1112
  * - `error_description` friendly error message or undefined
1122
1113
  * if no error
1123
1114
  */
1124
- async startAuthorizationCodeFlow(e, t = !1) {
1125
- var o, i, n;
1126
- if (c.logger.debug(h({ msg: "Starting authorization code flow" })), this.oidcConfig || await this.loadConfig(), !((o = this.oidcConfig) != null && o.response_types_supported.includes("code")) || !((i = this.oidcConfig) != null && i.response_modes_supported.includes("query")))
1115
+ async startAuthorizationCodeFlow(e, t, o, i = !1) {
1116
+ var n, s, a;
1117
+ if (d.logger.debug(h({ msg: "Starting authorization code flow" })), this.oidcConfig || await this.loadConfig(), !((n = this.oidcConfig) != null && n.response_types_supported.includes("code")) || !((s = this.oidcConfig) != null && s.response_modes_supported.includes("query")))
1127
1118
  return {
1128
1119
  error: "invalid_request",
1129
1120
  error_description: "Server does not support authorization code flow"
1130
1121
  };
1131
- if (!((n = this.oidcConfig) != null && n.authorization_endpoint))
1122
+ if (!((a = this.oidcConfig) != null && a.authorization_endpoint))
1132
1123
  return {
1133
1124
  error: "server_error",
1134
1125
  error_description: "Cannot get authorize endpoint"
1135
1126
  };
1136
- if (A(this, J, this.randomValue(this.stateLength)), !p(this, _)) return {
1127
+ if (!w(this, _)) return {
1137
1128
  error: "invalid_request",
1138
1129
  error_description: "Cannot make authorization code flow without client id"
1139
1130
  };
@@ -1141,8 +1132,30 @@ class cr {
1141
1132
  error: "invalid_request",
1142
1133
  error_description: "Cannot make authorization code flow without Redirect Uri"
1143
1134
  };
1144
- let s = this.oidcConfig.authorization_endpoint + "?response_type=code&client_id=" + encodeURIComponent(p(this, _)) + "&state=" + encodeURIComponent(p(this, J)) + "&redirect_uri=" + encodeURIComponent(this.redirect_uri);
1145
- return e && (s += "&scope=" + encodeURIComponent(e)), t && (A(this, F, this.randomValue(this.verifierLength)), A(this, q, this.codeChallengeMethod == "plain" ? p(this, F) : await this.sha256(p(this, F))), s += "&code_challenge=" + p(this, q)), { url: s };
1135
+ let c = this.oidcConfig.authorization_endpoint + "?response_type=code&client_id=" + encodeURIComponent(w(this, _)) + "&state=" + encodeURIComponent(e) + "&redirect_uri=" + encodeURIComponent(this.redirect_uri);
1136
+ return t && (c += "&scope=" + encodeURIComponent(t)), i && o && (c += "&code_challenge=" + o), { url: c };
1137
+ }
1138
+ async codeChallengeAndVerifier() {
1139
+ const e = this.randomValue(this.verifierLength);
1140
+ return { codeChallenge: this.codeChallengeMethod == "plain" ? e : await this.sha256(e), codeVerifier: e };
1141
+ }
1142
+ async getIdPayload(e, t) {
1143
+ let o, i;
1144
+ try {
1145
+ let n;
1146
+ if (n = await this.validateIdToken(e), !n)
1147
+ return o = "access_denied", i = "Invalid ID token received", { error: o, error_description: i };
1148
+ if (t && this.oauthUseUserInfoEndpoint) {
1149
+ const s = await this.userInfoEndpoint(t);
1150
+ if (s.error)
1151
+ return o = s.error, i = "Failed getting user info: " + (s.error_description ?? "unknown error"), { error: o, error_description: i };
1152
+ n = { ...n, ...s };
1153
+ }
1154
+ return { payload: n };
1155
+ } catch (n) {
1156
+ const s = g.asCrossauthError(n);
1157
+ return d.logger.debug(h({ err: s })), d.logger.error(h({ msg: "Couldn't get user info", cerr: s })), o = s.oauthErrorCode, i = "Couldn't get user info: " + s.message, { error: o, error_description: i };
1158
+ }
1146
1159
  }
1147
1160
  /**
1148
1161
  * This implements the functionality behind the redirect URI
@@ -1164,36 +1177,41 @@ class cr {
1164
1177
  * @returns The {@link OAuthTokenResponse} from the `token` endpoint
1165
1178
  * request, or `error` and `error_description`.
1166
1179
  */
1167
- async redirectEndpoint(e, t, o, i) {
1168
- var n, s;
1169
- if (this.oidcConfig || await this.loadConfig(), o || !e)
1170
- return o || (o = "server_error"), i || (i = "Unknown error"), { error: o, error_description: i };
1171
- if (p(this, J) && t != p(this, J))
1172
- return { error: "access_denied", error_description: "State is not valid" };
1173
- if (this.authzCode = e, !((n = this.oidcConfig) != null && n.grant_types_supported.includes("authorization_code")))
1180
+ async redirectEndpoint(e, t, o, i, n) {
1181
+ var s, a;
1182
+ if (this.oidcConfig || await this.loadConfig(), i || !e)
1183
+ return i || (i = "server_error"), n || (n = "Unknown error"), { error: i, error_description: n };
1184
+ if (this.authzCode = e, !((s = this.oidcConfig) != null && s.grant_types_supported.includes("authorization_code")))
1174
1185
  return {
1175
1186
  error: "invalid_request",
1176
1187
  error_description: "Server does not support authorization code grant"
1177
1188
  };
1178
- if (!((s = this.oidcConfig) != null && s.token_endpoint))
1189
+ if (!((a = this.oidcConfig) != null && a.token_endpoint))
1179
1190
  return {
1180
1191
  error: "server_error",
1181
1192
  error_description: "Cannot get token endpoint"
1182
1193
  };
1183
- const a = this.oidcConfig.token_endpoint;
1184
- let d, u;
1185
- d = "authorization_code", u = p(this, T);
1186
- let y = {
1187
- grant_type: d,
1188
- client_id: p(this, _),
1189
- code: this.authzCode
1194
+ const c = this.oidcConfig.token_endpoint;
1195
+ let u, y;
1196
+ u = "authorization_code", y = w(this, b);
1197
+ let k = {
1198
+ grant_type: u,
1199
+ client_id: w(this, _),
1200
+ code: this.authzCode,
1201
+ redirect_uri: this.redirect_uri
1190
1202
  };
1191
- u && (y.client_secret = u), y.code_verifier = p(this, F);
1203
+ t && (k.scope = t), y && (k.client_secret = y), o && (k.code_verifier = o);
1192
1204
  try {
1193
- const k = await this.post(a, y, this.authServerHeaders);
1194
- return k.id_token && !await this.validateIdToken(k.id_token) ? { error: "access_denied", error_description: "Invalid ID token" } : k;
1195
- } catch (k) {
1196
- return c.logger.error(h({ err: k })), {
1205
+ let E = await this.post(c, k, this.authServerHeaders);
1206
+ if (E.id_token) {
1207
+ const L = await this.getIdPayload(E.id_token, E.access_token);
1208
+ if (L.error)
1209
+ return L;
1210
+ E.id_payload = L.payload;
1211
+ }
1212
+ return E;
1213
+ } catch (E) {
1214
+ return d.logger.error(h({ err: E })), {
1197
1215
  error: "server_error",
1198
1216
  error_description: "Unable to get access token from server"
1199
1217
  };
@@ -1215,28 +1233,35 @@ class cr {
1215
1233
  */
1216
1234
  async clientCredentialsFlow(e) {
1217
1235
  var t, o;
1218
- if (c.logger.debug(h({ msg: "Starting client credentials flow" })), this.oidcConfig || await this.loadConfig(), !((t = this.oidcConfig) != null && t.grant_types_supported.includes("client_credentials")))
1236
+ if (d.logger.debug(h({ msg: "Starting client credentials flow" })), this.oidcConfig || await this.loadConfig(), !((t = this.oidcConfig) != null && t.grant_types_supported.includes("client_credentials")))
1219
1237
  return {
1220
1238
  error: "invalid_request",
1221
1239
  error_description: "Server does not support client credentials grant"
1222
1240
  };
1223
1241
  if (!((o = this.oidcConfig) != null && o.token_endpoint))
1224
1242
  return { error: "server_error", error_description: "Cannot get token endpoint" };
1225
- if (!p(this, _)) return {
1243
+ if (!w(this, _)) return {
1226
1244
  error: "invalid_request",
1227
1245
  error_description: "Cannot make client credentials flow without client id"
1228
1246
  };
1229
1247
  const i = this.oidcConfig.token_endpoint;
1230
1248
  let n = {
1231
1249
  grant_type: "client_credentials",
1232
- client_id: p(this, _),
1233
- client_secret: p(this, T)
1250
+ client_id: w(this, _),
1251
+ client_secret: w(this, b)
1234
1252
  };
1235
1253
  e && (n.scope = e);
1236
1254
  try {
1237
- return await this.post(i, n, this.authServerHeaders);
1255
+ let s = await this.post(i, n, this.authServerHeaders);
1256
+ if (s.id_token) {
1257
+ const a = await this.getIdPayload(s.id_token, s.access_token);
1258
+ if (a.error)
1259
+ return a;
1260
+ s.id_payload = a.payload;
1261
+ }
1262
+ return s;
1238
1263
  } catch (s) {
1239
- return c.logger.error(h({ err: s })), {
1264
+ return d.logger.error(h({ err: s })), {
1240
1265
  error: "server_error",
1241
1266
  error_description: "Error connecting to authorization server"
1242
1267
  };
@@ -1259,7 +1284,7 @@ class cr {
1259
1284
  */
1260
1285
  async passwordFlow(e, t, o) {
1261
1286
  var i, n;
1262
- if (c.logger.debug(h({ msg: "Starting password flow" })), this.oidcConfig || await this.loadConfig(), !((i = this.oidcConfig) != null && i.grant_types_supported.includes("password")))
1287
+ if (d.logger.debug(h({ msg: "Starting password flow" })), this.oidcConfig || await this.loadConfig(), !((i = this.oidcConfig) != null && i.grant_types_supported.includes("password")))
1263
1288
  return {
1264
1289
  error: "invalid_request",
1265
1290
  error_description: "Server does not support password grant"
@@ -1272,17 +1297,23 @@ class cr {
1272
1297
  const s = this.oidcConfig.token_endpoint;
1273
1298
  let a = {
1274
1299
  grant_type: "password",
1275
- client_id: p(this, _),
1276
- client_secret: p(this, T),
1300
+ client_id: w(this, _),
1301
+ client_secret: w(this, b),
1277
1302
  username: e,
1278
1303
  password: t
1279
1304
  };
1280
1305
  o && (a.scope = o);
1281
1306
  try {
1282
- let d = await this.post(s, a, this.authServerHeaders);
1283
- return d.id_token && !await this.validateIdToken(d.id_token) ? { error: "access_denied", error_description: "Invalid ID token" } : d;
1284
- } catch (d) {
1285
- return c.logger.error(h({ err: d })), {
1307
+ let c = await this.post(s, a, this.authServerHeaders);
1308
+ if (c.id_token) {
1309
+ const u = await this.getIdPayload(c.id_token, c.access_token);
1310
+ if (u.error)
1311
+ return u;
1312
+ c.id_payload = u.payload;
1313
+ }
1314
+ return c;
1315
+ } catch (c) {
1316
+ return d.logger.error(h({ err: c })), {
1286
1317
  error: "server_error",
1287
1318
  error_description: "Error connecting to authorization server"
1288
1319
  };
@@ -1303,7 +1334,7 @@ class cr {
1303
1334
  */
1304
1335
  async mfaAuthenticators(e) {
1305
1336
  var t, o, i;
1306
- if (c.logger.debug(h({ msg: "Getting valid MFA authenticators" })), this.oidcConfig || await this.loadConfig(), !((t = this.oidcConfig) != null && t.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-otp")) && (o = this.oidcConfig) != null && o.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-oob"))
1337
+ if (d.logger.debug(h({ msg: "Getting valid MFA authenticators" })), this.oidcConfig || await this.loadConfig(), !((t = this.oidcConfig) != null && t.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-otp")) && (o = this.oidcConfig) != null && o.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-oob"))
1307
1338
  return {
1308
1339
  error: "invalid_request",
1309
1340
  error_description: "Server does not support password_mfa grant"
@@ -1317,8 +1348,8 @@ class cr {
1317
1348
  error_description: "Expected array of authenticators in mfa/authenticators response"
1318
1349
  };
1319
1350
  let a = [];
1320
- for (let d = 0; d < s.length; ++d) {
1321
- const u = s[d];
1351
+ for (let c = 0; c < s.length; ++c) {
1352
+ const u = s[c];
1322
1353
  if (!u.id || !u.authenticator_type || !u.active)
1323
1354
  return {
1324
1355
  error: "server_error",
@@ -1348,7 +1379,7 @@ class cr {
1348
1379
  */
1349
1380
  async mfaOtpRequest(e, t) {
1350
1381
  var o, i;
1351
- if (c.logger.debug(h({ msg: "Making MFA OTB request" })), this.oidcConfig || await this.loadConfig(), !((o = this.oidcConfig) != null && o.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-otp")))
1382
+ if (d.logger.debug(h({ msg: "Making MFA OTB request" })), this.oidcConfig || await this.loadConfig(), !((o = this.oidcConfig) != null && o.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-otp")))
1352
1383
  return {
1353
1384
  error: "invalid_request",
1354
1385
  error_description: "Server does not support password_mfa grant"
@@ -1356,8 +1387,8 @@ class cr {
1356
1387
  if (!((i = this.oidcConfig) != null && i.issuer))
1357
1388
  return { error: "server_error", error_description: "Cannot get issuer" };
1358
1389
  const n = this.oidcConfig.issuer + (this.oidcConfig.issuer.endsWith("/") ? "" : "/") + "mfa/challenge", s = await this.post(n, {
1359
- client_id: p(this, _),
1360
- client_secret: p(this, T),
1390
+ client_id: w(this, _),
1391
+ client_secret: w(this, b),
1361
1392
  challenge_type: "otp",
1362
1393
  mfa_token: e,
1363
1394
  authenticator_id: t
@@ -1386,7 +1417,7 @@ class cr {
1386
1417
  */
1387
1418
  async mfaOtpComplete(e, t, o) {
1388
1419
  var i, n;
1389
- if (c.logger.debug(h({ msg: "Completing MFA OTP request" })), this.oidcConfig || await this.loadConfig(), !((i = this.oidcConfig) != null && i.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-otp")))
1420
+ if (d.logger.debug(h({ msg: "Completing MFA OTP request" })), this.oidcConfig || await this.loadConfig(), !((i = this.oidcConfig) != null && i.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-otp")))
1390
1421
  return {
1391
1422
  error: "invalid_request",
1392
1423
  error_description: "Server does not support password_mfa grant"
@@ -1395,13 +1426,19 @@ class cr {
1395
1426
  return { error: "server_error", error_description: "Cannot get issuer" };
1396
1427
  const s = this.oidcConfig.token_endpoint, a = await this.post(s, {
1397
1428
  grant_type: "http://auth0.com/oauth/grant-type/mfa-otp",
1398
- client_id: p(this, _),
1399
- client_secret: p(this, T),
1429
+ client_id: w(this, _),
1430
+ client_secret: w(this, b),
1400
1431
  challenge_type: "otp",
1401
1432
  mfa_token: e,
1402
1433
  otp: t,
1403
1434
  scope: o
1404
1435
  }, this.authServerHeaders);
1436
+ if (a.id_token) {
1437
+ const c = await this.getIdPayload(a.id_token, a.access_token);
1438
+ if (c.error)
1439
+ return c;
1440
+ a.id_payload = c.payload;
1441
+ }
1405
1442
  return {
1406
1443
  id_token: a.id_token,
1407
1444
  access_token: a.access_token,
@@ -1433,7 +1470,7 @@ class cr {
1433
1470
  */
1434
1471
  async mfaOobRequest(e, t) {
1435
1472
  var o, i;
1436
- if (c.logger.debug(h({ msg: "Making MFA OOB request" })), this.oidcConfig || await this.loadConfig(), !((o = this.oidcConfig) != null && o.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-otp")))
1473
+ if (d.logger.debug(h({ msg: "Making MFA OOB request" })), this.oidcConfig || await this.loadConfig(), !((o = this.oidcConfig) != null && o.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-otp")))
1437
1474
  return {
1438
1475
  error: "invalid_request",
1439
1476
  error_description: "Server does not support password_mfa grant"
@@ -1441,8 +1478,8 @@ class cr {
1441
1478
  if (!((i = this.oidcConfig) != null && i.issuer))
1442
1479
  return { error: "server_error", error_description: "Cannot get issuer" };
1443
1480
  const n = this.oidcConfig.issuer + (this.oidcConfig.issuer.endsWith("/") ? "" : "/") + "mfa/challenge", s = await this.post(n, {
1444
- client_id: p(this, _),
1445
- client_secret: p(this, T),
1481
+ client_id: w(this, _),
1482
+ client_secret: w(this, b),
1446
1483
  challenge_type: "oob",
1447
1484
  mfa_token: e,
1448
1485
  authenticator_id: t
@@ -1468,40 +1505,48 @@ class cr {
1468
1505
  */
1469
1506
  async mfaOobComplete(e, t, o, i) {
1470
1507
  var n, s;
1471
- if (c.logger.debug(h({ msg: "Completing MFA OOB request" })), this.oidcConfig || await this.loadConfig(), !((n = this.oidcConfig) != null && n.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-oob")))
1508
+ if (d.logger.debug(h({ msg: "Completing MFA OOB request" })), this.oidcConfig || await this.loadConfig(), !((n = this.oidcConfig) != null && n.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-oob")))
1472
1509
  return {
1473
1510
  error: "invalid_request",
1474
1511
  error_description: "Server does not support password_mfa grant"
1475
1512
  };
1476
1513
  if (!((s = this.oidcConfig) != null && s.issuer))
1477
1514
  return { error: "server_error", error_description: "Cannot get issuer" };
1478
- const a = this.oidcConfig.token_endpoint, d = await this.post(a, {
1515
+ const a = this.oidcConfig.token_endpoint, c = await this.post(a, {
1479
1516
  grant_type: "http://auth0.com/oauth/grant-type/mfa-oob",
1480
- client_id: p(this, _),
1481
- client_secret: p(this, T),
1517
+ client_id: w(this, _),
1518
+ client_secret: w(this, b),
1482
1519
  challenge_type: "otp",
1483
1520
  mfa_token: e,
1484
1521
  oob_code: t,
1485
1522
  binding_code: o,
1486
1523
  scope: i
1487
1524
  }, this.authServerHeaders);
1488
- return d.error ? {
1489
- error: d.error,
1490
- error_description: d.error_description
1491
- } : d.id_token && !await this.validateIdToken(d.id_token) ? { error: "access_denied", error_description: "Invalid ID token" } : {
1492
- id_token: d.id_token,
1493
- access_token: d.access_token,
1494
- refresh_token: d.refresh_token,
1495
- expires_in: "expires_in" in d ? Number(d.expires_in) : void 0,
1496
- scope: d.scope,
1497
- token_type: d.token_type
1525
+ if (c.error)
1526
+ return {
1527
+ error: c.error,
1528
+ error_description: c.error_description
1529
+ };
1530
+ if (c.id_token) {
1531
+ const u = await this.getIdPayload(c.id_token, c.access_token);
1532
+ if (u.error)
1533
+ return u;
1534
+ c.id_payload = u.payload;
1535
+ }
1536
+ return {
1537
+ id_token: c.id_token,
1538
+ access_token: c.access_token,
1539
+ refresh_token: c.refresh_token,
1540
+ expires_in: "expires_in" in c ? Number(c.expires_in) : void 0,
1541
+ scope: c.scope,
1542
+ token_type: c.token_type
1498
1543
  };
1499
1544
  }
1500
1545
  //////////////////////////////////////////////////////////////////////
1501
1546
  // Refresh Token Flow
1502
1547
  async refreshTokenFlow(e) {
1503
1548
  var t, o;
1504
- if (c.logger.debug(h({ msg: "Starting refresh token flow" })), this.oidcConfig || await this.loadConfig(), !((t = this.oidcConfig) != null && t.grant_types_supported.includes("refresh_token")))
1549
+ if (d.logger.debug(h({ msg: "Starting refresh token flow" })), this.oidcConfig || await this.loadConfig(), !((t = this.oidcConfig) != null && t.grant_types_supported.includes("refresh_token")))
1505
1550
  return {
1506
1551
  error: "invalid_request",
1507
1552
  error_description: "Server does not support refresh_token grant"
@@ -1513,18 +1558,24 @@ class cr {
1513
1558
  };
1514
1559
  const i = this.oidcConfig.token_endpoint;
1515
1560
  let n;
1516
- n = p(this, T);
1561
+ n = w(this, b);
1517
1562
  let s = {
1518
1563
  grant_type: "refresh_token",
1519
1564
  refresh_token: e,
1520
- client_id: p(this, _)
1565
+ client_id: w(this, _)
1521
1566
  };
1522
1567
  n && (s.client_secret = n);
1523
1568
  try {
1524
1569
  let a = await this.post(i, s, this.authServerHeaders);
1525
- return a.id_token && !await this.validateIdToken(a.id_token) ? { error: "access_denied", error_description: "Invalid ID token" } : a;
1570
+ if (a.id_token) {
1571
+ const c = await this.getIdPayload(a.id_token, a.access_token);
1572
+ if (c.error)
1573
+ return c;
1574
+ a.id_payload = c.payload;
1575
+ }
1576
+ return a;
1526
1577
  } catch (a) {
1527
- return c.logger.error(h({ err: a })), {
1578
+ return d.logger.error(h({ err: a })), {
1528
1579
  error: "server_error",
1529
1580
  error_description: "Error connecting to authorization server"
1530
1581
  };
@@ -1540,22 +1591,22 @@ class cr {
1540
1591
  */
1541
1592
  async startDeviceCodeFlow(e, t) {
1542
1593
  var o;
1543
- if (c.logger.debug(h({ msg: "Starting device code flow" })), this.oidcConfig || await this.loadConfig(), !((o = this.oidcConfig) != null && o.grant_types_supported.includes("urn:ietf:params:oauth:grant-type:device_code")))
1594
+ if (d.logger.debug(h({ msg: "Starting device code flow" })), this.oidcConfig || await this.loadConfig(), !((o = this.oidcConfig) != null && o.grant_types_supported.includes("urn:ietf:params:oauth:grant-type:device_code")))
1544
1595
  return {
1545
1596
  error: "invalid_request",
1546
1597
  error_description: "Server does not support device code grant"
1547
1598
  };
1548
1599
  let i = {
1549
1600
  grant_type: "urn:ietf:params:oauth:grant-type:device_code",
1550
- client_id: p(this, _),
1551
- client_secret: p(this, T)
1601
+ client_id: w(this, _),
1602
+ client_secret: w(this, b)
1552
1603
  };
1553
1604
  t && (i.scope = t);
1554
1605
  try {
1555
1606
  let n = await this.post(e, i, this.authServerHeaders);
1556
1607
  return n.id_token && !await this.validateIdToken(n.id_token) ? { error: "access_denied", error_description: "Invalid ID token" } : n;
1557
1608
  } catch (n) {
1558
- return c.logger.error(h({ err: n })), {
1609
+ return d.logger.error(h({ err: n })), {
1559
1610
  error: "server_error",
1560
1611
  error_description: "Error connecting to authorization server"
1561
1612
  };
@@ -1570,7 +1621,7 @@ class cr {
1570
1621
  */
1571
1622
  async pollDeviceCodeFlow(e) {
1572
1623
  var t, o, i;
1573
- if (c.logger.debug(h({ msg: "Starting device code flow" })), this.oidcConfig || await this.loadConfig(), !((t = this.oidcConfig) != null && t.grant_types_supported.includes("urn:ietf:params:oauth:grant-type:device_code")))
1624
+ if (d.logger.debug(h({ msg: "Starting device code flow" })), this.oidcConfig || await this.loadConfig(), !((t = this.oidcConfig) != null && t.grant_types_supported.includes("urn:ietf:params:oauth:grant-type:device_code")))
1574
1625
  return {
1575
1626
  error: "invalid_request",
1576
1627
  error_description: "Server does not support device code grant"
@@ -1582,20 +1633,39 @@ class cr {
1582
1633
  };
1583
1634
  let n = {
1584
1635
  grant_type: "urn:ietf:params:oauth:grant-type:device_code",
1585
- client_id: p(this, _),
1586
- client_secret: p(this, T),
1636
+ client_id: w(this, _),
1637
+ client_secret: w(this, b),
1587
1638
  device_code: e
1588
1639
  };
1589
1640
  try {
1590
1641
  const s = await this.post((i = this.oidcConfig) == null ? void 0 : i.token_endpoint, n, this.authServerHeaders);
1591
- return s.error ? s : s.id_token && !await this.validateIdToken(s.id_token) ? { error: "access_denied", error_description: "Invalid ID token" } : s;
1642
+ if (s.error) return s;
1643
+ if (s.id_token) {
1644
+ const a = await this.getIdPayload(s.id_token, s.access_token);
1645
+ if (a.error)
1646
+ return a;
1647
+ s.id_payload = a.payload;
1648
+ }
1649
+ return s;
1592
1650
  } catch (s) {
1593
- return c.logger.error(h({ err: s })), {
1651
+ return d.logger.error(h({ err: s })), {
1594
1652
  error: "server_error",
1595
1653
  error_description: "Error connecting to authorization server"
1596
1654
  };
1597
1655
  }
1598
1656
  }
1657
+ //////////////////////////////////////////////////////////////////
1658
+ // UserInfo
1659
+ async userInfoEndpoint(e) {
1660
+ var t;
1661
+ if (!((t = this.oidcConfig) != null && t.userinfo_endpoint))
1662
+ return {
1663
+ error: "server_error",
1664
+ error_description: "Cannot get token endpoint"
1665
+ };
1666
+ const o = this.oidcConfig.userinfo_endpoint;
1667
+ return await this.post(o, {}, { authorization: "Bearer " + e });
1668
+ }
1599
1669
  /**
1600
1670
  * Makes a POST request to the given URL using `fetch()`.
1601
1671
  *
@@ -1605,22 +1675,34 @@ class cr {
1605
1675
  * @throws any exception raised by `fetch()`
1606
1676
  */
1607
1677
  async post(e, t, o = {}) {
1608
- c.logger.debug(h({
1678
+ d.logger.debug(h({
1609
1679
  msg: "Fetch POST",
1610
1680
  url: e,
1611
1681
  params: Object.keys(t)
1612
1682
  }));
1613
1683
  let i = {};
1614
- return this.authServerCredentials && (i.credentials = this.authServerCredentials), this.authServerMode && (i.mode = this.authServerMode), await (await fetch(e, {
1684
+ this.authServerCredentials && (i.credentials = this.authServerCredentials), this.authServerMode && (i.mode = this.authServerMode);
1685
+ let n = "", s = "";
1686
+ if (this.oauthPostType == "json")
1687
+ n = JSON.stringify(t), s = "application/json";
1688
+ else {
1689
+ n = "";
1690
+ for (let c in t)
1691
+ n != "" && (n += "&"), n += encodeURIComponent(c) + "=" + encodeURIComponent(t[c]);
1692
+ s = "application/x-www-form-urlencoded";
1693
+ }
1694
+ this.oauthLogFetch && d.logger.debug(h({ msg: "OAuth fetch", method: "POST", url: e, body: n }));
1695
+ const a = await (await fetch(e, {
1615
1696
  method: "POST",
1616
1697
  ...i,
1617
1698
  headers: {
1618
1699
  Accept: "application/json",
1619
- "Content-Type": "application/json",
1700
+ "Content-Type": s,
1620
1701
  ...o
1621
1702
  },
1622
- body: JSON.stringify(t)
1703
+ body: n
1623
1704
  })).json();
1705
+ return this.oauthLogFetch && d.logger.debug(h({ msg: "OAuth fetch response", body: JSON.stringify(a) })), a;
1624
1706
  }
1625
1707
  /**
1626
1708
  * Makes a GET request to the given URL using `fetch()`.
@@ -1631,17 +1713,18 @@ class cr {
1631
1713
  * @throws any exception raised by `fetch()`
1632
1714
  */
1633
1715
  async get(e, t = {}) {
1634
- c.logger.debug(h({ msg: "Fetch GET", url: e }));
1716
+ d.logger.debug(h({ msg: "Fetch GET", url: e }));
1635
1717
  let o = {};
1636
- return this.authServerCredentials && (o.credentials = this.authServerCredentials), this.authServerMode && (o.mode = this.authServerMode), await (await fetch(e, {
1718
+ this.authServerCredentials && (o.credentials = this.authServerCredentials), this.authServerMode && (o.mode = this.authServerMode), this.oauthLogFetch && d.logger.debug(h({ msg: "OAuth fetch", method: "GET", url: e }));
1719
+ const i = await (await fetch(e, {
1637
1720
  method: "GET",
1638
1721
  ...o,
1639
1722
  headers: {
1640
1723
  Accept: "application/json",
1641
- "Content-Type": "application/json",
1642
1724
  ...t
1643
1725
  }
1644
1726
  })).json();
1727
+ return this.oauthLogFetch && d.logger.debug(h({ msg: "OAuth fetch response", body: JSON.stringify(i) })), i;
1645
1728
  }
1646
1729
  /**
1647
1730
  * Validates an OpenID ID token, returning undefined if it is invalid.
@@ -1670,7 +1753,7 @@ class cr {
1670
1753
  try {
1671
1754
  return await this.tokenConsumer.tokenAuthorized(e, "id");
1672
1755
  } catch (t) {
1673
- c.logger.warn(h({ err: t }));
1756
+ d.logger.warn(h({ err: t }));
1674
1757
  return;
1675
1758
  }
1676
1759
  }
@@ -1678,7 +1761,7 @@ class cr {
1678
1761
  return ar(e);
1679
1762
  }
1680
1763
  }
1681
- _ = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap();
1764
+ _ = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap();
1682
1765
  class dr {
1683
1766
  /**
1684
1767
  * Constrctor
@@ -1702,7 +1785,7 @@ class dr {
1702
1785
  * still call this function. This is because key loading is
1703
1786
  * asynchronous, and constructors may not be async.
1704
1787
  */
1705
- async loadKeys() {
1788
+ async loadKeys(e) {
1706
1789
  try {
1707
1790
  if (this.jwtSecretKey) {
1708
1791
  if (!this.jwtKeyType)
@@ -1710,25 +1793,25 @@ class dr {
1710
1793
  m.Configuration,
1711
1794
  "Must specify jwtKeyType if setting jwtSecretKey"
1712
1795
  );
1713
- this.keys._default = await Ye(this.jwtSecretKey, this.jwtKeyType);
1796
+ this.keys._default = await Xe(this.jwtSecretKey, this.jwtKeyType);
1714
1797
  } else if (this.jwtPublicKey) {
1715
1798
  if (!this.jwtKeyType)
1716
1799
  throw new g(
1717
1800
  m.Configuration,
1718
1801
  "Must specify jwtKeyType if setting jwtPublicKey"
1719
1802
  );
1720
- const e = await Ge(this.jwtPublicKey, this.jwtKeyType);
1721
- this.keys._default = e;
1803
+ const t = await Ye(this.jwtPublicKey, this.jwtKeyType);
1804
+ this.keys._default = t;
1722
1805
  } else {
1723
1806
  if (this.oidcConfig || await this.loadConfig(), !this.oidcConfig)
1724
1807
  throw new g(
1725
1808
  m.Connection,
1726
1809
  "Load OIDC config before Jwks"
1727
1810
  );
1728
- await this.loadJwks();
1811
+ await this.loadJwks(void 0, e);
1729
1812
  }
1730
- } catch (e) {
1731
- throw c.logger.debug(h({ err: e })), new g(m.Connection, "Couldn't load keys");
1813
+ } catch (t) {
1814
+ throw d.logger.debug(h({ err: t })), new g(m.Connection, "Couldn't load keys");
1732
1815
  }
1733
1816
  }
1734
1817
  /**
@@ -1751,11 +1834,11 @@ class dr {
1751
1834
  try {
1752
1835
  t = await fetch(new URL("/.well-known/openid-configuration", this.authServerBaseUrl));
1753
1836
  } catch (o) {
1754
- c.logger.error(h({ err: o }));
1837
+ d.logger.error(h({ err: o }));
1755
1838
  }
1756
1839
  if (!t || !t.ok)
1757
1840
  throw new g(m.Connection, "Couldn't get OIDC configuration");
1758
- this.oidcConfig = { ...ye };
1841
+ this.oidcConfig = { ...me };
1759
1842
  try {
1760
1843
  const o = await t.json();
1761
1844
  for (const [i, n] of Object.entries(o))
@@ -1773,40 +1856,46 @@ class dr {
1773
1856
  * - `Connection` if the fetch to the authorization server failed,
1774
1857
  * the OIDC configuration wasn't set or the keys could not be parsed.
1775
1858
  */
1776
- async loadJwks(e) {
1859
+ async loadJwks(e, t) {
1777
1860
  if (e) {
1778
1861
  this.keys = {};
1779
- for (let t = 0; t < e.keys.length; ++t) {
1780
- const o = e.keys[t];
1781
- this.keys[o.kid ?? "_default"] = await ue(e.keys[t]);
1862
+ for (let o = 0; o < e.keys.length; ++o) {
1863
+ const i = e.keys[o];
1864
+ this.keys[i.kid ?? "_default"] = await fe(e.keys[o]);
1782
1865
  }
1783
1866
  } else {
1784
1867
  if (!this.oidcConfig)
1785
1868
  throw new g(m.Connection, "Load OIDC config before Jwks");
1786
- let t;
1869
+ let o;
1787
1870
  try {
1788
- t = await fetch(new URL(this.oidcConfig.jwks_uri));
1789
- } catch (o) {
1790
- c.logger.error(h({ err: o }));
1871
+ o = await fetch(new URL(this.oidcConfig.jwks_uri));
1872
+ } catch (i) {
1873
+ d.logger.error(h({ err: i }));
1791
1874
  }
1792
- if (!t || !t.ok)
1875
+ if (!o || !o.ok)
1793
1876
  throw new g(m.Connection, "Couldn't get OIDC configuration");
1794
1877
  this.keys = {};
1795
1878
  try {
1796
- const o = await t.json();
1797
- if (!("keys" in o) || !Array.isArray(o.keys))
1879
+ const i = await o.json();
1880
+ if (!("keys" in i) || !Array.isArray(i.keys))
1798
1881
  throw new g(m.Connection, "Couldn't fetch keys");
1799
- for (let i = 0; i < o.keys.length; ++i)
1882
+ for (let n = 0; n < i.keys.length; ++n)
1800
1883
  try {
1801
- let n = "_default";
1802
- "kid" in o.keys[i] && typeof o.keys[i] == "string" && (n = String(o.keys[i]));
1803
- const s = await ue(o.keys[i]);
1804
- this.keys[n] = s;
1805
- } catch (n) {
1806
- throw c.logger.error(h({ err: n })), new g(m.Connection, "Couldn't load keys");
1884
+ let s = "_default", a = { ...i.keys[n] };
1885
+ if ("kid" in a && typeof a.kid == "string" && (s = String(a.kid)), a && !a.alg && !a.jwk_alg && t)
1886
+ if (t.startsWith("RS") && a.kty == "RSA")
1887
+ a.alg = t;
1888
+ else {
1889
+ d.logger.debug(h({ msg: "Skipping key with " + a.kty }));
1890
+ continue;
1891
+ }
1892
+ const c = await fe(a);
1893
+ this.keys[s] = c;
1894
+ } catch (s) {
1895
+ throw d.logger.error(h({ err: s })), new g(m.Connection, "Couldn't load keys");
1807
1896
  }
1808
- } catch (o) {
1809
- throw c.logger.error(h({ err: o })), new g(m.Connection, "Unrecognized response from OIDC jwks endpoint");
1897
+ } catch (i) {
1898
+ throw d.logger.error(h({ err: i })), new g(m.Connection, "Unrecognized response from OIDC jwks endpoint");
1810
1899
  }
1811
1900
  }
1812
1901
  }
@@ -1822,59 +1911,61 @@ class dr {
1822
1911
  * @returns the JWT payload if the token is valid, `undefined` otherwise.
1823
1912
  */
1824
1913
  async tokenAuthorized(e, t) {
1825
- (!this.keys || Object.keys(this.keys).length == 0) && await this.loadKeys();
1914
+ if (!this.keys || Object.keys(this.keys).length == 0) {
1915
+ const i = ge(e);
1916
+ await this.loadKeys(i.alg);
1917
+ }
1826
1918
  const o = await this.validateToken(e);
1827
1919
  if (o) {
1828
- if (o.type != t) {
1829
- c.logger.error(h({ msg: t + " expected but got " + o.type }));
1830
- return;
1831
- }
1832
1920
  if (o.iss != this.authServerBaseUrl) {
1833
- c.logger.error(h({ msg: `Invalid issuer ${o.iss} in access token`, hashedAccessToken: await this.hash(o.jti) }));
1921
+ const i = o.jti ? o.jti : o.sid ? o.sid : "";
1922
+ d.logger.error(h({ msg: `Invalid issuer ${o.iss} in access token`, hashedAccessToken: await this.hash(i) }));
1834
1923
  return;
1835
1924
  }
1836
- if (o.aud && (Array.isArray(o.aud) && !o.aud.includes(this.audience) || !Array.isArray(o.aud) && o.aud != this.audience)) {
1837
- c.logger.error(h({ msg: `Invalid audience ${o.aud} in access token`, hashedAccessToken: await this.hash(o.jti) }));
1838
- return;
1925
+ if (o.aud) {
1926
+ const i = o.jti ? o.jti : o.sid ? o.sid : "";
1927
+ if (Array.isArray(o.aud) && !o.aud.includes(this.audience) || !Array.isArray(o.aud) && o.aud != this.audience) {
1928
+ d.logger.error(h({ msg: `Invalid audience ${o.aud} in access token`, hashedAccessToken: await this.hash(i) }));
1929
+ return;
1930
+ }
1839
1931
  }
1840
1932
  return o;
1841
1933
  }
1842
1934
  }
1843
1935
  async validateToken(e) {
1844
- (!this.keys || Object.keys(this.keys).length == 0) && c.logger.warn("No keys loaded so cannot validate tokens");
1936
+ (!this.keys || Object.keys(this.keys).length == 0) && d.logger.warn("No keys loaded so cannot validate tokens");
1845
1937
  let t;
1846
1938
  try {
1847
- t = nr(e).kid;
1939
+ t = ge(e).kid;
1848
1940
  } catch {
1849
- c.logger.warn(h({ msg: "Invalid access token format" }));
1941
+ d.logger.warn(h({ msg: "Invalid access token format" }));
1850
1942
  return;
1851
1943
  }
1852
1944
  let o;
1853
- "_default" in this.keys && (o = this.keys._default);
1854
1945
  for (let i in this.keys)
1855
1946
  if (t == i) {
1856
1947
  o = this.keys[i];
1857
1948
  break;
1858
1949
  }
1859
- if (!o) {
1860
- c.logger.warn(h({ msg: "No matching keys found for access token" }));
1950
+ if (!o && "_default" in this.keys && (o = this.keys._default), !o) {
1951
+ d.logger.warn(h({ msg: "No matching keys found for access token" }));
1861
1952
  return;
1862
1953
  }
1863
1954
  try {
1864
- const { payload: i } = await sr(e, o), n = JSON.parse(new TextDecoder().decode(i));
1955
+ const { payload: i } = await nr(e, o), n = JSON.parse(new TextDecoder().decode(i));
1865
1956
  if (n.exp * 1e3 < Date.now() + this.clockTolerance) {
1866
- c.logger.warn(h({ msg: "Access token has expired" }));
1957
+ d.logger.warn(h({ msg: "Access token has expired" }));
1867
1958
  return;
1868
1959
  }
1869
1960
  return n;
1870
1961
  } catch {
1871
- c.logger.warn(h({ msg: "Access token did not validate" }));
1962
+ d.logger.warn(h({ msg: "Access token did not validate" }));
1872
1963
  return;
1873
1964
  }
1874
1965
  }
1875
1966
  }
1876
- const fe = 30, Z = 2, ae = 30;
1877
- class Ae {
1967
+ const pe = 30, Q = 2, ae = 30;
1968
+ class Re {
1878
1969
  /**
1879
1970
  * Constructor
1880
1971
  *
@@ -1899,50 +1990,50 @@ class Ae {
1899
1990
  }
1900
1991
  async startAutoRefresh(e = ["access", "id"], t) {
1901
1992
  if (!this.autoRefreshActive) {
1902
- this.autoRefreshActive = !0, c.logger.debug(h({ msg: "Starting auto refresh" }));
1993
+ this.autoRefreshActive = !0, d.logger.debug(h({ msg: "Starting auto refresh" }));
1903
1994
  try {
1904
1995
  await this.scheduleAutoRefresh(e, t);
1905
1996
  } catch (o) {
1906
1997
  const i = g.asCrossauthError(o);
1907
- c.logger.error(h({ cerr: i })), c.logger.debug(h({ err: i }));
1998
+ d.logger.error(h({ cerr: i })), d.logger.debug(h({ err: i }));
1908
1999
  }
1909
2000
  }
1910
2001
  }
1911
2002
  stopAutoRefresh() {
1912
- this.autoRefreshActive = !1, c.logger.debug(h({ msg: "Stopping auto refresh" }));
2003
+ this.autoRefreshActive = !1, d.logger.debug(h({ msg: "Stopping auto refresh" }));
1913
2004
  }
1914
2005
  async scheduleAutoRefresh(e, t) {
1915
2006
  const o = this.tokenProvider.getCsrfToken(), i = o ? await o : void 0, n = await this.tokenProvider.getTokenExpiries([...e, "refresh"], i);
1916
2007
  if (n.refresh == null) {
1917
- c.logger.debug(h({ msg: "No refresh token found" }));
2008
+ d.logger.debug(h({ msg: "No refresh token found" }));
1918
2009
  return;
1919
2010
  }
1920
2011
  const s = Date.now();
1921
2012
  let a = n.id;
1922
2013
  if ((!a || n.access && n.access < a) && (a = n.access), !a) {
1923
- c.logger.debug(h({ msg: "No tokens expire" }));
2014
+ d.logger.debug(h({ msg: "No tokens expire" }));
1924
2015
  return;
1925
2016
  }
1926
- const d = a * 1e3 - s - fe;
1927
- if (d < 0) {
1928
- c.logger.debug(h({ msg: "Expiry time has passed" }));
2017
+ const c = a * 1e3 - s - pe;
2018
+ if (c < 0) {
2019
+ d.logger.debug(h({ msg: "Expiry time has passed" }));
1929
2020
  return;
1930
2021
  }
1931
- if (n.refresh && n.refresh - fe < d) {
1932
- c.logger.debug(h({ msg: "Refresh token has expired" }));
2022
+ if (n.refresh && n.refresh - pe < c) {
2023
+ d.logger.debug(h({ msg: "Refresh token has expired" }));
1933
2024
  return;
1934
2025
  }
1935
2026
  let u = (y) => new Promise((k) => setTimeout(k, y));
1936
- c.logger.debug(h({ msg: `Waiting ${d} before refreshing tokens` })), await u(d), await this.autoRefresh(e, i, t);
2027
+ d.logger.debug(h({ msg: `Waiting ${c} before refreshing tokens` })), await u(c), await this.autoRefresh(e, i, t);
1937
2028
  }
1938
2029
  async autoRefresh(e, t, o) {
1939
2030
  if (this.autoRefreshActive) {
1940
2031
  let i, n = !1, s = 0;
1941
- for (; !n && s <= Z; )
2032
+ for (; !n && s <= Q; )
1942
2033
  try {
1943
2034
  let a = { ...this.headers };
1944
- t && (a[this.csrfHeader] = t), c.logger.debug(h({ msg: "Initiating auto refresh" }));
1945
- const d = await this.tokenProvider.jsonFetchWithToken(
2035
+ t && (a[this.csrfHeader] = t), d.logger.debug(h({ msg: "Initiating auto refresh" }));
2036
+ const c = await this.tokenProvider.jsonFetchWithToken(
1946
2037
  this.autoRefreshUrl,
1947
2038
  {
1948
2039
  method: "POST",
@@ -1959,24 +2050,24 @@ class Ae {
1959
2050
  },
1960
2051
  "refresh"
1961
2052
  );
1962
- if (d.ok || c.logger.error(h({ msg: "Failed auto refreshing tokens", status: d.status })), i = await d.json(), i != null && i.ok) {
2053
+ if (c.ok || d.logger.error(h({ msg: "Failed auto refreshing tokens", status: c.status })), i = await c.json(), i != null && i.ok) {
1963
2054
  await this.scheduleAutoRefresh(e, o), n = !0;
1964
2055
  try {
1965
2056
  await this.tokenProvider.receiveTokens(i);
1966
2057
  } catch (u) {
1967
2058
  const y = g.asCrossauthError(u);
1968
- o ? o("Couldn't receive tokens", y) : (c.logger.debug(h({ err: u })), c.logger.error(h({ msg: "Error receiving tokens", cerr: y })));
2059
+ o ? o("Couldn't receive tokens", y) : (d.logger.debug(h({ err: u })), d.logger.error(h({ msg: "Error receiving tokens", cerr: y })));
1969
2060
  }
1970
2061
  } else
1971
- s < Z ? (c.logger.error(h({ msg: `Failed auto refreshing tokens. Retrying in ${ae} seconds` })), await ((y) => new Promise((k) => setTimeout(k, y)))(ae * 1e3)) : (c.logger.error(h({ msg: "Failed auto refreshing tokens. Number of retries exceeded" })), o && o("Failed auto refreshing tokens")), s++;
2062
+ s < Q ? (d.logger.error(h({ msg: `Failed auto refreshing tokens. Retrying in ${ae} seconds` })), await ((y) => new Promise((k) => setTimeout(k, y)))(ae * 1e3)) : (d.logger.error(h({ msg: "Failed auto refreshing tokens. Number of retries exceeded" })), o && o("Failed auto refreshing tokens")), s++;
1972
2063
  } catch (a) {
1973
- const d = g.asCrossauthError(a);
1974
- c.logger.debug(h({ err: d })), s < Z ? (c.logger.error(h({ msg: `Failed auto refreshing tokens. Retrying in ${Z} seconds` })), await ((y) => new Promise((k) => setTimeout(k, y)))(ae)) : (c.logger.error(h({ msg: "Failed auto refreshing tokens. Number of retries exceeded" })), o && o(d.message, d)), s++;
2064
+ const c = g.asCrossauthError(a);
2065
+ d.logger.debug(h({ err: c })), s < Q ? (d.logger.error(h({ msg: `Failed auto refreshing tokens. Retrying in ${Q} seconds` })), await ((y) => new Promise((k) => setTimeout(k, y)))(ae)) : (d.logger.error(h({ msg: "Failed auto refreshing tokens. Number of retries exceeded" })), o && o(c.message, c)), s++;
1975
2066
  }
1976
2067
  }
1977
2068
  }
1978
2069
  }
1979
- class Pe {
2070
+ class Ie {
1980
2071
  /**
1981
2072
  * Constructor
1982
2073
  *
@@ -1997,18 +2088,18 @@ class Pe {
1997
2088
  this.oauthClient = e.oauthClient, e.deviceCodePollUrl != null && (this.deviceCodePollUrl = e.deviceCodePollUrl), e.headers && (this.headers = e.headers), e.mode && (this.mode = e.mode), e.credentials && (this.credentials = e.credentials);
1998
2089
  }
1999
2090
  async startPolling(e, t, o = 5) {
2000
- this.pollingActive || (this.pollingActive = !0, c.logger.debug(h({ msg: "Starting auto refresh" })), await this.poll(e, o, t));
2091
+ this.pollingActive || (this.pollingActive = !0, d.logger.debug(h({ msg: "Starting auto refresh" })), await this.poll(e, o, t));
2001
2092
  }
2002
2093
  stopPolling() {
2003
- this.pollingActive = !1, c.logger.debug(h({ msg: "Stopping auto refresh" }));
2094
+ this.pollingActive = !1, d.logger.debug(h({ msg: "Stopping auto refresh" }));
2004
2095
  }
2005
2096
  async poll(e, t, o) {
2006
2097
  var i;
2007
2098
  if (!e)
2008
- c.logger.debug(h({ msg: "device code poll: no device code provided" })), o("error", "Error waiting for authorization");
2099
+ d.logger.debug(h({ msg: "device code poll: no device code provided" })), o("error", "Error waiting for authorization");
2009
2100
  else
2010
2101
  try {
2011
- if (c.logger.debug(h({ msg: "device code poll: poll" })), !this.deviceCodePollUrl && this.oauthClient) {
2102
+ if (d.logger.debug(h({ msg: "device code poll: poll" })), !this.deviceCodePollUrl && this.oauthClient) {
2012
2103
  if (this.oauthClient.getOidcConfig() || await this.oauthClient.loadConfig(), !((i = this.oauthClient.getOidcConfig()) != null && i.grant_types_supported.includes("http://auth0.com/oauth/grant-type/mfa-oob")))
2013
2104
  return {
2014
2105
  error: "invalid_request",
@@ -2037,18 +2128,18 @@ class Pe {
2037
2128
  this.pollingActive = !1, o("error", "Received an error from the authorization server");
2038
2129
  else {
2039
2130
  const s = await n.json();
2040
- if (c.logger.debug(h({ msg: "device code poll: received" + JSON.stringify(s) })), s.error == "expired_token")
2131
+ if (d.logger.debug(h({ msg: "device code poll: received" + JSON.stringify(s) })), s.error == "expired_token")
2041
2132
  this.pollingActive = !1, o("expired_token", "Timeout waiting for authorization");
2042
2133
  else if (s.error == "authorization_pending" || s.error == "slow_down") {
2043
2134
  s.error == "slow_down" && (t += 5);
2044
- let a = s.interval ?? t, d = (u) => new Promise((y) => setTimeout(y, u));
2045
- c.logger.debug(h({ msg: "device code poll: waiting " + String(a) + " seconds" })), await d(a * 1e3), this.pollingActive && this.poll(e, t, o);
2135
+ let a = s.interval ?? t, c = (u) => new Promise((y) => setTimeout(y, u));
2136
+ d.logger.debug(h({ msg: "device code poll: waiting " + String(a) + " seconds" })), await c(a * 1e3), this.pollingActive && this.poll(e, t, o);
2046
2137
  } else s.error ? (this.pollingActive = !1, o("error", s.error_description ?? s.error)) : (this.pollingActive = !1, o("complete"));
2047
2138
  }
2048
2139
  } catch (n) {
2049
2140
  this.pollingActive = !1;
2050
2141
  const s = g.asCrossauthError(n);
2051
- c.logger.debug(h({ err: s })), c.logger.error(h({ msg: "Polling failed", cerr: s })), o("error", s.message);
2142
+ d.logger.debug(h({ err: s })), d.logger.error(h({ msg: "Polling failed", cerr: s })), o("error", s.message);
2052
2143
  }
2053
2144
  }
2054
2145
  }
@@ -2085,11 +2176,11 @@ class ur {
2085
2176
  f(this, "getCsrfTokenUrl", "/api/getcsrftoken");
2086
2177
  f(this, "autoRefreshUrl", "/api/refreshtokens");
2087
2178
  f(this, "tokensUrl", "/tokens");
2088
- e.bffPrefix && (this.bffPrefix = e.bffPrefix), e.csrfHeader && (this.csrfHeader = e.csrfHeader), e.enableCsrfProtection != null && (this.enableCsrfProtection = e.enableCsrfProtection), e.getCsrfTokenUrl && (this.getCsrfTokenUrl = e.getCsrfTokenUrl), e.tokensUrl && (this.tokensUrl = e.tokensUrl), e.autoRefreshUrl && (this.autoRefreshUrl = e.autoRefreshUrl), this.bffPrefix.endsWith("/") || (this.bffPrefix += "/"), e.headers && (this.headers = e.headers), e.mode && (this.mode = e.mode), e.credentials && (this.credentials = e.credentials), this.autoRefresher = new Ae({
2179
+ e.bffPrefix && (this.bffPrefix = e.bffPrefix), e.csrfHeader && (this.csrfHeader = e.csrfHeader), e.enableCsrfProtection != null && (this.enableCsrfProtection = e.enableCsrfProtection), e.getCsrfTokenUrl && (this.getCsrfTokenUrl = e.getCsrfTokenUrl), e.tokensUrl && (this.tokensUrl = e.tokensUrl), e.autoRefreshUrl && (this.autoRefreshUrl = e.autoRefreshUrl), this.bffPrefix.endsWith("/") || (this.bffPrefix += "/"), e.headers && (this.headers = e.headers), e.mode && (this.mode = e.mode), e.credentials && (this.credentials = e.credentials), this.autoRefresher = new Re({
2089
2180
  ...e,
2090
2181
  autoRefreshUrl: this.autoRefreshUrl,
2091
2182
  tokenProvider: this
2092
- }), this.deviceCodePoller = new Pe({ ...e, oauthClient: void 0 });
2183
+ }), this.deviceCodePoller = new Ie({ ...e, oauthClient: void 0 });
2093
2184
  }
2094
2185
  /**
2095
2186
  * Gets a CSRF token from the server
@@ -2211,8 +2302,8 @@ class ur {
2211
2302
  ...s
2212
2303
  }
2213
2304
  );
2214
- let d = null;
2215
- return a.body && (d = await a.json()), { status: a.status, body: d };
2305
+ let c = null;
2306
+ return a.body && (c = await a.json()), { status: a.status, body: c };
2216
2307
  }
2217
2308
  /**
2218
2309
  * Return all tokens that the client has been enabled to return.
@@ -2282,10 +2373,10 @@ class ur {
2282
2373
  */
2283
2374
  async getTokenExpiries(e, t) {
2284
2375
  const o = await this.getTokens(t), i = e.includes("id") ? (o == null ? void 0 : o.id_token) ?? null : null, n = e.includes("access") ? (o == null ? void 0 : o.access_token) ?? null : null, s = e.includes("refresh") ? (o == null ? void 0 : o.refresh_token) ?? null : null;
2285
- let a, d, u;
2286
- return i && (a = i.exp ? i.exp : null), n && (d = n.exp ? n.exp : null), s && (u = s.exp ? s.exp : null), {
2376
+ let a, c, u;
2377
+ return i && (a = i.exp ? i.exp : null), n && (c = n.exp ? n.exp : null), s && (u = s.exp ? s.exp : null), {
2287
2378
  id: a,
2288
- access: d,
2379
+ access: c,
2289
2380
  refresh: u
2290
2381
  };
2291
2382
  }
@@ -2326,7 +2417,7 @@ class hr extends dr {
2326
2417
  return btoa(n.reduce((s, a) => s + String.fromCharCode(a), "")).replace(/\//g, "_").replace(/\+/g, "-").replace(/=+$/, "");
2327
2418
  }
2328
2419
  }
2329
- var j, O, R, K, D, B, L;
2420
+ var x, N, I, K, z, J, M, q, V, B;
2330
2421
  class gr extends cr {
2331
2422
  /**
2332
2423
  * Constructor
@@ -2386,21 +2477,26 @@ class gr extends cr {
2386
2477
  f(this, "accessTokenName", "CROSSAUTH_AT");
2387
2478
  f(this, "refreshTokenName", "CROSSAUTH_RT");
2388
2479
  f(this, "idTokenName", "CROSSAUTH_IT");
2389
- N(this, j);
2390
- N(this, O);
2391
- N(this, R);
2392
- N(this, K);
2393
- N(this, D);
2394
- N(this, B);
2395
- N(this, L);
2480
+ A(this, x);
2481
+ A(this, N);
2482
+ A(this, I);
2483
+ A(this, K);
2484
+ A(this, z);
2485
+ A(this, J);
2486
+ A(this, M);
2396
2487
  f(this, "autoRefresher");
2397
2488
  f(this, "deviceCodePoller");
2398
2489
  f(this, "deviceAuthorizationUrl", "device_authorization");
2399
- this.resServerBaseUrl != null && (this.resServerBaseUrl = t.resServerBaseUrl ?? "", this.resServerBaseUrl.length > 0 && !this.resServerBaseUrl.endsWith("/") && (this.resServerBaseUrl += "/")), t.accessTokenResponseType && (this.accessTokenResponseType = t.accessTokenResponseType), t.idTokenResponseType && (this.idTokenResponseType = t.idTokenResponseType), t.refreshTokenResponseType && (this.refreshTokenResponseType = t.refreshTokenResponseType), t.accessTokenName && (this.accessTokenName = t.accessTokenName), t.idTokenName && (this.idTokenName = t.idTokenName), t.refreshTokenName && (this.refreshTokenName = t.refreshTokenName), t.resServerHeaders && (this.resServerHeaders = t.resServerHeaders), t.resServerMode && (this.resServerMode = t.resServerMode), t.resServerCredentials && (this.resServerCredentials = t.resServerCredentials), t.client_id && b(this, B, t.client_id), t.client_secret && b(this, L, t.client_secret), t.deviceAuthorizationUrl && (this.deviceAuthorizationUrl = t.deviceAuthorizationUrl), this.autoRefresher = new Ae({
2490
+ A(this, q);
2491
+ A(this, V);
2492
+ A(this, B);
2493
+ f(this, "scope");
2494
+ f(this, "logFetch", !1);
2495
+ this.resServerBaseUrl != null && (this.resServerBaseUrl = t.resServerBaseUrl ?? "", this.resServerBaseUrl.length > 0 && !this.resServerBaseUrl.endsWith("/") && (this.resServerBaseUrl += "/")), t.accessTokenResponseType && (this.accessTokenResponseType = t.accessTokenResponseType), t.idTokenResponseType && (this.idTokenResponseType = t.idTokenResponseType), t.refreshTokenResponseType && (this.refreshTokenResponseType = t.refreshTokenResponseType), t.accessTokenName && (this.accessTokenName = t.accessTokenName), t.idTokenName && (this.idTokenName = t.idTokenName), t.refreshTokenName && (this.refreshTokenName = t.refreshTokenName), t.resServerHeaders && (this.resServerHeaders = t.resServerHeaders), t.resServerMode && (this.resServerMode = t.resServerMode), t.resServerCredentials && (this.resServerCredentials = t.resServerCredentials), t.client_id && T(this, J, t.client_id), t.client_secret && T(this, M, t.client_secret), t.deviceAuthorizationUrl && (this.deviceAuthorizationUrl = t.deviceAuthorizationUrl), this.autoRefresher = new Re({
2400
2496
  ...t,
2401
2497
  autoRefreshUrl: this.authServerBaseUrl + "/token",
2402
2498
  tokenProvider: this
2403
- }), this.deviceCodePoller = new Pe({ ...t, oauthClient: this, deviceCodePollUrl: null });
2499
+ }), this.deviceCodePoller = new Ie({ ...t, oauthClient: this, deviceCodePollUrl: null });
2404
2500
  let o, i, n;
2405
2501
  if (this.idTokenResponseType == "sessionStorage" ? o = sessionStorage.getItem(this.idTokenName) : this.idTokenResponseType == "localStorage" && (o = localStorage.getItem(this.idTokenName)), this.accessTokenResponseType == "sessionStorage" ? i = sessionStorage.getItem(this.accessTokenName) : this.accessTokenResponseType == "localStorage" && (i = localStorage.getItem(this.accessTokenName)), this.refreshTokenResponseType == "sessionStorage" ? n = sessionStorage.getItem(this.refreshTokenName) : this.refreshTokenResponseType == "localStorage" && (n = localStorage.getItem(this.refreshTokenName)), this.receiveTokens({
2406
2502
  access_token: i,
@@ -2408,31 +2504,31 @@ class gr extends cr {
2408
2504
  refresh_token: n
2409
2505
  }), i) {
2410
2506
  const s = this.getTokenPayload(i);
2411
- s && (b(this, j, i), b(this, K, s));
2507
+ s && (T(this, x, i), T(this, K, s));
2412
2508
  }
2413
2509
  if (n) {
2414
2510
  const s = this.getTokenPayload(n);
2415
- s && (b(this, O, n), b(this, D, s));
2511
+ s && (T(this, N, n), T(this, z, s));
2416
2512
  }
2417
2513
  o ? this.validateIdToken(o).then((s) => {
2418
- b(this, R, s), t.autoRefresh && this.startAutoRefresh(t.autoRefresh).then().catch((a) => {
2419
- c.logger.debug(h({ err: a, msg: "Couldn't start auto refresh" }));
2514
+ T(this, I, s), t.autoRefresh && this.startAutoRefresh(t.autoRefresh).then().catch((a) => {
2515
+ d.logger.debug(h({ err: a, msg: "Couldn't start auto refresh" }));
2420
2516
  });
2421
2517
  }).catch((s) => {
2422
- c.logger.debug(h({ err: s, msg: "Couldn't validate ID token" }));
2423
- }) : w(this, j) && t.autoRefresh && n ? this.startAutoRefresh(t.autoRefresh).then().catch((s) => {
2424
- c.logger.debug(h({ err: s, msg: "Couldn't start auto refresh" }));
2518
+ d.logger.debug(h({ err: s, msg: "Couldn't validate ID token" }));
2519
+ }) : p(this, x) && t.autoRefresh && n ? this.startAutoRefresh(t.autoRefresh).then().catch((s) => {
2520
+ d.logger.debug(h({ err: s, msg: "Couldn't start auto refresh" }));
2425
2521
  }) : n && !i && this.refreshTokenFlow(n).then((s) => {
2426
- c.logger.debug(h({ msg: "Refreshed tokens" })), t.autoRefresh && this.startAutoRefresh(t.autoRefresh).then().catch((a) => {
2427
- c.logger.debug(h({ err: a, msg: "Couldn't start auto refresh" }));
2522
+ d.logger.debug(h({ msg: "Refreshed tokens" })), t.autoRefresh && this.startAutoRefresh(t.autoRefresh).then().catch((a) => {
2523
+ d.logger.debug(h({ err: a, msg: "Couldn't start auto refresh" }));
2428
2524
  });
2429
2525
  }).catch((s) => {
2430
2526
  const a = g.asCrossauthError(s);
2431
- c.logger.debug(h({ err: a })), c.logger.error(h({ msg: "failed refreshing tokens", cerr: a }));
2527
+ d.logger.debug(h({ err: a })), d.logger.error(h({ msg: "failed refreshing tokens", cerr: a }));
2432
2528
  });
2433
2529
  }
2434
2530
  get idTokenPayload() {
2435
- return w(this, R);
2531
+ return p(this, I);
2436
2532
  }
2437
2533
  /**
2438
2534
  * Processes the query parameters for a Redirect URI request if they
@@ -2466,14 +2562,19 @@ class gr extends cr {
2466
2562
  if (!s && !i) return;
2467
2563
  if (s) {
2468
2564
  const u = g.fromOAuthError(s, a);
2469
- throw c.logger.debug(h({ err: u })), c.logger.error(h({ cerr: u, msg: "Error from authorize endpoint: " + s })), u;
2565
+ throw d.logger.debug(h({ err: u })), d.logger.error(h({ cerr: u, msg: "Error from authorize endpoint: " + s })), u;
2470
2566
  }
2471
- const d = await this.redirectEndpoint(i, n, s, a);
2472
- if (d.error) {
2473
- const u = g.fromOAuthError(d.error, a);
2474
- throw c.logger.debug(h({ err: u })), c.logger.error(h({ cerr: u, msg: "Error from redirect endpoint: " + d.error })), u;
2567
+ if (p(this, B) && n != p(this, B))
2568
+ return {
2569
+ error: "access_denied",
2570
+ error_description: "Invalid state"
2571
+ };
2572
+ const c = await this.redirectEndpoint(i, this.scope, p(this, V), s, a);
2573
+ if (c.error) {
2574
+ const u = g.fromOAuthError(c.error, a);
2575
+ throw d.logger.debug(h({ err: u })), d.logger.error(h({ cerr: u, msg: "Error from redirect endpoint: " + c.error })), u;
2475
2576
  }
2476
- return await this.receiveTokens(d), d;
2577
+ return await this.receiveTokens(c), c;
2477
2578
  }
2478
2579
  /**
2479
2580
  * Turns auto refresh of tokens on
@@ -2512,7 +2613,7 @@ class gr extends cr {
2512
2613
  * @returns the payload as an object
2513
2614
  */
2514
2615
  getIdToken() {
2515
- return w(this, R);
2616
+ return p(this, I);
2516
2617
  }
2517
2618
  ///////
2518
2619
  // Implementation of abstract methods
@@ -2533,7 +2634,7 @@ class gr extends cr {
2533
2634
  */
2534
2635
  async sha256(t) {
2535
2636
  const i = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", i), s = Array.from(new Uint8Array(n));
2536
- return btoa(s.reduce((a, d) => a + String.fromCharCode(d), "")).replace(/\//g, "_").replace(/\+/g, "-").replace(/=+$/, "");
2637
+ return btoa(s.reduce((a, c) => a + String.fromCharCode(c), "")).replace(/\//g, "_").replace(/\+/g, "-").replace(/=+$/, "");
2537
2638
  }
2538
2639
  /**
2539
2640
  * Calls an API endpoint on the resource server
@@ -2549,7 +2650,7 @@ class gr extends cr {
2549
2650
  i && (s.body = JSON.stringify(i));
2550
2651
  let a;
2551
2652
  this.accessTokenResponseType == "sessionStorage" ? a = sessionStorage.getItem(this.accessTokenName) : this.accessTokenResponseType == "localStorage" && (a = localStorage.getItem(this.accessTokenName)), n.authorization = "Bearer " + a;
2552
- const d = await fetch(
2653
+ const c = await fetch(
2553
2654
  this.resServerBaseUrl + o,
2554
2655
  {
2555
2656
  headers: n,
@@ -2560,7 +2661,7 @@ class gr extends cr {
2560
2661
  }
2561
2662
  );
2562
2663
  let u = null;
2563
- return d.body && (u = await d.json()), { status: d.status, body: u };
2664
+ return c.body && (u = await c.json()), { status: c.status, body: u };
2564
2665
  }
2565
2666
  ///////////////////////////////////////////////////////////
2566
2667
  // OAuthTokenProvider interface
@@ -2573,7 +2674,7 @@ class gr extends cr {
2573
2674
  */
2574
2675
  async getTokenExpiries(t, o) {
2575
2676
  let i, n, s;
2576
- return w(this, R) && (i = w(this, R).exp ? w(this, R).exp : null), w(this, K) && (n = w(this, K).exp ? w(this, K).exp : null), w(this, D) && (s = w(this, D).exp ? w(this, D).exp : null), {
2677
+ return p(this, I) && (i = p(this, I).exp ? p(this, I).exp : null), p(this, K) && (n = p(this, K).exp ? p(this, K).exp : null), p(this, z) && (s = p(this, z).exp ? p(this, z).exp : null), {
2577
2678
  id: i,
2578
2679
  access: n,
2579
2680
  refresh: s
@@ -2591,15 +2692,15 @@ class gr extends cr {
2591
2692
  */
2592
2693
  async jsonFetchWithToken(t, o, i) {
2593
2694
  if (i == "access") {
2594
- if (!w(this, j))
2695
+ if (!p(this, x))
2595
2696
  throw new g(m.InvalidToken, "Cannot make fetch with access token - no access token defined");
2596
- o.headers || (o.headers = {}), o.headers.authorization = "Bearer " + w(this, j);
2697
+ o.headers || (o.headers = {}), o.headers.authorization = "Bearer " + p(this, x);
2597
2698
  } else {
2598
- if (o.body || (o.body = {}), !w(this, O))
2699
+ if (o.body || (o.body = {}), !p(this, N))
2599
2700
  throw new g(m.InvalidToken, "Cannot make fetch with refresh token - no refresh token defined");
2600
- o.body.refresh_token = w(this, O), o.body.grant_type = "refresh_token";
2701
+ o.body.refresh_token = p(this, N), o.body.grant_type = "refresh_token";
2601
2702
  }
2602
- return w(this, B) && (o.body || (o.body = {}), o.body.client_id = w(this, B), w(this, L) && (o.body.client_secret = w(this, L))), typeof o.body != "string" && (o.body = JSON.stringify(o.body)), await fetch(t, o);
2703
+ return p(this, J) && (o.body || (o.body = {}), o.body.client_id = p(this, J), p(this, M) && (o.body.client_secret = p(this, M))), typeof o.body != "string" && (o.body = JSON.stringify(o.body)), await fetch(t, o);
2603
2704
  }
2604
2705
  /**
2605
2706
  * Does nothing as CSRF tokens are not needed for this class
@@ -2610,15 +2711,15 @@ class gr extends cr {
2610
2711
  async receiveTokens(t) {
2611
2712
  if (t.access_token) {
2612
2713
  const o = this.getTokenPayload(t.access_token);
2613
- o && (b(this, j, t.access_token), b(this, K, o)), this.accessTokenResponseType == "localStorage" ? localStorage.setItem(this.accessTokenName, t.access_token) : this.accessTokenResponseType == "sessionStorage" && sessionStorage.setItem(this.accessTokenName, t.access_token);
2714
+ o && (T(this, x, t.access_token), T(this, K, o)), this.accessTokenResponseType == "localStorage" ? localStorage.setItem(this.accessTokenName, t.access_token) : this.accessTokenResponseType == "sessionStorage" && sessionStorage.setItem(this.accessTokenName, t.access_token);
2614
2715
  }
2615
2716
  if (t.refresh_token) {
2616
2717
  const o = this.getTokenPayload(t.refresh_token);
2617
- o && (b(this, O, t.refresh_token), b(this, D, o)), this.refreshTokenResponseType == "localStorage" ? localStorage.setItem(this.refreshTokenName, t.refresh_token) : this.accessTokenResponseType == "sessionStorage" && sessionStorage.setItem(this.refreshTokenName, t.refresh_token);
2718
+ o && (T(this, N, t.refresh_token), T(this, z, o)), this.refreshTokenResponseType == "localStorage" ? localStorage.setItem(this.refreshTokenName, t.refresh_token) : this.accessTokenResponseType == "sessionStorage" && sessionStorage.setItem(this.refreshTokenName, t.refresh_token);
2618
2719
  }
2619
2720
  if (t.id_token) {
2620
2721
  const o = await this.validateIdToken(t.id_token);
2621
- b(this, R, o), this.idTokenResponseType == "localStorage" ? localStorage.setItem(this.idTokenName, t.id_token) : this.idTokenResponseType == "sessionStorage" && sessionStorage.setItem(this.idTokenName, t.id_token);
2722
+ T(this, I, o), this.idTokenResponseType == "localStorage" ? localStorage.setItem(this.idTokenName, t.id_token) : this.idTokenResponseType == "sessionStorage" && sessionStorage.setItem(this.idTokenName, t.id_token);
2622
2723
  }
2623
2724
  }
2624
2725
  /////////
@@ -2680,8 +2781,8 @@ class gr extends cr {
2680
2781
  */
2681
2782
  async refreshTokenFlow(t) {
2682
2783
  if (!t)
2683
- if (w(this, O))
2684
- t = w(this, O);
2784
+ if (p(this, N))
2785
+ t = p(this, N);
2685
2786
  else
2686
2787
  throw new g(m.InvalidToken, "Cannot refresh tokens: no refresh token present");
2687
2788
  const o = await super.refreshTokenFlow(t);
@@ -2693,25 +2794,30 @@ class gr extends cr {
2693
2794
  * @param pkce whether or not to use PKCE.
2694
2795
  */
2695
2796
  async authorizationCodeFlow(t, o = !1) {
2696
- const i = await super.startAuthorizationCodeFlow(t, o);
2697
- if (i.error || !i.url) {
2698
- const n = g.fromOAuthError(
2699
- i.error ?? "Couldn't create URL for authorization code flow",
2700
- i.error_description
2797
+ const i = this.randomValue(this.stateLength);
2798
+ if (this.scope = t, o) {
2799
+ const s = await this.codeChallengeAndVerifier();
2800
+ T(this, q, s.codeChallenge), T(this, V, s.codeVerifier), T(this, B, i);
2801
+ }
2802
+ const n = await super.startAuthorizationCodeFlow(i, t, p(this, q), o);
2803
+ if (n.error || !n.url) {
2804
+ const s = g.fromOAuthError(
2805
+ n.error ?? "Couldn't create URL for authorization code flow",
2806
+ n.error_description
2701
2807
  );
2702
- throw c.logger.debug(h({ err: n })), n;
2808
+ throw d.logger.debug(h({ err: s })), s;
2703
2809
  }
2704
- location.href = i.url;
2810
+ location.href = n.url;
2705
2811
  }
2706
2812
  }
2707
- j = new WeakMap(), O = new WeakMap(), R = new WeakMap(), K = new WeakMap(), D = new WeakMap(), B = new WeakMap(), L = new WeakMap();
2813
+ x = new WeakMap(), N = new WeakMap(), I = new WeakMap(), K = new WeakMap(), z = new WeakMap(), J = new WeakMap(), M = new WeakMap(), q = new WeakMap(), V = new WeakMap(), B = new WeakMap();
2708
2814
  export {
2709
2815
  g as CrossauthError,
2710
- c as CrossauthLogger,
2711
- Ae as OAuthAutoRefresher,
2816
+ d as CrossauthLogger,
2817
+ Re as OAuthAutoRefresher,
2712
2818
  ur as OAuthBffClient,
2713
2819
  gr as OAuthClient,
2714
- Pe as OAuthDeviceCodePoller,
2820
+ Ie as OAuthDeviceCodePoller,
2715
2821
  hr as OAuthTokenConsumer,
2716
2822
  fr as OAuthTokenProvider,
2717
2823
  h as j