@versini/auth-provider 8.0.1 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.js +4 -4
- package/dist/auth0.js +3 -3
- package/dist/hooks.js +3 -3
- package/dist/{index-BUUrGwOT.js → index-CJYVbSzH.js} +100 -98
- package/dist/index.js +4 -4
- package/package.json +3 -3
package/dist/auth.js
CHANGED
|
@@ -2,17 +2,17 @@ var Pe = Object.defineProperty;
|
|
|
2
2
|
var Ce = (e, t, n) => t in e ? Pe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var K = (e, t, n) => Ce(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as H } from "react/jsx-runtime";
|
|
5
|
-
import { at as ie, st as ve, O as T, ot as M, nt as C, Ye as D, ct as Ue } from "./index-
|
|
5
|
+
import { at as ie, st as ve, O as T, ot as M, nt as C, Ye as D, ct as Ue } from "./index-CJYVbSzH.js";
|
|
6
6
|
import De, { useSyncExternalStore as Le, useCallback as S, useEffect as ce, createContext as $e, useContext as Ke, useReducer as Ye, useRef as Ge } from "react";
|
|
7
7
|
import { AuthHookContext as Ve } from "./AuthHookContext-C9a2AwWZ.js";
|
|
8
8
|
/*!
|
|
9
|
-
@versini/auth-provider v8.0.
|
|
9
|
+
@versini/auth-provider v8.0.2
|
|
10
10
|
© 2025 gizmette.com
|
|
11
11
|
*/
|
|
12
12
|
try {
|
|
13
13
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
14
|
-
version: "8.0.
|
|
15
|
-
buildTime: "04/
|
|
14
|
+
version: "8.0.2",
|
|
15
|
+
buildTime: "04/19/2025 03:24 PM EDT",
|
|
16
16
|
homepage: "https://github.com/aversini/auth-client",
|
|
17
17
|
license: "MIT"
|
|
18
18
|
});
|
package/dist/auth0.js
CHANGED
|
@@ -2,13 +2,13 @@ import { jsx as B } from "react/jsx-runtime";
|
|
|
2
2
|
import Oe, { createContext as Te, useState as Pe, useReducer as Ce, useRef as Ee, useCallback as R, useEffect as je, useMemo as ze, useContext as xe } from "react";
|
|
3
3
|
import { AuthHookContext as Re } from "./AuthHookContext-C9a2AwWZ.js";
|
|
4
4
|
/*!
|
|
5
|
-
@versini/auth-provider v8.0.
|
|
5
|
+
@versini/auth-provider v8.0.2
|
|
6
6
|
© 2025 gizmette.com
|
|
7
7
|
*/
|
|
8
8
|
try {
|
|
9
9
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
10
|
-
version: "8.0.
|
|
11
|
-
buildTime: "04/
|
|
10
|
+
version: "8.0.2",
|
|
11
|
+
buildTime: "04/19/2025 03:24 PM EDT",
|
|
12
12
|
homepage: "https://github.com/aversini/auth-client",
|
|
13
13
|
license: "MIT"
|
|
14
14
|
});
|
package/dist/hooks.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useContext as o } from "react";
|
|
2
2
|
import { AuthHookContext as e } from "./AuthHookContext-C9a2AwWZ.js";
|
|
3
3
|
/*!
|
|
4
|
-
@versini/auth-provider v8.0.
|
|
4
|
+
@versini/auth-provider v8.0.2
|
|
5
5
|
© 2025 gizmette.com
|
|
6
6
|
*/
|
|
7
7
|
try {
|
|
8
8
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
9
|
-
version: "8.0.
|
|
10
|
-
buildTime: "04/
|
|
9
|
+
version: "8.0.2",
|
|
10
|
+
buildTime: "04/19/2025 03:24 PM EDT",
|
|
11
11
|
homepage: "https://github.com/aversini/auth-client",
|
|
12
12
|
license: "MIT"
|
|
13
13
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var ee = Object.defineProperty, te = (e, t, r) => t in e ? ee(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, c = (e, t, r) => te(e, typeof t != "symbol" ? t + "" : t, r);
|
|
2
2
|
/*!
|
|
3
|
-
@versini/auth-common v4.
|
|
3
|
+
@versini/auth-common v4.3.0
|
|
4
4
|
© 2025 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
|
|
8
|
-
version: "4.
|
|
9
|
-
buildTime: "04/
|
|
8
|
+
version: "4.3.0",
|
|
9
|
+
buildTime: "04/19/2025 03:24 PM EDT",
|
|
10
10
|
homepage: "https://github.com/aversini/auth-client",
|
|
11
11
|
license: "MIT"
|
|
12
12
|
});
|
|
@@ -18,9 +18,11 @@ const qe = {
|
|
|
18
18
|
ID_AND_ACCESS_TOKEN: "id_token token",
|
|
19
19
|
CODE: "code",
|
|
20
20
|
REFRESH_TOKEN: "refresh_token",
|
|
21
|
-
PASSKEY: "passkey"
|
|
21
|
+
PASSKEY: "passkey",
|
|
22
|
+
AUTH0: "auth0"
|
|
22
23
|
}, ze = {
|
|
23
|
-
CLIENT_ID: "X-Auth-ClientId"
|
|
24
|
+
CLIENT_ID: "X-Auth-ClientId",
|
|
25
|
+
AUTH_TYPE: "X-Auth-Type"
|
|
24
26
|
}, I = {
|
|
25
27
|
ALG: "RS256",
|
|
26
28
|
USER_ID_KEY: "sub",
|
|
@@ -47,7 +49,7 @@ awIDAQAB
|
|
|
47
49
|
LOGOUT: "logout",
|
|
48
50
|
LOGIN: "login",
|
|
49
51
|
REFRESH: "refresh"
|
|
50
|
-
},
|
|
52
|
+
}, K = new TextEncoder(), C = new TextDecoder();
|
|
51
53
|
function ae(...e) {
|
|
52
54
|
const t = e.reduce((n, { length: o }) => n + o, 0), r = new Uint8Array(t);
|
|
53
55
|
let a = 0;
|
|
@@ -83,12 +85,12 @@ class A extends Error {
|
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
c(A, "code", "ERR_JOSE_GENERIC");
|
|
86
|
-
class
|
|
88
|
+
class h extends A {
|
|
87
89
|
constructor(t, r, a = "unspecified", n = "unspecified") {
|
|
88
90
|
super(t, { cause: { claim: a, reason: n, payload: r } }), c(this, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED"), c(this, "claim"), c(this, "reason"), c(this, "payload"), this.claim = a, this.reason = n, this.payload = r;
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
|
-
c(
|
|
93
|
+
c(h, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED");
|
|
92
94
|
class D extends A {
|
|
93
95
|
constructor(t, r, a = "unspecified", n = "unspecified") {
|
|
94
96
|
super(t, { cause: { claim: a, reason: n, payload: r } }), c(this, "code", "ERR_JWT_EXPIRED"), c(this, "claim"), c(this, "reason"), c(this, "payload"), this.claim = a, this.reason = n, this.payload = r;
|
|
@@ -107,12 +109,12 @@ class E extends A {
|
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
c(E, "code", "ERR_JOSE_NOT_SUPPORTED");
|
|
110
|
-
class
|
|
112
|
+
class d extends A {
|
|
111
113
|
constructor() {
|
|
112
114
|
super(...arguments), c(this, "code", "ERR_JWS_INVALID");
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
|
-
c(
|
|
117
|
+
c(d, "code", "ERR_JWS_INVALID");
|
|
116
118
|
class f extends A {
|
|
117
119
|
constructor() {
|
|
118
120
|
super(...arguments), c(this, "code", "ERR_JWT_INVALID");
|
|
@@ -131,7 +133,7 @@ function w(e, t = "algorithm.name") {
|
|
|
131
133
|
function k(e, t) {
|
|
132
134
|
return e.name === t;
|
|
133
135
|
}
|
|
134
|
-
function
|
|
136
|
+
function H(e) {
|
|
135
137
|
return parseInt(e.name.slice(4), 10);
|
|
136
138
|
}
|
|
137
139
|
function oe(e) {
|
|
@@ -158,7 +160,7 @@ function ie(e, t, r) {
|
|
|
158
160
|
if (!k(e.algorithm, "HMAC"))
|
|
159
161
|
throw w("HMAC");
|
|
160
162
|
const a = parseInt(t.slice(2), 10);
|
|
161
|
-
if (
|
|
163
|
+
if (H(e.algorithm.hash) !== a)
|
|
162
164
|
throw w(`SHA-${a}`, "algorithm.hash");
|
|
163
165
|
break;
|
|
164
166
|
}
|
|
@@ -168,7 +170,7 @@ function ie(e, t, r) {
|
|
|
168
170
|
if (!k(e.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
169
171
|
throw w("RSASSA-PKCS1-v1_5");
|
|
170
172
|
const a = parseInt(t.slice(2), 10);
|
|
171
|
-
if (
|
|
173
|
+
if (H(e.algorithm.hash) !== a)
|
|
172
174
|
throw w(`SHA-${a}`, "algorithm.hash");
|
|
173
175
|
break;
|
|
174
176
|
}
|
|
@@ -178,7 +180,7 @@ function ie(e, t, r) {
|
|
|
178
180
|
if (!k(e.algorithm, "RSA-PSS"))
|
|
179
181
|
throw w("RSA-PSS");
|
|
180
182
|
const a = parseInt(t.slice(2), 10);
|
|
181
|
-
if (
|
|
183
|
+
if (H(e.algorithm.hash) !== a)
|
|
182
184
|
throw w(`SHA-${a}`, "algorithm.hash");
|
|
183
185
|
break;
|
|
184
186
|
}
|
|
@@ -221,7 +223,7 @@ function q(e) {
|
|
|
221
223
|
function z(e) {
|
|
222
224
|
return e?.[Symbol.toStringTag] === "KeyObject";
|
|
223
225
|
}
|
|
224
|
-
const Q = (e) => q(e) || z(e),
|
|
226
|
+
const Q = (e) => q(e) || z(e), de = (...e) => {
|
|
225
227
|
const t = e.filter(Boolean);
|
|
226
228
|
if (t.length === 0 || t.length === 1)
|
|
227
229
|
return !0;
|
|
@@ -240,11 +242,11 @@ const Q = (e) => q(e) || z(e), le = (...e) => {
|
|
|
240
242
|
}
|
|
241
243
|
return !0;
|
|
242
244
|
};
|
|
243
|
-
function
|
|
245
|
+
function le(e) {
|
|
244
246
|
return typeof e == "object" && e !== null;
|
|
245
247
|
}
|
|
246
|
-
const
|
|
247
|
-
if (!
|
|
248
|
+
const T = (e) => {
|
|
249
|
+
if (!le(e) || Object.prototype.toString.call(e) !== "[object Object]")
|
|
248
250
|
return !1;
|
|
249
251
|
if (Object.getPrototypeOf(e) === null)
|
|
250
252
|
return !0;
|
|
@@ -258,27 +260,27 @@ const _ = (e) => {
|
|
|
258
260
|
if (typeof r != "number" || r < 2048)
|
|
259
261
|
throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
|
|
260
262
|
}
|
|
261
|
-
},
|
|
263
|
+
}, R = (e, t, r = 0) => {
|
|
262
264
|
r === 0 && (t.unshift(t.length), t.unshift(6));
|
|
263
265
|
const a = e.indexOf(t[0], r);
|
|
264
266
|
if (a === -1)
|
|
265
267
|
return !1;
|
|
266
268
|
const n = e.subarray(a, a + t.length);
|
|
267
|
-
return n.length !== t.length ? !1 : n.every((o, s) => o === t[s]) ||
|
|
269
|
+
return n.length !== t.length ? !1 : n.every((o, s) => o === t[s]) || R(e, t, a + 1);
|
|
268
270
|
}, ye = (e) => {
|
|
269
271
|
switch (!0) {
|
|
270
|
-
case
|
|
272
|
+
case R(e, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
271
273
|
return "P-256";
|
|
272
|
-
case
|
|
274
|
+
case R(e, [43, 129, 4, 0, 34]):
|
|
273
275
|
return "P-384";
|
|
274
|
-
case
|
|
276
|
+
case R(e, [43, 129, 4, 0, 35]):
|
|
275
277
|
return "P-521";
|
|
276
278
|
default:
|
|
277
279
|
return;
|
|
278
280
|
}
|
|
279
|
-
},
|
|
281
|
+
}, he = async (e, t, r, a, n) => {
|
|
280
282
|
let o, s;
|
|
281
|
-
const i = new Uint8Array(atob(r.replace(e, "")).split("").map((
|
|
283
|
+
const i = new Uint8Array(atob(r.replace(e, "")).split("").map((l) => l.charCodeAt(0)));
|
|
282
284
|
switch (a) {
|
|
283
285
|
case "PS256":
|
|
284
286
|
case "PS384":
|
|
@@ -312,8 +314,8 @@ const _ = (e) => {
|
|
|
312
314
|
case "ECDH-ES+A128KW":
|
|
313
315
|
case "ECDH-ES+A192KW":
|
|
314
316
|
case "ECDH-ES+A256KW": {
|
|
315
|
-
const
|
|
316
|
-
o =
|
|
317
|
+
const l = ye(i);
|
|
318
|
+
o = l != null && l.startsWith("P-") ? { name: "ECDH", namedCurve: l } : { name: "X25519" }, s = [];
|
|
317
319
|
break;
|
|
318
320
|
}
|
|
319
321
|
case "Ed25519":
|
|
@@ -324,7 +326,7 @@ const _ = (e) => {
|
|
|
324
326
|
throw new E('Invalid or unsupported "alg" (Algorithm) value');
|
|
325
327
|
}
|
|
326
328
|
return crypto.subtle.importKey(t, i, o, !0, s);
|
|
327
|
-
},
|
|
329
|
+
}, pe = (e, t, r) => he(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
|
|
328
330
|
function fe(e) {
|
|
329
331
|
let t, r;
|
|
330
332
|
switch (e.kty) {
|
|
@@ -407,7 +409,7 @@ const me = async (e) => {
|
|
|
407
409
|
async function we(e, t, r) {
|
|
408
410
|
if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
409
411
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
410
|
-
return
|
|
412
|
+
return pe(e, t);
|
|
411
413
|
}
|
|
412
414
|
const Se = (e, t, r, a, n) => {
|
|
413
415
|
if (n.crit !== void 0 && a?.crit === void 0)
|
|
@@ -434,7 +436,7 @@ const Se = (e, t, r, a, n) => {
|
|
|
434
436
|
return new Set(t);
|
|
435
437
|
};
|
|
436
438
|
function U(e) {
|
|
437
|
-
return
|
|
439
|
+
return T(e) && typeof e.kty == "string";
|
|
438
440
|
}
|
|
439
441
|
function ge(e) {
|
|
440
442
|
return e.kty !== "oct" && typeof e.d == "string";
|
|
@@ -646,9 +648,9 @@ const $ = async (e, t, r, a = !1) => {
|
|
|
646
648
|
case "encrypt":
|
|
647
649
|
throw new TypeError(`${v(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
648
650
|
}
|
|
649
|
-
},
|
|
651
|
+
}, Te = (e, t, r) => {
|
|
650
652
|
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(e) || /^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(e) ? ke(e, t, r) : Pe(e, t, r);
|
|
651
|
-
},
|
|
653
|
+
}, _e = (e, t) => {
|
|
652
654
|
const r = `SHA-${e.slice(-3)}`;
|
|
653
655
|
switch (e) {
|
|
654
656
|
case "HS256":
|
|
@@ -673,17 +675,17 @@ const $ = async (e, t, r, a = !1) => {
|
|
|
673
675
|
default:
|
|
674
676
|
throw new E(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
675
677
|
}
|
|
676
|
-
},
|
|
678
|
+
}, Ke = async (e, t, r) => {
|
|
677
679
|
if (t instanceof Uint8Array) {
|
|
678
680
|
if (!e.startsWith("HS"))
|
|
679
681
|
throw new TypeError(ce(t, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
680
682
|
return crypto.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
|
|
681
683
|
}
|
|
682
684
|
return ie(t, e, r), t;
|
|
683
|
-
},
|
|
684
|
-
const n = await
|
|
685
|
+
}, Re = async (e, t, r, a) => {
|
|
686
|
+
const n = await Ke(e, t, "verify");
|
|
685
687
|
ue(e, n);
|
|
686
|
-
const o =
|
|
688
|
+
const o = _e(e, n.algorithm);
|
|
687
689
|
try {
|
|
688
690
|
return await crypto.subtle.verify(o, n, r, a);
|
|
689
691
|
} catch {
|
|
@@ -691,79 +693,79 @@ const $ = async (e, t, r, a = !1) => {
|
|
|
691
693
|
}
|
|
692
694
|
};
|
|
693
695
|
async function Ie(e, t, r) {
|
|
694
|
-
if (!
|
|
695
|
-
throw new
|
|
696
|
+
if (!T(e))
|
|
697
|
+
throw new d("Flattened JWS must be an object");
|
|
696
698
|
if (e.protected === void 0 && e.header === void 0)
|
|
697
|
-
throw new
|
|
699
|
+
throw new d('Flattened JWS must have either of the "protected" or "header" members');
|
|
698
700
|
if (e.protected !== void 0 && typeof e.protected != "string")
|
|
699
|
-
throw new
|
|
701
|
+
throw new d("JWS Protected Header incorrect type");
|
|
700
702
|
if (e.payload === void 0)
|
|
701
|
-
throw new
|
|
703
|
+
throw new d("JWS Payload missing");
|
|
702
704
|
if (typeof e.signature != "string")
|
|
703
|
-
throw new
|
|
704
|
-
if (e.header !== void 0 && !
|
|
705
|
-
throw new
|
|
705
|
+
throw new d("JWS Signature missing or incorrect type");
|
|
706
|
+
if (e.header !== void 0 && !T(e.header))
|
|
707
|
+
throw new d("JWS Unprotected Header incorrect type");
|
|
706
708
|
let a = {};
|
|
707
709
|
if (e.protected)
|
|
708
710
|
try {
|
|
709
711
|
const O = P(e.protected);
|
|
710
712
|
a = JSON.parse(C.decode(O));
|
|
711
713
|
} catch {
|
|
712
|
-
throw new
|
|
714
|
+
throw new d("JWS Protected Header is invalid");
|
|
713
715
|
}
|
|
714
|
-
if (!
|
|
715
|
-
throw new
|
|
716
|
+
if (!de(a, e.header))
|
|
717
|
+
throw new d("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
716
718
|
const n = {
|
|
717
719
|
...a,
|
|
718
720
|
...e.header
|
|
719
|
-
}, o = Se(
|
|
721
|
+
}, o = Se(d, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, a, n);
|
|
720
722
|
let s = !0;
|
|
721
723
|
if (o.has("b64") && (s = a.b64, typeof s != "boolean"))
|
|
722
|
-
throw new
|
|
724
|
+
throw new d('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
723
725
|
const { alg: i } = n;
|
|
724
726
|
if (typeof i != "string" || !i)
|
|
725
|
-
throw new
|
|
726
|
-
const
|
|
727
|
-
if (
|
|
727
|
+
throw new d('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
728
|
+
const l = r && Ee("algorithms", r.algorithms);
|
|
729
|
+
if (l && !l.has(i))
|
|
728
730
|
throw new Y('"alg" (Algorithm) Header Parameter value not allowed');
|
|
729
731
|
if (s) {
|
|
730
732
|
if (typeof e.payload != "string")
|
|
731
|
-
throw new
|
|
733
|
+
throw new d("JWS Payload must be a string");
|
|
732
734
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
733
|
-
throw new
|
|
735
|
+
throw new d("JWS Payload must be a string or an Uint8Array instance");
|
|
734
736
|
let m = !1;
|
|
735
|
-
typeof t == "function" && (t = await t(a, e), m = !0),
|
|
736
|
-
const b = ae(
|
|
737
|
-
let
|
|
737
|
+
typeof t == "function" && (t = await t(a, e), m = !0), Te(i, t, "verify");
|
|
738
|
+
const b = ae(K.encode(e.protected ?? ""), K.encode("."), typeof e.payload == "string" ? K.encode(e.payload) : e.payload);
|
|
739
|
+
let p;
|
|
738
740
|
try {
|
|
739
|
-
|
|
741
|
+
p = P(e.signature);
|
|
740
742
|
} catch {
|
|
741
|
-
throw new
|
|
743
|
+
throw new d("Failed to base64url decode the signature");
|
|
742
744
|
}
|
|
743
|
-
const
|
|
744
|
-
if (!await
|
|
745
|
+
const _ = await Ce(t, i);
|
|
746
|
+
if (!await Re(i, _, p, b))
|
|
745
747
|
throw new F();
|
|
746
748
|
let S;
|
|
747
749
|
if (s)
|
|
748
750
|
try {
|
|
749
751
|
S = P(e.payload);
|
|
750
752
|
} catch {
|
|
751
|
-
throw new
|
|
753
|
+
throw new d("Failed to base64url decode the payload");
|
|
752
754
|
}
|
|
753
|
-
else typeof e.payload == "string" ? S =
|
|
755
|
+
else typeof e.payload == "string" ? S = K.encode(e.payload) : S = e.payload;
|
|
754
756
|
const y = { payload: S };
|
|
755
|
-
return e.protected !== void 0 && (y.protectedHeader = a), e.header !== void 0 && (y.unprotectedHeader = e.header), m ? { ...y, key:
|
|
757
|
+
return e.protected !== void 0 && (y.protectedHeader = a), e.header !== void 0 && (y.unprotectedHeader = e.header), m ? { ...y, key: _ } : y;
|
|
756
758
|
}
|
|
757
759
|
async function Oe(e, t, r) {
|
|
758
760
|
if (e instanceof Uint8Array && (e = C.decode(e)), typeof e != "string")
|
|
759
|
-
throw new
|
|
761
|
+
throw new d("Compact JWS must be a string or Uint8Array");
|
|
760
762
|
const { 0: a, 1: n, 2: o, length: s } = e.split(".");
|
|
761
763
|
if (s !== 3)
|
|
762
|
-
throw new
|
|
763
|
-
const i = await Ie({ payload: n, protected: a, signature: o }, t, r),
|
|
764
|
-
return typeof t == "function" ? { ...
|
|
764
|
+
throw new d("Invalid Compact JWS");
|
|
765
|
+
const i = await Ie({ payload: n, protected: a, signature: o }, t, r), l = { payload: i.payload, protectedHeader: i.protectedHeader };
|
|
766
|
+
return typeof t == "function" ? { ...l, key: i.key } : l;
|
|
765
767
|
}
|
|
766
|
-
const
|
|
768
|
+
const He = (e) => Math.floor(e.getTime() / 1e3), X = 60, Z = X * 60, N = Z * 24, We = N * 7, De = N * 365.25, Je = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, j = (e) => {
|
|
767
769
|
const t = Je.exec(e);
|
|
768
770
|
if (!t || t[4] && t[1])
|
|
769
771
|
throw new TypeError("Invalid time period format");
|
|
@@ -799,7 +801,7 @@ const We = (e) => Math.floor(e.getTime() / 1e3), X = 60, Z = X * 60, N = Z * 24,
|
|
|
799
801
|
case "week":
|
|
800
802
|
case "weeks":
|
|
801
803
|
case "w":
|
|
802
|
-
n = Math.round(r *
|
|
804
|
+
n = Math.round(r * We);
|
|
803
805
|
break;
|
|
804
806
|
default:
|
|
805
807
|
n = Math.round(r * De);
|
|
@@ -813,57 +815,57 @@ function Ne(e, t, r = {}) {
|
|
|
813
815
|
a = JSON.parse(C.decode(t));
|
|
814
816
|
} catch {
|
|
815
817
|
}
|
|
816
|
-
if (!
|
|
818
|
+
if (!T(a))
|
|
817
819
|
throw new f("JWT Claims Set must be a top-level JSON object");
|
|
818
820
|
const { typ: n } = r;
|
|
819
821
|
if (n && (typeof e.typ != "string" || L(e.typ) !== L(n)))
|
|
820
|
-
throw new
|
|
821
|
-
const { requiredClaims: o = [], issuer: s, subject: i, audience:
|
|
822
|
-
m !== void 0 && b.push("iat"),
|
|
822
|
+
throw new h('unexpected "typ" JWT header value', a, "typ", "check_failed");
|
|
823
|
+
const { requiredClaims: o = [], issuer: s, subject: i, audience: l, maxTokenAge: m } = r, b = [...o];
|
|
824
|
+
m !== void 0 && b.push("iat"), l !== void 0 && b.push("aud"), i !== void 0 && b.push("sub"), s !== void 0 && b.push("iss");
|
|
823
825
|
for (const y of new Set(b.reverse()))
|
|
824
826
|
if (!(y in a))
|
|
825
|
-
throw new
|
|
827
|
+
throw new h(`missing required "${y}" claim`, a, y, "missing");
|
|
826
828
|
if (s && !(Array.isArray(s) ? s : [s]).includes(a.iss))
|
|
827
|
-
throw new
|
|
829
|
+
throw new h('unexpected "iss" claim value', a, "iss", "check_failed");
|
|
828
830
|
if (i && a.sub !== i)
|
|
829
|
-
throw new
|
|
830
|
-
if (
|
|
831
|
-
throw new
|
|
832
|
-
let
|
|
831
|
+
throw new h('unexpected "sub" claim value', a, "sub", "check_failed");
|
|
832
|
+
if (l && !Ue(a.aud, typeof l == "string" ? [l] : l))
|
|
833
|
+
throw new h('unexpected "aud" claim value', a, "aud", "check_failed");
|
|
834
|
+
let p;
|
|
833
835
|
switch (typeof r.clockTolerance) {
|
|
834
836
|
case "string":
|
|
835
|
-
|
|
837
|
+
p = j(r.clockTolerance);
|
|
836
838
|
break;
|
|
837
839
|
case "number":
|
|
838
|
-
|
|
840
|
+
p = r.clockTolerance;
|
|
839
841
|
break;
|
|
840
842
|
case "undefined":
|
|
841
|
-
|
|
843
|
+
p = 0;
|
|
842
844
|
break;
|
|
843
845
|
default:
|
|
844
846
|
throw new TypeError("Invalid clockTolerance option type");
|
|
845
847
|
}
|
|
846
|
-
const { currentDate:
|
|
848
|
+
const { currentDate: _ } = r, S = He(_ || /* @__PURE__ */ new Date());
|
|
847
849
|
if ((a.iat !== void 0 || m) && typeof a.iat != "number")
|
|
848
|
-
throw new
|
|
850
|
+
throw new h('"iat" claim must be a number', a, "iat", "invalid");
|
|
849
851
|
if (a.nbf !== void 0) {
|
|
850
852
|
if (typeof a.nbf != "number")
|
|
851
|
-
throw new
|
|
852
|
-
if (a.nbf > S +
|
|
853
|
-
throw new
|
|
853
|
+
throw new h('"nbf" claim must be a number', a, "nbf", "invalid");
|
|
854
|
+
if (a.nbf > S + p)
|
|
855
|
+
throw new h('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
|
|
854
856
|
}
|
|
855
857
|
if (a.exp !== void 0) {
|
|
856
858
|
if (typeof a.exp != "number")
|
|
857
|
-
throw new
|
|
858
|
-
if (a.exp <= S -
|
|
859
|
+
throw new h('"exp" claim must be a number', a, "exp", "invalid");
|
|
860
|
+
if (a.exp <= S - p)
|
|
859
861
|
throw new D('"exp" claim timestamp check failed', a, "exp", "check_failed");
|
|
860
862
|
}
|
|
861
863
|
if (m) {
|
|
862
864
|
const y = S - a.iat, O = typeof m == "number" ? m : j(m);
|
|
863
|
-
if (y -
|
|
865
|
+
if (y - p > O)
|
|
864
866
|
throw new D('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
|
|
865
|
-
if (y < 0 -
|
|
866
|
-
throw new
|
|
867
|
+
if (y < 0 - p)
|
|
868
|
+
throw new h('"iat" claim timestamp check failed (it should be in the past)', a, "iat", "check_failed");
|
|
867
869
|
}
|
|
868
870
|
return a;
|
|
869
871
|
}
|
|
@@ -897,7 +899,7 @@ function je(e) {
|
|
|
897
899
|
} catch {
|
|
898
900
|
throw new f("Failed to parse the decoded payload as JSON");
|
|
899
901
|
}
|
|
900
|
-
if (!
|
|
902
|
+
if (!T(n))
|
|
901
903
|
throw new f("Invalid JWT Claims Set");
|
|
902
904
|
return n;
|
|
903
905
|
}
|
|
@@ -922,15 +924,15 @@ for (let e = 0; e < 256; ++e)
|
|
|
922
924
|
function Me(e, t = 0) {
|
|
923
925
|
return (u[e[t + 0]] + u[e[t + 1]] + u[e[t + 2]] + u[e[t + 3]] + "-" + u[e[t + 4]] + u[e[t + 5]] + "-" + u[e[t + 6]] + u[e[t + 7]] + "-" + u[e[t + 8]] + u[e[t + 9]] + "-" + u[e[t + 10]] + u[e[t + 11]] + u[e[t + 12]] + u[e[t + 13]] + u[e[t + 14]] + u[e[t + 15]]).toLowerCase();
|
|
924
926
|
}
|
|
925
|
-
let
|
|
927
|
+
let W;
|
|
926
928
|
const xe = new Uint8Array(16);
|
|
927
929
|
function Be() {
|
|
928
|
-
if (!
|
|
930
|
+
if (!W) {
|
|
929
931
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
930
932
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
931
|
-
|
|
933
|
+
W = crypto.getRandomValues.bind(crypto);
|
|
932
934
|
}
|
|
933
|
-
return
|
|
935
|
+
return W(xe);
|
|
934
936
|
}
|
|
935
937
|
const Ye = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), M = { randomUUID: Ye };
|
|
936
938
|
function x(e, t, r) {
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { nt as t, ft as r } from "./index-
|
|
1
|
+
import { nt as t, ft as r } from "./index-CJYVbSzH.js";
|
|
2
2
|
/*!
|
|
3
|
-
@versini/auth-provider v8.0.
|
|
3
|
+
@versini/auth-provider v8.0.2
|
|
4
4
|
© 2025 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
8
|
-
version: "8.0.
|
|
9
|
-
buildTime: "04/
|
|
8
|
+
version: "8.0.2",
|
|
9
|
+
buildTime: "04/19/2025 03:24 PM EDT",
|
|
10
10
|
homepage: "https://github.com/aversini/auth-client",
|
|
11
11
|
license: "MIT"
|
|
12
12
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/auth-provider",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@auth0/auth0-react": "2.3.0",
|
|
57
57
|
"@simplewebauthn/browser": "13.1.0",
|
|
58
|
-
"@versini/auth-common": "4.
|
|
58
|
+
"@versini/auth-common": "4.3.0",
|
|
59
59
|
"@versini/ui-hooks": "4.7.3",
|
|
60
60
|
"jose": "6.0.10",
|
|
61
61
|
"uuid": "11.1.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "687d768111980b3d94ca4008c9074477605e5871"
|
|
64
64
|
}
|