@versini/auth-provider 5.1.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +535 -924
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import * as
|
|
6
|
-
import {
|
|
1
|
+
var Ve = Object.defineProperty;
|
|
2
|
+
var Ye = (e, t, r) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var N = (e, t, r) => (Ye(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import { jsx as Be } from "react/jsx-runtime";
|
|
5
|
+
import * as U from "react";
|
|
6
|
+
import { createContext as Fe, useRef as Ge, useState as qe, useCallback as le, useEffect as ze, useContext as Xe } from "react";
|
|
7
7
|
/*!
|
|
8
|
-
@versini/auth-provider v5.1.
|
|
8
|
+
@versini/auth-provider v5.1.1
|
|
9
9
|
© 2024 gizmette.com
|
|
10
10
|
*/
|
|
11
11
|
try {
|
|
12
12
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
13
|
-
version: "5.1.
|
|
14
|
-
buildTime: "07/07/2024 10:
|
|
13
|
+
version: "5.1.1",
|
|
14
|
+
buildTime: "07/07/2024 10:59 AM EDT",
|
|
15
15
|
homepage: "https://github.com/aversini/auth-client",
|
|
16
16
|
license: "MIT"
|
|
17
17
|
});
|
|
@@ -24,28 +24,28 @@ try {
|
|
|
24
24
|
try {
|
|
25
25
|
window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
|
|
26
26
|
version: "2.11.0",
|
|
27
|
-
buildTime: "07/07/2024 10:
|
|
27
|
+
buildTime: "07/07/2024 10:59 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 G = {
|
|
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
|
+
}, Qe = {
|
|
40
40
|
CLIENT_ID: "X-Auth-ClientId"
|
|
41
|
-
},
|
|
41
|
+
}, w = {
|
|
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
|
+
}, Ze = `-----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-----`, q = {
|
|
57
57
|
AUTHENTICATE: "authenticate",
|
|
58
58
|
CODE: "code",
|
|
59
59
|
LOGOUT: "logout"
|
|
60
|
-
},
|
|
61
|
-
function
|
|
60
|
+
}, z = crypto, ve = (e) => e instanceof CryptoKey, L = new TextEncoder(), X = new TextDecoder();
|
|
61
|
+
function et(...e) {
|
|
62
62
|
const t = e.reduce((n, { length: s }) => n + s, 0), r = new Uint8Array(t);
|
|
63
|
-
let
|
|
63
|
+
let a = 0;
|
|
64
64
|
for (const n of e)
|
|
65
|
-
r.set(n,
|
|
65
|
+
r.set(n, a), a += n.length;
|
|
66
66
|
return r;
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const tt = (e) => {
|
|
69
69
|
const t = atob(e), r = new Uint8Array(t.length);
|
|
70
|
-
for (let
|
|
71
|
-
r[
|
|
70
|
+
for (let a = 0; a < t.length; a++)
|
|
71
|
+
r[a] = t.charCodeAt(a);
|
|
72
72
|
return r;
|
|
73
|
-
},
|
|
73
|
+
}, Y = (e) => {
|
|
74
74
|
let t = e;
|
|
75
|
-
t instanceof Uint8Array && (t =
|
|
75
|
+
t instanceof Uint8Array && (t = X.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
76
76
|
try {
|
|
77
|
-
return
|
|
77
|
+
return tt(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 C extends Error {
|
|
83
83
|
static get code() {
|
|
84
84
|
return "ERR_JOSE_GENERIC";
|
|
85
85
|
}
|
|
@@ -88,23 +88,23 @@ class H 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 A extends C {
|
|
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, a = "unspecified", n = "unspecified") {
|
|
96
|
+
super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = a, this.reason = n, this.payload = r;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
class
|
|
99
|
+
class he extends C {
|
|
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, a = "unspecified", n = "unspecified") {
|
|
104
|
+
super(t), this.code = "ERR_JWT_EXPIRED", this.claim = a, this.reason = n, this.payload = r;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
class
|
|
107
|
+
class rt extends C {
|
|
108
108
|
constructor() {
|
|
109
109
|
super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
110
110
|
}
|
|
@@ -112,14 +112,14 @@ class Ot extends H {
|
|
|
112
112
|
return "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
let
|
|
115
|
+
let _ = class extends C {
|
|
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
|
+
}, f = class extends C {
|
|
123
123
|
constructor() {
|
|
124
124
|
super(...arguments), this.code = "ERR_JWS_INVALID";
|
|
125
125
|
}
|
|
@@ -127,7 +127,7 @@ let x = class extends H {
|
|
|
127
127
|
return "ERR_JWS_INVALID";
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
-
class
|
|
130
|
+
class Re extends C {
|
|
131
131
|
constructor() {
|
|
132
132
|
super(...arguments), this.code = "ERR_JWT_INVALID";
|
|
133
133
|
}
|
|
@@ -135,7 +135,7 @@ class Ge extends H {
|
|
|
135
135
|
return "ERR_JWT_INVALID";
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
class
|
|
138
|
+
class at 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 T(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 $(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 nt(e) {
|
|
156
156
|
switch (e) {
|
|
157
157
|
case "ES256":
|
|
158
158
|
return "P-256";
|
|
@@ -164,89 +164,89 @@ function It(e) {
|
|
|
164
164
|
throw new Error("unreachable");
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function st(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 a = t.pop();
|
|
172
|
+
r += `one of ${t.join(", ")}, or ${a}.`;
|
|
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 ot(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 (!$(e.algorithm, "HMAC"))
|
|
184
|
+
throw T("HMAC");
|
|
185
|
+
const a = parseInt(t.slice(2), 10);
|
|
186
|
+
if (te(e.algorithm.hash) !== a)
|
|
187
|
+
throw T(`SHA-${a}`, "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 (!$(e.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
194
|
+
throw T("RSASSA-PKCS1-v1_5");
|
|
195
|
+
const a = parseInt(t.slice(2), 10);
|
|
196
|
+
if (te(e.algorithm.hash) !== a)
|
|
197
|
+
throw T(`SHA-${a}`, "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 (!$(e.algorithm, "RSA-PSS"))
|
|
204
|
+
throw T("RSA-PSS");
|
|
205
|
+
const a = parseInt(t.slice(2), 10);
|
|
206
|
+
if (te(e.algorithm.hash) !== a)
|
|
207
|
+
throw T(`SHA-${a}`, "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 T("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 (!$(e.algorithm, "ECDSA"))
|
|
219
|
+
throw T("ECDSA");
|
|
220
|
+
const a = nt(t);
|
|
221
|
+
if (e.algorithm.namedCurve !== a)
|
|
222
|
+
throw T(a, "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
|
+
st(e, r);
|
|
229
229
|
}
|
|
230
|
-
function
|
|
231
|
-
var
|
|
230
|
+
function Ie(e, t, ...r) {
|
|
231
|
+
var a;
|
|
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 && (a = t.constructor) != null && a.name && (e += ` Received an instance of ${t.constructor.name}`), e;
|
|
238
238
|
}
|
|
239
|
-
const
|
|
240
|
-
function
|
|
241
|
-
return
|
|
239
|
+
const fe = (e, ...t) => Ie("Key must be ", e, ...t);
|
|
240
|
+
function Ce(e, t, ...r) {
|
|
241
|
+
return Ie(`Key for the ${e} algorithm must be `, t, ...r);
|
|
242
242
|
}
|
|
243
|
-
const
|
|
243
|
+
const Pe = (e) => ve(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", F = ["CryptoKey"], it = (...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 a of t) {
|
|
249
|
+
const n = Object.keys(a);
|
|
250
250
|
if (!r || r.size === 0) {
|
|
251
251
|
r = new Set(n);
|
|
252
252
|
continue;
|
|
@@ -259,11 +259,11 @@ const Qe = (e) => Be(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) ===
|
|
|
259
259
|
}
|
|
260
260
|
return !0;
|
|
261
261
|
};
|
|
262
|
-
function
|
|
262
|
+
function ct(e) {
|
|
263
263
|
return typeof e == "object" && e !== null;
|
|
264
264
|
}
|
|
265
|
-
function
|
|
266
|
-
if (!
|
|
265
|
+
function ie(e) {
|
|
266
|
+
if (!ct(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 be(e) {
|
|
|
272
272
|
t = Object.getPrototypeOf(t);
|
|
273
273
|
return Object.getPrototypeOf(e) === t;
|
|
274
274
|
}
|
|
275
|
-
const
|
|
275
|
+
const ut = (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 dt(e) {
|
|
283
283
|
let t, r;
|
|
284
284
|
switch (e.kty) {
|
|
285
285
|
case "RSA": {
|
|
@@ -304,7 +304,7 @@ function xt(e) {
|
|
|
304
304
|
}, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
305
305
|
break;
|
|
306
306
|
default:
|
|
307
|
-
throw new
|
|
307
|
+
throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
308
308
|
}
|
|
309
309
|
break;
|
|
310
310
|
}
|
|
@@ -326,7 +326,7 @@ function xt(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 _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
330
330
|
}
|
|
331
331
|
break;
|
|
332
332
|
}
|
|
@@ -342,83 +342,83 @@ function xt(e) {
|
|
|
342
342
|
t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
|
|
343
343
|
break;
|
|
344
344
|
default:
|
|
345
|
-
throw new
|
|
345
|
+
throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
346
346
|
}
|
|
347
347
|
break;
|
|
348
348
|
}
|
|
349
349
|
default:
|
|
350
|
-
throw new
|
|
350
|
+
throw new _('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
351
351
|
}
|
|
352
352
|
return { algorithm: t, keyUsages: r };
|
|
353
353
|
}
|
|
354
|
-
const
|
|
354
|
+
const lt = 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 } = dt(e), a = [
|
|
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, z.subtle.importKey("jwk", n, ...a);
|
|
363
|
+
}, Oe = (e) => Y(e);
|
|
364
|
+
let re, ae;
|
|
365
|
+
const De = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", Ue = async (e, t, r, a) => {
|
|
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[a])
|
|
368
|
+
return n[a];
|
|
369
|
+
const s = await lt({ ...r, alg: a });
|
|
370
|
+
return n ? n[a] = s : e.set(t, { [a]: s }), s;
|
|
371
|
+
}, ht = (e, t) => {
|
|
372
|
+
if (De(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 ? Oe(r.k) : (ae || (ae = /* @__PURE__ */ new WeakMap()), Ue(ae, e, r, t));
|
|
375
375
|
}
|
|
376
376
|
return e;
|
|
377
|
-
},
|
|
378
|
-
if (
|
|
377
|
+
}, ft = (e, t) => {
|
|
378
|
+
if (De(e)) {
|
|
379
379
|
let r = e.export({ format: "jwk" });
|
|
380
|
-
return r.k ?
|
|
380
|
+
return r.k ? Oe(r.k) : (re || (re = /* @__PURE__ */ new WeakMap()), Ue(re, e, r, t));
|
|
381
381
|
}
|
|
382
382
|
return e;
|
|
383
|
-
},
|
|
383
|
+
}, pt = { normalizePublicKey: ht, normalizePrivateKey: ft }, b = (e, t, r = 0) => {
|
|
384
384
|
r === 0 && (t.unshift(t.length), t.unshift(6));
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
385
|
+
const a = e.indexOf(t[0], r);
|
|
386
|
+
if (a === -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(a, a + t.length);
|
|
389
|
+
return n.length !== t.length ? !1 : n.every((s, o) => s === t[o]) || b(e, t, a + 1);
|
|
390
|
+
}, pe = (e) => {
|
|
391
391
|
switch (!0) {
|
|
392
|
-
case
|
|
392
|
+
case b(e, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
393
393
|
return "P-256";
|
|
394
|
-
case
|
|
394
|
+
case b(e, [43, 129, 4, 0, 34]):
|
|
395
395
|
return "P-384";
|
|
396
|
-
case
|
|
396
|
+
case b(e, [43, 129, 4, 0, 35]):
|
|
397
397
|
return "P-521";
|
|
398
|
-
case
|
|
398
|
+
case b(e, [43, 101, 110]):
|
|
399
399
|
return "X25519";
|
|
400
|
-
case
|
|
400
|
+
case b(e, [43, 101, 111]):
|
|
401
401
|
return "X448";
|
|
402
|
-
case
|
|
402
|
+
case b(e, [43, 101, 112]):
|
|
403
403
|
return "Ed25519";
|
|
404
|
-
case
|
|
404
|
+
case b(e, [43, 101, 113]):
|
|
405
405
|
return "Ed448";
|
|
406
406
|
default:
|
|
407
|
-
throw new
|
|
407
|
+
throw new _("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
|
|
408
408
|
}
|
|
409
|
-
},
|
|
410
|
-
let s,
|
|
411
|
-
const
|
|
412
|
-
switch (
|
|
409
|
+
}, yt = async (e, t, r, a, n) => {
|
|
410
|
+
let s, o;
|
|
411
|
+
const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
|
|
412
|
+
switch (a) {
|
|
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-${a.slice(-3)}` }, o = ["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-${a.slice(-3)}` }, o = ["verify"];
|
|
422
422
|
break;
|
|
423
423
|
case "RSA-OAEP":
|
|
424
424
|
case "RSA-OAEP-256":
|
|
@@ -426,84 +426,84 @@ const et = (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(a.slice(-3), 10) || 1}`
|
|
430
|
+
}, o = ["encrypt", "wrapKey"];
|
|
431
431
|
break;
|
|
432
432
|
case "ES256":
|
|
433
|
-
s = { name: "ECDSA", namedCurve: "P-256" },
|
|
433
|
+
s = { name: "ECDSA", namedCurve: "P-256" }, o = ["verify"];
|
|
434
434
|
break;
|
|
435
435
|
case "ES384":
|
|
436
|
-
s = { name: "ECDSA", namedCurve: "P-384" },
|
|
436
|
+
s = { name: "ECDSA", namedCurve: "P-384" }, o = ["verify"];
|
|
437
437
|
break;
|
|
438
438
|
case "ES512":
|
|
439
|
-
s = { name: "ECDSA", namedCurve: "P-521" },
|
|
439
|
+
s = { name: "ECDSA", namedCurve: "P-521" }, o = ["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 c = pe(i);
|
|
446
|
+
s = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, o = [];
|
|
447
447
|
break;
|
|
448
448
|
}
|
|
449
449
|
case "EdDSA":
|
|
450
|
-
s = { name:
|
|
450
|
+
s = { name: pe(i) }, o = ["verify"];
|
|
451
451
|
break;
|
|
452
452
|
default:
|
|
453
|
-
throw new
|
|
453
|
+
throw new _('Invalid or unsupported "alg" (Algorithm) value');
|
|
454
454
|
}
|
|
455
|
-
return
|
|
456
|
-
},
|
|
457
|
-
async function
|
|
455
|
+
return z.subtle.importKey(t, i, s, !1, o);
|
|
456
|
+
}, wt = (e, t, r) => yt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
|
|
457
|
+
async function mt(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 wt(e, t);
|
|
461
461
|
}
|
|
462
|
-
const
|
|
462
|
+
const B = (e) => e == null ? void 0 : e[Symbol.toStringTag], Et = (e, t) => {
|
|
463
463
|
if (!(t instanceof Uint8Array)) {
|
|
464
|
-
if (!
|
|
465
|
-
throw new TypeError(
|
|
464
|
+
if (!Pe(t))
|
|
465
|
+
throw new TypeError(Ce(e, t, ...F, "Uint8Array"));
|
|
466
466
|
if (t.type !== "secret")
|
|
467
|
-
throw new TypeError(`${
|
|
467
|
+
throw new TypeError(`${B(t)} instances for symmetric algorithms must be of type "secret"`);
|
|
468
468
|
}
|
|
469
|
-
},
|
|
470
|
-
if (!
|
|
471
|
-
throw new TypeError(
|
|
469
|
+
}, St = (e, t, r) => {
|
|
470
|
+
if (!Pe(t))
|
|
471
|
+
throw new TypeError(Ce(e, t, ...F));
|
|
472
472
|
if (t.type === "secret")
|
|
473
|
-
throw new TypeError(`${
|
|
473
|
+
throw new TypeError(`${B(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(`${B(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(`${B(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
478
|
+
}, gt = (e, t, r) => {
|
|
479
|
+
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? Et(e, t) : St(e, t, r);
|
|
480
480
|
};
|
|
481
|
-
function
|
|
482
|
-
if (n.crit !== void 0 && (
|
|
481
|
+
function At(e, t, r, a, n) {
|
|
482
|
+
if (n.crit !== void 0 && (a == null ? void 0 : a.crit) === void 0)
|
|
483
483
|
throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
484
|
-
if (!
|
|
484
|
+
if (!a || a.crit === void 0)
|
|
485
485
|
return /* @__PURE__ */ new Set();
|
|
486
|
-
if (!Array.isArray(
|
|
486
|
+
if (!Array.isArray(a.crit) || a.crit.length === 0 || a.crit.some((o) => typeof o != "string" || o.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 o of a.crit) {
|
|
491
|
+
if (!s.has(o))
|
|
492
|
+
throw new _(`Extension Header Parameter "${o}" is not recognized`);
|
|
493
|
+
if (n[o] === void 0)
|
|
494
|
+
throw new e(`Extension Header Parameter "${o}" is missing`);
|
|
495
|
+
if (s.get(o) && a[o] === void 0)
|
|
496
|
+
throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`);
|
|
497
|
+
}
|
|
498
|
+
return new Set(a.crit);
|
|
499
499
|
}
|
|
500
|
-
const
|
|
500
|
+
const Tt = (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 kt(e, t) {
|
|
507
507
|
const r = `SHA-${e.slice(-3)}`;
|
|
508
508
|
switch (e) {
|
|
509
509
|
case "HS256":
|
|
@@ -525,109 +525,109 @@ function qt(e, t) {
|
|
|
525
525
|
case "EdDSA":
|
|
526
526
|
return { name: t.name };
|
|
527
527
|
default:
|
|
528
|
-
throw new
|
|
528
|
+
throw new _(`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 bt(e, t, r) {
|
|
532
|
+
if (t = await pt.normalizePublicKey(t, e), ve(t))
|
|
533
|
+
return ot(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(fe(t, ...F));
|
|
537
|
+
return z.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
|
|
538
538
|
}
|
|
539
|
-
throw new TypeError(
|
|
539
|
+
throw new TypeError(fe(t, ...F, "Uint8Array"));
|
|
540
540
|
}
|
|
541
|
-
const
|
|
542
|
-
const n = await
|
|
543
|
-
|
|
544
|
-
const s =
|
|
541
|
+
const _t = async (e, t, r, a) => {
|
|
542
|
+
const n = await bt(e, t, "verify");
|
|
543
|
+
ut(e, n);
|
|
544
|
+
const s = kt(e, n.algorithm);
|
|
545
545
|
try {
|
|
546
|
-
return await
|
|
546
|
+
return await z.subtle.verify(s, n, r, a);
|
|
547
547
|
} catch {
|
|
548
548
|
return !1;
|
|
549
549
|
}
|
|
550
550
|
};
|
|
551
|
-
async function
|
|
552
|
-
if (!
|
|
553
|
-
throw new
|
|
551
|
+
async function vt(e, t, r) {
|
|
552
|
+
if (!ie(e))
|
|
553
|
+
throw new f("Flattened JWS must be an object");
|
|
554
554
|
if (e.protected === void 0 && e.header === void 0)
|
|
555
|
-
throw new
|
|
555
|
+
throw new f('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 f("JWS Protected Header incorrect type");
|
|
558
558
|
if (e.payload === void 0)
|
|
559
|
-
throw new
|
|
559
|
+
throw new f("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 f("JWS Signature missing or incorrect type");
|
|
562
|
+
if (e.header !== void 0 && !ie(e.header))
|
|
563
|
+
throw new f("JWS Unprotected Header incorrect type");
|
|
564
|
+
let a = {};
|
|
565
565
|
if (e.protected)
|
|
566
566
|
try {
|
|
567
|
-
const S =
|
|
568
|
-
|
|
567
|
+
const S = Y(e.protected);
|
|
568
|
+
a = JSON.parse(X.decode(S));
|
|
569
569
|
} catch {
|
|
570
|
-
throw new
|
|
570
|
+
throw new f("JWS Protected Header is invalid");
|
|
571
571
|
}
|
|
572
|
-
if (
|
|
573
|
-
throw new
|
|
572
|
+
if (!it(a, e.header))
|
|
573
|
+
throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
574
574
|
const n = {
|
|
575
|
-
...
|
|
575
|
+
...a,
|
|
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 = At(f, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, a, n);
|
|
578
|
+
let o = !0;
|
|
579
|
+
if (s.has("b64") && (o = a.b64, typeof o != "boolean"))
|
|
580
|
+
throw new f('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
581
|
+
const { alg: i } = n;
|
|
582
|
+
if (typeof i != "string" || !i)
|
|
583
|
+
throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
584
|
+
const c = r && Tt("algorithms", r.algorithms);
|
|
585
|
+
if (c && !c.has(i))
|
|
586
|
+
throw new rt('"alg" (Algorithm) Header Parameter value not allowed');
|
|
587
|
+
if (o) {
|
|
588
588
|
if (typeof e.payload != "string")
|
|
589
|
-
throw new
|
|
589
|
+
throw new f("JWS Payload must be a string");
|
|
590
590
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
591
|
-
throw new
|
|
591
|
+
throw new f("JWS Payload must be a string or an Uint8Array instance");
|
|
592
592
|
let d = !1;
|
|
593
|
-
typeof t == "function" && (t = await t(
|
|
594
|
-
const p =
|
|
595
|
-
let
|
|
593
|
+
typeof t == "function" && (t = await t(a, e), d = !0), gt(i, t, "verify");
|
|
594
|
+
const p = et(L.encode(e.protected ?? ""), L.encode("."), typeof e.payload == "string" ? L.encode(e.payload) : e.payload);
|
|
595
|
+
let y;
|
|
596
596
|
try {
|
|
597
|
-
|
|
597
|
+
y = Y(e.signature);
|
|
598
598
|
} catch {
|
|
599
|
-
throw new
|
|
599
|
+
throw new f("Failed to base64url decode the signature");
|
|
600
600
|
}
|
|
601
|
-
if (!await
|
|
602
|
-
throw new
|
|
603
|
-
let
|
|
604
|
-
if (
|
|
601
|
+
if (!await _t(i, t, y, p))
|
|
602
|
+
throw new at();
|
|
603
|
+
let E;
|
|
604
|
+
if (o)
|
|
605
605
|
try {
|
|
606
|
-
|
|
606
|
+
E = Y(e.payload);
|
|
607
607
|
} catch {
|
|
608
|
-
throw new
|
|
608
|
+
throw new f("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" ? E = L.encode(e.payload) : E = e.payload;
|
|
612
|
+
const m = { payload: E };
|
|
613
|
+
return e.protected !== void 0 && (m.protectedHeader = a), e.header !== void 0 && (m.unprotectedHeader = e.header), d ? { ...m, key: t } : m;
|
|
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 Rt(e, t, r) {
|
|
616
|
+
if (e instanceof Uint8Array && (e = X.decode(e)), typeof e != "string")
|
|
617
|
+
throw new f("Compact JWS must be a string or Uint8Array");
|
|
618
|
+
const { 0: a, 1: n, 2: s, length: o } = e.split(".");
|
|
619
|
+
if (o !== 3)
|
|
620
|
+
throw new f("Invalid Compact JWS");
|
|
621
|
+
const i = await vt({ payload: n, protected: a, signature: s }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
|
|
622
|
+
return typeof t == "function" ? { ...c, key: i.key } : c;
|
|
623
623
|
}
|
|
624
|
-
const
|
|
625
|
-
const t =
|
|
624
|
+
const It = (e) => Math.floor(e.getTime() / 1e3), He = 60, Ke = He * 60, ce = Ke * 24, Ct = ce * 7, Pt = ce * 365.25, Ot = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, ye = (e) => {
|
|
625
|
+
const t = Ot.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]), a = t[3].toLowerCase();
|
|
629
629
|
let n;
|
|
630
|
-
switch (
|
|
630
|
+
switch (a) {
|
|
631
631
|
case "sec":
|
|
632
632
|
case "secs":
|
|
633
633
|
case "second":
|
|
@@ -640,650 +640,262 @@ const tr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, ot = rt * 60, ke = ot
|
|
|
640
640
|
case "min":
|
|
641
641
|
case "mins":
|
|
642
642
|
case "m":
|
|
643
|
-
n = Math.round(r *
|
|
643
|
+
n = Math.round(r * He);
|
|
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 * Ke);
|
|
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 * ce);
|
|
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 * Ct);
|
|
661
661
|
break;
|
|
662
662
|
default:
|
|
663
|
-
n = Math.round(r *
|
|
663
|
+
n = Math.round(r * Pt);
|
|
664
664
|
break;
|
|
665
665
|
}
|
|
666
666
|
return t[1] === "-" || t[4] === "ago" ? -n : n;
|
|
667
|
-
},
|
|
668
|
-
let
|
|
667
|
+
}, we = (e) => e.toLowerCase().replace(/^application\//, ""), Dt = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Ut = (e, t, r = {}) => {
|
|
668
|
+
let a;
|
|
669
669
|
try {
|
|
670
|
-
|
|
670
|
+
a = JSON.parse(X.decode(t));
|
|
671
671
|
} catch {
|
|
672
672
|
}
|
|
673
|
-
if (!
|
|
674
|
-
throw new
|
|
673
|
+
if (!ie(a))
|
|
674
|
+
throw new Re("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 && p.push("iat"),
|
|
676
|
+
if (n && (typeof e.typ != "string" || we(e.typ) !== we(n)))
|
|
677
|
+
throw new A('unexpected "typ" JWT header value', a, "typ", "check_failed");
|
|
678
|
+
const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: d } = r, p = [...s];
|
|
679
|
+
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
680
|
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
|
|
681
|
+
if (!(S in a))
|
|
682
|
+
throw new A(`missing required "${S}" claim`, a, S, "missing");
|
|
683
|
+
if (o && !(Array.isArray(o) ? o : [o]).includes(a.iss))
|
|
684
|
+
throw new A('unexpected "iss" claim value', a, "iss", "check_failed");
|
|
685
|
+
if (i && a.sub !== i)
|
|
686
|
+
throw new A('unexpected "sub" claim value', a, "sub", "check_failed");
|
|
687
|
+
if (c && !Dt(a.aud, typeof c == "string" ? [c] : c))
|
|
688
|
+
throw new A('unexpected "aud" claim value', a, "aud", "check_failed");
|
|
689
|
+
let y;
|
|
690
690
|
switch (typeof r.clockTolerance) {
|
|
691
691
|
case "string":
|
|
692
|
-
|
|
692
|
+
y = ye(r.clockTolerance);
|
|
693
693
|
break;
|
|
694
694
|
case "number":
|
|
695
|
-
|
|
695
|
+
y = r.clockTolerance;
|
|
696
696
|
break;
|
|
697
697
|
case "undefined":
|
|
698
|
-
|
|
698
|
+
y = 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: E } = r, m = It(E || /* @__PURE__ */ new Date());
|
|
704
|
+
if ((a.iat !== void 0 || d) && typeof a.iat != "number")
|
|
705
|
+
throw new A('"iat" claim must be a number', a, "iat", "invalid");
|
|
706
|
+
if (a.nbf !== void 0) {
|
|
707
|
+
if (typeof a.nbf != "number")
|
|
708
|
+
throw new A('"nbf" claim must be a number', a, "nbf", "invalid");
|
|
709
|
+
if (a.nbf > m + y)
|
|
710
|
+
throw new A('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
|
|
711
|
+
}
|
|
712
|
+
if (a.exp !== void 0) {
|
|
713
|
+
if (typeof a.exp != "number")
|
|
714
|
+
throw new A('"exp" claim must be a number', a, "exp", "invalid");
|
|
715
|
+
if (a.exp <= m - y)
|
|
716
|
+
throw new he('"exp" claim timestamp check failed', a, "exp", "check_failed");
|
|
717
717
|
}
|
|
718
718
|
if (d) {
|
|
719
|
-
const S =
|
|
720
|
-
if (S -
|
|
721
|
-
throw new
|
|
722
|
-
if (S < 0 -
|
|
723
|
-
throw new
|
|
719
|
+
const S = m - a.iat, Z = typeof d == "number" ? d : ye(d);
|
|
720
|
+
if (S - y > Z)
|
|
721
|
+
throw new he('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
|
|
722
|
+
if (S < 0 - y)
|
|
723
|
+
throw new A('"iat" claim timestamp check failed (it should be in the past)', a, "iat", "check_failed");
|
|
724
724
|
}
|
|
725
|
-
return
|
|
725
|
+
return a;
|
|
726
726
|
};
|
|
727
|
-
async function
|
|
728
|
-
var
|
|
729
|
-
const n = await
|
|
730
|
-
if ((
|
|
731
|
-
throw new
|
|
732
|
-
const s = { payload:
|
|
727
|
+
async function Ht(e, t, r) {
|
|
728
|
+
var a;
|
|
729
|
+
const n = await Rt(e, t, r);
|
|
730
|
+
if ((a = n.protectedHeader.crit) != null && a.includes("b64") && n.protectedHeader.b64 === !1)
|
|
731
|
+
throw new Re("JWTs MUST NOT use unencoded payload");
|
|
732
|
+
const s = { payload: Ut(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 H = async (e) => {
|
|
736
736
|
try {
|
|
737
|
-
const t =
|
|
738
|
-
return await
|
|
739
|
-
issuer:
|
|
737
|
+
const t = w.ALG, r = await mt(Ze, t);
|
|
738
|
+
return await Ht(e, r, {
|
|
739
|
+
issuer: w.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 l = [];
|
|
746
|
+
for (var ne = 0; ne < 256; ++ne)
|
|
747
|
+
l.push((ne + 256).toString(16).slice(1));
|
|
748
|
+
function Kt(e, t = 0) {
|
|
749
|
+
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
750
|
}
|
|
751
|
-
var
|
|
752
|
-
function
|
|
753
|
-
if (!
|
|
751
|
+
var W, Nt = new Uint8Array(16);
|
|
752
|
+
function Lt() {
|
|
753
|
+
if (!W && (W = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !W))
|
|
754
754
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
755
|
-
return
|
|
755
|
+
return W(Nt);
|
|
756
756
|
}
|
|
757
|
-
var
|
|
758
|
-
const
|
|
759
|
-
randomUUID:
|
|
757
|
+
var $t = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
758
|
+
const me = {
|
|
759
|
+
randomUUID: $t
|
|
760
760
|
};
|
|
761
|
-
function
|
|
762
|
-
if (
|
|
763
|
-
return
|
|
761
|
+
function Ee(e, t, r) {
|
|
762
|
+
if (me.randomUUID && !t && !e)
|
|
763
|
+
return me.randomUUID();
|
|
764
764
|
e = e || {};
|
|
765
|
-
var
|
|
766
|
-
return
|
|
765
|
+
var a = e.random || (e.rng || Lt)();
|
|
766
|
+
return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Kt(a);
|
|
767
767
|
}
|
|
768
|
-
const
|
|
768
|
+
const Se = globalThis.crypto, Wt = (e) => `${Ee()}${Ee()}`.slice(0, e), Jt = (e) => btoa(
|
|
769
769
|
[...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
|
|
770
770
|
);
|
|
771
|
-
async function
|
|
772
|
-
if (!
|
|
771
|
+
async function xt(e) {
|
|
772
|
+
if (!Se.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 Se.subtle.digest("SHA-256", t);
|
|
777
|
+
return Jt(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
778
778
|
}
|
|
779
|
-
async function
|
|
780
|
-
const r =
|
|
779
|
+
async function jt(e) {
|
|
780
|
+
const r = Wt(43), a = await xt(r);
|
|
781
781
|
return {
|
|
782
782
|
code_verifier: r,
|
|
783
|
-
code_challenge:
|
|
783
|
+
code_challenge: a
|
|
784
784
|
};
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function Ne(e, t) {
|
|
787
787
|
window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
|
|
788
788
|
}
|
|
789
|
-
const
|
|
789
|
+
const ge = (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), Ne(e, r);
|
|
794
|
+
}, Mt = (e) => {
|
|
795
|
+
window.localStorage.removeItem(e), Ne(e, null);
|
|
796
|
+
}, Ae = (e) => window.localStorage.getItem(e), Vt = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
|
|
797
|
+
function J({
|
|
798
798
|
key: e,
|
|
799
799
|
initialValue: t
|
|
800
800
|
}) {
|
|
801
|
-
const r = () =>
|
|
802
|
-
|
|
801
|
+
const r = () => Ae(e), a = U.useSyncExternalStore(
|
|
802
|
+
Vt,
|
|
803
803
|
r
|
|
804
|
-
), n =
|
|
805
|
-
(
|
|
804
|
+
), n = U.useCallback(
|
|
805
|
+
(i) => {
|
|
806
806
|
try {
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
} catch (
|
|
810
|
-
console.warn(
|
|
807
|
+
const c = typeof i == "function" ? i(JSON.parse(a)) : i;
|
|
808
|
+
c == null ? Mt(e) : ge(e, c);
|
|
809
|
+
} catch (c) {
|
|
810
|
+
console.warn(c);
|
|
811
811
|
}
|
|
812
812
|
},
|
|
813
|
-
[e,
|
|
814
|
-
), s =
|
|
813
|
+
[e, a]
|
|
814
|
+
), s = U.useCallback(() => {
|
|
815
815
|
n(t);
|
|
816
|
-
}, [t, n]),
|
|
816
|
+
}, [t, n]), o = U.useCallback(() => {
|
|
817
817
|
n(null);
|
|
818
818
|
}, [n]);
|
|
819
|
-
return
|
|
819
|
+
return U.useEffect(() => {
|
|
820
820
|
try {
|
|
821
|
-
|
|
822
|
-
} catch (
|
|
823
|
-
console.warn(
|
|
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
|
-
}
|
|
821
|
+
Ae(e) === null && typeof t < "u" && ge(e, t);
|
|
822
|
+
} catch (i) {
|
|
823
|
+
console.warn(i);
|
|
1061
824
|
}
|
|
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;
|
|
825
|
+
}, [e, t]), [a ? JSON.parse(a) : null, n, s, o];
|
|
1093
826
|
}
|
|
1094
|
-
var h =
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
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;
|
|
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];
|
|
827
|
+
var h = [];
|
|
828
|
+
for (var se = 0; se < 256; ++se)
|
|
829
|
+
h.push((se + 256).toString(16).slice(1));
|
|
830
|
+
function Yt(e, t = 0) {
|
|
831
|
+
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();
|
|
1208
832
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
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))
|
|
833
|
+
var x, Bt = new Uint8Array(16);
|
|
834
|
+
function Ft() {
|
|
835
|
+
if (!x && (x = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !x))
|
|
1226
836
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1227
|
-
return
|
|
837
|
+
return x(Bt);
|
|
1228
838
|
}
|
|
1229
|
-
var
|
|
1230
|
-
const
|
|
1231
|
-
randomUUID:
|
|
839
|
+
var Gt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
840
|
+
const Te = {
|
|
841
|
+
randomUUID: Gt
|
|
1232
842
|
};
|
|
1233
|
-
function
|
|
1234
|
-
if (
|
|
1235
|
-
return
|
|
843
|
+
function qt(e, t, r) {
|
|
844
|
+
if (Te.randomUUID && !t && !e)
|
|
845
|
+
return Te.randomUUID();
|
|
1236
846
|
e = e || {};
|
|
1237
|
-
var
|
|
1238
|
-
return
|
|
847
|
+
var a = e.random || (e.rng || Ft)();
|
|
848
|
+
return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Yt(a);
|
|
1239
849
|
}
|
|
1240
|
-
const
|
|
850
|
+
const j = "Oops! It looks like your session has expired. For your security, please log in again to continue.", zt = "Your session has been successfully terminated.", ke = "Login failed. Please try again.", oe = "Error getting access token, please re-authenticate.", Xt = "You forgot to wrap your component in <AuthProvider>.", be = {
|
|
1241
851
|
dev: "https://auth.gizmette.local.com:3003",
|
|
1242
852
|
prod: "https://mylogin.gizmette.com"
|
|
1243
|
-
},
|
|
853
|
+
}, M = "@@auth@@", Qt = process.env.NODE_ENV === "production", Zt = !Qt, Q = async ({
|
|
1244
854
|
type: e,
|
|
1245
855
|
clientId: t,
|
|
1246
856
|
params: r = {}
|
|
1247
857
|
}) => {
|
|
1248
858
|
try {
|
|
1249
|
-
const
|
|
1250
|
-
|
|
859
|
+
const a = await fetch(
|
|
860
|
+
Zt ? `${be.dev}/${e}` : `${be.prod}/${e}`,
|
|
1251
861
|
{
|
|
1252
862
|
credentials: "include",
|
|
1253
863
|
method: "POST",
|
|
1254
864
|
headers: {
|
|
1255
865
|
"Content-Type": "application/json",
|
|
1256
|
-
[
|
|
866
|
+
[Qe.CLIENT_ID]: `${t}`
|
|
1257
867
|
},
|
|
1258
868
|
body: JSON.stringify(r)
|
|
1259
869
|
}
|
|
1260
870
|
);
|
|
1261
|
-
if (
|
|
1262
|
-
return { status:
|
|
1263
|
-
const { data: n, errors: s } = await
|
|
871
|
+
if (a.status !== 200)
|
|
872
|
+
return { status: a.status, data: [] };
|
|
873
|
+
const { data: n, errors: s } = await a.json();
|
|
1264
874
|
return {
|
|
1265
|
-
status:
|
|
875
|
+
status: a.status,
|
|
1266
876
|
data: n,
|
|
1267
877
|
errors: s
|
|
1268
878
|
};
|
|
1269
|
-
} catch (
|
|
1270
|
-
return console.error(
|
|
879
|
+
} catch (a) {
|
|
880
|
+
return console.error(a), { status: 500, data: [] };
|
|
1271
881
|
}
|
|
1272
|
-
},
|
|
882
|
+
}, er = async ({
|
|
1273
883
|
idToken: e,
|
|
1274
884
|
accessToken: t,
|
|
1275
885
|
refreshToken: r,
|
|
1276
|
-
clientId:
|
|
886
|
+
clientId: a,
|
|
887
|
+
domain: n
|
|
1277
888
|
}) => {
|
|
1278
889
|
try {
|
|
1279
890
|
return {
|
|
1280
|
-
status: (await
|
|
1281
|
-
type:
|
|
1282
|
-
clientId:
|
|
891
|
+
status: (await Q({
|
|
892
|
+
type: q.LOGOUT,
|
|
893
|
+
clientId: a,
|
|
1283
894
|
params: {
|
|
1284
895
|
idToken: e,
|
|
1285
896
|
accessToken: t,
|
|
1286
|
-
refreshToken: r
|
|
897
|
+
refreshToken: r,
|
|
898
|
+
domain: n
|
|
1287
899
|
}
|
|
1288
900
|
})).status === 200
|
|
1289
901
|
};
|
|
@@ -1292,35 +904,37 @@ const te = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1292
904
|
status: !1
|
|
1293
905
|
};
|
|
1294
906
|
}
|
|
1295
|
-
},
|
|
907
|
+
}, _e = async ({
|
|
1296
908
|
username: e,
|
|
1297
909
|
password: t,
|
|
1298
910
|
clientId: r,
|
|
1299
|
-
nonce:
|
|
911
|
+
nonce: a,
|
|
1300
912
|
type: n,
|
|
1301
913
|
sessionExpiration: s,
|
|
1302
|
-
code:
|
|
1303
|
-
code_verifier:
|
|
914
|
+
code: o,
|
|
915
|
+
code_verifier: i,
|
|
916
|
+
domain: c
|
|
1304
917
|
}) => {
|
|
1305
918
|
try {
|
|
1306
|
-
const
|
|
1307
|
-
type:
|
|
919
|
+
const d = await Q({
|
|
920
|
+
type: q.AUTHENTICATE,
|
|
1308
921
|
clientId: r,
|
|
1309
922
|
params: {
|
|
1310
|
-
type: n ||
|
|
923
|
+
type: n || G.ID_AND_ACCESS_TOKEN,
|
|
1311
924
|
username: e,
|
|
1312
925
|
password: t,
|
|
1313
926
|
sessionExpiration: s,
|
|
1314
|
-
nonce:
|
|
1315
|
-
code:
|
|
1316
|
-
code_verifier:
|
|
927
|
+
nonce: a,
|
|
928
|
+
code: o,
|
|
929
|
+
code_verifier: i,
|
|
930
|
+
domain: c
|
|
1317
931
|
}
|
|
1318
|
-
}),
|
|
1319
|
-
return
|
|
1320
|
-
idToken:
|
|
1321
|
-
accessToken:
|
|
1322
|
-
refreshToken:
|
|
1323
|
-
userId:
|
|
932
|
+
}), p = await H(d.data.idToken);
|
|
933
|
+
return p && p.payload[w.USER_ID_KEY] !== "" && p.payload[w.NONCE_KEY] === a ? {
|
|
934
|
+
idToken: d.data.idToken,
|
|
935
|
+
accessToken: d.data.accessToken,
|
|
936
|
+
refreshToken: d.data.refreshToken,
|
|
937
|
+
userId: p.payload[w.USER_ID_KEY],
|
|
1324
938
|
status: !0
|
|
1325
939
|
} : {
|
|
1326
940
|
status: !1
|
|
@@ -1330,24 +944,24 @@ const te = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1330
944
|
status: !1
|
|
1331
945
|
};
|
|
1332
946
|
}
|
|
1333
|
-
},
|
|
947
|
+
}, tr = async ({
|
|
1334
948
|
nonce: e,
|
|
1335
949
|
clientId: t,
|
|
1336
950
|
code_challenge: r
|
|
1337
951
|
}) => {
|
|
1338
952
|
try {
|
|
1339
|
-
const
|
|
1340
|
-
type:
|
|
953
|
+
const a = await Q({
|
|
954
|
+
type: q.CODE,
|
|
1341
955
|
clientId: t,
|
|
1342
956
|
params: {
|
|
1343
|
-
type:
|
|
957
|
+
type: G.CODE,
|
|
1344
958
|
nonce: e,
|
|
1345
959
|
code_challenge: r
|
|
1346
960
|
}
|
|
1347
961
|
});
|
|
1348
|
-
return
|
|
962
|
+
return a.data.code ? {
|
|
1349
963
|
status: !0,
|
|
1350
|
-
code:
|
|
964
|
+
code: a.data.code
|
|
1351
965
|
} : {
|
|
1352
966
|
status: !1
|
|
1353
967
|
};
|
|
@@ -1356,29 +970,31 @@ const te = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1356
970
|
status: !1
|
|
1357
971
|
};
|
|
1358
972
|
}
|
|
1359
|
-
},
|
|
973
|
+
}, rr = async ({
|
|
1360
974
|
clientId: e,
|
|
1361
975
|
userId: t,
|
|
1362
976
|
nonce: r,
|
|
1363
|
-
refreshToken:
|
|
1364
|
-
accessToken: n
|
|
977
|
+
refreshToken: a,
|
|
978
|
+
accessToken: n,
|
|
979
|
+
domain: s
|
|
1365
980
|
}) => {
|
|
1366
981
|
try {
|
|
1367
|
-
const
|
|
1368
|
-
type:
|
|
982
|
+
const o = await Q({
|
|
983
|
+
type: q.AUTHENTICATE,
|
|
1369
984
|
clientId: e,
|
|
1370
985
|
params: {
|
|
1371
|
-
type:
|
|
986
|
+
type: G.REFRESH_TOKEN,
|
|
1372
987
|
userId: t,
|
|
1373
988
|
nonce: r,
|
|
1374
|
-
refreshToken:
|
|
1375
|
-
accessToken: n
|
|
989
|
+
refreshToken: a,
|
|
990
|
+
accessToken: n,
|
|
991
|
+
domain: s
|
|
1376
992
|
}
|
|
1377
|
-
}),
|
|
1378
|
-
return
|
|
1379
|
-
accessToken:
|
|
1380
|
-
refreshToken:
|
|
1381
|
-
userId:
|
|
993
|
+
}), i = await H(o.data.accessToken);
|
|
994
|
+
return i && i.payload[w.USER_ID_KEY] !== "" && i.payload[w.NONCE_KEY] === r ? {
|
|
995
|
+
accessToken: o.data.accessToken,
|
|
996
|
+
refreshToken: o.data.refreshToken,
|
|
997
|
+
userId: i.payload[w.USER_ID_KEY],
|
|
1382
998
|
status: !0
|
|
1383
999
|
} : {
|
|
1384
1000
|
status: !1
|
|
@@ -1389,22 +1005,24 @@ const te = "Oops! It looks like your session has expired. For your security, ple
|
|
|
1389
1005
|
};
|
|
1390
1006
|
}
|
|
1391
1007
|
};
|
|
1392
|
-
class
|
|
1008
|
+
class ar {
|
|
1393
1009
|
constructor(t = null, r = null) {
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1010
|
+
N(this, "refreshTokenPromise", null);
|
|
1011
|
+
N(this, "accessToken");
|
|
1012
|
+
N(this, "refreshToken");
|
|
1397
1013
|
this.accessToken = t || "", this.refreshToken = r || "";
|
|
1398
1014
|
}
|
|
1399
1015
|
async refreshtoken({
|
|
1400
1016
|
clientId: t,
|
|
1401
1017
|
userId: r,
|
|
1402
|
-
nonce:
|
|
1018
|
+
nonce: a,
|
|
1019
|
+
domain: n
|
|
1403
1020
|
}) {
|
|
1404
1021
|
this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
|
|
1405
1022
|
clientId: t,
|
|
1406
1023
|
userId: r,
|
|
1407
|
-
nonce:
|
|
1024
|
+
nonce: a,
|
|
1025
|
+
domain: n
|
|
1408
1026
|
}));
|
|
1409
1027
|
try {
|
|
1410
1028
|
return await this.refreshTokenPromise;
|
|
@@ -1415,21 +1033,23 @@ class zr {
|
|
|
1415
1033
|
async _refreshToken({
|
|
1416
1034
|
clientId: t,
|
|
1417
1035
|
userId: r,
|
|
1418
|
-
nonce:
|
|
1036
|
+
nonce: a,
|
|
1037
|
+
domain: n
|
|
1419
1038
|
}) {
|
|
1420
|
-
const
|
|
1421
|
-
if (
|
|
1422
|
-
const
|
|
1039
|
+
const s = await H(this.refreshToken);
|
|
1040
|
+
if (s && s.payload[w.USER_ID_KEY] !== "") {
|
|
1041
|
+
const o = await rr({
|
|
1423
1042
|
clientId: t,
|
|
1424
1043
|
userId: r,
|
|
1425
|
-
nonce:
|
|
1044
|
+
nonce: a,
|
|
1426
1045
|
refreshToken: this.refreshToken,
|
|
1427
|
-
accessToken: this.accessToken
|
|
1046
|
+
accessToken: this.accessToken,
|
|
1047
|
+
domain: n
|
|
1428
1048
|
});
|
|
1429
|
-
return
|
|
1049
|
+
return o.status ? (this.accessToken = o.accessToken, this.refreshToken = o.refreshToken, {
|
|
1430
1050
|
status: "success",
|
|
1431
|
-
newAccessToken:
|
|
1432
|
-
newRefreshToken:
|
|
1051
|
+
newAccessToken: o.accessToken,
|
|
1052
|
+
newRefreshToken: o.refreshToken
|
|
1433
1053
|
}) : {
|
|
1434
1054
|
status: "failure"
|
|
1435
1055
|
};
|
|
@@ -1439,191 +1059,182 @@ class zr {
|
|
|
1439
1059
|
};
|
|
1440
1060
|
}
|
|
1441
1061
|
}
|
|
1442
|
-
const
|
|
1443
|
-
throw new Error(
|
|
1444
|
-
},
|
|
1062
|
+
const V = () => {
|
|
1063
|
+
throw new Error(Xt);
|
|
1064
|
+
}, Le = Fe({
|
|
1445
1065
|
isAuthenticated: !1,
|
|
1446
1066
|
isLoading: !1,
|
|
1447
|
-
login:
|
|
1448
|
-
logout:
|
|
1449
|
-
getAccessToken:
|
|
1450
|
-
getIdToken:
|
|
1067
|
+
login: V,
|
|
1068
|
+
logout: V,
|
|
1069
|
+
getAccessToken: V,
|
|
1070
|
+
getIdToken: V,
|
|
1451
1071
|
logoutReason: ""
|
|
1452
|
-
}),
|
|
1072
|
+
}), ur = ({
|
|
1453
1073
|
children: e,
|
|
1454
1074
|
sessionExpiration: t,
|
|
1455
1075
|
clientId: r,
|
|
1456
|
-
domain:
|
|
1076
|
+
domain: a = ""
|
|
1457
1077
|
}) => {
|
|
1458
|
-
const n =
|
|
1459
|
-
key: `${
|
|
1460
|
-
}), [
|
|
1461
|
-
key: `${
|
|
1462
|
-
}), [
|
|
1078
|
+
const n = Ge(!1), [s, o, , i] = J({
|
|
1079
|
+
key: `${M}::${r}::@@user@@`
|
|
1080
|
+
}), [c, d, , p] = J({
|
|
1081
|
+
key: `${M}::${r}::@@access@@`
|
|
1082
|
+
}), [y, E, , m] = J(
|
|
1463
1083
|
{
|
|
1464
|
-
key: `${
|
|
1084
|
+
key: `${M}::${r}::@@refresh@@`
|
|
1465
1085
|
}
|
|
1466
|
-
), [
|
|
1467
|
-
key: `${
|
|
1468
|
-
}),
|
|
1086
|
+
), [S, Z, , ue] = J({
|
|
1087
|
+
key: `${M}::${r}::@@nonce@@`
|
|
1088
|
+
}), $e = new ar(c, y), [P, v] = qe({
|
|
1469
1089
|
isLoading: !0,
|
|
1470
1090
|
isAuthenticated: !1,
|
|
1471
1091
|
user: void 0,
|
|
1472
1092
|
logoutReason: ""
|
|
1473
|
-
}),
|
|
1474
|
-
(
|
|
1475
|
-
console.warn(
|
|
1093
|
+
}), K = le(
|
|
1094
|
+
(u) => {
|
|
1095
|
+
console.warn(u), v({
|
|
1476
1096
|
isLoading: !0,
|
|
1477
1097
|
isAuthenticated: !1,
|
|
1478
1098
|
user: void 0,
|
|
1479
|
-
logoutReason:
|
|
1480
|
-
}),
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1099
|
+
logoutReason: u || j
|
|
1100
|
+
}), i(), p(), m(), ue();
|
|
1101
|
+
},
|
|
1102
|
+
[p, i, ue, m]
|
|
1103
|
+
), R = le(
|
|
1104
|
+
async (u) => {
|
|
1105
|
+
K(u || j), await er({
|
|
1106
|
+
idToken: s,
|
|
1107
|
+
accessToken: c,
|
|
1108
|
+
refreshToken: y,
|
|
1109
|
+
clientId: r,
|
|
1110
|
+
domain: a
|
|
1111
|
+
}), v((k) => ({
|
|
1112
|
+
...k,
|
|
1113
|
+
isLoading: !1
|
|
1114
|
+
}));
|
|
1484
1115
|
},
|
|
1485
1116
|
[
|
|
1117
|
+
c,
|
|
1486
1118
|
r,
|
|
1487
|
-
o,
|
|
1488
|
-
T,
|
|
1489
1119
|
a,
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1120
|
+
s,
|
|
1121
|
+
y,
|
|
1122
|
+
K
|
|
1493
1123
|
]
|
|
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
1124
|
);
|
|
1508
|
-
|
|
1125
|
+
ze(() => {
|
|
1509
1126
|
if (!n.current)
|
|
1510
|
-
return
|
|
1127
|
+
return P.isLoading && s !== null ? (async () => {
|
|
1511
1128
|
try {
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1129
|
+
const u = await H(s);
|
|
1130
|
+
u && u.payload[w.USER_ID_KEY] !== "" ? v({
|
|
1514
1131
|
isLoading: !1,
|
|
1515
1132
|
isAuthenticated: !0,
|
|
1516
1133
|
user: {
|
|
1517
|
-
userId:
|
|
1518
|
-
username:
|
|
1134
|
+
userId: u.payload[w.USER_ID_KEY],
|
|
1135
|
+
username: u.payload[w.USERNAME_KEY]
|
|
1519
1136
|
},
|
|
1520
1137
|
logoutReason: ""
|
|
1521
|
-
}) : await
|
|
1138
|
+
}) : await R(j);
|
|
1522
1139
|
} catch {
|
|
1523
|
-
await
|
|
1140
|
+
await R(j);
|
|
1524
1141
|
}
|
|
1525
|
-
})() :
|
|
1526
|
-
...
|
|
1142
|
+
})() : v((u) => ({
|
|
1143
|
+
...u,
|
|
1527
1144
|
isLoading: !1
|
|
1528
1145
|
})), () => {
|
|
1529
1146
|
n.current = !0;
|
|
1530
1147
|
};
|
|
1531
|
-
}, [
|
|
1532
|
-
const
|
|
1533
|
-
const
|
|
1534
|
-
if (
|
|
1535
|
-
...
|
|
1148
|
+
}, [P.isLoading, s, R]);
|
|
1149
|
+
const We = async (u, k, g) => {
|
|
1150
|
+
const I = qt();
|
|
1151
|
+
if (Z(I), v((ee) => ({
|
|
1152
|
+
...ee,
|
|
1536
1153
|
isLoading: !0
|
|
1537
|
-
})),
|
|
1538
|
-
const { code_verifier:
|
|
1539
|
-
nonce:
|
|
1154
|
+
})), i(), p(), m(), g === G.CODE) {
|
|
1155
|
+
const { code_verifier: ee, code_challenge: Me } = await jt(), de = await tr({
|
|
1156
|
+
nonce: I,
|
|
1540
1157
|
clientId: r,
|
|
1541
|
-
code_challenge:
|
|
1158
|
+
code_challenge: Me
|
|
1542
1159
|
});
|
|
1543
|
-
if (
|
|
1544
|
-
const
|
|
1545
|
-
username:
|
|
1546
|
-
password:
|
|
1160
|
+
if (de.status) {
|
|
1161
|
+
const D = await _e({
|
|
1162
|
+
username: u,
|
|
1163
|
+
password: k,
|
|
1547
1164
|
clientId: r,
|
|
1548
1165
|
sessionExpiration: t,
|
|
1549
|
-
nonce:
|
|
1550
|
-
type:
|
|
1551
|
-
code:
|
|
1552
|
-
code_verifier:
|
|
1166
|
+
nonce: I,
|
|
1167
|
+
type: g,
|
|
1168
|
+
code: de.code,
|
|
1169
|
+
code_verifier: ee,
|
|
1170
|
+
domain: a
|
|
1553
1171
|
});
|
|
1554
|
-
return
|
|
1555
|
-
secure: !0,
|
|
1556
|
-
domain: o
|
|
1557
|
-
}), l(N.idToken), m(N.accessToken), S(N.refreshToken), i({
|
|
1172
|
+
return D.status ? (o(D.idToken), d(D.accessToken), E(D.refreshToken), v({
|
|
1558
1173
|
isLoading: !1,
|
|
1559
1174
|
isAuthenticated: !0,
|
|
1560
1175
|
user: {
|
|
1561
|
-
userId:
|
|
1562
|
-
username:
|
|
1176
|
+
userId: D.userId,
|
|
1177
|
+
username: u
|
|
1563
1178
|
},
|
|
1564
1179
|
logoutReason: ""
|
|
1565
|
-
}), !0) : (
|
|
1180
|
+
}), !0) : (K(ke), !1);
|
|
1566
1181
|
}
|
|
1567
1182
|
return !1;
|
|
1568
1183
|
}
|
|
1569
|
-
const
|
|
1570
|
-
username:
|
|
1571
|
-
password:
|
|
1184
|
+
const O = await _e({
|
|
1185
|
+
username: u,
|
|
1186
|
+
password: k,
|
|
1572
1187
|
clientId: r,
|
|
1573
1188
|
sessionExpiration: t,
|
|
1574
|
-
nonce:
|
|
1575
|
-
type:
|
|
1189
|
+
nonce: I,
|
|
1190
|
+
type: g,
|
|
1191
|
+
domain: a
|
|
1576
1192
|
});
|
|
1577
|
-
return
|
|
1578
|
-
secure: !0,
|
|
1579
|
-
domain: o
|
|
1580
|
-
}), l(U.idToken), m(U.accessToken), S(U.refreshToken), i({
|
|
1193
|
+
return O.status ? (o(O.idToken), d(O.accessToken), E(O.refreshToken), v({
|
|
1581
1194
|
isLoading: !1,
|
|
1582
1195
|
isAuthenticated: !0,
|
|
1583
1196
|
user: {
|
|
1584
|
-
userId:
|
|
1585
|
-
username:
|
|
1197
|
+
userId: O.userId,
|
|
1198
|
+
username: u
|
|
1586
1199
|
}
|
|
1587
|
-
}), !0) : (
|
|
1588
|
-
},
|
|
1589
|
-
|
|
1590
|
-
},
|
|
1591
|
-
const { isAuthenticated:
|
|
1200
|
+
}), !0) : (K(ke), !1);
|
|
1201
|
+
}, Je = async (u) => {
|
|
1202
|
+
u == null || u.preventDefault(), await R(zt);
|
|
1203
|
+
}, xe = async () => {
|
|
1204
|
+
const { isAuthenticated: u, user: k } = P;
|
|
1592
1205
|
try {
|
|
1593
|
-
if (
|
|
1594
|
-
if (
|
|
1595
|
-
const
|
|
1596
|
-
if (
|
|
1597
|
-
return
|
|
1206
|
+
if (u && k && k.userId) {
|
|
1207
|
+
if (c) {
|
|
1208
|
+
const I = await H(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: k.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__ */ Be(
|
|
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) => Xe(e);
|
|
1625
1236
|
export {
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1237
|
+
G as AUTH_TYPES,
|
|
1238
|
+
ur as AuthProvider,
|
|
1239
|
+
dr as useAuth
|
|
1629
1240
|
};
|