@versini/auth-provider 5.0.2 → 5.0.4

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,17 +1,17 @@
1
- var xe = Object.defineProperty;
2
- var je = (e, t, r) => t in e ? xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var K = (e, t, r) => (je(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { jsx as Me } from "react/jsx-runtime";
5
- import * as D from "react";
6
- import { createContext as Ve, useState as Ye, useCallback as Be, useEffect as Fe, useContext as Ge } from "react";
1
+ var je = Object.defineProperty;
2
+ var Me = (e, t, r) => t in e ? je(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var N = (e, t, r) => (Me(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ import { jsx as Ve } from "react/jsx-runtime";
5
+ import * as U from "react";
6
+ import { createContext as Ye, useRef as Be, useState as Fe, useCallback as Ge, useEffect as qe, useContext as ze } from "react";
7
7
  /*!
8
- @versini/auth-provider v5.0.2
8
+ @versini/auth-provider v5.0.4
9
9
  © 2024 gizmette.com
10
10
  */
11
11
  try {
12
12
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
13
- version: "5.0.2",
14
- buildTime: "07/04/2024 08:12 PM EDT",
13
+ version: "5.0.4",
14
+ buildTime: "07/05/2024 12:57 PM EDT",
15
15
  homepage: "https://github.com/aversini/auth-client",
16
16
  license: "MIT"
17
17
  });
@@ -24,28 +24,28 @@ try {
24
24
  try {
25
25
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
26
26
  version: "2.10.1",
27
- buildTime: "07/04/2024 08:12 PM EDT",
27
+ buildTime: "07/05/2024 12:57 PM EDT",
28
28
  homepage: "https://github.com/aversini/auth-client",
29
29
  license: "MIT"
30
30
  });
31
31
  } catch {
32
32
  }
33
- const B = {
33
+ const F = {
34
34
  ID_TOKEN: "id_token",
35
35
  ACCESS_TOKEN: "token",
36
36
  ID_AND_ACCESS_TOKEN: "id_token token",
37
37
  CODE: "code",
38
38
  REFRESH_TOKEN: "refresh_token"
39
- }, qe = {
39
+ }, Xe = {
40
40
  CLIENT_ID: "X-Auth-ClientId"
41
- }, y = {
41
+ }, m = {
42
42
  ALG: "RS256",
43
43
  USER_ID_KEY: "sub",
44
44
  TOKEN_ID_KEY: "__raw",
45
45
  NONCE_KEY: "_nonce",
46
46
  USERNAME_KEY: "username",
47
47
  ISSUER: "gizmette.com"
48
- }, ze = `-----BEGIN PUBLIC KEY-----
48
+ }, Qe = `-----BEGIN PUBLIC KEY-----
49
49
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
50
50
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
51
51
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -53,33 +53,33 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
53
53
  l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
54
54
  sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
55
55
  awIDAQAB
56
- -----END PUBLIC KEY-----`, F = {
56
+ -----END PUBLIC KEY-----`, G = {
57
57
  AUTHENTICATE: "authenticate",
58
58
  CODE: "code",
59
59
  LOGOUT: "logout"
60
- }, G = crypto, ke = (e) => e instanceof CryptoKey, N = new TextEncoder(), q = new TextDecoder();
61
- function Xe(...e) {
60
+ }, q = crypto, be = (e) => e instanceof CryptoKey, L = new TextEncoder(), z = new TextDecoder();
61
+ function Ze(...e) {
62
62
  const t = e.reduce((n, { length: s }) => n + s, 0), r = new Uint8Array(t);
63
63
  let a = 0;
64
64
  for (const n of e)
65
65
  r.set(n, a), a += n.length;
66
66
  return r;
67
67
  }
68
- const Qe = (e) => {
68
+ const et = (e) => {
69
69
  const t = atob(e), r = new Uint8Array(t.length);
70
70
  for (let a = 0; a < t.length; a++)
71
71
  r[a] = t.charCodeAt(a);
72
72
  return r;
73
- }, M = (e) => {
73
+ }, V = (e) => {
74
74
  let t = e;
75
- t instanceof Uint8Array && (t = q.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
75
+ t instanceof Uint8Array && (t = z.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
76
76
  try {
77
- return Qe(t);
77
+ return et(t);
78
78
  } catch {
79
79
  throw new TypeError("The input to be decoded is not correctly encoded.");
80
80
  }
81
81
  };
82
- class R extends Error {
82
+ class C extends Error {
83
83
  static get code() {
84
84
  return "ERR_JOSE_GENERIC";
85
85
  }
@@ -88,7 +88,7 @@ class R extends Error {
88
88
  super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
89
89
  }
90
90
  }
91
- class S extends R {
91
+ class A extends C {
92
92
  static get code() {
93
93
  return "ERR_JWT_CLAIM_VALIDATION_FAILED";
94
94
  }
@@ -96,7 +96,7 @@ class S extends R {
96
96
  super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = a, this.reason = n, this.payload = r;
97
97
  }
98
98
  }
99
- class ue extends R {
99
+ class de extends C {
100
100
  static get code() {
101
101
  return "ERR_JWT_EXPIRED";
102
102
  }
@@ -104,7 +104,7 @@ class ue extends R {
104
104
  super(t), this.code = "ERR_JWT_EXPIRED", this.claim = a, this.reason = n, this.payload = r;
105
105
  }
106
106
  }
107
- class Ze extends R {
107
+ class tt extends C {
108
108
  constructor() {
109
109
  super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
110
110
  }
@@ -112,14 +112,14 @@ class Ze extends R {
112
112
  return "ERR_JOSE_ALG_NOT_ALLOWED";
113
113
  }
114
114
  }
115
- let _ = class extends R {
115
+ let R = class extends C {
116
116
  constructor() {
117
117
  super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
118
118
  }
119
119
  static get code() {
120
120
  return "ERR_JOSE_NOT_SUPPORTED";
121
121
  }
122
- }, h = class extends R {
122
+ }, f = class extends C {
123
123
  constructor() {
124
124
  super(...arguments), this.code = "ERR_JWS_INVALID";
125
125
  }
@@ -127,7 +127,7 @@ let _ = class extends R {
127
127
  return "ERR_JWS_INVALID";
128
128
  }
129
129
  };
130
- class be extends R {
130
+ class _e extends C {
131
131
  constructor() {
132
132
  super(...arguments), this.code = "ERR_JWT_INVALID";
133
133
  }
@@ -135,7 +135,7 @@ class be extends R {
135
135
  return "ERR_JWT_INVALID";
136
136
  }
137
137
  }
138
- class et extends R {
138
+ class rt extends C {
139
139
  constructor() {
140
140
  super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
141
141
  }
@@ -143,16 +143,16 @@ class et extends R {
143
143
  return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
144
144
  }
145
145
  }
146
- function T(e, t = "algorithm.name") {
146
+ function _(e, t = "algorithm.name") {
147
147
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
148
148
  }
149
149
  function $(e, t) {
150
150
  return e.name === t;
151
151
  }
152
- function Q(e) {
152
+ function Z(e) {
153
153
  return parseInt(e.name.slice(4), 10);
154
154
  }
155
- function tt(e) {
155
+ function at(e) {
156
156
  switch (e) {
157
157
  case "ES256":
158
158
  return "P-256";
@@ -164,7 +164,7 @@ function tt(e) {
164
164
  throw new Error("unreachable");
165
165
  }
166
166
  }
167
- function rt(e, t) {
167
+ function nt(e, t) {
168
168
  if (t.length && !t.some((r) => e.usages.includes(r))) {
169
169
  let r = "CryptoKey does not support this operation, its usages must include ";
170
170
  if (t.length > 2) {
@@ -175,59 +175,59 @@ function rt(e, t) {
175
175
  throw new TypeError(r);
176
176
  }
177
177
  }
178
- function at(e, t, ...r) {
178
+ function st(e, t, ...r) {
179
179
  switch (t) {
180
180
  case "HS256":
181
181
  case "HS384":
182
182
  case "HS512": {
183
183
  if (!$(e.algorithm, "HMAC"))
184
- throw T("HMAC");
184
+ throw _("HMAC");
185
185
  const a = parseInt(t.slice(2), 10);
186
- if (Q(e.algorithm.hash) !== a)
187
- throw T(`SHA-${a}`, "algorithm.hash");
186
+ if (Z(e.algorithm.hash) !== a)
187
+ throw _(`SHA-${a}`, "algorithm.hash");
188
188
  break;
189
189
  }
190
190
  case "RS256":
191
191
  case "RS384":
192
192
  case "RS512": {
193
193
  if (!$(e.algorithm, "RSASSA-PKCS1-v1_5"))
194
- throw T("RSASSA-PKCS1-v1_5");
194
+ throw _("RSASSA-PKCS1-v1_5");
195
195
  const a = parseInt(t.slice(2), 10);
196
- if (Q(e.algorithm.hash) !== a)
197
- throw T(`SHA-${a}`, "algorithm.hash");
196
+ if (Z(e.algorithm.hash) !== a)
197
+ throw _(`SHA-${a}`, "algorithm.hash");
198
198
  break;
199
199
  }
200
200
  case "PS256":
201
201
  case "PS384":
202
202
  case "PS512": {
203
203
  if (!$(e.algorithm, "RSA-PSS"))
204
- throw T("RSA-PSS");
204
+ throw _("RSA-PSS");
205
205
  const a = parseInt(t.slice(2), 10);
206
- if (Q(e.algorithm.hash) !== a)
207
- throw T(`SHA-${a}`, "algorithm.hash");
206
+ if (Z(e.algorithm.hash) !== a)
207
+ throw _(`SHA-${a}`, "algorithm.hash");
208
208
  break;
209
209
  }
210
210
  case "EdDSA": {
211
211
  if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
212
- throw T("Ed25519 or Ed448");
212
+ throw _("Ed25519 or Ed448");
213
213
  break;
214
214
  }
215
215
  case "ES256":
216
216
  case "ES384":
217
217
  case "ES512": {
218
218
  if (!$(e.algorithm, "ECDSA"))
219
- throw T("ECDSA");
220
- const a = tt(t);
219
+ throw _("ECDSA");
220
+ const a = at(t);
221
221
  if (e.algorithm.namedCurve !== a)
222
- throw T(a, "algorithm.namedCurve");
222
+ throw _(a, "algorithm.namedCurve");
223
223
  break;
224
224
  }
225
225
  default:
226
226
  throw new TypeError("CryptoKey does not support this operation");
227
227
  }
228
- rt(e, r);
228
+ nt(e, r);
229
229
  }
230
- function _e(e, t, ...r) {
230
+ function ve(e, t, ...r) {
231
231
  var a;
232
232
  if (r.length > 2) {
233
233
  const n = r.pop();
@@ -236,11 +236,11 @@ function _e(e, t, ...r) {
236
236
  r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
237
237
  return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (a = t.constructor) != null && a.name && (e += ` Received an instance of ${t.constructor.name}`), e;
238
238
  }
239
- const de = (e, ...t) => _e("Key must be ", e, ...t);
240
- function ve(e, t, ...r) {
241
- return _e(`Key for the ${e} algorithm must be `, t, ...r);
239
+ const le = (e, ...t) => ve("Key must be ", e, ...t);
240
+ function Re(e, t, ...r) {
241
+ return ve(`Key for the ${e} algorithm must be `, t, ...r);
242
242
  }
243
- const Re = (e) => ke(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", Y = ["CryptoKey"], nt = (...e) => {
243
+ const Ie = (e) => be(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", B = ["CryptoKey"], ot = (...e) => {
244
244
  const t = e.filter(Boolean);
245
245
  if (t.length === 0 || t.length === 1)
246
246
  return !0;
@@ -259,11 +259,11 @@ const Re = (e) => ke(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) ===
259
259
  }
260
260
  return !0;
261
261
  };
262
- function st(e) {
262
+ function it(e) {
263
263
  return typeof e == "object" && e !== null;
264
264
  }
265
- function oe(e) {
266
- if (!st(e) || Object.prototype.toString.call(e) !== "[object Object]")
265
+ function ie(e) {
266
+ if (!it(e) || Object.prototype.toString.call(e) !== "[object Object]")
267
267
  return !1;
268
268
  if (Object.getPrototypeOf(e) === null)
269
269
  return !0;
@@ -272,14 +272,14 @@ function oe(e) {
272
272
  t = Object.getPrototypeOf(t);
273
273
  return Object.getPrototypeOf(e) === t;
274
274
  }
275
- const ot = (e, t) => {
275
+ const ct = (e, t) => {
276
276
  if (e.startsWith("RS") || e.startsWith("PS")) {
277
277
  const { modulusLength: r } = t.algorithm;
278
278
  if (typeof r != "number" || r < 2048)
279
279
  throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
280
280
  }
281
281
  };
282
- function it(e) {
282
+ function ut(e) {
283
283
  let t, r;
284
284
  switch (e.kty) {
285
285
  case "RSA": {
@@ -304,7 +304,7 @@ function it(e) {
304
304
  }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
305
305
  break;
306
306
  default:
307
- throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
307
+ throw new R('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
308
308
  }
309
309
  break;
310
310
  }
@@ -326,7 +326,7 @@ function it(e) {
326
326
  t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
327
327
  break;
328
328
  default:
329
- throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
329
+ throw new R('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
330
330
  }
331
331
  break;
332
332
  }
@@ -342,73 +342,73 @@ function it(e) {
342
342
  t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
343
343
  break;
344
344
  default:
345
- throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
345
+ throw new R('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
346
346
  }
347
347
  break;
348
348
  }
349
349
  default:
350
- throw new _('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
350
+ throw new R('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
351
351
  }
352
352
  return { algorithm: t, keyUsages: r };
353
353
  }
354
- const ct = async (e) => {
354
+ const dt = async (e) => {
355
355
  if (!e.alg)
356
356
  throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
357
- const { algorithm: t, keyUsages: r } = it(e), a = [
357
+ const { algorithm: t, keyUsages: r } = ut(e), a = [
358
358
  t,
359
359
  e.ext ?? !1,
360
360
  e.key_ops ?? r
361
361
  ], n = { ...e };
362
- return delete n.alg, delete n.use, G.subtle.importKey("jwk", n, ...a);
363
- }, Ie = (e) => M(e);
364
- let Z, ee;
365
- const Ce = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", Pe = async (e, t, r, a) => {
362
+ return delete n.alg, delete n.use, q.subtle.importKey("jwk", n, ...a);
363
+ }, Ce = (e) => V(e);
364
+ let ee, te;
365
+ const Pe = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", Oe = async (e, t, r, a) => {
366
366
  let n = e.get(t);
367
367
  if (n != null && n[a])
368
368
  return n[a];
369
- const s = await ct({ ...r, alg: a });
369
+ const s = await dt({ ...r, alg: a });
370
370
  return n ? n[a] = s : e.set(t, { [a]: s }), s;
371
- }, ut = (e, t) => {
372
- if (Ce(e)) {
371
+ }, lt = (e, t) => {
372
+ if (Pe(e)) {
373
373
  let r = e.export({ format: "jwk" });
374
- return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Ie(r.k) : (ee || (ee = /* @__PURE__ */ new WeakMap()), Pe(ee, e, r, t));
374
+ return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Ce(r.k) : (te || (te = /* @__PURE__ */ new WeakMap()), Oe(te, e, r, t));
375
375
  }
376
376
  return e;
377
- }, dt = (e, t) => {
378
- if (Ce(e)) {
377
+ }, ht = (e, t) => {
378
+ if (Pe(e)) {
379
379
  let r = e.export({ format: "jwk" });
380
- return r.k ? Ie(r.k) : (Z || (Z = /* @__PURE__ */ new WeakMap()), Pe(Z, e, r, t));
380
+ return r.k ? Ce(r.k) : (ee || (ee = /* @__PURE__ */ new WeakMap()), Oe(ee, e, r, t));
381
381
  }
382
382
  return e;
383
- }, lt = { normalizePublicKey: ut, normalizePrivateKey: dt }, b = (e, t, r = 0) => {
383
+ }, ft = { normalizePublicKey: lt, normalizePrivateKey: ht }, v = (e, t, r = 0) => {
384
384
  r === 0 && (t.unshift(t.length), t.unshift(6));
385
385
  const a = e.indexOf(t[0], r);
386
386
  if (a === -1)
387
387
  return !1;
388
388
  const n = e.subarray(a, a + t.length);
389
- return n.length !== t.length ? !1 : n.every((s, o) => s === t[o]) || b(e, t, a + 1);
390
- }, le = (e) => {
389
+ return n.length !== t.length ? !1 : n.every((s, o) => s === t[o]) || v(e, t, a + 1);
390
+ }, he = (e) => {
391
391
  switch (!0) {
392
- case b(e, [42, 134, 72, 206, 61, 3, 1, 7]):
392
+ case v(e, [42, 134, 72, 206, 61, 3, 1, 7]):
393
393
  return "P-256";
394
- case b(e, [43, 129, 4, 0, 34]):
394
+ case v(e, [43, 129, 4, 0, 34]):
395
395
  return "P-384";
396
- case b(e, [43, 129, 4, 0, 35]):
396
+ case v(e, [43, 129, 4, 0, 35]):
397
397
  return "P-521";
398
- case b(e, [43, 101, 110]):
398
+ case v(e, [43, 101, 110]):
399
399
  return "X25519";
400
- case b(e, [43, 101, 111]):
400
+ case v(e, [43, 101, 111]):
401
401
  return "X448";
402
- case b(e, [43, 101, 112]):
402
+ case v(e, [43, 101, 112]):
403
403
  return "Ed25519";
404
- case b(e, [43, 101, 113]):
404
+ case v(e, [43, 101, 113]):
405
405
  return "Ed448";
406
406
  default:
407
- throw new _("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
407
+ throw new R("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
408
408
  }
409
- }, ht = async (e, t, r, a, n) => {
409
+ }, pt = async (e, t, r, a, n) => {
410
410
  let s, o;
411
- const c = new Uint8Array(atob(r.replace(e, "")).split("").map((i) => i.charCodeAt(0)));
411
+ const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
412
412
  switch (a) {
413
413
  case "PS256":
414
414
  case "PS384":
@@ -442,43 +442,43 @@ const Ce = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
442
442
  case "ECDH-ES+A128KW":
443
443
  case "ECDH-ES+A192KW":
444
444
  case "ECDH-ES+A256KW": {
445
- const i = le(c);
446
- s = i.startsWith("P-") ? { name: "ECDH", namedCurve: i } : { name: i }, o = [];
445
+ const c = he(i);
446
+ s = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, o = [];
447
447
  break;
448
448
  }
449
449
  case "EdDSA":
450
- s = { name: le(c) }, o = ["verify"];
450
+ s = { name: he(i) }, o = ["verify"];
451
451
  break;
452
452
  default:
453
- throw new _('Invalid or unsupported "alg" (Algorithm) value');
453
+ throw new R('Invalid or unsupported "alg" (Algorithm) value');
454
454
  }
455
- return G.subtle.importKey(t, c, s, !1, o);
456
- }, pt = (e, t, r) => ht(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
457
- async function ft(e, t, r) {
455
+ return q.subtle.importKey(t, i, s, !1, o);
456
+ }, yt = (e, t, r) => pt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
457
+ async function mt(e, t, r) {
458
458
  if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
459
459
  throw new TypeError('"spki" must be SPKI formatted string');
460
- return pt(e, t);
460
+ return yt(e, t);
461
461
  }
462
- const V = (e) => e == null ? void 0 : e[Symbol.toStringTag], yt = (e, t) => {
462
+ const Y = (e) => e == null ? void 0 : e[Symbol.toStringTag], wt = (e, t) => {
463
463
  if (!(t instanceof Uint8Array)) {
464
- if (!Re(t))
465
- throw new TypeError(ve(e, t, ...Y, "Uint8Array"));
464
+ if (!Ie(t))
465
+ throw new TypeError(Re(e, t, ...B, "Uint8Array"));
466
466
  if (t.type !== "secret")
467
- throw new TypeError(`${V(t)} instances for symmetric algorithms must be of type "secret"`);
467
+ throw new TypeError(`${Y(t)} instances for symmetric algorithms must be of type "secret"`);
468
468
  }
469
- }, mt = (e, t, r) => {
470
- if (!Re(t))
471
- throw new TypeError(ve(e, t, ...Y));
469
+ }, Et = (e, t, r) => {
470
+ if (!Ie(t))
471
+ throw new TypeError(Re(e, t, ...B));
472
472
  if (t.type === "secret")
473
- throw new TypeError(`${V(t)} instances for asymmetric algorithms must not be of type "secret"`);
473
+ throw new TypeError(`${Y(t)} instances for asymmetric algorithms must not be of type "secret"`);
474
474
  if (t.algorithm && r === "verify" && t.type === "private")
475
- throw new TypeError(`${V(t)} instances for asymmetric algorithm verifying must be of type "public"`);
475
+ throw new TypeError(`${Y(t)} instances for asymmetric algorithm verifying must be of type "public"`);
476
476
  if (t.algorithm && r === "encrypt" && t.type === "private")
477
- throw new TypeError(`${V(t)} instances for asymmetric algorithm encryption must be of type "public"`);
478
- }, wt = (e, t, r) => {
479
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? yt(e, t) : mt(e, t, r);
477
+ throw new TypeError(`${Y(t)} instances for asymmetric algorithm encryption must be of type "public"`);
478
+ }, St = (e, t, r) => {
479
+ e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? wt(e, t) : Et(e, t, r);
480
480
  };
481
- function Et(e, t, r, a, n) {
481
+ function gt(e, t, r, a, n) {
482
482
  if (n.crit !== void 0 && (a == null ? void 0 : a.crit) === void 0)
483
483
  throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
484
484
  if (!a || a.crit === void 0)
@@ -489,7 +489,7 @@ function Et(e, t, r, a, n) {
489
489
  r !== void 0 ? s = new Map([...Object.entries(r), ...t.entries()]) : s = t;
490
490
  for (const o of a.crit) {
491
491
  if (!s.has(o))
492
- throw new _(`Extension Header Parameter "${o}" is not recognized`);
492
+ throw new R(`Extension Header Parameter "${o}" is not recognized`);
493
493
  if (n[o] === void 0)
494
494
  throw new e(`Extension Header Parameter "${o}" is missing`);
495
495
  if (s.get(o) && a[o] === void 0)
@@ -497,13 +497,13 @@ function Et(e, t, r, a, n) {
497
497
  }
498
498
  return new Set(a.crit);
499
499
  }
500
- const St = (e, t) => {
500
+ const At = (e, t) => {
501
501
  if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
502
502
  throw new TypeError(`"${e}" option must be an array of strings`);
503
503
  if (t)
504
504
  return new Set(t);
505
505
  };
506
- function gt(e, t) {
506
+ function Tt(e, t) {
507
507
  const r = `SHA-${e.slice(-3)}`;
508
508
  switch (e) {
509
509
  case "HS256":
@@ -525,104 +525,104 @@ function gt(e, t) {
525
525
  case "EdDSA":
526
526
  return { name: t.name };
527
527
  default:
528
- throw new _(`alg ${e} is not supported either by JOSE or your javascript runtime`);
528
+ throw new R(`alg ${e} is not supported either by JOSE or your javascript runtime`);
529
529
  }
530
530
  }
531
- async function At(e, t, r) {
532
- if (t = await lt.normalizePublicKey(t, e), ke(t))
533
- return at(t, e, r), t;
531
+ async function kt(e, t, r) {
532
+ if (t = await ft.normalizePublicKey(t, e), be(t))
533
+ return st(t, e, r), t;
534
534
  if (t instanceof Uint8Array) {
535
535
  if (!e.startsWith("HS"))
536
- throw new TypeError(de(t, ...Y));
537
- return G.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
536
+ throw new TypeError(le(t, ...B));
537
+ return q.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
538
538
  }
539
- throw new TypeError(de(t, ...Y, "Uint8Array"));
539
+ throw new TypeError(le(t, ...B, "Uint8Array"));
540
540
  }
541
- const Tt = async (e, t, r, a) => {
542
- const n = await At(e, t, "verify");
543
- ot(e, n);
544
- const s = gt(e, n.algorithm);
541
+ const bt = async (e, t, r, a) => {
542
+ const n = await kt(e, t, "verify");
543
+ ct(e, n);
544
+ const s = Tt(e, n.algorithm);
545
545
  try {
546
- return await G.subtle.verify(s, n, r, a);
546
+ return await q.subtle.verify(s, n, r, a);
547
547
  } catch {
548
548
  return !1;
549
549
  }
550
550
  };
551
- async function kt(e, t, r) {
552
- if (!oe(e))
553
- throw new h("Flattened JWS must be an object");
551
+ async function _t(e, t, r) {
552
+ if (!ie(e))
553
+ throw new f("Flattened JWS must be an object");
554
554
  if (e.protected === void 0 && e.header === void 0)
555
- throw new h('Flattened JWS must have either of the "protected" or "header" members');
555
+ throw new f('Flattened JWS must have either of the "protected" or "header" members');
556
556
  if (e.protected !== void 0 && typeof e.protected != "string")
557
- throw new h("JWS Protected Header incorrect type");
557
+ throw new f("JWS Protected Header incorrect type");
558
558
  if (e.payload === void 0)
559
- throw new h("JWS Payload missing");
559
+ throw new f("JWS Payload missing");
560
560
  if (typeof e.signature != "string")
561
- throw new h("JWS Signature missing or incorrect type");
562
- if (e.header !== void 0 && !oe(e.header))
563
- throw new h("JWS Unprotected Header incorrect type");
561
+ throw new f("JWS Signature missing or incorrect type");
562
+ if (e.header !== void 0 && !ie(e.header))
563
+ throw new f("JWS Unprotected Header incorrect type");
564
564
  let a = {};
565
565
  if (e.protected)
566
566
  try {
567
- const w = M(e.protected);
568
- a = JSON.parse(q.decode(w));
567
+ const S = V(e.protected);
568
+ a = JSON.parse(z.decode(S));
569
569
  } catch {
570
- throw new h("JWS Protected Header is invalid");
570
+ throw new f("JWS Protected Header is invalid");
571
571
  }
572
- if (!nt(a, e.header))
573
- throw new h("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
572
+ if (!ot(a, e.header))
573
+ throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
574
574
  const n = {
575
575
  ...a,
576
576
  ...e.header
577
- }, s = Et(h, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, a, n);
577
+ }, s = gt(f, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, a, n);
578
578
  let o = !0;
579
579
  if (s.has("b64") && (o = a.b64, typeof o != "boolean"))
580
- throw new h('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
581
- const { alg: c } = n;
582
- if (typeof c != "string" || !c)
583
- throw new h('JWS "alg" (Algorithm) Header Parameter missing or invalid');
584
- const i = r && St("algorithms", r.algorithms);
585
- if (i && !i.has(c))
586
- throw new Ze('"alg" (Algorithm) Header Parameter value not allowed');
580
+ throw new f('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
581
+ const { alg: i } = n;
582
+ if (typeof i != "string" || !i)
583
+ throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');
584
+ const c = r && At("algorithms", r.algorithms);
585
+ if (c && !c.has(i))
586
+ throw new tt('"alg" (Algorithm) Header Parameter value not allowed');
587
587
  if (o) {
588
588
  if (typeof e.payload != "string")
589
- throw new h("JWS Payload must be a string");
589
+ throw new f("JWS Payload must be a string");
590
590
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
591
- throw new h("JWS Payload must be a string or an Uint8Array instance");
592
- let u = !1;
593
- typeof t == "function" && (t = await t(a, e), u = !0), wt(c, t, "verify");
594
- const m = Xe(N.encode(e.protected ?? ""), N.encode("."), typeof e.payload == "string" ? N.encode(e.payload) : e.payload);
595
- let f;
591
+ throw new f("JWS Payload must be a string or an Uint8Array instance");
592
+ let d = !1;
593
+ typeof t == "function" && (t = await t(a, e), d = !0), St(i, t, "verify");
594
+ const y = Ze(L.encode(e.protected ?? ""), L.encode("."), typeof e.payload == "string" ? L.encode(e.payload) : e.payload);
595
+ let p;
596
596
  try {
597
- f = M(e.signature);
597
+ p = V(e.signature);
598
598
  } catch {
599
- throw new h("Failed to base64url decode the signature");
599
+ throw new f("Failed to base64url decode the signature");
600
600
  }
601
- if (!await Tt(c, t, f, m))
602
- throw new et();
603
- let k;
601
+ if (!await bt(i, t, p, y))
602
+ throw new rt();
603
+ let T;
604
604
  if (o)
605
605
  try {
606
- k = M(e.payload);
606
+ T = V(e.payload);
607
607
  } catch {
608
- throw new h("Failed to base64url decode the payload");
608
+ throw new f("Failed to base64url decode the payload");
609
609
  }
610
610
  else
611
- typeof e.payload == "string" ? k = N.encode(e.payload) : k = e.payload;
612
- const E = { payload: k };
613
- return e.protected !== void 0 && (E.protectedHeader = a), e.header !== void 0 && (E.unprotectedHeader = e.header), u ? { ...E, key: t } : E;
611
+ typeof e.payload == "string" ? T = L.encode(e.payload) : T = e.payload;
612
+ const E = { payload: T };
613
+ return e.protected !== void 0 && (E.protectedHeader = a), e.header !== void 0 && (E.unprotectedHeader = e.header), d ? { ...E, key: t } : E;
614
614
  }
615
- async function bt(e, t, r) {
616
- if (e instanceof Uint8Array && (e = q.decode(e)), typeof e != "string")
617
- throw new h("Compact JWS must be a string or Uint8Array");
615
+ async function vt(e, t, r) {
616
+ if (e instanceof Uint8Array && (e = z.decode(e)), typeof e != "string")
617
+ throw new f("Compact JWS must be a string or Uint8Array");
618
618
  const { 0: a, 1: n, 2: s, length: o } = e.split(".");
619
619
  if (o !== 3)
620
- throw new h("Invalid Compact JWS");
621
- const c = await kt({ payload: n, protected: a, signature: s }, t, r), i = { payload: c.payload, protectedHeader: c.protectedHeader };
622
- return typeof t == "function" ? { ...i, key: c.key } : i;
620
+ throw new f("Invalid Compact JWS");
621
+ const i = await _t({ payload: n, protected: a, signature: s }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
622
+ return typeof t == "function" ? { ...c, key: i.key } : c;
623
623
  }
624
- const _t = (e) => Math.floor(e.getTime() / 1e3), Oe = 60, De = Oe * 60, ie = De * 24, vt = ie * 7, Rt = ie * 365.25, It = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, he = (e) => {
625
- const t = It.exec(e);
624
+ const Rt = (e) => Math.floor(e.getTime() / 1e3), De = 60, Ue = De * 60, ce = Ue * 24, It = ce * 7, Ct = ce * 365.25, Pt = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, fe = (e) => {
625
+ const t = Pt.exec(e);
626
626
  if (!t || t[4] && t[1])
627
627
  throw new TypeError("Invalid time period format");
628
628
  const r = parseFloat(t[2]), a = t[3].toLowerCase();
@@ -640,230 +640,230 @@ const _t = (e) => Math.floor(e.getTime() / 1e3), Oe = 60, De = Oe * 60, ie = De
640
640
  case "min":
641
641
  case "mins":
642
642
  case "m":
643
- n = Math.round(r * Oe);
643
+ n = Math.round(r * De);
644
644
  break;
645
645
  case "hour":
646
646
  case "hours":
647
647
  case "hr":
648
648
  case "hrs":
649
649
  case "h":
650
- n = Math.round(r * De);
650
+ n = Math.round(r * Ue);
651
651
  break;
652
652
  case "day":
653
653
  case "days":
654
654
  case "d":
655
- n = Math.round(r * ie);
655
+ n = Math.round(r * ce);
656
656
  break;
657
657
  case "week":
658
658
  case "weeks":
659
659
  case "w":
660
- n = Math.round(r * vt);
660
+ n = Math.round(r * It);
661
661
  break;
662
662
  default:
663
- n = Math.round(r * Rt);
663
+ n = Math.round(r * Ct);
664
664
  break;
665
665
  }
666
666
  return t[1] === "-" || t[4] === "ago" ? -n : n;
667
- }, pe = (e) => e.toLowerCase().replace(/^application\//, ""), Ct = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Pt = (e, t, r = {}) => {
667
+ }, pe = (e) => e.toLowerCase().replace(/^application\//, ""), Ot = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Dt = (e, t, r = {}) => {
668
668
  let a;
669
669
  try {
670
- a = JSON.parse(q.decode(t));
670
+ a = JSON.parse(z.decode(t));
671
671
  } catch {
672
672
  }
673
- if (!oe(a))
674
- throw new be("JWT Claims Set must be a top-level JSON object");
673
+ if (!ie(a))
674
+ throw new _e("JWT Claims Set must be a top-level JSON object");
675
675
  const { typ: n } = r;
676
676
  if (n && (typeof e.typ != "string" || pe(e.typ) !== pe(n)))
677
- throw new S('unexpected "typ" JWT header value', a, "typ", "check_failed");
678
- const { requiredClaims: s = [], issuer: o, subject: c, audience: i, maxTokenAge: u } = r, m = [...s];
679
- u !== void 0 && m.push("iat"), i !== void 0 && m.push("aud"), c !== void 0 && m.push("sub"), o !== void 0 && m.push("iss");
680
- for (const w of new Set(m.reverse()))
681
- if (!(w in a))
682
- throw new S(`missing required "${w}" claim`, a, w, "missing");
677
+ throw new A('unexpected "typ" JWT header value', a, "typ", "check_failed");
678
+ const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: d } = r, y = [...s];
679
+ d !== void 0 && y.push("iat"), c !== void 0 && y.push("aud"), i !== void 0 && y.push("sub"), o !== void 0 && y.push("iss");
680
+ for (const S of new Set(y.reverse()))
681
+ if (!(S in a))
682
+ throw new A(`missing required "${S}" claim`, a, S, "missing");
683
683
  if (o && !(Array.isArray(o) ? o : [o]).includes(a.iss))
684
- throw new S('unexpected "iss" claim value', a, "iss", "check_failed");
685
- if (c && a.sub !== c)
686
- throw new S('unexpected "sub" claim value', a, "sub", "check_failed");
687
- if (i && !Ct(a.aud, typeof i == "string" ? [i] : i))
688
- throw new S('unexpected "aud" claim value', a, "aud", "check_failed");
689
- let f;
684
+ throw new A('unexpected "iss" claim value', a, "iss", "check_failed");
685
+ if (i && a.sub !== i)
686
+ throw new A('unexpected "sub" claim value', a, "sub", "check_failed");
687
+ if (c && !Ot(a.aud, typeof c == "string" ? [c] : c))
688
+ throw new A('unexpected "aud" claim value', a, "aud", "check_failed");
689
+ let p;
690
690
  switch (typeof r.clockTolerance) {
691
691
  case "string":
692
- f = he(r.clockTolerance);
692
+ p = fe(r.clockTolerance);
693
693
  break;
694
694
  case "number":
695
- f = r.clockTolerance;
695
+ p = r.clockTolerance;
696
696
  break;
697
697
  case "undefined":
698
- f = 0;
698
+ p = 0;
699
699
  break;
700
700
  default:
701
701
  throw new TypeError("Invalid clockTolerance option type");
702
702
  }
703
- const { currentDate: k } = r, E = _t(k || /* @__PURE__ */ new Date());
704
- if ((a.iat !== void 0 || u) && typeof a.iat != "number")
705
- throw new S('"iat" claim must be a number', a, "iat", "invalid");
703
+ const { currentDate: T } = r, E = Rt(T || /* @__PURE__ */ new Date());
704
+ if ((a.iat !== void 0 || d) && typeof a.iat != "number")
705
+ throw new A('"iat" claim must be a number', a, "iat", "invalid");
706
706
  if (a.nbf !== void 0) {
707
707
  if (typeof a.nbf != "number")
708
- throw new S('"nbf" claim must be a number', a, "nbf", "invalid");
709
- if (a.nbf > E + f)
710
- throw new S('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
708
+ throw new A('"nbf" claim must be a number', a, "nbf", "invalid");
709
+ if (a.nbf > E + p)
710
+ throw new A('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
711
711
  }
712
712
  if (a.exp !== void 0) {
713
713
  if (typeof a.exp != "number")
714
- throw new S('"exp" claim must be a number', a, "exp", "invalid");
715
- if (a.exp <= E - f)
716
- throw new ue('"exp" claim timestamp check failed', a, "exp", "check_failed");
714
+ throw new A('"exp" claim must be a number', a, "exp", "invalid");
715
+ if (a.exp <= E - p)
716
+ throw new de('"exp" claim timestamp check failed', a, "exp", "check_failed");
717
717
  }
718
- if (u) {
719
- const w = E - a.iat, X = typeof u == "number" ? u : he(u);
720
- if (w - f > X)
721
- throw new ue('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
722
- if (w < 0 - f)
723
- throw new S('"iat" claim timestamp check failed (it should be in the past)', a, "iat", "check_failed");
718
+ if (d) {
719
+ const S = E - a.iat, K = typeof d == "number" ? d : fe(d);
720
+ if (S - p > K)
721
+ throw new de('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
722
+ if (S < 0 - p)
723
+ throw new A('"iat" claim timestamp check failed (it should be in the past)', a, "iat", "check_failed");
724
724
  }
725
725
  return a;
726
726
  };
727
- async function Ot(e, t, r) {
727
+ async function Ut(e, t, r) {
728
728
  var a;
729
- const n = await bt(e, t, r);
729
+ const n = await vt(e, t, r);
730
730
  if ((a = n.protectedHeader.crit) != null && a.includes("b64") && n.protectedHeader.b64 === !1)
731
- throw new be("JWTs MUST NOT use unencoded payload");
732
- const s = { payload: Pt(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
731
+ throw new _e("JWTs MUST NOT use unencoded payload");
732
+ const s = { payload: Dt(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
733
733
  return typeof t == "function" ? { ...s, key: n.key } : s;
734
734
  }
735
- const U = async (e) => {
735
+ const H = async (e) => {
736
736
  try {
737
- const t = y.ALG, r = await ft(ze, t);
738
- return await Ot(e, r, {
739
- issuer: y.ISSUER
737
+ const t = m.ALG, r = await mt(Qe, t);
738
+ return await Ut(e, r, {
739
+ issuer: m.ISSUER
740
740
  });
741
741
  } catch {
742
742
  return;
743
743
  }
744
744
  };
745
- var d = [];
746
- for (var te = 0; te < 256; ++te)
747
- d.push((te + 256).toString(16).slice(1));
748
- function Dt(e, t = 0) {
749
- return (d[e[t + 0]] + d[e[t + 1]] + d[e[t + 2]] + d[e[t + 3]] + "-" + d[e[t + 4]] + d[e[t + 5]] + "-" + d[e[t + 6]] + d[e[t + 7]] + "-" + d[e[t + 8]] + d[e[t + 9]] + "-" + d[e[t + 10]] + d[e[t + 11]] + d[e[t + 12]] + d[e[t + 13]] + d[e[t + 14]] + d[e[t + 15]]).toLowerCase();
745
+ var l = [];
746
+ for (var re = 0; re < 256; ++re)
747
+ l.push((re + 256).toString(16).slice(1));
748
+ function Ht(e, t = 0) {
749
+ return (l[e[t + 0]] + l[e[t + 1]] + l[e[t + 2]] + l[e[t + 3]] + "-" + l[e[t + 4]] + l[e[t + 5]] + "-" + l[e[t + 6]] + l[e[t + 7]] + "-" + l[e[t + 8]] + l[e[t + 9]] + "-" + l[e[t + 10]] + l[e[t + 11]] + l[e[t + 12]] + l[e[t + 13]] + l[e[t + 14]] + l[e[t + 15]]).toLowerCase();
750
750
  }
751
- var L, Ut = new Uint8Array(16);
752
- function Ht() {
753
- if (!L && (L = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !L))
751
+ var W, Kt = new Uint8Array(16);
752
+ function Nt() {
753
+ if (!W && (W = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !W))
754
754
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
755
- return L(Ut);
755
+ return W(Kt);
756
756
  }
757
- var Kt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
758
- const fe = {
759
- randomUUID: Kt
757
+ var Lt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
758
+ const ye = {
759
+ randomUUID: Lt
760
760
  };
761
- function ye(e, t, r) {
762
- if (fe.randomUUID && !t && !e)
763
- return fe.randomUUID();
761
+ function me(e, t, r) {
762
+ if (ye.randomUUID && !t && !e)
763
+ return ye.randomUUID();
764
764
  e = e || {};
765
- var a = e.random || (e.rng || Ht)();
766
- return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Dt(a);
765
+ var a = e.random || (e.rng || Nt)();
766
+ return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Ht(a);
767
767
  }
768
- const me = globalThis.crypto, Nt = (e) => `${ye()}${ye()}`.slice(0, e), $t = (e) => btoa(
768
+ const we = globalThis.crypto, $t = (e) => `${me()}${me()}`.slice(0, e), Wt = (e) => btoa(
769
769
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
770
770
  );
771
- async function Lt(e) {
772
- if (!me.subtle)
771
+ async function Jt(e) {
772
+ if (!we.subtle)
773
773
  throw new Error(
774
774
  "crypto.subtle is available only in secure contexts (HTTPS)."
775
775
  );
776
- const t = new TextEncoder().encode(e), r = await me.subtle.digest("SHA-256", t);
777
- return $t(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
776
+ const t = new TextEncoder().encode(e), r = await we.subtle.digest("SHA-256", t);
777
+ return Wt(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
778
778
  }
779
- async function Wt(e) {
780
- const r = Nt(43), a = await Lt(r);
779
+ async function xt(e) {
780
+ const r = $t(43), a = await Jt(r);
781
781
  return {
782
782
  code_verifier: r,
783
783
  code_challenge: a
784
784
  };
785
785
  }
786
- function Ue(e, t) {
786
+ function He(e, t) {
787
787
  window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
788
788
  }
789
- const we = (e, t) => {
789
+ const Ee = (e, t) => {
790
790
  const r = JSON.stringify(
791
791
  typeof t == "function" ? t() : t
792
792
  );
793
- window.localStorage.setItem(e, r), Ue(e, r);
794
- }, Jt = (e) => {
795
- window.localStorage.removeItem(e), Ue(e, null);
796
- }, Ee = (e) => window.localStorage.getItem(e), xt = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
797
- function W({
793
+ window.localStorage.setItem(e, r), He(e, r);
794
+ }, jt = (e) => {
795
+ window.localStorage.removeItem(e), He(e, null);
796
+ }, Se = (e) => window.localStorage.getItem(e), Mt = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
797
+ function J({
798
798
  key: e,
799
799
  initialValue: t
800
800
  }) {
801
- const r = () => Ee(e), a = D.useSyncExternalStore(
802
- xt,
801
+ const r = () => Se(e), a = U.useSyncExternalStore(
802
+ Mt,
803
803
  r
804
- ), n = D.useCallback(
805
- (c) => {
804
+ ), n = U.useCallback(
805
+ (i) => {
806
806
  try {
807
- const i = typeof c == "function" ? c(JSON.parse(a)) : c;
808
- i == null ? Jt(e) : we(e, i);
809
- } catch (i) {
810
- console.warn(i);
807
+ const c = typeof i == "function" ? i(JSON.parse(a)) : i;
808
+ c == null ? jt(e) : Ee(e, c);
809
+ } catch (c) {
810
+ console.warn(c);
811
811
  }
812
812
  },
813
813
  [e, a]
814
- ), s = D.useCallback(() => {
814
+ ), s = U.useCallback(() => {
815
815
  n(t);
816
- }, [t, n]), o = D.useCallback(() => {
816
+ }, [t, n]), o = U.useCallback(() => {
817
817
  n(null);
818
818
  }, [n]);
819
- return D.useEffect(() => {
819
+ return U.useEffect(() => {
820
820
  try {
821
- Ee(e) === null && typeof t < "u" && we(e, t);
822
- } catch (c) {
823
- console.warn(c);
821
+ Se(e) === null && typeof t < "u" && Ee(e, t);
822
+ } catch (i) {
823
+ console.warn(i);
824
824
  }
825
825
  }, [e, t]), [a ? JSON.parse(a) : null, n, s, o];
826
826
  }
827
- var l = [];
828
- for (var re = 0; re < 256; ++re)
829
- l.push((re + 256).toString(16).slice(1));
830
- function jt(e, t = 0) {
831
- return (l[e[t + 0]] + l[e[t + 1]] + l[e[t + 2]] + l[e[t + 3]] + "-" + l[e[t + 4]] + l[e[t + 5]] + "-" + l[e[t + 6]] + l[e[t + 7]] + "-" + l[e[t + 8]] + l[e[t + 9]] + "-" + l[e[t + 10]] + l[e[t + 11]] + l[e[t + 12]] + l[e[t + 13]] + l[e[t + 14]] + l[e[t + 15]]).toLowerCase();
827
+ var h = [];
828
+ for (var ae = 0; ae < 256; ++ae)
829
+ h.push((ae + 256).toString(16).slice(1));
830
+ function Vt(e, t = 0) {
831
+ return (h[e[t + 0]] + h[e[t + 1]] + h[e[t + 2]] + h[e[t + 3]] + "-" + h[e[t + 4]] + h[e[t + 5]] + "-" + h[e[t + 6]] + h[e[t + 7]] + "-" + h[e[t + 8]] + h[e[t + 9]] + "-" + h[e[t + 10]] + h[e[t + 11]] + h[e[t + 12]] + h[e[t + 13]] + h[e[t + 14]] + h[e[t + 15]]).toLowerCase();
832
832
  }
833
- var J, Mt = new Uint8Array(16);
834
- function Vt() {
835
- if (!J && (J = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !J))
833
+ var x, Yt = new Uint8Array(16);
834
+ function Bt() {
835
+ if (!x && (x = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !x))
836
836
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
837
- return J(Mt);
837
+ return x(Yt);
838
838
  }
839
- var Yt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
840
- const Se = {
841
- randomUUID: Yt
839
+ var Ft = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
840
+ const ge = {
841
+ randomUUID: Ft
842
842
  };
843
- function Bt(e, t, r) {
844
- if (Se.randomUUID && !t && !e)
845
- return Se.randomUUID();
843
+ function Gt(e, t, r) {
844
+ if (ge.randomUUID && !t && !e)
845
+ return ge.randomUUID();
846
846
  e = e || {};
847
- var a = e.random || (e.rng || Vt)();
848
- return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, jt(a);
847
+ var a = e.random || (e.rng || Bt)();
848
+ return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Vt(a);
849
849
  }
850
- const ae = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Ft = "Your session has been successfully terminated.", ge = "Login failed. Please try again.", ne = "Error getting access token, please re-authenticate.", Gt = "You forgot to wrap your component in <AuthProvider>.", Ae = {
850
+ const ne = "Oops! It looks like your session has expired. For your security, please log in again to continue.", qt = "Your session has been successfully terminated.", Ae = "Login failed. Please try again.", se = "Error getting access token, please re-authenticate.", zt = "You forgot to wrap your component in <AuthProvider>.", Te = {
851
851
  dev: "https://auth.gizmette.local.com:3003",
852
852
  prod: "https://mylogin.gizmette.com"
853
- }, x = "@@auth@@", qt = process.env.NODE_ENV === "production", zt = !qt, z = async ({
853
+ }, j = "@@auth@@", Xt = process.env.NODE_ENV === "production", Qt = !Xt, X = async ({
854
854
  type: e,
855
855
  clientId: t,
856
856
  params: r = {}
857
857
  }) => {
858
858
  try {
859
859
  const a = await fetch(
860
- zt ? `${Ae.dev}/${e}` : `${Ae.prod}/${e}`,
860
+ Qt ? `${Te.dev}/${e}` : `${Te.prod}/${e}`,
861
861
  {
862
862
  credentials: "include",
863
863
  method: "POST",
864
864
  headers: {
865
865
  "Content-Type": "application/json",
866
- [qe.CLIENT_ID]: `${t}`
866
+ [Xe.CLIENT_ID]: `${t}`
867
867
  },
868
868
  body: JSON.stringify(r)
869
869
  }
@@ -879,7 +879,7 @@ const ae = "Oops! It looks like your session has expired. For your security, ple
879
879
  } catch (a) {
880
880
  return console.error(a), { status: 500, data: [] };
881
881
  }
882
- }, se = async ({
882
+ }, oe = async ({
883
883
  idToken: e,
884
884
  accessToken: t,
885
885
  refreshToken: r,
@@ -887,8 +887,8 @@ const ae = "Oops! It looks like your session has expired. For your security, ple
887
887
  }) => {
888
888
  try {
889
889
  return {
890
- status: (await z({
891
- type: F.LOGOUT,
890
+ status: (await X({
891
+ type: G.LOGOUT,
892
892
  clientId: a,
893
893
  params: {
894
894
  idToken: e,
@@ -902,7 +902,7 @@ const ae = "Oops! It looks like your session has expired. For your security, ple
902
902
  status: !1
903
903
  };
904
904
  }
905
- }, Te = async ({
905
+ }, ke = async ({
906
906
  username: e,
907
907
  password: t,
908
908
  clientId: r,
@@ -910,27 +910,27 @@ const ae = "Oops! It looks like your session has expired. For your security, ple
910
910
  type: n,
911
911
  sessionExpiration: s,
912
912
  code: o,
913
- code_verifier: c
913
+ code_verifier: i
914
914
  }) => {
915
915
  try {
916
- const i = await z({
917
- type: F.AUTHENTICATE,
916
+ const c = await X({
917
+ type: G.AUTHENTICATE,
918
918
  clientId: r,
919
919
  params: {
920
- type: n || B.ID_AND_ACCESS_TOKEN,
920
+ type: n || F.ID_AND_ACCESS_TOKEN,
921
921
  username: e,
922
922
  password: t,
923
923
  sessionExpiration: s,
924
924
  nonce: a,
925
925
  code: o,
926
- code_verifier: c
926
+ code_verifier: i
927
927
  }
928
- }), u = await U(i.data.idToken);
929
- return u && u.payload[y.USER_ID_KEY] !== "" && u.payload[y.NONCE_KEY] === a ? {
930
- idToken: i.data.idToken,
931
- accessToken: i.data.accessToken,
932
- refreshToken: i.data.refreshToken,
933
- userId: u.payload[y.USER_ID_KEY],
928
+ }), d = await H(c.data.idToken);
929
+ return d && d.payload[m.USER_ID_KEY] !== "" && d.payload[m.NONCE_KEY] === a ? {
930
+ idToken: c.data.idToken,
931
+ accessToken: c.data.accessToken,
932
+ refreshToken: c.data.refreshToken,
933
+ userId: d.payload[m.USER_ID_KEY],
934
934
  status: !0
935
935
  } : {
936
936
  status: !1
@@ -940,17 +940,17 @@ const ae = "Oops! It looks like your session has expired. For your security, ple
940
940
  status: !1
941
941
  };
942
942
  }
943
- }, Xt = async ({
943
+ }, Zt = async ({
944
944
  nonce: e,
945
945
  clientId: t,
946
946
  code_challenge: r
947
947
  }) => {
948
948
  try {
949
- const a = await z({
950
- type: F.CODE,
949
+ const a = await X({
950
+ type: G.CODE,
951
951
  clientId: t,
952
952
  params: {
953
- type: B.CODE,
953
+ type: F.CODE,
954
954
  nonce: e,
955
955
  code_challenge: r
956
956
  }
@@ -966,7 +966,7 @@ const ae = "Oops! It looks like your session has expired. For your security, ple
966
966
  status: !1
967
967
  };
968
968
  }
969
- }, Qt = async ({
969
+ }, er = async ({
970
970
  clientId: e,
971
971
  userId: t,
972
972
  nonce: r,
@@ -974,21 +974,21 @@ const ae = "Oops! It looks like your session has expired. For your security, ple
974
974
  accessToken: n
975
975
  }) => {
976
976
  try {
977
- const s = await z({
978
- type: F.AUTHENTICATE,
977
+ const s = await X({
978
+ type: G.AUTHENTICATE,
979
979
  clientId: e,
980
980
  params: {
981
- type: B.REFRESH_TOKEN,
981
+ type: F.REFRESH_TOKEN,
982
982
  userId: t,
983
983
  nonce: r,
984
984
  refreshToken: a,
985
985
  accessToken: n
986
986
  }
987
- }), o = await U(s.data.accessToken);
988
- return o && o.payload[y.USER_ID_KEY] !== "" && o.payload[y.NONCE_KEY] === r ? {
987
+ }), o = await H(s.data.accessToken);
988
+ return o && o.payload[m.USER_ID_KEY] !== "" && o.payload[m.NONCE_KEY] === r ? {
989
989
  accessToken: s.data.accessToken,
990
990
  refreshToken: s.data.refreshToken,
991
- userId: o.payload[y.USER_ID_KEY],
991
+ userId: o.payload[m.USER_ID_KEY],
992
992
  status: !0
993
993
  } : {
994
994
  status: !1
@@ -999,11 +999,11 @@ const ae = "Oops! It looks like your session has expired. For your security, ple
999
999
  };
1000
1000
  }
1001
1001
  };
1002
- class Zt {
1002
+ class tr {
1003
1003
  constructor(t = null, r = null) {
1004
- K(this, "refreshTokenPromise", null);
1005
- K(this, "accessToken");
1006
- K(this, "refreshToken");
1004
+ N(this, "refreshTokenPromise", null);
1005
+ N(this, "accessToken");
1006
+ N(this, "refreshToken");
1007
1007
  this.accessToken = t || "", this.refreshToken = r || "";
1008
1008
  }
1009
1009
  async refreshtoken({
@@ -1027,9 +1027,9 @@ class Zt {
1027
1027
  userId: r,
1028
1028
  nonce: a
1029
1029
  }) {
1030
- const n = await U(this.refreshToken);
1031
- if (n && n.payload[y.USER_ID_KEY] !== "") {
1032
- const s = await Qt({
1030
+ const n = await H(this.refreshToken);
1031
+ if (n && n.payload[m.USER_ID_KEY] !== "") {
1032
+ const s = await er({
1033
1033
  clientId: t,
1034
1034
  userId: r,
1035
1035
  nonce: a,
@@ -1049,170 +1049,188 @@ class Zt {
1049
1049
  };
1050
1050
  }
1051
1051
  }
1052
- const j = () => {
1053
- throw new Error(Gt);
1054
- }, He = Ve({
1052
+ const M = () => {
1053
+ throw new Error(zt);
1054
+ }, Ke = Ye({
1055
1055
  isAuthenticated: !1,
1056
1056
  isLoading: !1,
1057
- login: j,
1058
- logout: j,
1059
- getAccessToken: j,
1060
- getIdToken: j,
1057
+ login: M,
1058
+ logout: M,
1059
+ getAccessToken: M,
1060
+ getIdToken: M,
1061
1061
  logoutReason: ""
1062
- }), sr = ({
1062
+ }), ir = ({
1063
1063
  children: e,
1064
1064
  sessionExpiration: t,
1065
1065
  clientId: r
1066
1066
  }) => {
1067
- const [a, n, , s] = W({
1068
- key: `${x}::${r}::@@user@@`
1069
- }), [o, c, , i] = W({
1070
- key: `${x}::${r}::@@access@@`
1071
- }), [u, m, , f] = W(
1067
+ const a = Be(!1), [n, s, , o] = J({
1068
+ key: `${j}::${r}::@@user@@`
1069
+ }), [i, c, , d] = J({
1070
+ key: `${j}::${r}::@@access@@`
1071
+ }), [y, p, , T] = J(
1072
1072
  {
1073
- key: `${x}::${r}::@@refresh@@`
1073
+ key: `${j}::${r}::@@refresh@@`
1074
1074
  }
1075
- ), [k, E, , w] = W({
1076
- key: `${x}::${r}::@@nonce@@`
1077
- }), X = new Zt(o, u), [C, H] = Ye({
1075
+ ), [E, S, , K] = J({
1076
+ key: `${j}::${r}::@@nonce@@`
1077
+ }), Ne = new tr(i, y), [P, k] = Fe({
1078
1078
  isLoading: !0,
1079
1079
  isAuthenticated: !1,
1080
1080
  user: void 0,
1081
1081
  logoutReason: ""
1082
- }), g = Be(
1083
- (p) => {
1084
- console.warn(p), H({
1085
- isLoading: !1,
1082
+ }), b = Ge(
1083
+ (u) => {
1084
+ console.warn(u), k({
1085
+ isLoading: !0,
1086
1086
  isAuthenticated: !1,
1087
1087
  user: void 0,
1088
- logoutReason: p || ae
1089
- }), s(), i(), f(), w();
1088
+ logoutReason: u || ne
1089
+ }), o(), d(), T(), K();
1090
1090
  },
1091
- [s, i, w, f]
1091
+ [o, d, K, T]
1092
1092
  );
1093
- Fe(() => {
1094
- C.isLoading && a !== null && (async () => {
1095
- try {
1096
- const p = await U(a);
1097
- p && p.payload[y.USER_ID_KEY] !== "" ? H({
1098
- isLoading: !1,
1099
- isAuthenticated: !0,
1100
- user: {
1101
- userId: p.payload[y.USER_ID_KEY],
1102
- username: p.payload[y.USERNAME_KEY]
1103
- },
1104
- logoutReason: ""
1105
- }) : (g(ae), await se({
1106
- idToken: a,
1107
- accessToken: o,
1108
- refreshToken: u,
1109
- clientId: r
1110
- }));
1111
- } catch {
1112
- g(ae), await se({
1113
- idToken: a,
1114
- accessToken: o,
1115
- refreshToken: u,
1116
- clientId: r
1117
- });
1118
- }
1119
- })();
1093
+ qe(() => {
1094
+ if (!a.current)
1095
+ return P.isLoading && n !== null ? (async () => {
1096
+ try {
1097
+ const u = await H(n);
1098
+ u && u.payload[m.USER_ID_KEY] !== "" ? k({
1099
+ isLoading: !1,
1100
+ isAuthenticated: !0,
1101
+ user: {
1102
+ userId: u.payload[m.USER_ID_KEY],
1103
+ username: u.payload[m.USERNAME_KEY]
1104
+ },
1105
+ logoutReason: ""
1106
+ }) : (b(ne), await oe({
1107
+ idToken: n,
1108
+ accessToken: i,
1109
+ refreshToken: y,
1110
+ clientId: r
1111
+ }), k((w) => ({
1112
+ ...w,
1113
+ isLoading: !1
1114
+ })));
1115
+ } catch {
1116
+ b(ne), await oe({
1117
+ idToken: n,
1118
+ accessToken: i,
1119
+ refreshToken: y,
1120
+ clientId: r
1121
+ }), k((w) => ({
1122
+ ...w,
1123
+ isLoading: !1
1124
+ }));
1125
+ }
1126
+ })() : k((u) => ({
1127
+ ...u,
1128
+ isLoading: !1
1129
+ })), () => {
1130
+ a.current = !0;
1131
+ };
1120
1132
  }, [
1121
- C.isLoading,
1122
- o,
1123
- a,
1124
- u,
1133
+ P,
1134
+ i,
1135
+ n,
1136
+ y,
1125
1137
  r,
1126
- g
1138
+ b
1127
1139
  ]);
1128
- const Ke = async (p, I, A) => {
1129
- const v = Bt();
1130
- if (E(v), A === B.CODE) {
1131
- const { code_verifier: We, code_challenge: Je } = await Wt(), ce = await Xt({
1132
- nonce: v,
1140
+ const Le = async (u, w, g) => {
1141
+ const I = Gt();
1142
+ if (S(I), k((Q) => ({
1143
+ ...Q,
1144
+ isLoading: !0
1145
+ })), g === F.CODE) {
1146
+ const { code_verifier: Q, code_challenge: xe } = await xt(), ue = await Zt({
1147
+ nonce: I,
1133
1148
  clientId: r,
1134
- code_challenge: Je
1149
+ code_challenge: xe
1135
1150
  });
1136
- if (ce.status) {
1137
- const O = await Te({
1138
- username: p,
1139
- password: I,
1151
+ if (ue.status) {
1152
+ const D = await ke({
1153
+ username: u,
1154
+ password: w,
1140
1155
  clientId: r,
1141
1156
  sessionExpiration: t,
1142
- nonce: v,
1143
- type: A,
1144
- code: ce.code,
1145
- code_verifier: We
1157
+ nonce: I,
1158
+ type: g,
1159
+ code: ue.code,
1160
+ code_verifier: Q
1146
1161
  });
1147
- return O.status ? (n(O.idToken), c(O.accessToken), m(O.refreshToken), H({
1162
+ return D.status ? (s(D.idToken), c(D.accessToken), p(D.refreshToken), k({
1148
1163
  isLoading: !1,
1149
1164
  isAuthenticated: !0,
1150
1165
  user: {
1151
- userId: O.userId,
1152
- username: p
1166
+ userId: D.userId,
1167
+ username: u
1153
1168
  },
1154
1169
  logoutReason: ""
1155
- }), !0) : (g(ge), !1);
1170
+ }), !0) : (b(Ae), !1);
1156
1171
  }
1157
1172
  return !1;
1158
1173
  }
1159
- const P = await Te({
1160
- username: p,
1161
- password: I,
1174
+ const O = await ke({
1175
+ username: u,
1176
+ password: w,
1162
1177
  clientId: r,
1163
1178
  sessionExpiration: t,
1164
- nonce: v,
1165
- type: A
1179
+ nonce: I,
1180
+ type: g
1166
1181
  });
1167
- return P.status ? (n(P.idToken), c(P.accessToken), m(P.refreshToken), H({
1182
+ return O.status ? (s(O.idToken), c(O.accessToken), p(O.refreshToken), k({
1168
1183
  isLoading: !1,
1169
1184
  isAuthenticated: !0,
1170
1185
  user: {
1171
- userId: P.userId,
1172
- username: p
1186
+ userId: O.userId,
1187
+ username: u
1173
1188
  }
1174
- }), !0) : (g(ge), !1);
1175
- }, Ne = async () => {
1176
- g(Ft), await se({
1177
- idToken: a,
1178
- accessToken: o,
1179
- refreshToken: u,
1189
+ }), !0) : (b(Ae), !1);
1190
+ }, $e = async (u) => {
1191
+ u == null || u.preventDefault(), b(qt), await oe({
1192
+ idToken: n,
1193
+ accessToken: i,
1194
+ refreshToken: y,
1180
1195
  clientId: r
1181
- });
1182
- }, $e = async () => {
1183
- const { isAuthenticated: p, user: I } = C;
1196
+ }), k((w) => ({
1197
+ ...w,
1198
+ isLoading: !1
1199
+ }));
1200
+ }, We = async () => {
1201
+ const { isAuthenticated: u, user: w } = P;
1184
1202
  try {
1185
- if (p && I && I.userId) {
1186
- if (o) {
1187
- const v = await U(o);
1188
- if (v && v.payload[y.USER_ID_KEY] !== "")
1189
- return o;
1203
+ if (u && w && w.userId) {
1204
+ if (i) {
1205
+ const I = await H(i);
1206
+ if (I && I.payload[m.USER_ID_KEY] !== "")
1207
+ return i;
1190
1208
  }
1191
- const A = await X.refreshtoken({
1209
+ const g = await Ne.refreshtoken({
1192
1210
  clientId: r,
1193
- userId: I.userId,
1194
- nonce: k
1211
+ userId: w.userId,
1212
+ nonce: E
1195
1213
  });
1196
- return A.status ? (c(A.newAccessToken), m(A.newRefreshToken), A.newAccessToken) : (g(ne), "");
1214
+ return g.status && g.status === "success" ? (c(g.newAccessToken), p(g.newRefreshToken), g.newAccessToken) : (b(se), "");
1197
1215
  }
1198
- return g(ne), "";
1216
+ return b(se), "";
1199
1217
  } catch {
1200
- return g(ne), "";
1218
+ return b(se), "";
1201
1219
  }
1202
- }, Le = () => {
1203
- if (C.isAuthenticated && a)
1204
- return a;
1220
+ }, Je = () => {
1221
+ if (P.isAuthenticated && n)
1222
+ return n;
1205
1223
  };
1206
- return /* @__PURE__ */ Me(
1207
- He.Provider,
1224
+ return /* @__PURE__ */ Ve(
1225
+ Ke.Provider,
1208
1226
  {
1209
- value: { ...C, login: Ke, logout: Ne, getAccessToken: $e, getIdToken: Le },
1227
+ value: { ...P, login: Le, logout: $e, getAccessToken: We, getIdToken: Je },
1210
1228
  children: e
1211
1229
  }
1212
1230
  );
1213
- }, or = (e = He) => Ge(e);
1231
+ }, cr = (e = Ke) => ze(e);
1214
1232
  export {
1215
- B as AUTH_TYPES,
1216
- sr as AuthProvider,
1217
- or as useAuth
1233
+ F as AUTH_TYPES,
1234
+ ir as AuthProvider,
1235
+ cr as useAuth
1218
1236
  };