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