@versini/auth-provider 8.0.3 → 8.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/auth.js +4 -4
- package/dist/auth0.js +18 -18
- package/dist/hooks.js +3 -3
- package/dist/{index-DxGUVOpC.js → index-BM1ZTA9w.js} +81 -75
- 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, m as T, ot as M, nt as C, ke as D, ct as Ue } from "./index-BM1ZTA9w.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.4
|
|
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: "06/
|
|
14
|
+
version: "8.0.4",
|
|
15
|
+
buildTime: "06/03/2025 09:53 AM 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.4
|
|
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: "06/
|
|
10
|
+
version: "8.0.4",
|
|
11
|
+
buildTime: "06/03/2025 09:53 AM EDT",
|
|
12
12
|
homepage: "https://github.com/aversini/auth-client",
|
|
13
13
|
license: "MIT"
|
|
14
14
|
});
|
|
@@ -505,7 +505,7 @@ const H = () => window.crypto, M = () => {
|
|
|
505
505
|
})]).finally(() => {
|
|
506
506
|
clearTimeout(o);
|
|
507
507
|
});
|
|
508
|
-
},
|
|
508
|
+
}, Ae = async (i, e, t, n, o, r, c) => {
|
|
509
509
|
return h = { auth: { audience: e, scope: t }, timeout: o, fetchUrl: i, fetchOptions: n, useFormData: c }, l = r, new Promise(function(d, a) {
|
|
510
510
|
const s = new MessageChannel();
|
|
511
511
|
s.port1.onmessage = function(u) {
|
|
@@ -513,14 +513,14 @@ const H = () => window.crypto, M = () => {
|
|
|
513
513
|
}, l.postMessage(h, [s.port2]);
|
|
514
514
|
});
|
|
515
515
|
var h, l;
|
|
516
|
-
},
|
|
516
|
+
}, De = async (i, e, t, n, o, r, c = 1e4) => o ? Ae(i, e, t, n, c, o, r) : Ne(i, n, c);
|
|
517
517
|
async function Xe(i, e) {
|
|
518
518
|
var { baseUrl: t, timeout: n, audience: o, scope: r, auth0Client: c, useFormData: h } = i, l = E(i, ["baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData"]);
|
|
519
519
|
const d = h ? Q(l) : JSON.stringify(l);
|
|
520
520
|
return await async function(a, s, u, p, m, w, g) {
|
|
521
521
|
let v, b = null;
|
|
522
522
|
for (let I = 0; I < 3; I++) try {
|
|
523
|
-
v = await
|
|
523
|
+
v = await De(a, u, p, m, w, g, s), b = null;
|
|
524
524
|
break;
|
|
525
525
|
} catch (S) {
|
|
526
526
|
b = S;
|
|
@@ -663,7 +663,7 @@ class Je {
|
|
|
663
663
|
this.storage.remove(this.storageKey, { cookieDomain: this.cookieDomain });
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
|
-
const
|
|
666
|
+
const D = (i) => typeof i == "number", Me = ["iss", "aud", "exp", "nbf", "iat", "jti", "azp", "nonce", "auth_time", "at_hash", "c_hash", "acr", "amr", "sub_jwk", "cnf", "sip_from_tag", "sip_date", "sip_callid", "sip_cseq_num", "sip_via_branch", "orig", "dest", "mky", "events", "toe", "txn", "rph", "sid", "vot", "vtm"], Fe = (i) => {
|
|
667
667
|
if (!i.id_token) throw new Error("ID token is required but missing");
|
|
668
668
|
const e = ((r) => {
|
|
669
669
|
const c = r.split("."), [h, l, d] = c;
|
|
@@ -689,16 +689,16 @@ const A = (i) => typeof i == "number", Me = ["iss", "aud", "exp", "nbf", "iat",
|
|
|
689
689
|
if (!e.claims.nonce) throw new Error("Nonce (nonce) claim must be a string present in the ID token");
|
|
690
690
|
if (e.claims.nonce !== i.nonce) throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${i.nonce}", found "${e.claims.nonce}"`);
|
|
691
691
|
}
|
|
692
|
-
if (i.max_age && !
|
|
693
|
-
if (e.claims.exp == null || !
|
|
694
|
-
if (!
|
|
692
|
+
if (i.max_age && !D(e.claims.auth_time)) throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");
|
|
693
|
+
if (e.claims.exp == null || !D(e.claims.exp)) throw new Error("Expiration Time (exp) claim must be a number present in the ID token");
|
|
694
|
+
if (!D(e.claims.iat)) throw new Error("Issued At (iat) claim must be a number present in the ID token");
|
|
695
695
|
const t = i.leeway || 60, n = new Date(i.now || Date.now()), o = /* @__PURE__ */ new Date(0);
|
|
696
696
|
if (o.setUTCSeconds(e.claims.exp + t), n > o) throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${n}) is after expiration time (${o})`);
|
|
697
|
-
if (e.claims.nbf != null &&
|
|
697
|
+
if (e.claims.nbf != null && D(e.claims.nbf)) {
|
|
698
698
|
const r = /* @__PURE__ */ new Date(0);
|
|
699
699
|
if (r.setUTCSeconds(e.claims.nbf - t), n < r) throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${n}) is before ${r}`);
|
|
700
700
|
}
|
|
701
|
-
if (e.claims.auth_time != null &&
|
|
701
|
+
if (e.claims.auth_time != null && D(e.claims.auth_time)) {
|
|
702
702
|
const r = /* @__PURE__ */ new Date(0);
|
|
703
703
|
if (r.setUTCSeconds(parseInt(e.claims.auth_time) + i.max_age + t), n > r) throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${n}) is after last auth at ${r}`);
|
|
704
704
|
}
|
|
@@ -1220,20 +1220,20 @@ var be = {
|
|
|
1220
1220
|
), b = R(function(k, _) {
|
|
1221
1221
|
return L(void 0, void 0, void 0, function() {
|
|
1222
1222
|
var I, S, O, z;
|
|
1223
|
-
return K(this, function(
|
|
1224
|
-
switch (
|
|
1223
|
+
return K(this, function(A) {
|
|
1224
|
+
switch (A.label) {
|
|
1225
1225
|
case 0:
|
|
1226
|
-
return
|
|
1226
|
+
return A.trys.push([0, 2, 3, 5]), [4, l.getTokenWithPopup(k, _)];
|
|
1227
1227
|
case 1:
|
|
1228
|
-
return I =
|
|
1228
|
+
return I = A.sent(), [3, 5];
|
|
1229
1229
|
case 2:
|
|
1230
|
-
throw S =
|
|
1230
|
+
throw S = A.sent(), $(S);
|
|
1231
1231
|
case 3:
|
|
1232
1232
|
return O = s, z = {
|
|
1233
1233
|
type: "GET_ACCESS_TOKEN_COMPLETE"
|
|
1234
1234
|
}, [4, l.getUser()];
|
|
1235
1235
|
case 4:
|
|
1236
|
-
return O.apply(void 0, [(z.user =
|
|
1236
|
+
return O.apply(void 0, [(z.user = A.sent(), z)]), [
|
|
1237
1237
|
7
|
|
1238
1238
|
/*endfinally*/
|
|
1239
1239
|
];
|
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.4
|
|
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: "06/
|
|
9
|
+
version: "8.0.4",
|
|
10
|
+
buildTime: "06/03/2025 09:53 AM 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.5.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: "06/
|
|
8
|
+
version: "4.5.0",
|
|
9
|
+
buildTime: "06/03/2025 09:53 AM EDT",
|
|
10
10
|
homepage: "https://github.com/aversini/auth-client",
|
|
11
11
|
license: "MIT"
|
|
12
12
|
});
|
|
@@ -23,7 +23,7 @@ const qe = {
|
|
|
23
23
|
}, ze = {
|
|
24
24
|
CLIENT_ID: "X-Auth-ClientId",
|
|
25
25
|
AUTH_TYPE: "X-Auth-Type"
|
|
26
|
-
},
|
|
26
|
+
}, C = {
|
|
27
27
|
ALG: "RS256",
|
|
28
28
|
USER_ID_KEY: "sub",
|
|
29
29
|
USERNAME_KEY: "username",
|
|
@@ -34,6 +34,7 @@ const qe = {
|
|
|
34
34
|
EXPIRES_AT_KEY: "exp",
|
|
35
35
|
CREATED_AT_KEY: "iat",
|
|
36
36
|
SCOPES_KEY: "scopes",
|
|
37
|
+
SCOPE_KEY: "scope",
|
|
37
38
|
CLIENT_ID_KEY: "aud",
|
|
38
39
|
ISSUER: "gizmette.com"
|
|
39
40
|
}, re = `-----BEGIN PUBLIC KEY-----
|
|
@@ -49,7 +50,7 @@ awIDAQAB
|
|
|
49
50
|
LOGOUT: "logout",
|
|
50
51
|
LOGIN: "login",
|
|
51
52
|
REFRESH: "refresh"
|
|
52
|
-
},
|
|
53
|
+
}, R = new TextEncoder(), k = new TextDecoder();
|
|
53
54
|
function ae(...e) {
|
|
54
55
|
const t = e.reduce((n, { length: o }) => n + o, 0), r = new Uint8Array(t);
|
|
55
56
|
let a = 0;
|
|
@@ -65,13 +66,13 @@ function ne(e) {
|
|
|
65
66
|
r[a] = t.charCodeAt(a);
|
|
66
67
|
return r;
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
+
function _(e) {
|
|
69
70
|
if (Uint8Array.fromBase64)
|
|
70
|
-
return Uint8Array.fromBase64(typeof e == "string" ? e :
|
|
71
|
+
return Uint8Array.fromBase64(typeof e == "string" ? e : k.decode(e), {
|
|
71
72
|
alphabet: "base64url"
|
|
72
73
|
});
|
|
73
74
|
let t = e;
|
|
74
|
-
t instanceof Uint8Array && (t =
|
|
75
|
+
t instanceof Uint8Array && (t = k.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
75
76
|
try {
|
|
76
77
|
return ne(t);
|
|
77
78
|
} catch {
|
|
@@ -127,10 +128,10 @@ class F extends A {
|
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
c(F, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
|
|
130
|
-
function
|
|
131
|
+
function S(e, t = "algorithm.name") {
|
|
131
132
|
return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
+
function P(e, t) {
|
|
134
135
|
return e.name === t;
|
|
135
136
|
}
|
|
136
137
|
function H(e) {
|
|
@@ -157,47 +158,47 @@ function ie(e, t, r) {
|
|
|
157
158
|
case "HS256":
|
|
158
159
|
case "HS384":
|
|
159
160
|
case "HS512": {
|
|
160
|
-
if (!
|
|
161
|
-
throw
|
|
161
|
+
if (!P(e.algorithm, "HMAC"))
|
|
162
|
+
throw S("HMAC");
|
|
162
163
|
const a = parseInt(t.slice(2), 10);
|
|
163
164
|
if (H(e.algorithm.hash) !== a)
|
|
164
|
-
throw
|
|
165
|
+
throw S(`SHA-${a}`, "algorithm.hash");
|
|
165
166
|
break;
|
|
166
167
|
}
|
|
167
168
|
case "RS256":
|
|
168
169
|
case "RS384":
|
|
169
170
|
case "RS512": {
|
|
170
|
-
if (!
|
|
171
|
-
throw
|
|
171
|
+
if (!P(e.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
172
|
+
throw S("RSASSA-PKCS1-v1_5");
|
|
172
173
|
const a = parseInt(t.slice(2), 10);
|
|
173
174
|
if (H(e.algorithm.hash) !== a)
|
|
174
|
-
throw
|
|
175
|
+
throw S(`SHA-${a}`, "algorithm.hash");
|
|
175
176
|
break;
|
|
176
177
|
}
|
|
177
178
|
case "PS256":
|
|
178
179
|
case "PS384":
|
|
179
180
|
case "PS512": {
|
|
180
|
-
if (!
|
|
181
|
-
throw
|
|
181
|
+
if (!P(e.algorithm, "RSA-PSS"))
|
|
182
|
+
throw S("RSA-PSS");
|
|
182
183
|
const a = parseInt(t.slice(2), 10);
|
|
183
184
|
if (H(e.algorithm.hash) !== a)
|
|
184
|
-
throw
|
|
185
|
+
throw S(`SHA-${a}`, "algorithm.hash");
|
|
185
186
|
break;
|
|
186
187
|
}
|
|
187
188
|
case "Ed25519":
|
|
188
189
|
case "EdDSA": {
|
|
189
|
-
if (!
|
|
190
|
-
throw
|
|
190
|
+
if (!P(e.algorithm, "Ed25519"))
|
|
191
|
+
throw S("Ed25519");
|
|
191
192
|
break;
|
|
192
193
|
}
|
|
193
194
|
case "ES256":
|
|
194
195
|
case "ES384":
|
|
195
196
|
case "ES512": {
|
|
196
|
-
if (!
|
|
197
|
-
throw
|
|
197
|
+
if (!P(e.algorithm, "ECDSA"))
|
|
198
|
+
throw S("ECDSA");
|
|
198
199
|
const a = oe(t);
|
|
199
200
|
if (e.algorithm.namedCurve !== a)
|
|
200
|
-
throw
|
|
201
|
+
throw S(a, "algorithm.namedCurve");
|
|
201
202
|
break;
|
|
202
203
|
}
|
|
203
204
|
default:
|
|
@@ -245,7 +246,7 @@ const Q = (e) => q(e) || z(e), le = (...e) => {
|
|
|
245
246
|
function de(e) {
|
|
246
247
|
return typeof e == "object" && e !== null;
|
|
247
248
|
}
|
|
248
|
-
const
|
|
249
|
+
const K = (e) => {
|
|
249
250
|
if (!de(e) || Object.prototype.toString.call(e) !== "[object Object]")
|
|
250
251
|
return !1;
|
|
251
252
|
if (Object.getPrototypeOf(e) === null)
|
|
@@ -260,20 +261,20 @@ const T = (e) => {
|
|
|
260
261
|
if (typeof r != "number" || r < 2048)
|
|
261
262
|
throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
|
|
262
263
|
}
|
|
263
|
-
},
|
|
264
|
+
}, I = (e, t, r = 0) => {
|
|
264
265
|
r === 0 && (t.unshift(t.length), t.unshift(6));
|
|
265
266
|
const a = e.indexOf(t[0], r);
|
|
266
267
|
if (a === -1)
|
|
267
268
|
return !1;
|
|
268
269
|
const n = e.subarray(a, a + t.length);
|
|
269
|
-
return n.length !== t.length ? !1 : n.every((o, s) => o === t[s]) ||
|
|
270
|
+
return n.length !== t.length ? !1 : n.every((o, s) => o === t[s]) || I(e, t, a + 1);
|
|
270
271
|
}, ye = (e) => {
|
|
271
272
|
switch (!0) {
|
|
272
|
-
case
|
|
273
|
+
case I(e, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
273
274
|
return "P-256";
|
|
274
|
-
case
|
|
275
|
+
case I(e, [43, 129, 4, 0, 34]):
|
|
275
276
|
return "P-384";
|
|
276
|
-
case
|
|
277
|
+
case I(e, [43, 129, 4, 0, 35]):
|
|
277
278
|
return "P-521";
|
|
278
279
|
default:
|
|
279
280
|
return;
|
|
@@ -406,12 +407,12 @@ const me = async (e) => {
|
|
|
406
407
|
const { algorithm: t, keyUsages: r } = fe(e), a = { ...e };
|
|
407
408
|
return delete a.alg, delete a.use, crypto.subtle.importKey("jwk", a, t, e.ext ?? !e.d, e.key_ops ?? r);
|
|
408
409
|
};
|
|
409
|
-
async function
|
|
410
|
+
async function Se(e, t, r) {
|
|
410
411
|
if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
411
412
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
412
413
|
return he(e, t);
|
|
413
414
|
}
|
|
414
|
-
const
|
|
415
|
+
const we = (e, t, r, a, n) => {
|
|
415
416
|
if (n.crit !== void 0 && a?.crit === void 0)
|
|
416
417
|
throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
417
418
|
if (!a || a.crit === void 0)
|
|
@@ -436,7 +437,7 @@ const Se = (e, t, r, a, n) => {
|
|
|
436
437
|
return new Set(t);
|
|
437
438
|
};
|
|
438
439
|
function U(e) {
|
|
439
|
-
return
|
|
440
|
+
return K(e) && typeof e.kty == "string";
|
|
440
441
|
}
|
|
441
442
|
function ge(e) {
|
|
442
443
|
return e.kty !== "oct" && typeof e.d == "string";
|
|
@@ -558,7 +559,7 @@ const $ = async (e, t, r, a = !1) => {
|
|
|
558
559
|
return $(e, r, t);
|
|
559
560
|
}
|
|
560
561
|
if (U(e))
|
|
561
|
-
return e.k ?
|
|
562
|
+
return e.k ? _(e.k) : $(e, e, t, !0);
|
|
562
563
|
throw new Error("unreachable");
|
|
563
564
|
}, v = (e) => e?.[Symbol.toStringTag], J = (e, t, r) => {
|
|
564
565
|
var a, n;
|
|
@@ -648,9 +649,9 @@ const $ = async (e, t, r, a = !1) => {
|
|
|
648
649
|
case "encrypt":
|
|
649
650
|
throw new TypeError(`${v(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
650
651
|
}
|
|
651
|
-
},
|
|
652
|
+
}, _e = (e, t, r) => {
|
|
652
653
|
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);
|
|
653
|
-
},
|
|
654
|
+
}, Ke = (e, t) => {
|
|
654
655
|
const r = `SHA-${e.slice(-3)}`;
|
|
655
656
|
switch (e) {
|
|
656
657
|
case "HS256":
|
|
@@ -675,17 +676,17 @@ const $ = async (e, t, r, a = !1) => {
|
|
|
675
676
|
default:
|
|
676
677
|
throw new E(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
677
678
|
}
|
|
678
|
-
},
|
|
679
|
+
}, Te = async (e, t, r) => {
|
|
679
680
|
if (t instanceof Uint8Array) {
|
|
680
681
|
if (!e.startsWith("HS"))
|
|
681
682
|
throw new TypeError(ce(t, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
682
683
|
return crypto.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
|
|
683
684
|
}
|
|
684
685
|
return ie(t, e, r), t;
|
|
685
|
-
},
|
|
686
|
-
const n = await
|
|
686
|
+
}, Re = async (e, t, r, a) => {
|
|
687
|
+
const n = await Te(e, t, "verify");
|
|
687
688
|
ue(e, n);
|
|
688
|
-
const o =
|
|
689
|
+
const o = Ke(e, n.algorithm);
|
|
689
690
|
try {
|
|
690
691
|
return await crypto.subtle.verify(o, n, r, a);
|
|
691
692
|
} catch {
|
|
@@ -693,7 +694,7 @@ const $ = async (e, t, r, a = !1) => {
|
|
|
693
694
|
}
|
|
694
695
|
};
|
|
695
696
|
async function Ie(e, t, r) {
|
|
696
|
-
if (!
|
|
697
|
+
if (!K(e))
|
|
697
698
|
throw new l("Flattened JWS must be an object");
|
|
698
699
|
if (e.protected === void 0 && e.header === void 0)
|
|
699
700
|
throw new l('Flattened JWS must have either of the "protected" or "header" members');
|
|
@@ -703,13 +704,13 @@ async function Ie(e, t, r) {
|
|
|
703
704
|
throw new l("JWS Payload missing");
|
|
704
705
|
if (typeof e.signature != "string")
|
|
705
706
|
throw new l("JWS Signature missing or incorrect type");
|
|
706
|
-
if (e.header !== void 0 && !
|
|
707
|
+
if (e.header !== void 0 && !K(e.header))
|
|
707
708
|
throw new l("JWS Unprotected Header incorrect type");
|
|
708
709
|
let a = {};
|
|
709
710
|
if (e.protected)
|
|
710
711
|
try {
|
|
711
|
-
const O =
|
|
712
|
-
a = JSON.parse(
|
|
712
|
+
const O = _(e.protected);
|
|
713
|
+
a = JSON.parse(k.decode(O));
|
|
713
714
|
} catch {
|
|
714
715
|
throw new l("JWS Protected Header is invalid");
|
|
715
716
|
}
|
|
@@ -718,7 +719,7 @@ async function Ie(e, t, r) {
|
|
|
718
719
|
const n = {
|
|
719
720
|
...a,
|
|
720
721
|
...e.header
|
|
721
|
-
}, o =
|
|
722
|
+
}, o = we(l, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, a, n);
|
|
722
723
|
let s = !0;
|
|
723
724
|
if (o.has("b64") && (s = a.b64, typeof s != "boolean"))
|
|
724
725
|
throw new l('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
@@ -734,30 +735,30 @@ async function Ie(e, t, r) {
|
|
|
734
735
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
735
736
|
throw new l("JWS Payload must be a string or an Uint8Array instance");
|
|
736
737
|
let m = !1;
|
|
737
|
-
typeof t == "function" && (t = await t(a, e), m = !0),
|
|
738
|
-
const b = ae(
|
|
738
|
+
typeof t == "function" && (t = await t(a, e), m = !0), _e(i, t, "verify");
|
|
739
|
+
const b = ae(R.encode(e.protected ?? ""), R.encode("."), typeof e.payload == "string" ? R.encode(e.payload) : e.payload);
|
|
739
740
|
let h;
|
|
740
741
|
try {
|
|
741
|
-
h =
|
|
742
|
+
h = _(e.signature);
|
|
742
743
|
} catch {
|
|
743
744
|
throw new l("Failed to base64url decode the signature");
|
|
744
745
|
}
|
|
745
|
-
const
|
|
746
|
-
if (!await
|
|
746
|
+
const T = await Ce(t, i);
|
|
747
|
+
if (!await Re(i, T, h, b))
|
|
747
748
|
throw new F();
|
|
748
|
-
let
|
|
749
|
+
let w;
|
|
749
750
|
if (s)
|
|
750
751
|
try {
|
|
751
|
-
|
|
752
|
+
w = _(e.payload);
|
|
752
753
|
} catch {
|
|
753
754
|
throw new l("Failed to base64url decode the payload");
|
|
754
755
|
}
|
|
755
|
-
else typeof e.payload == "string" ?
|
|
756
|
-
const y = { payload:
|
|
757
|
-
return e.protected !== void 0 && (y.protectedHeader = a), e.header !== void 0 && (y.unprotectedHeader = e.header), m ? { ...y, key:
|
|
756
|
+
else typeof e.payload == "string" ? w = R.encode(e.payload) : w = e.payload;
|
|
757
|
+
const y = { payload: w };
|
|
758
|
+
return e.protected !== void 0 && (y.protectedHeader = a), e.header !== void 0 && (y.unprotectedHeader = e.header), m ? { ...y, key: T } : y;
|
|
758
759
|
}
|
|
759
760
|
async function Oe(e, t, r) {
|
|
760
|
-
if (e instanceof Uint8Array && (e =
|
|
761
|
+
if (e instanceof Uint8Array && (e = k.decode(e)), typeof e != "string")
|
|
761
762
|
throw new l("Compact JWS must be a string or Uint8Array");
|
|
762
763
|
const { 0: a, 1: n, 2: o, length: s } = e.split(".");
|
|
763
764
|
if (s !== 3)
|
|
@@ -812,10 +813,10 @@ const He = (e) => Math.floor(e.getTime() / 1e3), X = 60, Z = X * 60, N = Z * 24,
|
|
|
812
813
|
function Ne(e, t, r = {}) {
|
|
813
814
|
let a;
|
|
814
815
|
try {
|
|
815
|
-
a = JSON.parse(
|
|
816
|
+
a = JSON.parse(k.decode(t));
|
|
816
817
|
} catch {
|
|
817
818
|
}
|
|
818
|
-
if (!
|
|
819
|
+
if (!K(a))
|
|
819
820
|
throw new f("JWT Claims Set must be a top-level JSON object");
|
|
820
821
|
const { typ: n } = r;
|
|
821
822
|
if (n && (typeof e.typ != "string" || L(e.typ) !== L(n)))
|
|
@@ -845,23 +846,23 @@ function Ne(e, t, r = {}) {
|
|
|
845
846
|
default:
|
|
846
847
|
throw new TypeError("Invalid clockTolerance option type");
|
|
847
848
|
}
|
|
848
|
-
const { currentDate:
|
|
849
|
+
const { currentDate: T } = r, w = He(T || /* @__PURE__ */ new Date());
|
|
849
850
|
if ((a.iat !== void 0 || m) && typeof a.iat != "number")
|
|
850
851
|
throw new p('"iat" claim must be a number', a, "iat", "invalid");
|
|
851
852
|
if (a.nbf !== void 0) {
|
|
852
853
|
if (typeof a.nbf != "number")
|
|
853
854
|
throw new p('"nbf" claim must be a number', a, "nbf", "invalid");
|
|
854
|
-
if (a.nbf >
|
|
855
|
+
if (a.nbf > w + h)
|
|
855
856
|
throw new p('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
|
|
856
857
|
}
|
|
857
858
|
if (a.exp !== void 0) {
|
|
858
859
|
if (typeof a.exp != "number")
|
|
859
860
|
throw new p('"exp" claim must be a number', a, "exp", "invalid");
|
|
860
|
-
if (a.exp <=
|
|
861
|
+
if (a.exp <= w - h)
|
|
861
862
|
throw new D('"exp" claim timestamp check failed', a, "exp", "check_failed");
|
|
862
863
|
}
|
|
863
864
|
if (m) {
|
|
864
|
-
const y =
|
|
865
|
+
const y = w - a.iat, O = typeof m == "number" ? m : j(m);
|
|
865
866
|
if (y - h > O)
|
|
866
867
|
throw new D('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
|
|
867
868
|
if (y < 0 - h)
|
|
@@ -889,25 +890,25 @@ function je(e) {
|
|
|
889
890
|
throw new f("JWTs must contain a payload");
|
|
890
891
|
let a;
|
|
891
892
|
try {
|
|
892
|
-
a =
|
|
893
|
+
a = _(t);
|
|
893
894
|
} catch {
|
|
894
895
|
throw new f("Failed to base64url decode the payload");
|
|
895
896
|
}
|
|
896
897
|
let n;
|
|
897
898
|
try {
|
|
898
|
-
n = JSON.parse(
|
|
899
|
+
n = JSON.parse(k.decode(a));
|
|
899
900
|
} catch {
|
|
900
901
|
throw new f("Failed to parse the decoded payload as JSON");
|
|
901
902
|
}
|
|
902
|
-
if (!
|
|
903
|
+
if (!K(n))
|
|
903
904
|
throw new f("Invalid JWT Claims Set");
|
|
904
905
|
return n;
|
|
905
906
|
}
|
|
906
907
|
const Le = async (e) => {
|
|
907
908
|
try {
|
|
908
|
-
const t =
|
|
909
|
+
const t = C.ALG, r = await Se(re, t);
|
|
909
910
|
return await $e(e, r, {
|
|
910
|
-
issuer:
|
|
911
|
+
issuer: C.ISSUER
|
|
911
912
|
});
|
|
912
913
|
} catch {
|
|
913
914
|
return;
|
|
@@ -964,21 +965,26 @@ async function Ze(e) {
|
|
|
964
965
|
};
|
|
965
966
|
}
|
|
966
967
|
const et = async (e, t) => {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
968
|
+
const r = await Le(e);
|
|
969
|
+
if (!r || !r.payload)
|
|
970
|
+
return !1;
|
|
971
|
+
let a = [];
|
|
972
|
+
if (Array.isArray(r.payload[C.SCOPES_KEY]))
|
|
973
|
+
a = r.payload[C.SCOPES_KEY];
|
|
974
|
+
else if (typeof r.payload[C.SCOPE_KEY] == "string")
|
|
975
|
+
a = r.payload[C.SCOPE_KEY].split(" ").filter((n) => n.trim() !== "");
|
|
976
|
+
else
|
|
970
977
|
return !1;
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
(o) => t[o].every((s) => n.includes(s))
|
|
978
|
+
return Array.isArray(t) ? t.every((n) => a.includes(n)) : Object.keys(t).some(
|
|
979
|
+
(n) => t[n].every((o) => a.includes(o))
|
|
974
980
|
);
|
|
975
981
|
};
|
|
976
982
|
export {
|
|
977
|
-
I as K,
|
|
978
|
-
Le as Ye,
|
|
979
983
|
ze as at,
|
|
980
984
|
Ze as ct,
|
|
981
985
|
et as ft,
|
|
986
|
+
Le as ke,
|
|
987
|
+
C as m,
|
|
982
988
|
qe as nt,
|
|
983
989
|
Qe as ot,
|
|
984
990
|
Xe as st
|
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-BM1ZTA9w.js";
|
|
2
2
|
/*!
|
|
3
|
-
@versini/auth-provider v8.0.
|
|
3
|
+
@versini/auth-provider v8.0.4
|
|
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: "06/
|
|
8
|
+
version: "8.0.4",
|
|
9
|
+
buildTime: "06/03/2025 09:53 AM 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.4",
|
|
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.5.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": "fb77e97e486bd0fa158543e93d35b3a9be64d451"
|
|
64
64
|
}
|