@versini/auth-provider 5.1.0 → 5.1.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/index.js +546 -935
- package/package.json +3 -4
package/dist/index.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import
|
|
6
|
-
import { useContext as Ve, useState as ze, useLayoutEffect as At, useMemo as Ee, createContext as vt, useRef as _t, useCallback as Re, useEffect as Tt } from "react";
|
|
1
|
+
var Ye = Object.defineProperty;
|
|
2
|
+
var Be = (e, t, r) => t in e ? Ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var L = (e, t, r) => Be(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { jsx as Fe } from "react/jsx-runtime";
|
|
5
|
+
import { useSyncExternalStore as Ge, useCallback as H, useEffect as ve, createContext as qe, useRef as ze, useState as Xe, useContext as Qe } from "react";
|
|
7
6
|
/*!
|
|
8
|
-
@versini/auth-provider v5.1.
|
|
7
|
+
@versini/auth-provider v5.1.2
|
|
9
8
|
© 2024 gizmette.com
|
|
10
9
|
*/
|
|
11
10
|
try {
|
|
12
11
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
13
|
-
version: "5.1.
|
|
14
|
-
buildTime: "07/
|
|
12
|
+
version: "5.1.2",
|
|
13
|
+
buildTime: "07/09/2024 11:15 AM EDT",
|
|
15
14
|
homepage: "https://github.com/aversini/auth-client",
|
|
16
15
|
license: "MIT"
|
|
17
16
|
});
|
|
@@ -24,28 +23,28 @@ try {
|
|
|
24
23
|
try {
|
|
25
24
|
window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
|
|
26
25
|
version: "2.11.0",
|
|
27
|
-
buildTime: "07/
|
|
26
|
+
buildTime: "07/09/2024 11:15 AM EDT",
|
|
28
27
|
homepage: "https://github.com/aversini/auth-client",
|
|
29
28
|
license: "MIT"
|
|
30
29
|
});
|
|
31
30
|
} catch {
|
|
32
31
|
}
|
|
33
|
-
const
|
|
32
|
+
const q = {
|
|
34
33
|
ID_TOKEN: "id_token",
|
|
35
34
|
ACCESS_TOKEN: "token",
|
|
36
35
|
ID_AND_ACCESS_TOKEN: "id_token token",
|
|
37
36
|
CODE: "code",
|
|
38
37
|
REFRESH_TOKEN: "refresh_token"
|
|
39
|
-
},
|
|
38
|
+
}, Ze = {
|
|
40
39
|
CLIENT_ID: "X-Auth-ClientId"
|
|
41
|
-
},
|
|
40
|
+
}, w = {
|
|
42
41
|
ALG: "RS256",
|
|
43
42
|
USER_ID_KEY: "sub",
|
|
44
43
|
TOKEN_ID_KEY: "__raw",
|
|
45
44
|
NONCE_KEY: "_nonce",
|
|
46
45
|
USERNAME_KEY: "username",
|
|
47
46
|
ISSUER: "gizmette.com"
|
|
48
|
-
},
|
|
47
|
+
}, et = `-----BEGIN PUBLIC KEY-----
|
|
49
48
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
|
|
50
49
|
w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
|
|
51
50
|
i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
|
|
@@ -53,33 +52,33 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
|
|
|
53
52
|
l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
|
|
54
53
|
sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
|
|
55
54
|
awIDAQAB
|
|
56
|
-
-----END PUBLIC KEY-----`,
|
|
55
|
+
-----END PUBLIC KEY-----`, z = {
|
|
57
56
|
AUTHENTICATE: "authenticate",
|
|
58
57
|
CODE: "code",
|
|
59
58
|
LOGOUT: "logout"
|
|
60
|
-
},
|
|
61
|
-
function
|
|
59
|
+
}, X = crypto, be = (e) => e instanceof CryptoKey, $ = new TextEncoder(), Q = new TextDecoder();
|
|
60
|
+
function tt(...e) {
|
|
62
61
|
const t = e.reduce((n, { length: s }) => n + s, 0), r = new Uint8Array(t);
|
|
63
|
-
let
|
|
62
|
+
let a = 0;
|
|
64
63
|
for (const n of e)
|
|
65
|
-
r.set(n,
|
|
64
|
+
r.set(n, a), a += n.length;
|
|
66
65
|
return r;
|
|
67
66
|
}
|
|
68
|
-
const
|
|
67
|
+
const rt = (e) => {
|
|
69
68
|
const t = atob(e), r = new Uint8Array(t.length);
|
|
70
|
-
for (let
|
|
71
|
-
r[
|
|
69
|
+
for (let a = 0; a < t.length; a++)
|
|
70
|
+
r[a] = t.charCodeAt(a);
|
|
72
71
|
return r;
|
|
73
|
-
},
|
|
72
|
+
}, B = (e) => {
|
|
74
73
|
let t = e;
|
|
75
|
-
t instanceof Uint8Array && (t =
|
|
74
|
+
t instanceof Uint8Array && (t = Q.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
76
75
|
try {
|
|
77
|
-
return
|
|
76
|
+
return rt(t);
|
|
78
77
|
} catch {
|
|
79
78
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
80
79
|
}
|
|
81
80
|
};
|
|
82
|
-
class
|
|
81
|
+
class C extends Error {
|
|
83
82
|
static get code() {
|
|
84
83
|
return "ERR_JOSE_GENERIC";
|
|
85
84
|
}
|
|
@@ -88,23 +87,23 @@ class H extends Error {
|
|
|
88
87
|
super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
|
-
class
|
|
90
|
+
class A extends C {
|
|
92
91
|
static get code() {
|
|
93
92
|
return "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
94
93
|
}
|
|
95
|
-
constructor(t, r,
|
|
96
|
-
super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim =
|
|
94
|
+
constructor(t, r, a = "unspecified", n = "unspecified") {
|
|
95
|
+
super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = a, this.reason = n, this.payload = r;
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
|
-
class
|
|
98
|
+
class le extends C {
|
|
100
99
|
static get code() {
|
|
101
100
|
return "ERR_JWT_EXPIRED";
|
|
102
101
|
}
|
|
103
|
-
constructor(t, r,
|
|
104
|
-
super(t), this.code = "ERR_JWT_EXPIRED", this.claim =
|
|
102
|
+
constructor(t, r, a = "unspecified", n = "unspecified") {
|
|
103
|
+
super(t), this.code = "ERR_JWT_EXPIRED", this.claim = a, this.reason = n, this.payload = r;
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
|
-
class
|
|
106
|
+
class at extends C {
|
|
108
107
|
constructor() {
|
|
109
108
|
super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
110
109
|
}
|
|
@@ -112,30 +111,31 @@ class Ot extends H {
|
|
|
112
111
|
return "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
|
-
|
|
114
|
+
class b extends C {
|
|
116
115
|
constructor() {
|
|
117
116
|
super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
|
|
118
117
|
}
|
|
119
118
|
static get code() {
|
|
120
119
|
return "ERR_JOSE_NOT_SUPPORTED";
|
|
121
120
|
}
|
|
122
|
-
}
|
|
121
|
+
}
|
|
122
|
+
class f extends C {
|
|
123
123
|
constructor() {
|
|
124
124
|
super(...arguments), this.code = "ERR_JWS_INVALID";
|
|
125
125
|
}
|
|
126
126
|
static get code() {
|
|
127
127
|
return "ERR_JWS_INVALID";
|
|
128
128
|
}
|
|
129
|
-
}
|
|
130
|
-
class
|
|
129
|
+
}
|
|
130
|
+
let Re = class extends C {
|
|
131
131
|
constructor() {
|
|
132
132
|
super(...arguments), this.code = "ERR_JWT_INVALID";
|
|
133
133
|
}
|
|
134
134
|
static get code() {
|
|
135
135
|
return "ERR_JWT_INVALID";
|
|
136
136
|
}
|
|
137
|
-
}
|
|
138
|
-
class
|
|
137
|
+
};
|
|
138
|
+
class nt extends C {
|
|
139
139
|
constructor() {
|
|
140
140
|
super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
|
|
141
141
|
}
|
|
@@ -143,16 +143,16 @@ class Pt extends H {
|
|
|
143
143
|
return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function k(e, t = "algorithm.name") {
|
|
147
147
|
return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function W(e, t) {
|
|
150
150
|
return e.name === t;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function te(e) {
|
|
153
153
|
return parseInt(e.name.slice(4), 10);
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function st(e) {
|
|
156
156
|
switch (e) {
|
|
157
157
|
case "ES256":
|
|
158
158
|
return "P-256";
|
|
@@ -164,89 +164,87 @@ function It(e) {
|
|
|
164
164
|
throw new Error("unreachable");
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function ot(e, t) {
|
|
168
168
|
if (t.length && !t.some((r) => e.usages.includes(r))) {
|
|
169
169
|
let r = "CryptoKey does not support this operation, its usages must include ";
|
|
170
170
|
if (t.length > 2) {
|
|
171
|
-
const
|
|
172
|
-
r += `one of ${t.join(", ")}, or ${
|
|
173
|
-
} else
|
|
174
|
-
t.length === 2 ? r += `one of ${t[0]} or ${t[1]}.` : r += `${t[0]}.`;
|
|
171
|
+
const a = t.pop();
|
|
172
|
+
r += `one of ${t.join(", ")}, or ${a}.`;
|
|
173
|
+
} else t.length === 2 ? r += `one of ${t[0]} or ${t[1]}.` : r += `${t[0]}.`;
|
|
175
174
|
throw new TypeError(r);
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
|
-
function
|
|
177
|
+
function it(e, t, ...r) {
|
|
179
178
|
switch (t) {
|
|
180
179
|
case "HS256":
|
|
181
180
|
case "HS384":
|
|
182
181
|
case "HS512": {
|
|
183
|
-
if (!
|
|
184
|
-
throw
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
187
|
-
throw
|
|
182
|
+
if (!W(e.algorithm, "HMAC"))
|
|
183
|
+
throw k("HMAC");
|
|
184
|
+
const a = parseInt(t.slice(2), 10);
|
|
185
|
+
if (te(e.algorithm.hash) !== a)
|
|
186
|
+
throw k(`SHA-${a}`, "algorithm.hash");
|
|
188
187
|
break;
|
|
189
188
|
}
|
|
190
189
|
case "RS256":
|
|
191
190
|
case "RS384":
|
|
192
191
|
case "RS512": {
|
|
193
|
-
if (!
|
|
194
|
-
throw
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
197
|
-
throw
|
|
192
|
+
if (!W(e.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
193
|
+
throw k("RSASSA-PKCS1-v1_5");
|
|
194
|
+
const a = parseInt(t.slice(2), 10);
|
|
195
|
+
if (te(e.algorithm.hash) !== a)
|
|
196
|
+
throw k(`SHA-${a}`, "algorithm.hash");
|
|
198
197
|
break;
|
|
199
198
|
}
|
|
200
199
|
case "PS256":
|
|
201
200
|
case "PS384":
|
|
202
201
|
case "PS512": {
|
|
203
|
-
if (!
|
|
204
|
-
throw
|
|
205
|
-
const
|
|
206
|
-
if (
|
|
207
|
-
throw
|
|
202
|
+
if (!W(e.algorithm, "RSA-PSS"))
|
|
203
|
+
throw k("RSA-PSS");
|
|
204
|
+
const a = parseInt(t.slice(2), 10);
|
|
205
|
+
if (te(e.algorithm.hash) !== a)
|
|
206
|
+
throw k(`SHA-${a}`, "algorithm.hash");
|
|
208
207
|
break;
|
|
209
208
|
}
|
|
210
209
|
case "EdDSA": {
|
|
211
210
|
if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
|
|
212
|
-
throw
|
|
211
|
+
throw k("Ed25519 or Ed448");
|
|
213
212
|
break;
|
|
214
213
|
}
|
|
215
214
|
case "ES256":
|
|
216
215
|
case "ES384":
|
|
217
216
|
case "ES512": {
|
|
218
|
-
if (!
|
|
219
|
-
throw
|
|
220
|
-
const
|
|
221
|
-
if (e.algorithm.namedCurve !==
|
|
222
|
-
throw
|
|
217
|
+
if (!W(e.algorithm, "ECDSA"))
|
|
218
|
+
throw k("ECDSA");
|
|
219
|
+
const a = st(t);
|
|
220
|
+
if (e.algorithm.namedCurve !== a)
|
|
221
|
+
throw k(a, "algorithm.namedCurve");
|
|
223
222
|
break;
|
|
224
223
|
}
|
|
225
224
|
default:
|
|
226
225
|
throw new TypeError("CryptoKey does not support this operation");
|
|
227
226
|
}
|
|
228
|
-
|
|
227
|
+
ot(e, r);
|
|
229
228
|
}
|
|
230
|
-
function
|
|
231
|
-
var
|
|
229
|
+
function Ie(e, t, ...r) {
|
|
230
|
+
var a;
|
|
232
231
|
if (r.length > 2) {
|
|
233
232
|
const n = r.pop();
|
|
234
233
|
e += `one of type ${r.join(", ")}, or ${n}.`;
|
|
235
|
-
} else
|
|
236
|
-
|
|
237
|
-
return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (o = t.constructor) != null && o.name && (e += ` Received an instance of ${t.constructor.name}`), e;
|
|
234
|
+
} else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
|
|
235
|
+
return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (a = t.constructor) != null && a.name && (e += ` Received an instance of ${t.constructor.name}`), e;
|
|
238
236
|
}
|
|
239
|
-
const
|
|
240
|
-
function
|
|
241
|
-
return
|
|
237
|
+
const he = (e, ...t) => Ie("Key must be ", e, ...t);
|
|
238
|
+
function Ce(e, t, ...r) {
|
|
239
|
+
return Ie(`Key for the ${e} algorithm must be `, t, ...r);
|
|
242
240
|
}
|
|
243
|
-
const
|
|
241
|
+
const Pe = (e) => be(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", G = ["CryptoKey"], ct = (...e) => {
|
|
244
242
|
const t = e.filter(Boolean);
|
|
245
243
|
if (t.length === 0 || t.length === 1)
|
|
246
244
|
return !0;
|
|
247
245
|
let r;
|
|
248
|
-
for (const
|
|
249
|
-
const n = Object.keys(
|
|
246
|
+
for (const a of t) {
|
|
247
|
+
const n = Object.keys(a);
|
|
250
248
|
if (!r || r.size === 0) {
|
|
251
249
|
r = new Set(n);
|
|
252
250
|
continue;
|
|
@@ -259,11 +257,11 @@ const Qe = (e) => Be(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) ===
|
|
|
259
257
|
}
|
|
260
258
|
return !0;
|
|
261
259
|
};
|
|
262
|
-
function
|
|
260
|
+
function ut(e) {
|
|
263
261
|
return typeof e == "object" && e !== null;
|
|
264
262
|
}
|
|
265
|
-
function
|
|
266
|
-
if (!
|
|
263
|
+
function ie(e) {
|
|
264
|
+
if (!ut(e) || Object.prototype.toString.call(e) !== "[object Object]")
|
|
267
265
|
return !1;
|
|
268
266
|
if (Object.getPrototypeOf(e) === null)
|
|
269
267
|
return !0;
|
|
@@ -272,14 +270,14 @@ function be(e) {
|
|
|
272
270
|
t = Object.getPrototypeOf(t);
|
|
273
271
|
return Object.getPrototypeOf(e) === t;
|
|
274
272
|
}
|
|
275
|
-
const
|
|
273
|
+
const dt = (e, t) => {
|
|
276
274
|
if (e.startsWith("RS") || e.startsWith("PS")) {
|
|
277
275
|
const { modulusLength: r } = t.algorithm;
|
|
278
276
|
if (typeof r != "number" || r < 2048)
|
|
279
277
|
throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
|
|
280
278
|
}
|
|
281
279
|
};
|
|
282
|
-
function
|
|
280
|
+
function lt(e) {
|
|
283
281
|
let t, r;
|
|
284
282
|
switch (e.kty) {
|
|
285
283
|
case "RSA": {
|
|
@@ -304,7 +302,7 @@ function xt(e) {
|
|
|
304
302
|
}, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
305
303
|
break;
|
|
306
304
|
default:
|
|
307
|
-
throw new
|
|
305
|
+
throw new b('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
308
306
|
}
|
|
309
307
|
break;
|
|
310
308
|
}
|
|
@@ -326,7 +324,7 @@ function xt(e) {
|
|
|
326
324
|
t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
|
|
327
325
|
break;
|
|
328
326
|
default:
|
|
329
|
-
throw new
|
|
327
|
+
throw new b('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
330
328
|
}
|
|
331
329
|
break;
|
|
332
330
|
}
|
|
@@ -342,83 +340,83 @@ function xt(e) {
|
|
|
342
340
|
t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
|
|
343
341
|
break;
|
|
344
342
|
default:
|
|
345
|
-
throw new
|
|
343
|
+
throw new b('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
346
344
|
}
|
|
347
345
|
break;
|
|
348
346
|
}
|
|
349
347
|
default:
|
|
350
|
-
throw new
|
|
348
|
+
throw new b('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
351
349
|
}
|
|
352
350
|
return { algorithm: t, keyUsages: r };
|
|
353
351
|
}
|
|
354
|
-
const
|
|
352
|
+
const ht = async (e) => {
|
|
355
353
|
if (!e.alg)
|
|
356
354
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
357
|
-
const { algorithm: t, keyUsages: r } =
|
|
355
|
+
const { algorithm: t, keyUsages: r } = lt(e), a = [
|
|
358
356
|
t,
|
|
359
357
|
e.ext ?? !1,
|
|
360
358
|
e.key_ops ?? r
|
|
361
359
|
], n = { ...e };
|
|
362
|
-
return delete n.alg, delete n.use,
|
|
363
|
-
},
|
|
364
|
-
let
|
|
365
|
-
const
|
|
360
|
+
return delete n.alg, delete n.use, X.subtle.importKey("jwk", n, ...a);
|
|
361
|
+
}, Oe = (e) => B(e);
|
|
362
|
+
let re, ae;
|
|
363
|
+
const De = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", Ue = async (e, t, r, a) => {
|
|
366
364
|
let n = e.get(t);
|
|
367
|
-
if (n != null && n[
|
|
368
|
-
return n[
|
|
369
|
-
const s = await
|
|
370
|
-
return n ? n[
|
|
371
|
-
},
|
|
372
|
-
if (
|
|
365
|
+
if (n != null && n[a])
|
|
366
|
+
return n[a];
|
|
367
|
+
const s = await ht({ ...r, alg: a });
|
|
368
|
+
return n ? n[a] = s : e.set(t, { [a]: s }), s;
|
|
369
|
+
}, ft = (e, t) => {
|
|
370
|
+
if (De(e)) {
|
|
373
371
|
let r = e.export({ format: "jwk" });
|
|
374
|
-
return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ?
|
|
372
|
+
return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Oe(r.k) : (ae || (ae = /* @__PURE__ */ new WeakMap()), Ue(ae, e, r, t));
|
|
375
373
|
}
|
|
376
374
|
return e;
|
|
377
|
-
},
|
|
378
|
-
if (
|
|
375
|
+
}, pt = (e, t) => {
|
|
376
|
+
if (De(e)) {
|
|
379
377
|
let r = e.export({ format: "jwk" });
|
|
380
|
-
return r.k ?
|
|
378
|
+
return r.k ? Oe(r.k) : (re || (re = /* @__PURE__ */ new WeakMap()), Ue(re, e, r, t));
|
|
381
379
|
}
|
|
382
380
|
return e;
|
|
383
|
-
},
|
|
381
|
+
}, yt = { normalizePublicKey: ft, normalizePrivateKey: pt }, v = (e, t, r = 0) => {
|
|
384
382
|
r === 0 && (t.unshift(t.length), t.unshift(6));
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
383
|
+
const a = e.indexOf(t[0], r);
|
|
384
|
+
if (a === -1)
|
|
387
385
|
return !1;
|
|
388
|
-
const n = e.subarray(
|
|
389
|
-
return n.length !== t.length ? !1 : n.every((s,
|
|
390
|
-
},
|
|
386
|
+
const n = e.subarray(a, a + t.length);
|
|
387
|
+
return n.length !== t.length ? !1 : n.every((s, o) => s === t[o]) || v(e, t, a + 1);
|
|
388
|
+
}, fe = (e) => {
|
|
391
389
|
switch (!0) {
|
|
392
|
-
case
|
|
390
|
+
case v(e, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
393
391
|
return "P-256";
|
|
394
|
-
case
|
|
392
|
+
case v(e, [43, 129, 4, 0, 34]):
|
|
395
393
|
return "P-384";
|
|
396
|
-
case
|
|
394
|
+
case v(e, [43, 129, 4, 0, 35]):
|
|
397
395
|
return "P-521";
|
|
398
|
-
case
|
|
396
|
+
case v(e, [43, 101, 110]):
|
|
399
397
|
return "X25519";
|
|
400
|
-
case
|
|
398
|
+
case v(e, [43, 101, 111]):
|
|
401
399
|
return "X448";
|
|
402
|
-
case
|
|
400
|
+
case v(e, [43, 101, 112]):
|
|
403
401
|
return "Ed25519";
|
|
404
|
-
case
|
|
402
|
+
case v(e, [43, 101, 113]):
|
|
405
403
|
return "Ed448";
|
|
406
404
|
default:
|
|
407
|
-
throw new
|
|
405
|
+
throw new b("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
|
|
408
406
|
}
|
|
409
|
-
},
|
|
410
|
-
let s,
|
|
411
|
-
const
|
|
412
|
-
switch (
|
|
407
|
+
}, wt = async (e, t, r, a, n) => {
|
|
408
|
+
let s, o;
|
|
409
|
+
const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
|
|
410
|
+
switch (a) {
|
|
413
411
|
case "PS256":
|
|
414
412
|
case "PS384":
|
|
415
413
|
case "PS512":
|
|
416
|
-
s = { name: "RSA-PSS", hash: `SHA-${
|
|
414
|
+
s = { name: "RSA-PSS", hash: `SHA-${a.slice(-3)}` }, o = ["verify"];
|
|
417
415
|
break;
|
|
418
416
|
case "RS256":
|
|
419
417
|
case "RS384":
|
|
420
418
|
case "RS512":
|
|
421
|
-
s = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${
|
|
419
|
+
s = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${a.slice(-3)}` }, o = ["verify"];
|
|
422
420
|
break;
|
|
423
421
|
case "RSA-OAEP":
|
|
424
422
|
case "RSA-OAEP-256":
|
|
@@ -426,84 +424,84 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
|
|
|
426
424
|
case "RSA-OAEP-512":
|
|
427
425
|
s = {
|
|
428
426
|
name: "RSA-OAEP",
|
|
429
|
-
hash: `SHA-${parseInt(
|
|
430
|
-
},
|
|
427
|
+
hash: `SHA-${parseInt(a.slice(-3), 10) || 1}`
|
|
428
|
+
}, o = ["encrypt", "wrapKey"];
|
|
431
429
|
break;
|
|
432
430
|
case "ES256":
|
|
433
|
-
s = { name: "ECDSA", namedCurve: "P-256" },
|
|
431
|
+
s = { name: "ECDSA", namedCurve: "P-256" }, o = ["verify"];
|
|
434
432
|
break;
|
|
435
433
|
case "ES384":
|
|
436
|
-
s = { name: "ECDSA", namedCurve: "P-384" },
|
|
434
|
+
s = { name: "ECDSA", namedCurve: "P-384" }, o = ["verify"];
|
|
437
435
|
break;
|
|
438
436
|
case "ES512":
|
|
439
|
-
s = { name: "ECDSA", namedCurve: "P-521" },
|
|
437
|
+
s = { name: "ECDSA", namedCurve: "P-521" }, o = ["verify"];
|
|
440
438
|
break;
|
|
441
439
|
case "ECDH-ES":
|
|
442
440
|
case "ECDH-ES+A128KW":
|
|
443
441
|
case "ECDH-ES+A192KW":
|
|
444
442
|
case "ECDH-ES+A256KW": {
|
|
445
|
-
const
|
|
446
|
-
s =
|
|
443
|
+
const c = fe(i);
|
|
444
|
+
s = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, o = [];
|
|
447
445
|
break;
|
|
448
446
|
}
|
|
449
447
|
case "EdDSA":
|
|
450
|
-
s = { name:
|
|
448
|
+
s = { name: fe(i) }, o = ["verify"];
|
|
451
449
|
break;
|
|
452
450
|
default:
|
|
453
|
-
throw new
|
|
451
|
+
throw new b('Invalid or unsupported "alg" (Algorithm) value');
|
|
454
452
|
}
|
|
455
|
-
return
|
|
456
|
-
},
|
|
457
|
-
async function
|
|
453
|
+
return X.subtle.importKey(t, i, s, !1, o);
|
|
454
|
+
}, mt = (e, t, r) => wt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
|
|
455
|
+
async function Et(e, t, r) {
|
|
458
456
|
if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
459
457
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
460
|
-
return
|
|
458
|
+
return mt(e, t);
|
|
461
459
|
}
|
|
462
|
-
const
|
|
460
|
+
const F = (e) => e == null ? void 0 : e[Symbol.toStringTag], St = (e, t) => {
|
|
463
461
|
if (!(t instanceof Uint8Array)) {
|
|
464
|
-
if (!
|
|
465
|
-
throw new TypeError(
|
|
462
|
+
if (!Pe(t))
|
|
463
|
+
throw new TypeError(Ce(e, t, ...G, "Uint8Array"));
|
|
466
464
|
if (t.type !== "secret")
|
|
467
|
-
throw new TypeError(`${
|
|
465
|
+
throw new TypeError(`${F(t)} instances for symmetric algorithms must be of type "secret"`);
|
|
468
466
|
}
|
|
469
|
-
},
|
|
470
|
-
if (!
|
|
471
|
-
throw new TypeError(
|
|
467
|
+
}, gt = (e, t, r) => {
|
|
468
|
+
if (!Pe(t))
|
|
469
|
+
throw new TypeError(Ce(e, t, ...G));
|
|
472
470
|
if (t.type === "secret")
|
|
473
|
-
throw new TypeError(`${
|
|
471
|
+
throw new TypeError(`${F(t)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
474
472
|
if (t.algorithm && r === "verify" && t.type === "private")
|
|
475
|
-
throw new TypeError(`${
|
|
473
|
+
throw new TypeError(`${F(t)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
476
474
|
if (t.algorithm && r === "encrypt" && t.type === "private")
|
|
477
|
-
throw new TypeError(`${
|
|
478
|
-
},
|
|
479
|
-
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ?
|
|
475
|
+
throw new TypeError(`${F(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
476
|
+
}, At = (e, t, r) => {
|
|
477
|
+
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? St(e, t) : gt(e, t, r);
|
|
480
478
|
};
|
|
481
|
-
function
|
|
482
|
-
if (n.crit !== void 0 && (
|
|
479
|
+
function Tt(e, t, r, a, n) {
|
|
480
|
+
if (n.crit !== void 0 && (a == null ? void 0 : a.crit) === void 0)
|
|
483
481
|
throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
484
|
-
if (!
|
|
482
|
+
if (!a || a.crit === void 0)
|
|
485
483
|
return /* @__PURE__ */ new Set();
|
|
486
|
-
if (!Array.isArray(
|
|
484
|
+
if (!Array.isArray(a.crit) || a.crit.length === 0 || a.crit.some((o) => typeof o != "string" || o.length === 0))
|
|
487
485
|
throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
488
486
|
let s;
|
|
489
487
|
r !== void 0 ? s = new Map([...Object.entries(r), ...t.entries()]) : s = t;
|
|
490
|
-
for (const
|
|
491
|
-
if (!s.has(
|
|
492
|
-
throw new
|
|
493
|
-
if (n[
|
|
494
|
-
throw new e(`Extension Header Parameter "${
|
|
495
|
-
if (s.get(
|
|
496
|
-
throw new e(`Extension Header Parameter "${
|
|
497
|
-
}
|
|
498
|
-
return new Set(
|
|
488
|
+
for (const o of a.crit) {
|
|
489
|
+
if (!s.has(o))
|
|
490
|
+
throw new b(`Extension Header Parameter "${o}" is not recognized`);
|
|
491
|
+
if (n[o] === void 0)
|
|
492
|
+
throw new e(`Extension Header Parameter "${o}" is missing`);
|
|
493
|
+
if (s.get(o) && a[o] === void 0)
|
|
494
|
+
throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`);
|
|
495
|
+
}
|
|
496
|
+
return new Set(a.crit);
|
|
499
497
|
}
|
|
500
|
-
const
|
|
498
|
+
const kt = (e, t) => {
|
|
501
499
|
if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
|
|
502
500
|
throw new TypeError(`"${e}" option must be an array of strings`);
|
|
503
501
|
if (t)
|
|
504
502
|
return new Set(t);
|
|
505
503
|
};
|
|
506
|
-
function
|
|
504
|
+
function _t(e, t) {
|
|
507
505
|
const r = `SHA-${e.slice(-3)}`;
|
|
508
506
|
switch (e) {
|
|
509
507
|
case "HS256":
|
|
@@ -525,109 +523,108 @@ function qt(e, t) {
|
|
|
525
523
|
case "EdDSA":
|
|
526
524
|
return { name: t.name };
|
|
527
525
|
default:
|
|
528
|
-
throw new
|
|
526
|
+
throw new b(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
529
527
|
}
|
|
530
528
|
}
|
|
531
|
-
async function
|
|
532
|
-
if (t = await
|
|
533
|
-
return
|
|
529
|
+
async function vt(e, t, r) {
|
|
530
|
+
if (t = await yt.normalizePublicKey(t, e), be(t))
|
|
531
|
+
return it(t, e, r), t;
|
|
534
532
|
if (t instanceof Uint8Array) {
|
|
535
533
|
if (!e.startsWith("HS"))
|
|
536
|
-
throw new TypeError(
|
|
537
|
-
return
|
|
534
|
+
throw new TypeError(he(t, ...G));
|
|
535
|
+
return X.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
|
|
538
536
|
}
|
|
539
|
-
throw new TypeError(
|
|
537
|
+
throw new TypeError(he(t, ...G, "Uint8Array"));
|
|
540
538
|
}
|
|
541
|
-
const
|
|
542
|
-
const n = await
|
|
543
|
-
|
|
544
|
-
const s =
|
|
539
|
+
const bt = async (e, t, r, a) => {
|
|
540
|
+
const n = await vt(e, t, "verify");
|
|
541
|
+
dt(e, n);
|
|
542
|
+
const s = _t(e, n.algorithm);
|
|
545
543
|
try {
|
|
546
|
-
return await
|
|
544
|
+
return await X.subtle.verify(s, n, r, a);
|
|
547
545
|
} catch {
|
|
548
546
|
return !1;
|
|
549
547
|
}
|
|
550
548
|
};
|
|
551
|
-
async function
|
|
552
|
-
if (!
|
|
553
|
-
throw new
|
|
549
|
+
async function Rt(e, t, r) {
|
|
550
|
+
if (!ie(e))
|
|
551
|
+
throw new f("Flattened JWS must be an object");
|
|
554
552
|
if (e.protected === void 0 && e.header === void 0)
|
|
555
|
-
throw new
|
|
553
|
+
throw new f('Flattened JWS must have either of the "protected" or "header" members');
|
|
556
554
|
if (e.protected !== void 0 && typeof e.protected != "string")
|
|
557
|
-
throw new
|
|
555
|
+
throw new f("JWS Protected Header incorrect type");
|
|
558
556
|
if (e.payload === void 0)
|
|
559
|
-
throw new
|
|
557
|
+
throw new f("JWS Payload missing");
|
|
560
558
|
if (typeof e.signature != "string")
|
|
561
|
-
throw new
|
|
562
|
-
if (e.header !== void 0 && !
|
|
563
|
-
throw new
|
|
564
|
-
let
|
|
559
|
+
throw new f("JWS Signature missing or incorrect type");
|
|
560
|
+
if (e.header !== void 0 && !ie(e.header))
|
|
561
|
+
throw new f("JWS Unprotected Header incorrect type");
|
|
562
|
+
let a = {};
|
|
565
563
|
if (e.protected)
|
|
566
564
|
try {
|
|
567
|
-
const S =
|
|
568
|
-
|
|
565
|
+
const S = B(e.protected);
|
|
566
|
+
a = JSON.parse(Q.decode(S));
|
|
569
567
|
} catch {
|
|
570
|
-
throw new
|
|
568
|
+
throw new f("JWS Protected Header is invalid");
|
|
571
569
|
}
|
|
572
|
-
if (
|
|
573
|
-
throw new
|
|
570
|
+
if (!ct(a, e.header))
|
|
571
|
+
throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
574
572
|
const n = {
|
|
575
|
-
...
|
|
573
|
+
...a,
|
|
576
574
|
...e.header
|
|
577
|
-
}, s =
|
|
578
|
-
let
|
|
579
|
-
if (s.has("b64") && (
|
|
580
|
-
throw new
|
|
581
|
-
const { alg:
|
|
582
|
-
if (typeof
|
|
583
|
-
throw new
|
|
584
|
-
const
|
|
585
|
-
if (
|
|
586
|
-
throw new
|
|
587
|
-
if (
|
|
575
|
+
}, s = Tt(f, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, a, n);
|
|
576
|
+
let o = !0;
|
|
577
|
+
if (s.has("b64") && (o = a.b64, typeof o != "boolean"))
|
|
578
|
+
throw new f('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
579
|
+
const { alg: i } = n;
|
|
580
|
+
if (typeof i != "string" || !i)
|
|
581
|
+
throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
582
|
+
const c = r && kt("algorithms", r.algorithms);
|
|
583
|
+
if (c && !c.has(i))
|
|
584
|
+
throw new at('"alg" (Algorithm) Header Parameter value not allowed');
|
|
585
|
+
if (o) {
|
|
588
586
|
if (typeof e.payload != "string")
|
|
589
|
-
throw new
|
|
587
|
+
throw new f("JWS Payload must be a string");
|
|
590
588
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
591
|
-
throw new
|
|
589
|
+
throw new f("JWS Payload must be a string or an Uint8Array instance");
|
|
592
590
|
let d = !1;
|
|
593
|
-
typeof t == "function" && (t = await t(
|
|
594
|
-
const p =
|
|
595
|
-
let
|
|
591
|
+
typeof t == "function" && (t = await t(a, e), d = !0), At(i, t, "verify");
|
|
592
|
+
const p = tt($.encode(e.protected ?? ""), $.encode("."), typeof e.payload == "string" ? $.encode(e.payload) : e.payload);
|
|
593
|
+
let y;
|
|
596
594
|
try {
|
|
597
|
-
|
|
595
|
+
y = B(e.signature);
|
|
598
596
|
} catch {
|
|
599
|
-
throw new
|
|
597
|
+
throw new f("Failed to base64url decode the signature");
|
|
600
598
|
}
|
|
601
|
-
if (!await
|
|
602
|
-
throw new
|
|
603
|
-
let
|
|
604
|
-
if (
|
|
599
|
+
if (!await bt(i, t, y, p))
|
|
600
|
+
throw new nt();
|
|
601
|
+
let E;
|
|
602
|
+
if (o)
|
|
605
603
|
try {
|
|
606
|
-
|
|
604
|
+
E = B(e.payload);
|
|
607
605
|
} catch {
|
|
608
|
-
throw new
|
|
606
|
+
throw new f("Failed to base64url decode the payload");
|
|
609
607
|
}
|
|
610
|
-
else
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
return e.protected !== void 0 && (E.protectedHeader = o), e.header !== void 0 && (E.unprotectedHeader = e.header), d ? { ...E, key: t } : E;
|
|
608
|
+
else typeof e.payload == "string" ? E = $.encode(e.payload) : E = e.payload;
|
|
609
|
+
const m = { payload: E };
|
|
610
|
+
return e.protected !== void 0 && (m.protectedHeader = a), e.header !== void 0 && (m.unprotectedHeader = e.header), d ? { ...m, key: t } : m;
|
|
614
611
|
}
|
|
615
|
-
async function
|
|
616
|
-
if (e instanceof Uint8Array && (e =
|
|
617
|
-
throw new
|
|
618
|
-
const { 0:
|
|
619
|
-
if (
|
|
620
|
-
throw new
|
|
621
|
-
const
|
|
622
|
-
return typeof t == "function" ? { ...
|
|
612
|
+
async function It(e, t, r) {
|
|
613
|
+
if (e instanceof Uint8Array && (e = Q.decode(e)), typeof e != "string")
|
|
614
|
+
throw new f("Compact JWS must be a string or Uint8Array");
|
|
615
|
+
const { 0: a, 1: n, 2: s, length: o } = e.split(".");
|
|
616
|
+
if (o !== 3)
|
|
617
|
+
throw new f("Invalid Compact JWS");
|
|
618
|
+
const i = await Rt({ payload: n, protected: a, signature: s }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
|
|
619
|
+
return typeof t == "function" ? { ...c, key: i.key } : c;
|
|
623
620
|
}
|
|
624
|
-
const
|
|
625
|
-
const t =
|
|
621
|
+
const Ct = (e) => Math.floor(e.getTime() / 1e3), He = 60, Ke = He * 60, ce = Ke * 24, Pt = ce * 7, Ot = ce * 365.25, Dt = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, pe = (e) => {
|
|
622
|
+
const t = Dt.exec(e);
|
|
626
623
|
if (!t || t[4] && t[1])
|
|
627
624
|
throw new TypeError("Invalid time period format");
|
|
628
|
-
const r = parseFloat(t[2]),
|
|
625
|
+
const r = parseFloat(t[2]), a = t[3].toLowerCase();
|
|
629
626
|
let n;
|
|
630
|
-
switch (
|
|
627
|
+
switch (a) {
|
|
631
628
|
case "sec":
|
|
632
629
|
case "secs":
|
|
633
630
|
case "second":
|
|
@@ -640,650 +637,259 @@ const tr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, ot = rt * 60, ke = ot
|
|
|
640
637
|
case "min":
|
|
641
638
|
case "mins":
|
|
642
639
|
case "m":
|
|
643
|
-
n = Math.round(r *
|
|
640
|
+
n = Math.round(r * He);
|
|
644
641
|
break;
|
|
645
642
|
case "hour":
|
|
646
643
|
case "hours":
|
|
647
644
|
case "hr":
|
|
648
645
|
case "hrs":
|
|
649
646
|
case "h":
|
|
650
|
-
n = Math.round(r *
|
|
647
|
+
n = Math.round(r * Ke);
|
|
651
648
|
break;
|
|
652
649
|
case "day":
|
|
653
650
|
case "days":
|
|
654
651
|
case "d":
|
|
655
|
-
n = Math.round(r *
|
|
652
|
+
n = Math.round(r * ce);
|
|
656
653
|
break;
|
|
657
654
|
case "week":
|
|
658
655
|
case "weeks":
|
|
659
656
|
case "w":
|
|
660
|
-
n = Math.round(r *
|
|
657
|
+
n = Math.round(r * Pt);
|
|
661
658
|
break;
|
|
662
659
|
default:
|
|
663
|
-
n = Math.round(r *
|
|
660
|
+
n = Math.round(r * Ot);
|
|
664
661
|
break;
|
|
665
662
|
}
|
|
666
663
|
return t[1] === "-" || t[4] === "ago" ? -n : n;
|
|
667
|
-
},
|
|
668
|
-
let
|
|
664
|
+
}, ye = (e) => e.toLowerCase().replace(/^application\//, ""), Ut = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Ht = (e, t, r = {}) => {
|
|
665
|
+
let a;
|
|
669
666
|
try {
|
|
670
|
-
|
|
667
|
+
a = JSON.parse(Q.decode(t));
|
|
671
668
|
} catch {
|
|
672
669
|
}
|
|
673
|
-
if (!
|
|
674
|
-
throw new
|
|
670
|
+
if (!ie(a))
|
|
671
|
+
throw new Re("JWT Claims Set must be a top-level JSON object");
|
|
675
672
|
const { typ: n } = r;
|
|
676
|
-
if (n && (typeof e.typ != "string" ||
|
|
677
|
-
throw new
|
|
678
|
-
const { requiredClaims: s = [], issuer:
|
|
679
|
-
d !== void 0 && p.push("iat"),
|
|
673
|
+
if (n && (typeof e.typ != "string" || ye(e.typ) !== ye(n)))
|
|
674
|
+
throw new A('unexpected "typ" JWT header value', a, "typ", "check_failed");
|
|
675
|
+
const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: d } = r, p = [...s];
|
|
676
|
+
d !== void 0 && p.push("iat"), c !== void 0 && p.push("aud"), i !== void 0 && p.push("sub"), o !== void 0 && p.push("iss");
|
|
680
677
|
for (const S of new Set(p.reverse()))
|
|
681
|
-
if (!(S in
|
|
682
|
-
throw new
|
|
683
|
-
if (
|
|
684
|
-
throw new
|
|
685
|
-
if (
|
|
686
|
-
throw new
|
|
687
|
-
if (
|
|
688
|
-
throw new
|
|
689
|
-
let
|
|
678
|
+
if (!(S in a))
|
|
679
|
+
throw new A(`missing required "${S}" claim`, a, S, "missing");
|
|
680
|
+
if (o && !(Array.isArray(o) ? o : [o]).includes(a.iss))
|
|
681
|
+
throw new A('unexpected "iss" claim value', a, "iss", "check_failed");
|
|
682
|
+
if (i && a.sub !== i)
|
|
683
|
+
throw new A('unexpected "sub" claim value', a, "sub", "check_failed");
|
|
684
|
+
if (c && !Ut(a.aud, typeof c == "string" ? [c] : c))
|
|
685
|
+
throw new A('unexpected "aud" claim value', a, "aud", "check_failed");
|
|
686
|
+
let y;
|
|
690
687
|
switch (typeof r.clockTolerance) {
|
|
691
688
|
case "string":
|
|
692
|
-
|
|
689
|
+
y = pe(r.clockTolerance);
|
|
693
690
|
break;
|
|
694
691
|
case "number":
|
|
695
|
-
|
|
692
|
+
y = r.clockTolerance;
|
|
696
693
|
break;
|
|
697
694
|
case "undefined":
|
|
698
|
-
|
|
695
|
+
y = 0;
|
|
699
696
|
break;
|
|
700
697
|
default:
|
|
701
698
|
throw new TypeError("Invalid clockTolerance option type");
|
|
702
699
|
}
|
|
703
|
-
const { currentDate:
|
|
704
|
-
if ((
|
|
705
|
-
throw new
|
|
706
|
-
if (
|
|
707
|
-
if (typeof
|
|
708
|
-
throw new
|
|
709
|
-
if (
|
|
710
|
-
throw new
|
|
711
|
-
}
|
|
712
|
-
if (
|
|
713
|
-
if (typeof
|
|
714
|
-
throw new
|
|
715
|
-
if (
|
|
716
|
-
throw new
|
|
700
|
+
const { currentDate: E } = r, m = Ct(E || /* @__PURE__ */ new Date());
|
|
701
|
+
if ((a.iat !== void 0 || d) && typeof a.iat != "number")
|
|
702
|
+
throw new A('"iat" claim must be a number', a, "iat", "invalid");
|
|
703
|
+
if (a.nbf !== void 0) {
|
|
704
|
+
if (typeof a.nbf != "number")
|
|
705
|
+
throw new A('"nbf" claim must be a number', a, "nbf", "invalid");
|
|
706
|
+
if (a.nbf > m + y)
|
|
707
|
+
throw new A('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
|
|
708
|
+
}
|
|
709
|
+
if (a.exp !== void 0) {
|
|
710
|
+
if (typeof a.exp != "number")
|
|
711
|
+
throw new A('"exp" claim must be a number', a, "exp", "invalid");
|
|
712
|
+
if (a.exp <= m - y)
|
|
713
|
+
throw new le('"exp" claim timestamp check failed', a, "exp", "check_failed");
|
|
717
714
|
}
|
|
718
715
|
if (d) {
|
|
719
|
-
const S =
|
|
720
|
-
if (S -
|
|
721
|
-
throw new
|
|
722
|
-
if (S < 0 -
|
|
723
|
-
throw new
|
|
716
|
+
const S = m - a.iat, ee = typeof d == "number" ? d : pe(d);
|
|
717
|
+
if (S - y > ee)
|
|
718
|
+
throw new le('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
|
|
719
|
+
if (S < 0 - y)
|
|
720
|
+
throw new A('"iat" claim timestamp check failed (it should be in the past)', a, "iat", "check_failed");
|
|
724
721
|
}
|
|
725
|
-
return
|
|
722
|
+
return a;
|
|
726
723
|
};
|
|
727
|
-
async function
|
|
728
|
-
var
|
|
729
|
-
const n = await
|
|
730
|
-
if ((
|
|
731
|
-
throw new
|
|
732
|
-
const s = { payload:
|
|
724
|
+
async function Kt(e, t, r) {
|
|
725
|
+
var a;
|
|
726
|
+
const n = await It(e, t, r);
|
|
727
|
+
if ((a = n.protectedHeader.crit) != null && a.includes("b64") && n.protectedHeader.b64 === !1)
|
|
728
|
+
throw new Re("JWTs MUST NOT use unencoded payload");
|
|
729
|
+
const s = { payload: Ht(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
|
|
733
730
|
return typeof t == "function" ? { ...s, key: n.key } : s;
|
|
734
731
|
}
|
|
735
|
-
const
|
|
732
|
+
const K = async (e) => {
|
|
736
733
|
try {
|
|
737
|
-
const t =
|
|
738
|
-
return await
|
|
739
|
-
issuer:
|
|
734
|
+
const t = w.ALG, r = await Et(et, t);
|
|
735
|
+
return await Kt(e, r, {
|
|
736
|
+
issuer: w.ISSUER
|
|
740
737
|
});
|
|
741
738
|
} catch {
|
|
742
739
|
return;
|
|
743
740
|
}
|
|
744
741
|
};
|
|
745
|
-
var
|
|
746
|
-
for (var
|
|
747
|
-
|
|
748
|
-
function
|
|
749
|
-
return (
|
|
742
|
+
var l = [];
|
|
743
|
+
for (var ne = 0; ne < 256; ++ne)
|
|
744
|
+
l.push((ne + 256).toString(16).slice(1));
|
|
745
|
+
function Nt(e, t = 0) {
|
|
746
|
+
return (l[e[t + 0]] + l[e[t + 1]] + l[e[t + 2]] + l[e[t + 3]] + "-" + l[e[t + 4]] + l[e[t + 5]] + "-" + l[e[t + 6]] + l[e[t + 7]] + "-" + l[e[t + 8]] + l[e[t + 9]] + "-" + l[e[t + 10]] + l[e[t + 11]] + l[e[t + 12]] + l[e[t + 13]] + l[e[t + 14]] + l[e[t + 15]]).toLowerCase();
|
|
750
747
|
}
|
|
751
|
-
var
|
|
752
|
-
function
|
|
753
|
-
if (!
|
|
748
|
+
var J, Lt = new Uint8Array(16);
|
|
749
|
+
function $t() {
|
|
750
|
+
if (!J && (J = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !J))
|
|
754
751
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
755
|
-
return
|
|
752
|
+
return J(Lt);
|
|
756
753
|
}
|
|
757
|
-
var
|
|
758
|
-
const
|
|
759
|
-
randomUUID:
|
|
754
|
+
var Wt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
755
|
+
const we = {
|
|
756
|
+
randomUUID: Wt
|
|
760
757
|
};
|
|
761
|
-
function
|
|
762
|
-
if (
|
|
763
|
-
return
|
|
758
|
+
function me(e, t, r) {
|
|
759
|
+
if (we.randomUUID && !t && !e)
|
|
760
|
+
return we.randomUUID();
|
|
764
761
|
e = e || {};
|
|
765
|
-
var
|
|
766
|
-
return
|
|
762
|
+
var a = e.random || (e.rng || $t)();
|
|
763
|
+
return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Nt(a);
|
|
767
764
|
}
|
|
768
|
-
const
|
|
765
|
+
const Ee = globalThis.crypto, Jt = (e) => `${me()}${me()}`.slice(0, e), xt = (e) => btoa(
|
|
769
766
|
[...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
|
|
770
767
|
);
|
|
771
|
-
async function
|
|
772
|
-
if (!
|
|
768
|
+
async function jt(e) {
|
|
769
|
+
if (!Ee.subtle)
|
|
773
770
|
throw new Error(
|
|
774
771
|
"crypto.subtle is available only in secure contexts (HTTPS)."
|
|
775
772
|
);
|
|
776
|
-
const t = new TextEncoder().encode(e), r = await
|
|
777
|
-
return
|
|
773
|
+
const t = new TextEncoder().encode(e), r = await Ee.subtle.digest("SHA-256", t);
|
|
774
|
+
return xt(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
778
775
|
}
|
|
779
|
-
async function
|
|
780
|
-
const r =
|
|
776
|
+
async function Mt(e) {
|
|
777
|
+
const r = Jt(43), a = await jt(r);
|
|
781
778
|
return {
|
|
782
779
|
code_verifier: r,
|
|
783
|
-
code_challenge:
|
|
780
|
+
code_challenge: a
|
|
784
781
|
};
|
|
785
782
|
}
|
|
786
|
-
function
|
|
783
|
+
function Ne(e, t) {
|
|
787
784
|
window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
|
|
788
785
|
}
|
|
789
|
-
const
|
|
786
|
+
const Se = (e, t) => {
|
|
790
787
|
const r = JSON.stringify(
|
|
791
788
|
typeof t == "function" ? t() : t
|
|
792
789
|
);
|
|
793
|
-
window.localStorage.setItem(e, r),
|
|
794
|
-
},
|
|
795
|
-
window.localStorage.removeItem(e),
|
|
796
|
-
},
|
|
797
|
-
function
|
|
790
|
+
window.localStorage.setItem(e, r), Ne(e, r);
|
|
791
|
+
}, Vt = (e) => {
|
|
792
|
+
window.localStorage.removeItem(e), Ne(e, null);
|
|
793
|
+
}, ge = (e) => window.localStorage.getItem(e), Yt = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
|
|
794
|
+
function x({
|
|
798
795
|
key: e,
|
|
799
796
|
initialValue: t
|
|
800
797
|
}) {
|
|
801
|
-
const r = () =>
|
|
802
|
-
|
|
803
|
-
r
|
|
804
|
-
), n = K.useCallback(
|
|
805
|
-
(c) => {
|
|
798
|
+
const r = Ge(Yt, () => ge(e)), a = H(
|
|
799
|
+
(o) => {
|
|
806
800
|
try {
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
} catch (
|
|
810
|
-
console.warn(
|
|
801
|
+
const i = typeof o == "function" ? o(JSON.parse(r)) : o;
|
|
802
|
+
i == null ? Vt(e) : Se(e, i);
|
|
803
|
+
} catch (i) {
|
|
804
|
+
console.warn(i);
|
|
811
805
|
}
|
|
812
806
|
},
|
|
813
|
-
[e,
|
|
814
|
-
),
|
|
815
|
-
|
|
816
|
-
}, [t,
|
|
817
|
-
|
|
818
|
-
}, [
|
|
819
|
-
return
|
|
820
|
-
try {
|
|
821
|
-
He(e) === null && typeof t < "u" && xe(e, t);
|
|
822
|
-
} catch (c) {
|
|
823
|
-
console.warn(c);
|
|
824
|
-
}
|
|
825
|
-
}, [e, t]), [o ? JSON.parse(o) : null, n, s, a];
|
|
826
|
-
}
|
|
827
|
-
/*!
|
|
828
|
-
* cookie
|
|
829
|
-
* Copyright(c) 2012-2014 Roman Shtylman
|
|
830
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
831
|
-
* MIT Licensed
|
|
832
|
-
*/
|
|
833
|
-
var at = wr, Me = gr, Sr = Object.prototype.toString, Z = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
834
|
-
function wr(e, t) {
|
|
835
|
-
if (typeof e != "string")
|
|
836
|
-
throw new TypeError("argument str must be a string");
|
|
837
|
-
for (var r = {}, o = t || {}, n = o.decode || Ar, s = 0; s < e.length; ) {
|
|
838
|
-
var a = e.indexOf("=", s);
|
|
839
|
-
if (a === -1)
|
|
840
|
-
break;
|
|
841
|
-
var c = e.indexOf(";", s);
|
|
842
|
-
if (c === -1)
|
|
843
|
-
c = e.length;
|
|
844
|
-
else if (c < a) {
|
|
845
|
-
s = e.lastIndexOf(";", a - 1) + 1;
|
|
846
|
-
continue;
|
|
847
|
-
}
|
|
848
|
-
var l = e.slice(s, a).trim();
|
|
849
|
-
if (r[l] === void 0) {
|
|
850
|
-
var d = e.slice(a + 1, c).trim();
|
|
851
|
-
d.charCodeAt(0) === 34 && (d = d.slice(1, -1)), r[l] = Tr(d, n);
|
|
852
|
-
}
|
|
853
|
-
s = c + 1;
|
|
854
|
-
}
|
|
855
|
-
return r;
|
|
856
|
-
}
|
|
857
|
-
function gr(e, t, r) {
|
|
858
|
-
var o = r || {}, n = o.encode || vr;
|
|
859
|
-
if (typeof n != "function")
|
|
860
|
-
throw new TypeError("option encode is invalid");
|
|
861
|
-
if (!Z.test(e))
|
|
862
|
-
throw new TypeError("argument name is invalid");
|
|
863
|
-
var s = n(t);
|
|
864
|
-
if (s && !Z.test(s))
|
|
865
|
-
throw new TypeError("argument val is invalid");
|
|
866
|
-
var a = e + "=" + s;
|
|
867
|
-
if (o.maxAge != null) {
|
|
868
|
-
var c = o.maxAge - 0;
|
|
869
|
-
if (isNaN(c) || !isFinite(c))
|
|
870
|
-
throw new TypeError("option maxAge is invalid");
|
|
871
|
-
a += "; Max-Age=" + Math.floor(c);
|
|
872
|
-
}
|
|
873
|
-
if (o.domain) {
|
|
874
|
-
if (!Z.test(o.domain))
|
|
875
|
-
throw new TypeError("option domain is invalid");
|
|
876
|
-
a += "; Domain=" + o.domain;
|
|
877
|
-
}
|
|
878
|
-
if (o.path) {
|
|
879
|
-
if (!Z.test(o.path))
|
|
880
|
-
throw new TypeError("option path is invalid");
|
|
881
|
-
a += "; Path=" + o.path;
|
|
882
|
-
}
|
|
883
|
-
if (o.expires) {
|
|
884
|
-
var l = o.expires;
|
|
885
|
-
if (!_r(l) || isNaN(l.valueOf()))
|
|
886
|
-
throw new TypeError("option expires is invalid");
|
|
887
|
-
a += "; Expires=" + l.toUTCString();
|
|
888
|
-
}
|
|
889
|
-
if (o.httpOnly && (a += "; HttpOnly"), o.secure && (a += "; Secure"), o.partitioned && (a += "; Partitioned"), o.priority) {
|
|
890
|
-
var d = typeof o.priority == "string" ? o.priority.toLowerCase() : o.priority;
|
|
891
|
-
switch (d) {
|
|
892
|
-
case "low":
|
|
893
|
-
a += "; Priority=Low";
|
|
894
|
-
break;
|
|
895
|
-
case "medium":
|
|
896
|
-
a += "; Priority=Medium";
|
|
897
|
-
break;
|
|
898
|
-
case "high":
|
|
899
|
-
a += "; Priority=High";
|
|
900
|
-
break;
|
|
901
|
-
default:
|
|
902
|
-
throw new TypeError("option priority is invalid");
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
if (o.sameSite) {
|
|
906
|
-
var p = typeof o.sameSite == "string" ? o.sameSite.toLowerCase() : o.sameSite;
|
|
907
|
-
switch (p) {
|
|
908
|
-
case !0:
|
|
909
|
-
a += "; SameSite=Strict";
|
|
910
|
-
break;
|
|
911
|
-
case "lax":
|
|
912
|
-
a += "; SameSite=Lax";
|
|
913
|
-
break;
|
|
914
|
-
case "strict":
|
|
915
|
-
a += "; SameSite=Strict";
|
|
916
|
-
break;
|
|
917
|
-
case "none":
|
|
918
|
-
a += "; SameSite=None";
|
|
919
|
-
break;
|
|
920
|
-
default:
|
|
921
|
-
throw new TypeError("option sameSite is invalid");
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
return a;
|
|
925
|
-
}
|
|
926
|
-
function Ar(e) {
|
|
927
|
-
return e.indexOf("%") !== -1 ? decodeURIComponent(e) : e;
|
|
928
|
-
}
|
|
929
|
-
function vr(e) {
|
|
930
|
-
return encodeURIComponent(e);
|
|
931
|
-
}
|
|
932
|
-
function _r(e) {
|
|
933
|
-
return Sr.call(e) === "[object Date]" || e instanceof Date;
|
|
934
|
-
}
|
|
935
|
-
function Tr(e, t) {
|
|
936
|
-
try {
|
|
937
|
-
return t(e);
|
|
938
|
-
} catch {
|
|
939
|
-
return e;
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
function br() {
|
|
943
|
-
const e = typeof global > "u" ? void 0 : global.TEST_HAS_DOCUMENT_COOKIE;
|
|
944
|
-
return typeof e == "boolean" ? e : typeof document == "object" && typeof document.cookie == "string";
|
|
945
|
-
}
|
|
946
|
-
function kr(e) {
|
|
947
|
-
return typeof e == "string" ? at(e) : typeof e == "object" && e !== null ? e : {};
|
|
948
|
-
}
|
|
949
|
-
function ve(e, t = {}) {
|
|
950
|
-
const r = Cr(e);
|
|
951
|
-
if (!t.doNotParse)
|
|
807
|
+
[e, r]
|
|
808
|
+
), n = H(() => {
|
|
809
|
+
a(t);
|
|
810
|
+
}, [t, a]), s = H(() => {
|
|
811
|
+
a(null);
|
|
812
|
+
}, [a]);
|
|
813
|
+
return ve(() => {
|
|
952
814
|
try {
|
|
953
|
-
|
|
954
|
-
} catch {
|
|
955
|
-
|
|
956
|
-
return e;
|
|
957
|
-
}
|
|
958
|
-
function Cr(e) {
|
|
959
|
-
return e && e[0] === "j" && e[1] === ":" ? e.substr(2) : e;
|
|
960
|
-
}
|
|
961
|
-
class Rr {
|
|
962
|
-
constructor(t, r = {}) {
|
|
963
|
-
this.changeListeners = [], this.HAS_DOCUMENT_COOKIE = !1, this.update = () => {
|
|
964
|
-
if (!this.HAS_DOCUMENT_COOKIE)
|
|
965
|
-
return;
|
|
966
|
-
const n = this.cookies;
|
|
967
|
-
this.cookies = at(document.cookie), this._checkChanges(n);
|
|
968
|
-
};
|
|
969
|
-
const o = typeof document > "u" ? "" : document.cookie;
|
|
970
|
-
this.cookies = kr(t || o), this.defaultSetOptions = r, this.HAS_DOCUMENT_COOKIE = br();
|
|
971
|
-
}
|
|
972
|
-
_emitChange(t) {
|
|
973
|
-
for (let r = 0; r < this.changeListeners.length; ++r)
|
|
974
|
-
this.changeListeners[r](t);
|
|
975
|
-
}
|
|
976
|
-
_checkChanges(t) {
|
|
977
|
-
new Set(Object.keys(t).concat(Object.keys(this.cookies))).forEach((o) => {
|
|
978
|
-
t[o] !== this.cookies[o] && this._emitChange({
|
|
979
|
-
name: o,
|
|
980
|
-
value: ve(this.cookies[o])
|
|
981
|
-
});
|
|
982
|
-
});
|
|
983
|
-
}
|
|
984
|
-
_startPolling() {
|
|
985
|
-
this.pollingInterval = setInterval(this.update, 300);
|
|
986
|
-
}
|
|
987
|
-
_stopPolling() {
|
|
988
|
-
this.pollingInterval && clearInterval(this.pollingInterval);
|
|
989
|
-
}
|
|
990
|
-
get(t, r = {}) {
|
|
991
|
-
return r.doNotUpdate || this.update(), ve(this.cookies[t], r);
|
|
992
|
-
}
|
|
993
|
-
getAll(t = {}) {
|
|
994
|
-
t.doNotUpdate || this.update();
|
|
995
|
-
const r = {};
|
|
996
|
-
for (let o in this.cookies)
|
|
997
|
-
r[o] = ve(this.cookies[o], t);
|
|
998
|
-
return r;
|
|
999
|
-
}
|
|
1000
|
-
set(t, r, o) {
|
|
1001
|
-
o ? o = Object.assign(Object.assign({}, this.defaultSetOptions), o) : o = this.defaultSetOptions;
|
|
1002
|
-
const n = typeof r == "string" ? r : JSON.stringify(r);
|
|
1003
|
-
this.cookies = Object.assign(Object.assign({}, this.cookies), { [t]: n }), this.HAS_DOCUMENT_COOKIE && (document.cookie = Me(t, n, o)), this._emitChange({ name: t, value: r, options: o });
|
|
1004
|
-
}
|
|
1005
|
-
remove(t, r) {
|
|
1006
|
-
const o = r = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), r), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 });
|
|
1007
|
-
this.cookies = Object.assign({}, this.cookies), delete this.cookies[t], this.HAS_DOCUMENT_COOKIE && (document.cookie = Me(t, "", o)), this._emitChange({ name: t, value: void 0, options: r });
|
|
1008
|
-
}
|
|
1009
|
-
addChangeListener(t) {
|
|
1010
|
-
this.changeListeners.push(t), this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1 && (typeof window == "object" && "cookieStore" in window ? window.cookieStore.addEventListener("change", this.update) : this._startPolling());
|
|
1011
|
-
}
|
|
1012
|
-
removeChangeListener(t) {
|
|
1013
|
-
const r = this.changeListeners.indexOf(t);
|
|
1014
|
-
r >= 0 && this.changeListeners.splice(r, 1), this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0 && (typeof window == "object" && "cookieStore" in window ? window.cookieStore.removeEventListener("change", this.update) : this._stopPolling());
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
const Or = K.createContext(new Rr());
|
|
1018
|
-
var f = {};
|
|
1019
|
-
/** @license React v16.13.1
|
|
1020
|
-
* react-is.production.min.js
|
|
1021
|
-
*
|
|
1022
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1023
|
-
*
|
|
1024
|
-
* This source code is licensed under the MIT license found in the
|
|
1025
|
-
* LICENSE file in the root directory of this source tree.
|
|
1026
|
-
*/
|
|
1027
|
-
var Ke;
|
|
1028
|
-
function Pr() {
|
|
1029
|
-
if (Ke)
|
|
1030
|
-
return f;
|
|
1031
|
-
Ke = 1;
|
|
1032
|
-
var e = typeof Symbol == "function" && Symbol.for, t = e ? Symbol.for("react.element") : 60103, r = e ? Symbol.for("react.portal") : 60106, o = e ? Symbol.for("react.fragment") : 60107, n = e ? Symbol.for("react.strict_mode") : 60108, s = e ? Symbol.for("react.profiler") : 60114, a = e ? Symbol.for("react.provider") : 60109, c = e ? Symbol.for("react.context") : 60110, l = e ? Symbol.for("react.async_mode") : 60111, d = e ? Symbol.for("react.concurrent_mode") : 60111, p = e ? Symbol.for("react.forward_ref") : 60112, m = e ? Symbol.for("react.suspense") : 60113, T = e ? Symbol.for("react.suspense_list") : 60120, E = e ? Symbol.for("react.memo") : 60115, S = e ? Symbol.for("react.lazy") : 60116, P = e ? Symbol.for("react.block") : 60121, j = e ? Symbol.for("react.fundamental") : 60117, W = e ? Symbol.for("react.responder") : 60118, M = e ? Symbol.for("react.scope") : 60119;
|
|
1033
|
-
function g(i) {
|
|
1034
|
-
if (typeof i == "object" && i !== null) {
|
|
1035
|
-
var C = i.$$typeof;
|
|
1036
|
-
switch (C) {
|
|
1037
|
-
case t:
|
|
1038
|
-
switch (i = i.type, i) {
|
|
1039
|
-
case l:
|
|
1040
|
-
case d:
|
|
1041
|
-
case o:
|
|
1042
|
-
case s:
|
|
1043
|
-
case n:
|
|
1044
|
-
case m:
|
|
1045
|
-
return i;
|
|
1046
|
-
default:
|
|
1047
|
-
switch (i = i && i.$$typeof, i) {
|
|
1048
|
-
case c:
|
|
1049
|
-
case p:
|
|
1050
|
-
case S:
|
|
1051
|
-
case E:
|
|
1052
|
-
case a:
|
|
1053
|
-
return i;
|
|
1054
|
-
default:
|
|
1055
|
-
return C;
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
case r:
|
|
1059
|
-
return C;
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
function w(i) {
|
|
1064
|
-
return g(i) === d;
|
|
1065
|
-
}
|
|
1066
|
-
return f.AsyncMode = l, f.ConcurrentMode = d, f.ContextConsumer = c, f.ContextProvider = a, f.Element = t, f.ForwardRef = p, f.Fragment = o, f.Lazy = S, f.Memo = E, f.Portal = r, f.Profiler = s, f.StrictMode = n, f.Suspense = m, f.isAsyncMode = function(i) {
|
|
1067
|
-
return w(i) || g(i) === l;
|
|
1068
|
-
}, f.isConcurrentMode = w, f.isContextConsumer = function(i) {
|
|
1069
|
-
return g(i) === c;
|
|
1070
|
-
}, f.isContextProvider = function(i) {
|
|
1071
|
-
return g(i) === a;
|
|
1072
|
-
}, f.isElement = function(i) {
|
|
1073
|
-
return typeof i == "object" && i !== null && i.$$typeof === t;
|
|
1074
|
-
}, f.isForwardRef = function(i) {
|
|
1075
|
-
return g(i) === p;
|
|
1076
|
-
}, f.isFragment = function(i) {
|
|
1077
|
-
return g(i) === o;
|
|
1078
|
-
}, f.isLazy = function(i) {
|
|
1079
|
-
return g(i) === S;
|
|
1080
|
-
}, f.isMemo = function(i) {
|
|
1081
|
-
return g(i) === E;
|
|
1082
|
-
}, f.isPortal = function(i) {
|
|
1083
|
-
return g(i) === r;
|
|
1084
|
-
}, f.isProfiler = function(i) {
|
|
1085
|
-
return g(i) === s;
|
|
1086
|
-
}, f.isStrictMode = function(i) {
|
|
1087
|
-
return g(i) === n;
|
|
1088
|
-
}, f.isSuspense = function(i) {
|
|
1089
|
-
return g(i) === m;
|
|
1090
|
-
}, f.isValidElementType = function(i) {
|
|
1091
|
-
return typeof i == "string" || typeof i == "function" || i === o || i === d || i === s || i === n || i === m || i === T || typeof i == "object" && i !== null && (i.$$typeof === S || i.$$typeof === E || i.$$typeof === a || i.$$typeof === c || i.$$typeof === p || i.$$typeof === j || i.$$typeof === W || i.$$typeof === M || i.$$typeof === P);
|
|
1092
|
-
}, f.typeOf = g, f;
|
|
1093
|
-
}
|
|
1094
|
-
var h = {};
|
|
1095
|
-
/** @license React v16.13.1
|
|
1096
|
-
* react-is.development.js
|
|
1097
|
-
*
|
|
1098
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1099
|
-
*
|
|
1100
|
-
* This source code is licensed under the MIT license found in the
|
|
1101
|
-
* LICENSE file in the root directory of this source tree.
|
|
1102
|
-
*/
|
|
1103
|
-
var je;
|
|
1104
|
-
function Ir() {
|
|
1105
|
-
return je || (je = 1, process.env.NODE_ENV !== "production" && function() {
|
|
1106
|
-
var e = typeof Symbol == "function" && Symbol.for, t = e ? Symbol.for("react.element") : 60103, r = e ? Symbol.for("react.portal") : 60106, o = e ? Symbol.for("react.fragment") : 60107, n = e ? Symbol.for("react.strict_mode") : 60108, s = e ? Symbol.for("react.profiler") : 60114, a = e ? Symbol.for("react.provider") : 60109, c = e ? Symbol.for("react.context") : 60110, l = e ? Symbol.for("react.async_mode") : 60111, d = e ? Symbol.for("react.concurrent_mode") : 60111, p = e ? Symbol.for("react.forward_ref") : 60112, m = e ? Symbol.for("react.suspense") : 60113, T = e ? Symbol.for("react.suspense_list") : 60120, E = e ? Symbol.for("react.memo") : 60115, S = e ? Symbol.for("react.lazy") : 60116, P = e ? Symbol.for("react.block") : 60121, j = e ? Symbol.for("react.fundamental") : 60117, W = e ? Symbol.for("react.responder") : 60118, M = e ? Symbol.for("react.scope") : 60119;
|
|
1107
|
-
function g(u) {
|
|
1108
|
-
return typeof u == "string" || typeof u == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1109
|
-
u === o || u === d || u === s || u === n || u === m || u === T || typeof u == "object" && u !== null && (u.$$typeof === S || u.$$typeof === E || u.$$typeof === a || u.$$typeof === c || u.$$typeof === p || u.$$typeof === j || u.$$typeof === W || u.$$typeof === M || u.$$typeof === P);
|
|
1110
|
-
}
|
|
1111
|
-
function w(u) {
|
|
1112
|
-
if (typeof u == "object" && u !== null) {
|
|
1113
|
-
var me = u.$$typeof;
|
|
1114
|
-
switch (me) {
|
|
1115
|
-
case t:
|
|
1116
|
-
var z = u.type;
|
|
1117
|
-
switch (z) {
|
|
1118
|
-
case l:
|
|
1119
|
-
case d:
|
|
1120
|
-
case o:
|
|
1121
|
-
case s:
|
|
1122
|
-
case n:
|
|
1123
|
-
case m:
|
|
1124
|
-
return z;
|
|
1125
|
-
default:
|
|
1126
|
-
var Ce = z && z.$$typeof;
|
|
1127
|
-
switch (Ce) {
|
|
1128
|
-
case c:
|
|
1129
|
-
case p:
|
|
1130
|
-
case S:
|
|
1131
|
-
case E:
|
|
1132
|
-
case a:
|
|
1133
|
-
return Ce;
|
|
1134
|
-
default:
|
|
1135
|
-
return me;
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
case r:
|
|
1139
|
-
return me;
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
var i = l, C = d, I = c, fe = a, he = t, pe = p, ye = o, y = S, R = E, b = r, D = s, U = n, J = m, F = !1;
|
|
1144
|
-
function V(u) {
|
|
1145
|
-
return F || (F = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), N(u) || w(u) === l;
|
|
1146
|
-
}
|
|
1147
|
-
function N(u) {
|
|
1148
|
-
return w(u) === d;
|
|
1149
|
-
}
|
|
1150
|
-
function it(u) {
|
|
1151
|
-
return w(u) === c;
|
|
1152
|
-
}
|
|
1153
|
-
function ct(u) {
|
|
1154
|
-
return w(u) === a;
|
|
815
|
+
ge(e) === null && typeof t < "u" && Se(e, t);
|
|
816
|
+
} catch (o) {
|
|
817
|
+
console.warn(o);
|
|
1155
818
|
}
|
|
1156
|
-
|
|
1157
|
-
return typeof u == "object" && u !== null && u.$$typeof === t;
|
|
1158
|
-
}
|
|
1159
|
-
function lt(u) {
|
|
1160
|
-
return w(u) === p;
|
|
1161
|
-
}
|
|
1162
|
-
function dt(u) {
|
|
1163
|
-
return w(u) === o;
|
|
1164
|
-
}
|
|
1165
|
-
function ft(u) {
|
|
1166
|
-
return w(u) === S;
|
|
1167
|
-
}
|
|
1168
|
-
function ht(u) {
|
|
1169
|
-
return w(u) === E;
|
|
1170
|
-
}
|
|
1171
|
-
function pt(u) {
|
|
1172
|
-
return w(u) === r;
|
|
1173
|
-
}
|
|
1174
|
-
function yt(u) {
|
|
1175
|
-
return w(u) === s;
|
|
1176
|
-
}
|
|
1177
|
-
function mt(u) {
|
|
1178
|
-
return w(u) === n;
|
|
1179
|
-
}
|
|
1180
|
-
function Et(u) {
|
|
1181
|
-
return w(u) === m;
|
|
1182
|
-
}
|
|
1183
|
-
h.AsyncMode = i, h.ConcurrentMode = C, h.ContextConsumer = I, h.ContextProvider = fe, h.Element = he, h.ForwardRef = pe, h.Fragment = ye, h.Lazy = y, h.Memo = R, h.Portal = b, h.Profiler = D, h.StrictMode = U, h.Suspense = J, h.isAsyncMode = V, h.isConcurrentMode = N, h.isContextConsumer = it, h.isContextProvider = ct, h.isElement = ut, h.isForwardRef = lt, h.isFragment = dt, h.isLazy = ft, h.isMemo = ht, h.isPortal = pt, h.isProfiler = yt, h.isStrictMode = mt, h.isSuspense = Et, h.isValidElementType = g, h.typeOf = w;
|
|
1184
|
-
}()), h;
|
|
1185
|
-
}
|
|
1186
|
-
process.env.NODE_ENV === "production" ? Pr() : Ir();
|
|
1187
|
-
function Dr() {
|
|
1188
|
-
return typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
|
|
1189
|
-
}
|
|
1190
|
-
function Nr(e) {
|
|
1191
|
-
const t = Ve(Or);
|
|
1192
|
-
if (!t)
|
|
1193
|
-
throw new Error("Missing <CookiesProvider>");
|
|
1194
|
-
const [r, o] = ze(() => t.getAll({ doNotUpdate: !0 }));
|
|
1195
|
-
Dr() && At(() => {
|
|
1196
|
-
function c() {
|
|
1197
|
-
const l = t.getAll({
|
|
1198
|
-
doNotUpdate: !0
|
|
1199
|
-
});
|
|
1200
|
-
$r(e || null, l, r) && o(l);
|
|
1201
|
-
}
|
|
1202
|
-
return t.addChangeListener(c), () => {
|
|
1203
|
-
t.removeChangeListener(c);
|
|
1204
|
-
};
|
|
1205
|
-
}, [t, r]);
|
|
1206
|
-
const n = Ee(() => t.set.bind(t), [t]), s = Ee(() => t.remove.bind(t), [t]), a = Ee(() => t.update.bind(t), [t]);
|
|
1207
|
-
return [r, n, s, a];
|
|
1208
|
-
}
|
|
1209
|
-
function $r(e, t, r) {
|
|
1210
|
-
if (!e)
|
|
1211
|
-
return !0;
|
|
1212
|
-
for (let o of e)
|
|
1213
|
-
if (t[o] !== r[o])
|
|
1214
|
-
return !0;
|
|
1215
|
-
return !1;
|
|
819
|
+
}, [e, t]), [r ? JSON.parse(r) : null, a, n, s];
|
|
1216
820
|
}
|
|
1217
|
-
var
|
|
1218
|
-
for (var
|
|
1219
|
-
|
|
1220
|
-
function
|
|
1221
|
-
return (
|
|
821
|
+
var h = [];
|
|
822
|
+
for (var se = 0; se < 256; ++se)
|
|
823
|
+
h.push((se + 256).toString(16).slice(1));
|
|
824
|
+
function Bt(e, t = 0) {
|
|
825
|
+
return (h[e[t + 0]] + h[e[t + 1]] + h[e[t + 2]] + h[e[t + 3]] + "-" + h[e[t + 4]] + h[e[t + 5]] + "-" + h[e[t + 6]] + h[e[t + 7]] + "-" + h[e[t + 8]] + h[e[t + 9]] + "-" + h[e[t + 10]] + h[e[t + 11]] + h[e[t + 12]] + h[e[t + 13]] + h[e[t + 14]] + h[e[t + 15]]).toLowerCase();
|
|
1222
826
|
}
|
|
1223
|
-
var
|
|
1224
|
-
function
|
|
1225
|
-
if (!
|
|
827
|
+
var j, Ft = new Uint8Array(16);
|
|
828
|
+
function Gt() {
|
|
829
|
+
if (!j && (j = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !j))
|
|
1226
830
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1227
|
-
return
|
|
831
|
+
return j(Ft);
|
|
1228
832
|
}
|
|
1229
|
-
var
|
|
1230
|
-
const
|
|
1231
|
-
randomUUID:
|
|
833
|
+
var qt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
834
|
+
const Ae = {
|
|
835
|
+
randomUUID: qt
|
|
1232
836
|
};
|
|
1233
|
-
function
|
|
1234
|
-
if (
|
|
1235
|
-
return
|
|
837
|
+
function zt(e, t, r) {
|
|
838
|
+
if (Ae.randomUUID && !t && !e)
|
|
839
|
+
return Ae.randomUUID();
|
|
1236
840
|
e = e || {};
|
|
1237
|
-
var
|
|
1238
|
-
return
|
|
841
|
+
var a = e.random || (e.rng || Gt)();
|
|
842
|
+
return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Bt(a);
|
|
1239
843
|
}
|
|
1240
|
-
const
|
|
844
|
+
const M = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Xt = "Your session has been successfully terminated.", Te = "Login failed. Please try again.", oe = "Error getting access token, please re-authenticate.", Qt = "You forgot to wrap your component in <AuthProvider>.", ke = {
|
|
1241
845
|
dev: "https://auth.gizmette.local.com:3003",
|
|
1242
846
|
prod: "https://mylogin.gizmette.com"
|
|
1243
|
-
},
|
|
847
|
+
}, V = "@@auth@@", Zt = process.env.NODE_ENV === "production", er = !Zt, Z = async ({
|
|
1244
848
|
type: e,
|
|
1245
849
|
clientId: t,
|
|
1246
850
|
params: r = {}
|
|
1247
851
|
}) => {
|
|
1248
852
|
try {
|
|
1249
|
-
const
|
|
1250
|
-
|
|
853
|
+
const a = await fetch(
|
|
854
|
+
er ? `${ke.dev}/${e}` : `${ke.prod}/${e}`,
|
|
1251
855
|
{
|
|
1252
856
|
credentials: "include",
|
|
1253
857
|
method: "POST",
|
|
1254
858
|
headers: {
|
|
1255
859
|
"Content-Type": "application/json",
|
|
1256
|
-
[
|
|
860
|
+
[Ze.CLIENT_ID]: `${t}`
|
|
1257
861
|
},
|
|
1258
862
|
body: JSON.stringify(r)
|
|
1259
863
|
}
|
|
1260
864
|
);
|
|
1261
|
-
if (
|
|
1262
|
-
return { status:
|
|
1263
|
-
const { data: n, errors: s } = await
|
|
865
|
+
if (a.status !== 200)
|
|
866
|
+
return { status: a.status, data: [] };
|
|
867
|
+
const { data: n, errors: s } = await a.json();
|
|
1264
868
|
return {
|
|
1265
|
-
status:
|
|
869
|
+
status: a.status,
|
|
1266
870
|
data: n,
|
|
1267
871
|
errors: s
|
|
1268
872
|
};
|
|
1269
|
-
} catch (
|
|
1270
|
-
return console.error(
|
|
873
|
+
} catch (a) {
|
|
874
|
+
return console.error(a), { status: 500, data: [] };
|
|
1271
875
|
}
|
|
1272
|
-
},
|
|
876
|
+
}, tr = async ({
|
|
1273
877
|
idToken: e,
|
|
1274
878
|
accessToken: t,
|
|
1275
879
|
refreshToken: r,
|
|
1276
|
-
clientId:
|
|
880
|
+
clientId: a,
|
|
881
|
+
domain: n
|
|
1277
882
|
}) => {
|
|
1278
883
|
try {
|
|
1279
884
|
return {
|
|
1280
|
-
status: (await
|
|
1281
|
-
type:
|
|
1282
|
-
clientId:
|
|
885
|
+
status: (await Z({
|
|
886
|
+
type: z.LOGOUT,
|
|
887
|
+
clientId: a,
|
|
1283
888
|
params: {
|
|
1284
889
|
idToken: e,
|
|
1285
890
|
accessToken: t,
|
|
1286
|
-
refreshToken: r
|
|
891
|
+
refreshToken: r,
|
|
892
|
+
domain: n
|
|
1287
893
|
}
|
|
1288
894
|
})).status === 200
|
|
1289
895
|
};
|
|
@@ -1292,35 +898,37 @@ const te = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1292
898
|
status: !1
|
|
1293
899
|
};
|
|
1294
900
|
}
|
|
1295
|
-
},
|
|
901
|
+
}, _e = async ({
|
|
1296
902
|
username: e,
|
|
1297
903
|
password: t,
|
|
1298
904
|
clientId: r,
|
|
1299
|
-
nonce:
|
|
905
|
+
nonce: a,
|
|
1300
906
|
type: n,
|
|
1301
907
|
sessionExpiration: s,
|
|
1302
|
-
code:
|
|
1303
|
-
code_verifier:
|
|
908
|
+
code: o,
|
|
909
|
+
code_verifier: i,
|
|
910
|
+
domain: c
|
|
1304
911
|
}) => {
|
|
1305
912
|
try {
|
|
1306
|
-
const
|
|
1307
|
-
type:
|
|
913
|
+
const d = await Z({
|
|
914
|
+
type: z.AUTHENTICATE,
|
|
1308
915
|
clientId: r,
|
|
1309
916
|
params: {
|
|
1310
|
-
type: n ||
|
|
917
|
+
type: n || q.ID_AND_ACCESS_TOKEN,
|
|
1311
918
|
username: e,
|
|
1312
919
|
password: t,
|
|
1313
920
|
sessionExpiration: s,
|
|
1314
|
-
nonce:
|
|
1315
|
-
code:
|
|
1316
|
-
code_verifier:
|
|
921
|
+
nonce: a,
|
|
922
|
+
code: o,
|
|
923
|
+
code_verifier: i,
|
|
924
|
+
domain: c
|
|
1317
925
|
}
|
|
1318
|
-
}),
|
|
1319
|
-
return
|
|
1320
|
-
idToken:
|
|
1321
|
-
accessToken:
|
|
1322
|
-
refreshToken:
|
|
1323
|
-
userId:
|
|
926
|
+
}), p = await K(d.data.idToken);
|
|
927
|
+
return p && p.payload[w.USER_ID_KEY] !== "" && p.payload[w.NONCE_KEY] === a ? {
|
|
928
|
+
idToken: d.data.idToken,
|
|
929
|
+
accessToken: d.data.accessToken,
|
|
930
|
+
refreshToken: d.data.refreshToken,
|
|
931
|
+
userId: p.payload[w.USER_ID_KEY],
|
|
1324
932
|
status: !0
|
|
1325
933
|
} : {
|
|
1326
934
|
status: !1
|
|
@@ -1330,24 +938,24 @@ const te = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1330
938
|
status: !1
|
|
1331
939
|
};
|
|
1332
940
|
}
|
|
1333
|
-
},
|
|
941
|
+
}, rr = async ({
|
|
1334
942
|
nonce: e,
|
|
1335
943
|
clientId: t,
|
|
1336
944
|
code_challenge: r
|
|
1337
945
|
}) => {
|
|
1338
946
|
try {
|
|
1339
|
-
const
|
|
1340
|
-
type:
|
|
947
|
+
const a = await Z({
|
|
948
|
+
type: z.CODE,
|
|
1341
949
|
clientId: t,
|
|
1342
950
|
params: {
|
|
1343
|
-
type:
|
|
951
|
+
type: q.CODE,
|
|
1344
952
|
nonce: e,
|
|
1345
953
|
code_challenge: r
|
|
1346
954
|
}
|
|
1347
955
|
});
|
|
1348
|
-
return
|
|
956
|
+
return a.data.code ? {
|
|
1349
957
|
status: !0,
|
|
1350
|
-
code:
|
|
958
|
+
code: a.data.code
|
|
1351
959
|
} : {
|
|
1352
960
|
status: !1
|
|
1353
961
|
};
|
|
@@ -1356,29 +964,31 @@ const te = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1356
964
|
status: !1
|
|
1357
965
|
};
|
|
1358
966
|
}
|
|
1359
|
-
},
|
|
967
|
+
}, ar = async ({
|
|
1360
968
|
clientId: e,
|
|
1361
969
|
userId: t,
|
|
1362
970
|
nonce: r,
|
|
1363
|
-
refreshToken:
|
|
1364
|
-
accessToken: n
|
|
971
|
+
refreshToken: a,
|
|
972
|
+
accessToken: n,
|
|
973
|
+
domain: s
|
|
1365
974
|
}) => {
|
|
1366
975
|
try {
|
|
1367
|
-
const
|
|
1368
|
-
type:
|
|
976
|
+
const o = await Z({
|
|
977
|
+
type: z.AUTHENTICATE,
|
|
1369
978
|
clientId: e,
|
|
1370
979
|
params: {
|
|
1371
|
-
type:
|
|
980
|
+
type: q.REFRESH_TOKEN,
|
|
1372
981
|
userId: t,
|
|
1373
982
|
nonce: r,
|
|
1374
|
-
refreshToken:
|
|
1375
|
-
accessToken: n
|
|
983
|
+
refreshToken: a,
|
|
984
|
+
accessToken: n,
|
|
985
|
+
domain: s
|
|
1376
986
|
}
|
|
1377
|
-
}),
|
|
1378
|
-
return
|
|
1379
|
-
accessToken:
|
|
1380
|
-
refreshToken:
|
|
1381
|
-
userId:
|
|
987
|
+
}), i = await K(o.data.accessToken);
|
|
988
|
+
return i && i.payload[w.USER_ID_KEY] !== "" && i.payload[w.NONCE_KEY] === r ? {
|
|
989
|
+
accessToken: o.data.accessToken,
|
|
990
|
+
refreshToken: o.data.refreshToken,
|
|
991
|
+
userId: i.payload[w.USER_ID_KEY],
|
|
1382
992
|
status: !0
|
|
1383
993
|
} : {
|
|
1384
994
|
status: !1
|
|
@@ -1389,22 +999,24 @@ const te = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1389
999
|
};
|
|
1390
1000
|
}
|
|
1391
1001
|
};
|
|
1392
|
-
class
|
|
1002
|
+
class nr {
|
|
1393
1003
|
constructor(t = null, r = null) {
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1004
|
+
L(this, "refreshTokenPromise", null);
|
|
1005
|
+
L(this, "accessToken");
|
|
1006
|
+
L(this, "refreshToken");
|
|
1397
1007
|
this.accessToken = t || "", this.refreshToken = r || "";
|
|
1398
1008
|
}
|
|
1399
1009
|
async refreshtoken({
|
|
1400
1010
|
clientId: t,
|
|
1401
1011
|
userId: r,
|
|
1402
|
-
nonce:
|
|
1012
|
+
nonce: a,
|
|
1013
|
+
domain: n
|
|
1403
1014
|
}) {
|
|
1404
1015
|
this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
|
|
1405
1016
|
clientId: t,
|
|
1406
1017
|
userId: r,
|
|
1407
|
-
nonce:
|
|
1018
|
+
nonce: a,
|
|
1019
|
+
domain: n
|
|
1408
1020
|
}));
|
|
1409
1021
|
try {
|
|
1410
1022
|
return await this.refreshTokenPromise;
|
|
@@ -1415,21 +1027,23 @@ class zr {
|
|
|
1415
1027
|
async _refreshToken({
|
|
1416
1028
|
clientId: t,
|
|
1417
1029
|
userId: r,
|
|
1418
|
-
nonce:
|
|
1030
|
+
nonce: a,
|
|
1031
|
+
domain: n
|
|
1419
1032
|
}) {
|
|
1420
|
-
const
|
|
1421
|
-
if (
|
|
1422
|
-
const
|
|
1033
|
+
const s = await K(this.refreshToken);
|
|
1034
|
+
if (s && s.payload[w.USER_ID_KEY] !== "") {
|
|
1035
|
+
const o = await ar({
|
|
1423
1036
|
clientId: t,
|
|
1424
1037
|
userId: r,
|
|
1425
|
-
nonce:
|
|
1038
|
+
nonce: a,
|
|
1426
1039
|
refreshToken: this.refreshToken,
|
|
1427
|
-
accessToken: this.accessToken
|
|
1040
|
+
accessToken: this.accessToken,
|
|
1041
|
+
domain: n
|
|
1428
1042
|
});
|
|
1429
|
-
return
|
|
1043
|
+
return o.status ? (this.accessToken = o.accessToken, this.refreshToken = o.refreshToken, {
|
|
1430
1044
|
status: "success",
|
|
1431
|
-
newAccessToken:
|
|
1432
|
-
newRefreshToken:
|
|
1045
|
+
newAccessToken: o.accessToken,
|
|
1046
|
+
newRefreshToken: o.refreshToken
|
|
1433
1047
|
}) : {
|
|
1434
1048
|
status: "failure"
|
|
1435
1049
|
};
|
|
@@ -1439,191 +1053,188 @@ class zr {
|
|
|
1439
1053
|
};
|
|
1440
1054
|
}
|
|
1441
1055
|
}
|
|
1442
|
-
const
|
|
1443
|
-
throw new Error(
|
|
1444
|
-
},
|
|
1056
|
+
const Y = () => {
|
|
1057
|
+
throw new Error(Qt);
|
|
1058
|
+
}, Le = qe({
|
|
1445
1059
|
isAuthenticated: !1,
|
|
1446
1060
|
isLoading: !1,
|
|
1447
|
-
login:
|
|
1448
|
-
logout:
|
|
1449
|
-
getAccessToken:
|
|
1450
|
-
getIdToken:
|
|
1061
|
+
login: Y,
|
|
1062
|
+
logout: Y,
|
|
1063
|
+
getAccessToken: Y,
|
|
1064
|
+
getIdToken: Y,
|
|
1451
1065
|
logoutReason: ""
|
|
1452
|
-
}),
|
|
1066
|
+
}), ur = ({
|
|
1453
1067
|
children: e,
|
|
1454
1068
|
sessionExpiration: t,
|
|
1455
1069
|
clientId: r,
|
|
1456
|
-
domain:
|
|
1070
|
+
domain: a = ""
|
|
1457
1071
|
}) => {
|
|
1458
|
-
const n =
|
|
1459
|
-
key: `${
|
|
1460
|
-
}), [
|
|
1461
|
-
key: `${
|
|
1462
|
-
}), [
|
|
1072
|
+
const n = ze(!1), [s, o, , i] = x({
|
|
1073
|
+
key: `${V}::${r}::@@user@@`
|
|
1074
|
+
}), [c, d, , p] = x({
|
|
1075
|
+
key: `${V}::${r}::@@access@@`
|
|
1076
|
+
}), [y, E, , m] = x(
|
|
1463
1077
|
{
|
|
1464
|
-
key: `${
|
|
1078
|
+
key: `${V}::${r}::@@refresh@@`
|
|
1465
1079
|
}
|
|
1466
|
-
), [
|
|
1467
|
-
key: `${
|
|
1468
|
-
}),
|
|
1080
|
+
), [S, ee, , ue] = x({
|
|
1081
|
+
key: `${V}::${r}::@@nonce@@`
|
|
1082
|
+
}), $e = new nr(c, y), [P, T] = Xe({
|
|
1469
1083
|
isLoading: !0,
|
|
1470
1084
|
isAuthenticated: !1,
|
|
1471
1085
|
user: void 0,
|
|
1472
1086
|
logoutReason: ""
|
|
1473
|
-
}),
|
|
1474
|
-
(
|
|
1475
|
-
console.warn(
|
|
1087
|
+
}), N = H(
|
|
1088
|
+
(u) => {
|
|
1089
|
+
console.warn(u), T({
|
|
1476
1090
|
isLoading: !0,
|
|
1477
1091
|
isAuthenticated: !1,
|
|
1478
1092
|
user: void 0,
|
|
1479
|
-
logoutReason:
|
|
1480
|
-
}),
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1093
|
+
logoutReason: u || M
|
|
1094
|
+
}), i(), p(), m(), ue();
|
|
1095
|
+
},
|
|
1096
|
+
[p, i, ue, m]
|
|
1097
|
+
), R = H(
|
|
1098
|
+
async (u) => {
|
|
1099
|
+
N(u || M), await tr({
|
|
1100
|
+
idToken: s,
|
|
1101
|
+
accessToken: c,
|
|
1102
|
+
refreshToken: y,
|
|
1103
|
+
clientId: r,
|
|
1104
|
+
domain: a
|
|
1105
|
+
}), T((_) => ({
|
|
1106
|
+
..._,
|
|
1107
|
+
isLoading: !1
|
|
1108
|
+
}));
|
|
1484
1109
|
},
|
|
1485
1110
|
[
|
|
1111
|
+
c,
|
|
1486
1112
|
r,
|
|
1487
|
-
o,
|
|
1488
|
-
T,
|
|
1489
1113
|
a,
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1114
|
+
s,
|
|
1115
|
+
y,
|
|
1116
|
+
N
|
|
1493
1117
|
]
|
|
1494
|
-
), I = Re(
|
|
1495
|
-
async (y) => {
|
|
1496
|
-
C(y || te), await Yr({
|
|
1497
|
-
idToken: c,
|
|
1498
|
-
accessToken: p,
|
|
1499
|
-
refreshToken: E,
|
|
1500
|
-
clientId: r
|
|
1501
|
-
}), i((R) => ({
|
|
1502
|
-
...R,
|
|
1503
|
-
isLoading: !1
|
|
1504
|
-
}));
|
|
1505
|
-
},
|
|
1506
|
-
[p, r, c, C, E]
|
|
1507
1118
|
);
|
|
1508
|
-
|
|
1119
|
+
ve(() => {
|
|
1509
1120
|
if (!n.current)
|
|
1510
|
-
return
|
|
1121
|
+
return P.isLoading && s !== null ? (async () => {
|
|
1511
1122
|
try {
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1123
|
+
const u = await K(s);
|
|
1124
|
+
u && u.payload[w.USER_ID_KEY] !== "" ? T({
|
|
1514
1125
|
isLoading: !1,
|
|
1515
1126
|
isAuthenticated: !0,
|
|
1516
1127
|
user: {
|
|
1517
|
-
userId:
|
|
1518
|
-
username:
|
|
1128
|
+
userId: u.payload[w.USER_ID_KEY],
|
|
1129
|
+
username: u.payload[w.USERNAME_KEY]
|
|
1519
1130
|
},
|
|
1520
1131
|
logoutReason: ""
|
|
1521
|
-
}) : await
|
|
1132
|
+
}) : await R(M);
|
|
1522
1133
|
} catch {
|
|
1523
|
-
await
|
|
1134
|
+
await R(M);
|
|
1524
1135
|
}
|
|
1525
|
-
})() :
|
|
1526
|
-
...
|
|
1136
|
+
})() : T((u) => ({
|
|
1137
|
+
...u,
|
|
1527
1138
|
isLoading: !1
|
|
1528
1139
|
})), () => {
|
|
1529
1140
|
n.current = !0;
|
|
1530
1141
|
};
|
|
1531
|
-
}, [
|
|
1532
|
-
const
|
|
1533
|
-
const
|
|
1534
|
-
if (
|
|
1535
|
-
...
|
|
1142
|
+
}, [P.isLoading, s, R]);
|
|
1143
|
+
const We = async (u, _, g) => {
|
|
1144
|
+
const I = zt();
|
|
1145
|
+
if (ee(I), T((D) => ({
|
|
1146
|
+
...D,
|
|
1536
1147
|
isLoading: !0
|
|
1537
|
-
})),
|
|
1538
|
-
const { code_verifier:
|
|
1539
|
-
nonce:
|
|
1148
|
+
})), i(), p(), m(), g === q.CODE) {
|
|
1149
|
+
const { code_verifier: D, code_challenge: Me } = await Mt(), de = await rr({
|
|
1150
|
+
nonce: I,
|
|
1540
1151
|
clientId: r,
|
|
1541
|
-
code_challenge:
|
|
1152
|
+
code_challenge: Me
|
|
1542
1153
|
});
|
|
1543
|
-
if (
|
|
1544
|
-
const
|
|
1545
|
-
username:
|
|
1546
|
-
password:
|
|
1154
|
+
if (de.status) {
|
|
1155
|
+
const U = await _e({
|
|
1156
|
+
username: u,
|
|
1157
|
+
password: _,
|
|
1547
1158
|
clientId: r,
|
|
1548
1159
|
sessionExpiration: t,
|
|
1549
|
-
nonce:
|
|
1550
|
-
type:
|
|
1551
|
-
code:
|
|
1552
|
-
code_verifier:
|
|
1160
|
+
nonce: I,
|
|
1161
|
+
type: g,
|
|
1162
|
+
code: de.code,
|
|
1163
|
+
code_verifier: D,
|
|
1164
|
+
domain: a
|
|
1553
1165
|
});
|
|
1554
|
-
return
|
|
1555
|
-
secure: !0,
|
|
1556
|
-
domain: o
|
|
1557
|
-
}), l(N.idToken), m(N.accessToken), S(N.refreshToken), i({
|
|
1166
|
+
return U.status ? (o(U.idToken), d(U.accessToken), E(U.refreshToken), T({
|
|
1558
1167
|
isLoading: !1,
|
|
1559
1168
|
isAuthenticated: !0,
|
|
1560
1169
|
user: {
|
|
1561
|
-
userId:
|
|
1562
|
-
username:
|
|
1170
|
+
userId: U.userId,
|
|
1171
|
+
username: u
|
|
1563
1172
|
},
|
|
1564
1173
|
logoutReason: ""
|
|
1565
|
-
}), !0) : (
|
|
1174
|
+
}), !0) : (N(Te), T((Ve) => ({
|
|
1175
|
+
...Ve,
|
|
1176
|
+
isLoading: !1
|
|
1177
|
+
})), !1);
|
|
1566
1178
|
}
|
|
1567
1179
|
return !1;
|
|
1568
1180
|
}
|
|
1569
|
-
const
|
|
1570
|
-
username:
|
|
1571
|
-
password:
|
|
1181
|
+
const O = await _e({
|
|
1182
|
+
username: u,
|
|
1183
|
+
password: _,
|
|
1572
1184
|
clientId: r,
|
|
1573
1185
|
sessionExpiration: t,
|
|
1574
|
-
nonce:
|
|
1575
|
-
type:
|
|
1186
|
+
nonce: I,
|
|
1187
|
+
type: g,
|
|
1188
|
+
domain: a
|
|
1576
1189
|
});
|
|
1577
|
-
return
|
|
1578
|
-
secure: !0,
|
|
1579
|
-
domain: o
|
|
1580
|
-
}), l(U.idToken), m(U.accessToken), S(U.refreshToken), i({
|
|
1190
|
+
return O.status ? (o(O.idToken), d(O.accessToken), E(O.refreshToken), T({
|
|
1581
1191
|
isLoading: !1,
|
|
1582
1192
|
isAuthenticated: !0,
|
|
1583
1193
|
user: {
|
|
1584
|
-
userId:
|
|
1585
|
-
username:
|
|
1194
|
+
userId: O.userId,
|
|
1195
|
+
username: u
|
|
1586
1196
|
}
|
|
1587
|
-
}), !0) : (
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1197
|
+
}), !0) : (N(Te), T((D) => ({
|
|
1198
|
+
...D,
|
|
1199
|
+
isLoading: !1
|
|
1200
|
+
})), !1);
|
|
1201
|
+
}, Je = async (u) => {
|
|
1202
|
+
u == null || u.preventDefault(), await R(Xt);
|
|
1203
|
+
}, xe = async () => {
|
|
1204
|
+
const { isAuthenticated: u, user: _ } = P;
|
|
1592
1205
|
try {
|
|
1593
|
-
if (
|
|
1594
|
-
if (
|
|
1595
|
-
const
|
|
1596
|
-
if (
|
|
1597
|
-
return
|
|
1206
|
+
if (u && _ && _.userId) {
|
|
1207
|
+
if (c) {
|
|
1208
|
+
const I = await K(c);
|
|
1209
|
+
if (I && I.payload[w.USER_ID_KEY] !== "")
|
|
1210
|
+
return c;
|
|
1598
1211
|
}
|
|
1599
|
-
const
|
|
1212
|
+
const g = await $e.refreshtoken({
|
|
1600
1213
|
clientId: r,
|
|
1601
|
-
userId:
|
|
1602
|
-
nonce:
|
|
1214
|
+
userId: _.userId,
|
|
1215
|
+
nonce: S,
|
|
1216
|
+
domain: a
|
|
1603
1217
|
});
|
|
1604
|
-
return
|
|
1605
|
-
secure: !0,
|
|
1606
|
-
domain: o
|
|
1607
|
-
}), m(b.newAccessToken), S(b.newRefreshToken), b.newAccessToken) : (await I(Te), "");
|
|
1218
|
+
return g.status && g.status === "success" ? (d(g.newAccessToken), E(g.newRefreshToken), g.newAccessToken) : (await R(oe), "");
|
|
1608
1219
|
}
|
|
1609
|
-
return await
|
|
1220
|
+
return await R(oe), "";
|
|
1610
1221
|
} catch {
|
|
1611
|
-
return await
|
|
1222
|
+
return await R(oe), "";
|
|
1612
1223
|
}
|
|
1613
|
-
},
|
|
1614
|
-
if (
|
|
1615
|
-
return
|
|
1224
|
+
}, je = () => {
|
|
1225
|
+
if (P.isAuthenticated && s)
|
|
1226
|
+
return s;
|
|
1616
1227
|
};
|
|
1617
|
-
return /* @__PURE__ */
|
|
1618
|
-
|
|
1228
|
+
return /* @__PURE__ */ Fe(
|
|
1229
|
+
Le.Provider,
|
|
1619
1230
|
{
|
|
1620
|
-
value: { ...
|
|
1231
|
+
value: { ...P, login: We, logout: Je, getAccessToken: xe, getIdToken: je },
|
|
1621
1232
|
children: e
|
|
1622
1233
|
}
|
|
1623
1234
|
);
|
|
1624
|
-
},
|
|
1235
|
+
}, dr = (e = Le) => Qe(e);
|
|
1625
1236
|
export {
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1237
|
+
q as AUTH_TYPES,
|
|
1238
|
+
ur as AuthProvider,
|
|
1239
|
+
dr as useAuth
|
|
1629
1240
|
};
|