@versini/auth-common 4.5.1 → 4.6.0
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.d.ts +2 -0
- package/dist/index.js +17 -15
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare const AUTH_TYPES: {
|
|
|
8
8
|
REFRESH_TOKEN: string;
|
|
9
9
|
PASSKEY: string;
|
|
10
10
|
AUTH0: string;
|
|
11
|
+
GOOGLE: string;
|
|
11
12
|
};
|
|
12
13
|
declare const HEADERS: {
|
|
13
14
|
CLIENT_ID: string;
|
|
@@ -42,6 +43,7 @@ declare const API_TYPE: {
|
|
|
42
43
|
LOGOUT: string;
|
|
43
44
|
LOGIN: string;
|
|
44
45
|
REFRESH: string;
|
|
46
|
+
GOOGLE: string;
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
declare const verifyAndExtractToken: (token: string) => Promise<jose.JWTVerifyResult<jose.JWTPayload> | undefined>;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/auth-common v4.
|
|
2
|
+
@versini/auth-common v4.6.0
|
|
3
3
|
© 2025 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
try {
|
|
6
6
|
window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
|
|
7
|
-
version: "4.
|
|
8
|
-
buildTime: "
|
|
7
|
+
version: "4.6.0",
|
|
8
|
+
buildTime: "11/23/2025 02:59 PM EST",
|
|
9
9
|
homepage: "https://github.com/aversini/auth-client",
|
|
10
10
|
license: "MIT"
|
|
11
11
|
});
|
|
@@ -18,7 +18,8 @@ const it = {
|
|
|
18
18
|
CODE: "code",
|
|
19
19
|
REFRESH_TOKEN: "refresh_token",
|
|
20
20
|
PASSKEY: "passkey",
|
|
21
|
-
AUTH0: "auth0"
|
|
21
|
+
AUTH0: "auth0",
|
|
22
|
+
GOOGLE: "google"
|
|
22
23
|
}, st = {
|
|
23
24
|
CLIENT_ID: "X-Auth-ClientId",
|
|
24
25
|
AUTH_TYPE: "X-Auth-Type"
|
|
@@ -54,7 +55,8 @@ awIDAQAB
|
|
|
54
55
|
CODE: "code",
|
|
55
56
|
LOGOUT: "logout",
|
|
56
57
|
LOGIN: "login",
|
|
57
|
-
REFRESH: "refresh"
|
|
58
|
+
REFRESH: "refresh",
|
|
59
|
+
GOOGLE: "google"
|
|
58
60
|
}, R = new TextEncoder(), v = new TextDecoder();
|
|
59
61
|
function ie(...e) {
|
|
60
62
|
const t = e.reduce((a, { length: o }) => a + o, 0), r = new Uint8Array(t);
|
|
@@ -63,7 +65,7 @@ function ie(...e) {
|
|
|
63
65
|
r.set(a, n), n += a.length;
|
|
64
66
|
return r;
|
|
65
67
|
}
|
|
66
|
-
function
|
|
68
|
+
function G(e) {
|
|
67
69
|
if (Uint8Array.fromBase64)
|
|
68
70
|
return Uint8Array.fromBase64(e);
|
|
69
71
|
const t = atob(e), r = new Uint8Array(t.length);
|
|
@@ -79,7 +81,7 @@ function T(e) {
|
|
|
79
81
|
let t = e;
|
|
80
82
|
t instanceof Uint8Array && (t = v.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
81
83
|
try {
|
|
82
|
-
return
|
|
84
|
+
return G(t);
|
|
83
85
|
} catch {
|
|
84
86
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
85
87
|
}
|
|
@@ -219,16 +221,16 @@ function fe(e, t, r) {
|
|
|
219
221
|
}
|
|
220
222
|
ue(e, r);
|
|
221
223
|
}
|
|
222
|
-
function
|
|
224
|
+
function V(e, t, ...r) {
|
|
223
225
|
if (r = r.filter(Boolean), r.length > 2) {
|
|
224
226
|
const n = r.pop();
|
|
225
227
|
e += `one of type ${r.join(", ")}, or ${n}.`;
|
|
226
228
|
} else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
|
|
227
229
|
return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && t.constructor?.name && (e += ` Received an instance of ${t.constructor.name}`), e;
|
|
228
230
|
}
|
|
229
|
-
const le = (e, ...t) =>
|
|
231
|
+
const le = (e, ...t) => V("Key must be ", e, ...t);
|
|
230
232
|
function q(e, t, ...r) {
|
|
231
|
-
return
|
|
233
|
+
return V(`Key for the ${e} algorithm must be `, t, ...r);
|
|
232
234
|
}
|
|
233
235
|
function z(e) {
|
|
234
236
|
return e?.[Symbol.toStringTag] === "CryptoKey";
|
|
@@ -377,7 +379,7 @@ const we = (e) => {
|
|
|
377
379
|
throw new E('Invalid or unsupported "alg" (Algorithm) value');
|
|
378
380
|
}
|
|
379
381
|
return crypto.subtle.importKey(e, t, a, n?.extractable ?? !0, o);
|
|
380
|
-
}, ge = (e, t) =>
|
|
382
|
+
}, ge = (e, t) => G(e.replace(t, "")), be = (e, t, r) => {
|
|
381
383
|
const n = ge(e, /(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g);
|
|
382
384
|
let a = r;
|
|
383
385
|
return t?.startsWith?.("ECDH-ES") && (a ||= {}, a.getNamedCurve = (o) => {
|
|
@@ -892,7 +894,7 @@ const $e = (e) => Math.floor(e.getTime() / 1e3), j = 60, ee = j * 60, N = ee * 2
|
|
|
892
894
|
}
|
|
893
895
|
return t[1] === "-" || t[4] === "ago" ? -a : a;
|
|
894
896
|
}, k = (e) => e.includes("/") ? e.toLowerCase() : `application/${e.toLowerCase()}`, Fe = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1;
|
|
895
|
-
function
|
|
897
|
+
function Ge(e, t, r = {}) {
|
|
896
898
|
let n;
|
|
897
899
|
try {
|
|
898
900
|
n = JSON.parse(v.decode(t));
|
|
@@ -952,11 +954,11 @@ function Ve(e, t, r = {}) {
|
|
|
952
954
|
}
|
|
953
955
|
return n;
|
|
954
956
|
}
|
|
955
|
-
async function
|
|
957
|
+
async function Ve(e, t, r) {
|
|
956
958
|
const n = await Me(e, t, r);
|
|
957
959
|
if (n.protectedHeader.crit?.includes("b64") && n.protectedHeader.b64 === !1)
|
|
958
960
|
throw new S("JWTs MUST NOT use unencoded payload");
|
|
959
|
-
const o = { payload:
|
|
961
|
+
const o = { payload: Ge(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
|
|
960
962
|
return typeof t == "function" ? { ...o, key: n.key } : o;
|
|
961
963
|
}
|
|
962
964
|
function te(e) {
|
|
@@ -988,7 +990,7 @@ function te(e) {
|
|
|
988
990
|
const qe = async (e) => {
|
|
989
991
|
try {
|
|
990
992
|
const t = y.ALG, n = await ve(oe, t);
|
|
991
|
-
return await
|
|
993
|
+
return await Ve(e, n, {
|
|
992
994
|
issuer: y.ISSUER
|
|
993
995
|
});
|
|
994
996
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/auth-common",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"jose": "6.1.0",
|
|
38
38
|
"uuid": "11.1.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "08365bc6d187fe1379f4f86fb6ec730cc9129ddf"
|
|
41
41
|
}
|