@versini/auth-provider 6.1.0 → 6.1.1
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 +71 -70
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,13 +4,13 @@ var Q = (e, t, r) => Nt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
|
4
4
|
import { jsx as Ue } from "react/jsx-runtime";
|
|
5
5
|
import Dt, { useSyncExternalStore as Ut, useCallback as Y, useEffect as Xe, createContext as $t, useReducer as Kt, useRef as Lt, useContext as Mt } from "react";
|
|
6
6
|
/*!
|
|
7
|
-
@versini/auth-provider v6.1.
|
|
7
|
+
@versini/auth-provider v6.1.1
|
|
8
8
|
© 2024 gizmette.com
|
|
9
9
|
*/
|
|
10
10
|
try {
|
|
11
11
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
12
|
-
version: "6.1.
|
|
13
|
-
buildTime: "07/16/2024 05:
|
|
12
|
+
version: "6.1.1",
|
|
13
|
+
buildTime: "07/16/2024 05:27 PM EDT",
|
|
14
14
|
homepage: "https://github.com/aversini/auth-client",
|
|
15
15
|
license: "MIT"
|
|
16
16
|
});
|
|
@@ -23,7 +23,7 @@ function P(e) {
|
|
|
23
23
|
r += String.fromCharCode(a);
|
|
24
24
|
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function le(e) {
|
|
27
27
|
const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - t.length % 4) % 4, n = t.padEnd(t.length + r, "="), a = atob(n), i = new ArrayBuffer(a.length), o = new Uint8Array(i);
|
|
28
28
|
for (let s = 0; s < a.length; s++)
|
|
29
29
|
o[s] = a.charCodeAt(s);
|
|
@@ -36,7 +36,7 @@ function Ze(e) {
|
|
|
36
36
|
const { id: t } = e;
|
|
37
37
|
return {
|
|
38
38
|
...e,
|
|
39
|
-
id:
|
|
39
|
+
id: le(t),
|
|
40
40
|
transports: e.transports
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -153,10 +153,10 @@ async function Gt(e) {
|
|
|
153
153
|
throw new Error("WebAuthn is not supported in this browser");
|
|
154
154
|
const r = { publicKey: {
|
|
155
155
|
...e,
|
|
156
|
-
challenge:
|
|
156
|
+
challenge: le(e.challenge),
|
|
157
157
|
user: {
|
|
158
158
|
...e.user,
|
|
159
|
-
id:
|
|
159
|
+
id: le(e.user.id)
|
|
160
160
|
},
|
|
161
161
|
excludeCredentials: (g = e.excludeCredentials) == null ? void 0 : g.map(Ze)
|
|
162
162
|
} };
|
|
@@ -177,7 +177,7 @@ async function Gt(e) {
|
|
|
177
177
|
try {
|
|
178
178
|
h = o.getPublicKeyAlgorithm();
|
|
179
179
|
} catch (p) {
|
|
180
|
-
|
|
180
|
+
ye("getPublicKeyAlgorithm()", p);
|
|
181
181
|
}
|
|
182
182
|
let c;
|
|
183
183
|
if (typeof o.getPublicKey == "function")
|
|
@@ -185,14 +185,14 @@ async function Gt(e) {
|
|
|
185
185
|
const p = o.getPublicKey();
|
|
186
186
|
p !== null && (c = P(p));
|
|
187
187
|
} catch (p) {
|
|
188
|
-
|
|
188
|
+
ye("getPublicKey()", p);
|
|
189
189
|
}
|
|
190
190
|
let f;
|
|
191
191
|
if (typeof o.getAuthenticatorData == "function")
|
|
192
192
|
try {
|
|
193
193
|
f = P(o.getAuthenticatorData());
|
|
194
194
|
} catch (p) {
|
|
195
|
-
|
|
195
|
+
ye("getAuthenticatorData()", p);
|
|
196
196
|
}
|
|
197
197
|
return {
|
|
198
198
|
id: a,
|
|
@@ -210,7 +210,7 @@ async function Gt(e) {
|
|
|
210
210
|
authenticatorAttachment: rt(n.authenticatorAttachment)
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function ye(e, t) {
|
|
214
214
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
|
|
215
215
|
`, t);
|
|
216
216
|
}
|
|
@@ -269,7 +269,7 @@ async function Bt(e, t = !1) {
|
|
|
269
269
|
((f = e.allowCredentials) == null ? void 0 : f.length) !== 0 && (r = (g = e.allowCredentials) == null ? void 0 : g.map(Ze));
|
|
270
270
|
const n = {
|
|
271
271
|
...e,
|
|
272
|
-
challenge:
|
|
272
|
+
challenge: le(e.challenge),
|
|
273
273
|
allowCredentials: r
|
|
274
274
|
}, a = {};
|
|
275
275
|
if (t) {
|
|
@@ -311,7 +311,7 @@ async function Bt(e, t = !1) {
|
|
|
311
311
|
try {
|
|
312
312
|
window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
|
|
313
313
|
version: "2.12.1",
|
|
314
|
-
buildTime: "07/16/2024 05:
|
|
314
|
+
buildTime: "07/16/2024 05:27 PM EDT",
|
|
315
315
|
homepage: "https://github.com/aversini/auth-client",
|
|
316
316
|
license: "MIT"
|
|
317
317
|
});
|
|
@@ -342,11 +342,11 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
|
|
|
342
342
|
l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
|
|
343
343
|
sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
|
|
344
344
|
awIDAQAB
|
|
345
|
-
-----END PUBLIC KEY-----`,
|
|
345
|
+
-----END PUBLIC KEY-----`, fe = {
|
|
346
346
|
AUTHENTICATE: "authenticate",
|
|
347
347
|
CODE: "code",
|
|
348
348
|
LOGOUT: "logout"
|
|
349
|
-
},
|
|
349
|
+
}, pe = crypto, at = (e) => e instanceof CryptoKey, X = new TextEncoder(), me = new TextDecoder();
|
|
350
350
|
function Yt(...e) {
|
|
351
351
|
const t = e.reduce((a, { length: i }) => a + i, 0), r = new Uint8Array(t);
|
|
352
352
|
let n = 0;
|
|
@@ -361,7 +361,7 @@ const Jt = (e) => {
|
|
|
361
361
|
return r;
|
|
362
362
|
}, se = (e) => {
|
|
363
363
|
let t = e;
|
|
364
|
-
t instanceof Uint8Array && (t =
|
|
364
|
+
t instanceof Uint8Array && (t = me.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
365
365
|
try {
|
|
366
366
|
return Jt(t);
|
|
367
367
|
} catch {
|
|
@@ -436,7 +436,7 @@ function C(e, t = "algorithm.name") {
|
|
|
436
436
|
function Z(e, t) {
|
|
437
437
|
return e.name === t;
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function we(e) {
|
|
440
440
|
return parseInt(e.name.slice(4), 10);
|
|
441
441
|
}
|
|
442
442
|
function Qt(e) {
|
|
@@ -469,7 +469,7 @@ function Zt(e, t, ...r) {
|
|
|
469
469
|
if (!Z(e.algorithm, "HMAC"))
|
|
470
470
|
throw C("HMAC");
|
|
471
471
|
const n = parseInt(t.slice(2), 10);
|
|
472
|
-
if (
|
|
472
|
+
if (we(e.algorithm.hash) !== n)
|
|
473
473
|
throw C(`SHA-${n}`, "algorithm.hash");
|
|
474
474
|
break;
|
|
475
475
|
}
|
|
@@ -479,7 +479,7 @@ function Zt(e, t, ...r) {
|
|
|
479
479
|
if (!Z(e.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
480
480
|
throw C("RSASSA-PKCS1-v1_5");
|
|
481
481
|
const n = parseInt(t.slice(2), 10);
|
|
482
|
-
if (
|
|
482
|
+
if (we(e.algorithm.hash) !== n)
|
|
483
483
|
throw C(`SHA-${n}`, "algorithm.hash");
|
|
484
484
|
break;
|
|
485
485
|
}
|
|
@@ -489,7 +489,7 @@ function Zt(e, t, ...r) {
|
|
|
489
489
|
if (!Z(e.algorithm, "RSA-PSS"))
|
|
490
490
|
throw C("RSA-PSS");
|
|
491
491
|
const n = parseInt(t.slice(2), 10);
|
|
492
|
-
if (
|
|
492
|
+
if (we(e.algorithm.hash) !== n)
|
|
493
493
|
throw C(`SHA-${n}`, "algorithm.hash");
|
|
494
494
|
break;
|
|
495
495
|
}
|
|
@@ -525,7 +525,7 @@ const Ke = (e, ...t) => it("Key must be ", e, ...t);
|
|
|
525
525
|
function st(e, t, ...r) {
|
|
526
526
|
return it(`Key for the ${e} algorithm must be `, t, ...r);
|
|
527
527
|
}
|
|
528
|
-
const ct = (e) => at(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
|
|
528
|
+
const ct = (e) => at(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", de = ["CryptoKey"], er = (...e) => {
|
|
529
529
|
const t = e.filter(Boolean);
|
|
530
530
|
if (t.length === 0 || t.length === 1)
|
|
531
531
|
return !0;
|
|
@@ -644,9 +644,9 @@ const ar = async (e) => {
|
|
|
644
644
|
e.ext ?? !1,
|
|
645
645
|
e.key_ops ?? r
|
|
646
646
|
], a = { ...e };
|
|
647
|
-
return delete a.alg, delete a.use,
|
|
647
|
+
return delete a.alg, delete a.use, pe.subtle.importKey("jwk", a, ...n);
|
|
648
648
|
}, ut = (e) => se(e);
|
|
649
|
-
let
|
|
649
|
+
let Ee, Se;
|
|
650
650
|
const lt = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", dt = async (e, t, r, n) => {
|
|
651
651
|
let a = e.get(t);
|
|
652
652
|
if (a != null && a[n])
|
|
@@ -656,13 +656,13 @@ const lt = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
|
|
|
656
656
|
}, or = (e, t) => {
|
|
657
657
|
if (lt(e)) {
|
|
658
658
|
let r = e.export({ format: "jwk" });
|
|
659
|
-
return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? ut(r.k) : (
|
|
659
|
+
return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? ut(r.k) : (Se || (Se = /* @__PURE__ */ new WeakMap()), dt(Se, e, r, t));
|
|
660
660
|
}
|
|
661
661
|
return e;
|
|
662
662
|
}, ir = (e, t) => {
|
|
663
663
|
if (lt(e)) {
|
|
664
664
|
let r = e.export({ format: "jwk" });
|
|
665
|
-
return r.k ? ut(r.k) : (
|
|
665
|
+
return r.k ? ut(r.k) : (Ee || (Ee = /* @__PURE__ */ new WeakMap()), dt(Ee, e, r, t));
|
|
666
666
|
}
|
|
667
667
|
return e;
|
|
668
668
|
}, sr = { normalizePublicKey: or, normalizePrivateKey: ir }, D = (e, t, r = 0) => {
|
|
@@ -737,7 +737,7 @@ const lt = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
|
|
|
737
737
|
default:
|
|
738
738
|
throw new U('Invalid or unsupported "alg" (Algorithm) value');
|
|
739
739
|
}
|
|
740
|
-
return
|
|
740
|
+
return pe.subtle.importKey(t, s, i, !1, o);
|
|
741
741
|
}, ur = (e, t, r) => cr(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
|
|
742
742
|
async function lr(e, t, r) {
|
|
743
743
|
if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
@@ -747,13 +747,13 @@ async function lr(e, t, r) {
|
|
|
747
747
|
const ce = (e) => e == null ? void 0 : e[Symbol.toStringTag], dr = (e, t) => {
|
|
748
748
|
if (!(t instanceof Uint8Array)) {
|
|
749
749
|
if (!ct(t))
|
|
750
|
-
throw new TypeError(st(e, t, ...
|
|
750
|
+
throw new TypeError(st(e, t, ...de, "Uint8Array"));
|
|
751
751
|
if (t.type !== "secret")
|
|
752
752
|
throw new TypeError(`${ce(t)} instances for symmetric algorithms must be of type "secret"`);
|
|
753
753
|
}
|
|
754
754
|
}, hr = (e, t, r) => {
|
|
755
755
|
if (!ct(t))
|
|
756
|
-
throw new TypeError(st(e, t, ...
|
|
756
|
+
throw new TypeError(st(e, t, ...de));
|
|
757
757
|
if (t.type === "secret")
|
|
758
758
|
throw new TypeError(`${ce(t)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
759
759
|
if (t.algorithm && r === "verify" && t.type === "private")
|
|
@@ -818,17 +818,17 @@ async function yr(e, t, r) {
|
|
|
818
818
|
return Zt(t, e, r), t;
|
|
819
819
|
if (t instanceof Uint8Array) {
|
|
820
820
|
if (!e.startsWith("HS"))
|
|
821
|
-
throw new TypeError(Ke(t, ...
|
|
822
|
-
return
|
|
821
|
+
throw new TypeError(Ke(t, ...de));
|
|
822
|
+
return pe.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
|
|
823
823
|
}
|
|
824
|
-
throw new TypeError(Ke(t, ...
|
|
824
|
+
throw new TypeError(Ke(t, ...de, "Uint8Array"));
|
|
825
825
|
}
|
|
826
826
|
const wr = async (e, t, r, n) => {
|
|
827
827
|
const a = await yr(e, t, "verify");
|
|
828
828
|
rr(e, a);
|
|
829
829
|
const i = gr(e, a.algorithm);
|
|
830
830
|
try {
|
|
831
|
-
return await
|
|
831
|
+
return await pe.subtle.verify(i, a, r, n);
|
|
832
832
|
} catch {
|
|
833
833
|
return !1;
|
|
834
834
|
}
|
|
@@ -850,7 +850,7 @@ async function Er(e, t, r) {
|
|
|
850
850
|
if (e.protected)
|
|
851
851
|
try {
|
|
852
852
|
const A = se(e.protected);
|
|
853
|
-
n = JSON.parse(
|
|
853
|
+
n = JSON.parse(me.decode(A));
|
|
854
854
|
} catch {
|
|
855
855
|
throw new S("JWS Protected Header is invalid");
|
|
856
856
|
}
|
|
@@ -897,7 +897,7 @@ async function Er(e, t, r) {
|
|
|
897
897
|
return e.protected !== void 0 && (p.protectedHeader = n), e.header !== void 0 && (p.unprotectedHeader = e.header), h ? { ...p, key: t } : p;
|
|
898
898
|
}
|
|
899
899
|
async function Sr(e, t, r) {
|
|
900
|
-
if (e instanceof Uint8Array && (e =
|
|
900
|
+
if (e instanceof Uint8Array && (e = me.decode(e)), typeof e != "string")
|
|
901
901
|
throw new S("Compact JWS must be a string or Uint8Array");
|
|
902
902
|
const { 0: n, 1: a, 2: i, length: o } = e.split(".");
|
|
903
903
|
if (o !== 3)
|
|
@@ -951,7 +951,7 @@ const Ar = (e) => Math.floor(e.getTime() / 1e3), ht = 60, ft = ht * 60, Ce = ft
|
|
|
951
951
|
}, He = (e) => e.toLowerCase().replace(/^application\//, ""), Rr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Ir = (e, t, r = {}) => {
|
|
952
952
|
let n;
|
|
953
953
|
try {
|
|
954
|
-
n = JSON.parse(
|
|
954
|
+
n = JSON.parse(me.decode(t));
|
|
955
955
|
} catch {
|
|
956
956
|
}
|
|
957
957
|
if (!_e(n))
|
|
@@ -1027,8 +1027,8 @@ const q = async (e) => {
|
|
|
1027
1027
|
}
|
|
1028
1028
|
};
|
|
1029
1029
|
var w = [];
|
|
1030
|
-
for (var
|
|
1031
|
-
w.push((
|
|
1030
|
+
for (var Ae = 0; Ae < 256; ++Ae)
|
|
1031
|
+
w.push((Ae + 256).toString(16).slice(1));
|
|
1032
1032
|
function Pr(e, t = 0) {
|
|
1033
1033
|
return (w[e[t + 0]] + w[e[t + 1]] + w[e[t + 2]] + w[e[t + 3]] + "-" + w[e[t + 4]] + w[e[t + 5]] + "-" + w[e[t + 6]] + w[e[t + 7]] + "-" + w[e[t + 8]] + w[e[t + 9]] + "-" + w[e[t + 10]] + w[e[t + 11]] + w[e[t + 12]] + w[e[t + 13]] + w[e[t + 14]] + w[e[t + 15]]).toLowerCase();
|
|
1034
1034
|
}
|
|
@@ -1106,8 +1106,8 @@ function te({
|
|
|
1106
1106
|
}, [e, t]), [r ? JSON.parse(r) : null, n, a, i];
|
|
1107
1107
|
}
|
|
1108
1108
|
var E = [];
|
|
1109
|
-
for (var
|
|
1110
|
-
E.push((
|
|
1109
|
+
for (var ve = 0; ve < 256; ++ve)
|
|
1110
|
+
E.push((ve + 256).toString(16).slice(1));
|
|
1111
1111
|
function Mr(e, t = 0) {
|
|
1112
1112
|
return (E[e[t + 0]] + E[e[t + 1]] + E[e[t + 2]] + E[e[t + 3]] + "-" + E[e[t + 4]] + E[e[t + 5]] + "-" + E[e[t + 6]] + E[e[t + 7]] + "-" + E[e[t + 8]] + E[e[t + 9]] + "-" + E[e[t + 10]] + E[e[t + 11]] + E[e[t + 12]] + E[e[t + 13]] + E[e[t + 14]] + E[e[t + 15]]).toLowerCase();
|
|
1113
1113
|
}
|
|
@@ -1121,7 +1121,7 @@ var Wr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(cryp
|
|
|
1121
1121
|
const Be = {
|
|
1122
1122
|
randomUUID: Wr
|
|
1123
1123
|
};
|
|
1124
|
-
function
|
|
1124
|
+
function Te(e, t, r) {
|
|
1125
1125
|
if (Be.randomUUID && !t && !e)
|
|
1126
1126
|
return Be.randomUUID();
|
|
1127
1127
|
e = e || {};
|
|
@@ -1222,19 +1222,19 @@ var N = { exclude: [] }, mt = {}, Gr = { timeout: "true" }, R = function(e, t) {
|
|
|
1222
1222
|
return [e[0], (0, e[1])()];
|
|
1223
1223
|
}));
|
|
1224
1224
|
}, Fe = 3432918353, Ye = 461845907, jr = 3864292196, Br = 2246822507, Fr = 3266489909;
|
|
1225
|
-
function
|
|
1225
|
+
function be(e, t) {
|
|
1226
1226
|
return e << t | e >>> 32 - t;
|
|
1227
1227
|
}
|
|
1228
1228
|
function ke(e, t) {
|
|
1229
1229
|
t === void 0 && (t = 0);
|
|
1230
|
-
for (var r = t, n = 0, a = 3 & e.length, i = e.length - a, o = 0; o < i; ) n = 255 & e.charCodeAt(o) | (255 & e.charCodeAt(++o)) << 8 | (255 & e.charCodeAt(++o)) << 16 | (255 & e.charCodeAt(++o)) << 24, ++o, n =
|
|
1230
|
+
for (var r = t, n = 0, a = 3 & e.length, i = e.length - a, o = 0; o < i; ) n = 255 & e.charCodeAt(o) | (255 & e.charCodeAt(++o)) << 8 | (255 & e.charCodeAt(++o)) << 16 | (255 & e.charCodeAt(++o)) << 24, ++o, n = be(n = Math.imul(n, Fe), 15), r = be(r ^= n = Math.imul(n, Ye), 13), r = Math.imul(r, 5) + jr;
|
|
1231
1231
|
switch (n = 0, a) {
|
|
1232
1232
|
case 3:
|
|
1233
1233
|
n ^= (255 & e.charCodeAt(o + 2)) << 16;
|
|
1234
1234
|
case 2:
|
|
1235
1235
|
n ^= (255 & e.charCodeAt(o + 1)) << 8;
|
|
1236
1236
|
case 1:
|
|
1237
|
-
n ^= 255 & e.charCodeAt(o), n =
|
|
1237
|
+
n ^= 255 & e.charCodeAt(o), n = be(n = Math.imul(n, Fe), 15), r ^= n = Math.imul(n, Ye);
|
|
1238
1238
|
}
|
|
1239
1239
|
return ((r = function(s) {
|
|
1240
1240
|
return s ^= s >>> 16, s = Math.imul(s, Br), s ^= s >>> 13, s = Math.imul(s, Fr), s ^ s >>> 16;
|
|
@@ -1371,7 +1371,7 @@ z().name != "Firefox" && R("canvas", function() {
|
|
|
1371
1371
|
e({ commonImageDataHash: ke(yt(t, Je, qe).data.toString()).toString() });
|
|
1372
1372
|
});
|
|
1373
1373
|
});
|
|
1374
|
-
var
|
|
1374
|
+
var Re, en = ["Arial", "Arial Black", "Arial Narrow", "Arial Rounded MT", "Arimo", "Archivo", "Barlow", "Bebas Neue", "Bitter", "Bookman", "Calibri", "Cabin", "Candara", "Century", "Century Gothic", "Comic Sans MS", "Constantia", "Courier", "Courier New", "Crimson Text", "DM Mono", "DM Sans", "DM Serif Display", "DM Serif Text", "Dosis", "Droid Sans", "Exo", "Fira Code", "Fira Sans", "Franklin Gothic Medium", "Garamond", "Geneva", "Georgia", "Gill Sans", "Helvetica", "Impact", "Inconsolata", "Indie Flower", "Inter", "Josefin Sans", "Karla", "Lato", "Lexend", "Lucida Bright", "Lucida Console", "Lucida Sans Unicode", "Manrope", "Merriweather", "Merriweather Sans", "Montserrat", "Myriad", "Noto Sans", "Nunito", "Nunito Sans", "Open Sans", "Optima", "Orbitron", "Oswald", "Pacifico", "Palatino", "Perpetua", "PT Sans", "PT Serif", "Poppins", "Prompt", "Public Sans", "Quicksand", "Rajdhani", "Recursive", "Roboto", "Roboto Condensed", "Rockwell", "Rubik", "Segoe Print", "Segoe Script", "Segoe UI", "Sora", "Source Sans Pro", "Space Mono", "Tahoma", "Taviraj", "Times", "Times New Roman", "Titillium Web", "Trebuchet MS", "Ubuntu", "Varela Round", "Verdana", "Work Sans"], tn = ["monospace", "sans-serif", "serif"];
|
|
1375
1375
|
function ze(e, t) {
|
|
1376
1376
|
if (!e) throw new Error("Canvas context not supported");
|
|
1377
1377
|
return e.font = "72px ".concat(t), e.measureText("WwMmLli0Oo").width;
|
|
@@ -1482,14 +1482,14 @@ z().name != "Firefox" && R("fonts", function() {
|
|
|
1482
1482
|
return k(this, void 0, void 0, function() {
|
|
1483
1483
|
var e;
|
|
1484
1484
|
return O(this, function(t) {
|
|
1485
|
-
return
|
|
1485
|
+
return Re = (N == null ? void 0 : N.permissions_to_check) || ["accelerometer", "accessibility", "accessibility-events", "ambient-light-sensor", "background-fetch", "background-sync", "bluetooth", "camera", "clipboard-read", "clipboard-write", "device-info", "display-capture", "gyroscope", "geolocation", "local-fonts", "magnetometer", "microphone", "midi", "nfc", "notifications", "payment-handler", "persistent-storage", "push", "speaker", "storage-access", "top-level-storage-access", "window-management", "query"], e = Array.from({ length: (N == null ? void 0 : N.retries) || 3 }, function() {
|
|
1486
1486
|
return function() {
|
|
1487
1487
|
return k(this, void 0, void 0, function() {
|
|
1488
1488
|
var r, n, a, i, o;
|
|
1489
1489
|
return O(this, function(s) {
|
|
1490
1490
|
switch (s.label) {
|
|
1491
1491
|
case 0:
|
|
1492
|
-
r = {}, n = 0, a =
|
|
1492
|
+
r = {}, n = 0, a = Re, s.label = 1;
|
|
1493
1493
|
case 1:
|
|
1494
1494
|
if (!(n < a.length)) return [3, 6];
|
|
1495
1495
|
i = a[n], s.label = 2;
|
|
@@ -1508,7 +1508,7 @@ z().name != "Firefox" && R("fonts", function() {
|
|
|
1508
1508
|
});
|
|
1509
1509
|
}();
|
|
1510
1510
|
}), [2, Promise.all(e).then(function(r) {
|
|
1511
|
-
return an(r,
|
|
1511
|
+
return an(r, Re);
|
|
1512
1512
|
})];
|
|
1513
1513
|
});
|
|
1514
1514
|
});
|
|
@@ -1596,17 +1596,17 @@ R("math", function() {
|
|
|
1596
1596
|
});
|
|
1597
1597
|
});
|
|
1598
1598
|
});
|
|
1599
|
-
const ne = "Oops! It looks like your session has expired. For your security, please log in again to continue.", un = "Your session has been successfully terminated.", ae = "Login failed. Please try again.",
|
|
1599
|
+
const ne = "Oops! It looks like your session has expired. For your security, please log in again to continue.", un = "Your session has been successfully terminated.", ae = "Login failed. Please try again.", Ie = "Error getting access token, please re-authenticate.", ln = "You forgot to wrap your component in <AuthProvider>.", he = {
|
|
1600
1600
|
dev: "https://auth.gizmette.local.com:3003",
|
|
1601
1601
|
prod: "https://mylogin.gizmette.com/auth"
|
|
1602
|
-
}, oe = "@@auth@@", B = "LOADING", F = "LOGIN", wt = "LOGOUT", dn = process.env.NODE_ENV === "production", Et = !dn,
|
|
1602
|
+
}, oe = "@@auth@@", B = "LOADING", F = "LOGIN", wt = "LOGOUT", dn = process.env.NODE_ENV === "production", Et = !dn, ge = async ({
|
|
1603
1603
|
type: e,
|
|
1604
1604
|
clientId: t,
|
|
1605
1605
|
params: r = {}
|
|
1606
1606
|
}) => {
|
|
1607
1607
|
try {
|
|
1608
1608
|
const n = await fetch(
|
|
1609
|
-
Et ? `${
|
|
1609
|
+
Et ? `${he.dev}/${e}` : `${he.prod}/${e}`,
|
|
1610
1610
|
{
|
|
1611
1611
|
credentials: "include",
|
|
1612
1612
|
method: "POST",
|
|
@@ -1638,8 +1638,8 @@ const ne = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1638
1638
|
}) => {
|
|
1639
1639
|
try {
|
|
1640
1640
|
return {
|
|
1641
|
-
status: (await
|
|
1642
|
-
type:
|
|
1641
|
+
status: (await ge({
|
|
1642
|
+
type: fe.LOGOUT,
|
|
1643
1643
|
clientId: a,
|
|
1644
1644
|
params: {
|
|
1645
1645
|
userId: e,
|
|
@@ -1668,8 +1668,8 @@ const ne = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1668
1668
|
fingerprint: h
|
|
1669
1669
|
}) => {
|
|
1670
1670
|
try {
|
|
1671
|
-
const c = await
|
|
1672
|
-
type:
|
|
1671
|
+
const c = await ge({
|
|
1672
|
+
type: fe.AUTHENTICATE,
|
|
1673
1673
|
clientId: r,
|
|
1674
1674
|
params: {
|
|
1675
1675
|
type: a || J.ID_AND_ACCESS_TOKEN,
|
|
@@ -1703,8 +1703,8 @@ const ne = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1703
1703
|
code_challenge: r
|
|
1704
1704
|
}) => {
|
|
1705
1705
|
try {
|
|
1706
|
-
const n = await
|
|
1707
|
-
type:
|
|
1706
|
+
const n = await ge({
|
|
1707
|
+
type: fe.CODE,
|
|
1708
1708
|
clientId: t,
|
|
1709
1709
|
params: {
|
|
1710
1710
|
type: J.CODE,
|
|
@@ -1732,8 +1732,8 @@ const ne = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1732
1732
|
domain: i
|
|
1733
1733
|
}) => {
|
|
1734
1734
|
try {
|
|
1735
|
-
const o = await
|
|
1736
|
-
type:
|
|
1735
|
+
const o = await ge({
|
|
1736
|
+
type: fe.AUTHENTICATE,
|
|
1737
1737
|
clientId: e,
|
|
1738
1738
|
params: {
|
|
1739
1739
|
type: J.REFRESH_TOKEN,
|
|
@@ -1741,7 +1741,8 @@ const ne = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1741
1741
|
nonce: r,
|
|
1742
1742
|
refreshToken: n,
|
|
1743
1743
|
accessToken: a,
|
|
1744
|
-
domain: i
|
|
1744
|
+
domain: i,
|
|
1745
|
+
fingerprint: await ue()
|
|
1745
1746
|
}
|
|
1746
1747
|
}), s = await q(o.data.accessToken);
|
|
1747
1748
|
return s && s.payload[b.USER_ID_KEY] !== "" && s.payload[b.NONCE_KEY] === r ? {
|
|
@@ -1857,7 +1858,7 @@ const ne = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1857
1858
|
}) => {
|
|
1858
1859
|
try {
|
|
1859
1860
|
const a = t != null && t.data ? t.data(n) : n, i = `Bearer ${e}`, o = await fetch(
|
|
1860
|
-
Et ? `${
|
|
1861
|
+
Et ? `${he.dev}/graphql` : `${he.prod}/graphql`,
|
|
1861
1862
|
{
|
|
1862
1863
|
method: "POST",
|
|
1863
1864
|
credentials: "include",
|
|
@@ -1884,7 +1885,7 @@ const ne = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1884
1885
|
} catch (a) {
|
|
1885
1886
|
return console.error(a), { status: 500, data: [] };
|
|
1886
1887
|
}
|
|
1887
|
-
},
|
|
1888
|
+
}, ue = async () => {
|
|
1888
1889
|
try {
|
|
1889
1890
|
const e = await zr();
|
|
1890
1891
|
return typeof e == "string" ? e : e.hash && typeof e.hash == "string" ? e.hash : "";
|
|
@@ -2063,7 +2064,7 @@ const G = () => {
|
|
|
2063
2064
|
};
|
|
2064
2065
|
}, [a.isLoading, s, K]);
|
|
2065
2066
|
const Tt = async (d, y, m) => {
|
|
2066
|
-
const I =
|
|
2067
|
+
const I = Te();
|
|
2067
2068
|
if (Oe(I), i({ type: B, payload: { isLoading: !0 } }), h(), g(), $(), m === J.CODE) {
|
|
2068
2069
|
const { code_verifier: Ct, code_challenge: kt } = await $r(), De = await fn({
|
|
2069
2070
|
nonce: I,
|
|
@@ -2081,7 +2082,7 @@ const G = () => {
|
|
|
2081
2082
|
code: De.code,
|
|
2082
2083
|
code_verifier: Ct,
|
|
2083
2084
|
domain: n,
|
|
2084
|
-
fingerprint: await
|
|
2085
|
+
fingerprint: await ue()
|
|
2085
2086
|
});
|
|
2086
2087
|
return j.status ? (u(j.idToken), f(j.accessToken), A(j.refreshToken), i({
|
|
2087
2088
|
type: F,
|
|
@@ -2104,7 +2105,7 @@ const G = () => {
|
|
|
2104
2105
|
nonce: I,
|
|
2105
2106
|
type: m,
|
|
2106
2107
|
domain: n,
|
|
2107
|
-
fingerprint: await
|
|
2108
|
+
fingerprint: await ue()
|
|
2108
2109
|
});
|
|
2109
2110
|
return V.status ? (u(V.idToken), f(V.accessToken), A(V.refreshToken), i({
|
|
2110
2111
|
type: F,
|
|
@@ -2133,11 +2134,11 @@ const G = () => {
|
|
|
2133
2134
|
nonce: At,
|
|
2134
2135
|
domain: n
|
|
2135
2136
|
});
|
|
2136
|
-
return m.status && m.status === "success" ? (f(m.newAccessToken), A(m.newRefreshToken), m.newAccessToken) : (await K(
|
|
2137
|
+
return m.status && m.status === "success" ? (f(m.newAccessToken), A(m.newRefreshToken), m.newAccessToken) : (await K(Ie), "");
|
|
2137
2138
|
}
|
|
2138
|
-
return await K(
|
|
2139
|
+
return await K(Ie), "";
|
|
2139
2140
|
} catch {
|
|
2140
|
-
return await K(
|
|
2141
|
+
return await K(Ie), "";
|
|
2141
2142
|
}
|
|
2142
2143
|
}, It = () => {
|
|
2143
2144
|
if (a.isAuthenticated && s)
|
|
@@ -2182,9 +2183,9 @@ const G = () => {
|
|
|
2182
2183
|
}), !1;
|
|
2183
2184
|
}
|
|
2184
2185
|
}, Pt = async () => {
|
|
2185
|
-
const d =
|
|
2186
|
+
const d = Te();
|
|
2186
2187
|
Oe(d), i({ type: B, payload: { isLoading: !0 } }), h(), g(), $();
|
|
2187
|
-
const y =
|
|
2188
|
+
const y = Te();
|
|
2188
2189
|
let m = await W({
|
|
2189
2190
|
accessToken: c,
|
|
2190
2191
|
clientId: r,
|
|
@@ -2207,7 +2208,7 @@ const G = () => {
|
|
|
2207
2208
|
authentication: I,
|
|
2208
2209
|
nonce: d,
|
|
2209
2210
|
domain: n,
|
|
2210
|
-
fingerprint: await
|
|
2211
|
+
fingerprint: await ue()
|
|
2211
2212
|
}
|
|
2212
2213
|
}), m.data.status === "success" ? (u(m.data.idToken), f(m.data.accessToken), A(m.data.refreshToken), i({
|
|
2213
2214
|
type: F,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/auth-provider",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"jose": "5.6.3",
|
|
52
52
|
"uuid": "10.0.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "12463c7c9fa434e7f9efe98ede515b47d50be0cb"
|
|
55
55
|
}
|