@versini/auth-provider 8.0.1 → 8.0.3
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-DxGUVOpC.js} +43 -41
- 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,
|
|
5
|
+
import { at as ie, st as ve, K as T, ot as M, nt as C, Ye as D, ct as Ue } from "./index-DxGUVOpC.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.3
|
|
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: "
|
|
14
|
+
version: "8.0.3",
|
|
15
|
+
buildTime: "06/02/2025 05:45 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.3
|
|
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: "
|
|
10
|
+
version: "8.0.3",
|
|
11
|
+
buildTime: "06/02/2025 05:45 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.3
|
|
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: "
|
|
9
|
+
version: "8.0.3",
|
|
10
|
+
buildTime: "06/02/2025 05:45 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.4.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: "
|
|
8
|
+
version: "4.4.0",
|
|
9
|
+
buildTime: "06/02/2025 05:45 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
|
+
}, _ = 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;
|
|
@@ -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
|
}
|
|
@@ -243,7 +245,7 @@ const Q = (e) => q(e) || z(e), le = (...e) => {
|
|
|
243
245
|
function de(e) {
|
|
244
246
|
return typeof e == "object" && e !== null;
|
|
245
247
|
}
|
|
246
|
-
const
|
|
248
|
+
const T = (e) => {
|
|
247
249
|
if (!de(e) || Object.prototype.toString.call(e) !== "[object Object]")
|
|
248
250
|
return !1;
|
|
249
251
|
if (Object.getPrototypeOf(e) === null)
|
|
@@ -258,20 +260,20 @@ 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
|
+
}, K = (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]) || K(e, t, a + 1);
|
|
268
270
|
}, ye = (e) => {
|
|
269
271
|
switch (!0) {
|
|
270
|
-
case
|
|
272
|
+
case K(e, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
271
273
|
return "P-256";
|
|
272
|
-
case
|
|
274
|
+
case K(e, [43, 129, 4, 0, 34]):
|
|
273
275
|
return "P-384";
|
|
274
|
-
case
|
|
276
|
+
case K(e, [43, 129, 4, 0, 35]):
|
|
275
277
|
return "P-521";
|
|
276
278
|
default:
|
|
277
279
|
return;
|
|
@@ -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
|
+
}, Re = (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
|
+
}, _e = 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
|
+
}, Ke = async (e, t, r, a) => {
|
|
686
|
+
const n = await _e(e, t, "verify");
|
|
685
687
|
ue(e, n);
|
|
686
|
-
const o =
|
|
688
|
+
const o = Re(e, n.algorithm);
|
|
687
689
|
try {
|
|
688
690
|
return await crypto.subtle.verify(o, n, r, a);
|
|
689
691
|
} catch {
|
|
@@ -691,7 +693,7 @@ const $ = async (e, t, r, a = !1) => {
|
|
|
691
693
|
}
|
|
692
694
|
};
|
|
693
695
|
async function Ie(e, t, r) {
|
|
694
|
-
if (!
|
|
696
|
+
if (!T(e))
|
|
695
697
|
throw new l("Flattened JWS must be an object");
|
|
696
698
|
if (e.protected === void 0 && e.header === void 0)
|
|
697
699
|
throw new l('Flattened JWS must have either of the "protected" or "header" members');
|
|
@@ -701,7 +703,7 @@ async function Ie(e, t, r) {
|
|
|
701
703
|
throw new l("JWS Payload missing");
|
|
702
704
|
if (typeof e.signature != "string")
|
|
703
705
|
throw new l("JWS Signature missing or incorrect type");
|
|
704
|
-
if (e.header !== void 0 && !
|
|
706
|
+
if (e.header !== void 0 && !T(e.header))
|
|
705
707
|
throw new l("JWS Unprotected Header incorrect type");
|
|
706
708
|
let a = {};
|
|
707
709
|
if (e.protected)
|
|
@@ -732,16 +734,16 @@ async function Ie(e, t, r) {
|
|
|
732
734
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
733
735
|
throw new l("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
|
+
typeof t == "function" && (t = await t(a, e), m = !0), Te(i, t, "verify");
|
|
738
|
+
const b = ae(_.encode(e.protected ?? ""), _.encode("."), typeof e.payload == "string" ? _.encode(e.payload) : e.payload);
|
|
737
739
|
let h;
|
|
738
740
|
try {
|
|
739
741
|
h = P(e.signature);
|
|
740
742
|
} catch {
|
|
741
743
|
throw new l("Failed to base64url decode the signature");
|
|
742
744
|
}
|
|
743
|
-
const
|
|
744
|
-
if (!await
|
|
745
|
+
const R = await Ce(t, i);
|
|
746
|
+
if (!await Ke(i, R, h, b))
|
|
745
747
|
throw new F();
|
|
746
748
|
let S;
|
|
747
749
|
if (s)
|
|
@@ -750,9 +752,9 @@ async function Ie(e, t, r) {
|
|
|
750
752
|
} catch {
|
|
751
753
|
throw new l("Failed to base64url decode the payload");
|
|
752
754
|
}
|
|
753
|
-
else typeof e.payload == "string" ? S =
|
|
755
|
+
else typeof e.payload == "string" ? S = _.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: R } : y;
|
|
756
758
|
}
|
|
757
759
|
async function Oe(e, t, r) {
|
|
758
760
|
if (e instanceof Uint8Array && (e = C.decode(e)), typeof e != "string")
|
|
@@ -763,7 +765,7 @@ async function Oe(e, t, r) {
|
|
|
763
765
|
const i = await Ie({ payload: n, protected: a, signature: o }, t, r), d = { payload: i.payload, protectedHeader: i.protectedHeader };
|
|
764
766
|
return typeof t == "function" ? { ...d, key: i.key } : d;
|
|
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,7 +815,7 @@ 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)))
|
|
@@ -843,7 +845,7 @@ function Ne(e, t, r = {}) {
|
|
|
843
845
|
default:
|
|
844
846
|
throw new TypeError("Invalid clockTolerance option type");
|
|
845
847
|
}
|
|
846
|
-
const { currentDate:
|
|
848
|
+
const { currentDate: R } = r, S = He(R || /* @__PURE__ */ new Date());
|
|
847
849
|
if ((a.iat !== void 0 || m) && typeof a.iat != "number")
|
|
848
850
|
throw new p('"iat" claim must be a number', a, "iat", "invalid");
|
|
849
851
|
if (a.nbf !== void 0) {
|
|
@@ -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) {
|
|
@@ -972,7 +974,7 @@ const et = async (e, t) => {
|
|
|
972
974
|
);
|
|
973
975
|
};
|
|
974
976
|
export {
|
|
975
|
-
I as
|
|
977
|
+
I as K,
|
|
976
978
|
Le as Ye,
|
|
977
979
|
ze as at,
|
|
978
980
|
Ze as ct,
|
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-DxGUVOpC.js";
|
|
2
2
|
/*!
|
|
3
|
-
@versini/auth-provider v8.0.
|
|
3
|
+
@versini/auth-provider v8.0.3
|
|
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: "
|
|
8
|
+
version: "8.0.3",
|
|
9
|
+
buildTime: "06/02/2025 05:45 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.3",
|
|
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.4.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": "3109c57783f179b3d0f2fee8cecf16cc8ba333e1"
|
|
64
64
|
}
|