@versini/auth-provider 6.4.4 → 7.0.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 +1 -12
- package/dist/index.js +856 -1266
- package/package.json +3 -4
package/dist/index.js
CHANGED
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import
|
|
1
|
+
var Et = Object.defineProperty;
|
|
2
|
+
var mt = (e, t, r) => t in e ? Et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var j = (e, t, r) => mt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { jsx as be } from "react/jsx-runtime";
|
|
5
|
+
import wt, { useSyncExternalStore as St, useCallback as N, useEffect as He, createContext as At, useReducer as Tt, useRef as Rt, useContext as _t } from "react";
|
|
6
6
|
/*!
|
|
7
|
-
@versini/auth-provider
|
|
7
|
+
@versini/auth-provider v7.0.0
|
|
8
8
|
© 2024 gizmette.com
|
|
9
9
|
*/
|
|
10
10
|
try {
|
|
11
11
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
12
|
-
version: "
|
|
13
|
-
buildTime: "
|
|
12
|
+
version: "7.0.0",
|
|
13
|
+
buildTime: "08/19/2024 06:11 PM EDT",
|
|
14
14
|
homepage: "https://github.com/aversini/auth-client",
|
|
15
15
|
license: "MIT"
|
|
16
16
|
});
|
|
17
17
|
} catch {
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function _(e) {
|
|
20
20
|
const t = new Uint8Array(e);
|
|
21
|
-
let
|
|
21
|
+
let r = "";
|
|
22
22
|
for (const a of t)
|
|
23
|
-
|
|
24
|
-
return btoa(
|
|
23
|
+
r += String.fromCharCode(a);
|
|
24
|
+
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const t = e.replace(/-/g, "+").replace(/_/g, "/"),
|
|
26
|
+
function re(e) {
|
|
27
|
+
const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - t.length % 4) % 4, n = t.padEnd(t.length + r, "="), a = atob(n), o = new ArrayBuffer(a.length), s = new Uint8Array(o);
|
|
28
28
|
for (let i = 0; i < a.length; i++)
|
|
29
|
-
|
|
30
|
-
return
|
|
29
|
+
s[i] = a.charCodeAt(i);
|
|
30
|
+
return o;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Se() {
|
|
33
33
|
return window?.PublicKeyCredential !== void 0 && typeof window.PublicKeyCredential == "function";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function We(e) {
|
|
36
36
|
const { id: t } = e;
|
|
37
37
|
return {
|
|
38
38
|
...e,
|
|
39
|
-
id:
|
|
39
|
+
id: re(t),
|
|
40
40
|
transports: e.transports
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function xe(e) {
|
|
44
44
|
return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
|
|
45
45
|
}
|
|
46
|
-
class
|
|
47
|
-
constructor({ message: t, code:
|
|
48
|
-
super(t, { cause:
|
|
46
|
+
class w extends Error {
|
|
47
|
+
constructor({ message: t, code: r, cause: n, name: a }) {
|
|
48
|
+
super(t, { cause: n }), this.name = a ?? n.name, this.code = r;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
const { publicKey:
|
|
53
|
-
if (!
|
|
51
|
+
function It({ error: e, options: t }) {
|
|
52
|
+
const { publicKey: r } = t;
|
|
53
|
+
if (!r)
|
|
54
54
|
throw Error("options was missing required publicKey property");
|
|
55
55
|
if (e.name === "AbortError") {
|
|
56
56
|
if (t.signal instanceof AbortSignal)
|
|
57
|
-
return new
|
|
57
|
+
return new w({
|
|
58
58
|
message: "Registration ceremony was sent an abort signal",
|
|
59
59
|
code: "ERROR_CEREMONY_ABORTED",
|
|
60
60
|
cause: e
|
|
61
61
|
});
|
|
62
62
|
} else if (e.name === "ConstraintError") {
|
|
63
|
-
if (
|
|
64
|
-
return new
|
|
63
|
+
if (r.authenticatorSelection?.requireResidentKey === !0)
|
|
64
|
+
return new w({
|
|
65
65
|
message: "Discoverable credentials were required but no available authenticator supported it",
|
|
66
66
|
code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
|
|
67
67
|
cause: e
|
|
68
68
|
});
|
|
69
|
-
if (
|
|
70
|
-
return new
|
|
69
|
+
if (r.authenticatorSelection?.userVerification === "required")
|
|
70
|
+
return new w({
|
|
71
71
|
message: "User verification was required but no available authenticator supported it",
|
|
72
72
|
code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
|
|
73
73
|
cause: e
|
|
74
74
|
});
|
|
75
75
|
} else {
|
|
76
76
|
if (e.name === "InvalidStateError")
|
|
77
|
-
return new
|
|
77
|
+
return new w({
|
|
78
78
|
message: "The authenticator was previously registered",
|
|
79
79
|
code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
|
|
80
80
|
cause: e
|
|
81
81
|
});
|
|
82
82
|
if (e.name === "NotAllowedError")
|
|
83
|
-
return new
|
|
83
|
+
return new w({
|
|
84
84
|
message: e.message,
|
|
85
85
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
86
86
|
cause: e
|
|
87
87
|
});
|
|
88
88
|
if (e.name === "NotSupportedError")
|
|
89
|
-
return
|
|
89
|
+
return r.pubKeyCredParams.filter((a) => a.type === "public-key").length === 0 ? new w({
|
|
90
90
|
message: 'No entry in pubKeyCredParams was of type "public-key"',
|
|
91
91
|
code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
|
|
92
92
|
cause: e
|
|
93
|
-
}) : new
|
|
93
|
+
}) : new w({
|
|
94
94
|
message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
|
|
95
95
|
code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
|
|
96
96
|
cause: e
|
|
97
97
|
});
|
|
98
98
|
if (e.name === "SecurityError") {
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
if (
|
|
102
|
-
return new
|
|
103
|
-
message: `The RP ID "${
|
|
99
|
+
const n = window.location.hostname;
|
|
100
|
+
if (xe(n)) {
|
|
101
|
+
if (r.rp.id !== n)
|
|
102
|
+
return new w({
|
|
103
|
+
message: `The RP ID "${r.rp.id}" is invalid for this domain`,
|
|
104
104
|
code: "ERROR_INVALID_RP_ID",
|
|
105
105
|
cause: e
|
|
106
106
|
});
|
|
107
|
-
} else return new
|
|
107
|
+
} else return new w({
|
|
108
108
|
message: `${window.location.hostname} is an invalid domain`,
|
|
109
109
|
code: "ERROR_INVALID_DOMAIN",
|
|
110
110
|
cause: e
|
|
111
111
|
});
|
|
112
112
|
} else if (e.name === "TypeError") {
|
|
113
|
-
if (
|
|
114
|
-
return new
|
|
113
|
+
if (r.user.id.byteLength < 1 || r.user.id.byteLength > 64)
|
|
114
|
+
return new w({
|
|
115
115
|
message: "User ID was not between 1 and 64 characters",
|
|
116
116
|
code: "ERROR_INVALID_USER_ID_LENGTH",
|
|
117
117
|
cause: e
|
|
118
118
|
});
|
|
119
119
|
} else if (e.name === "UnknownError")
|
|
120
|
-
return new
|
|
120
|
+
return new w({
|
|
121
121
|
message: "The authenticator was unable to process the specified options, or could not create a new credential",
|
|
122
122
|
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
123
123
|
cause: e
|
|
@@ -125,11 +125,11 @@ function Wt({ error: e, options: t }) {
|
|
|
125
125
|
}
|
|
126
126
|
return e;
|
|
127
127
|
}
|
|
128
|
-
class
|
|
128
|
+
class bt {
|
|
129
129
|
createNewAbortSignal() {
|
|
130
130
|
if (this.controller) {
|
|
131
|
-
const
|
|
132
|
-
|
|
131
|
+
const r = new Error("Cancelling existing WebAuthn API call for new one");
|
|
132
|
+
r.name = "AbortError", this.controller.abort(r);
|
|
133
133
|
}
|
|
134
134
|
const t = new AbortController();
|
|
135
135
|
return this.controller = t, t.signal;
|
|
@@ -141,117 +141,117 @@ class xt {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
function
|
|
146
|
-
if (e && !(
|
|
144
|
+
const Je = new bt(), Ot = ["cross-platform", "platform"];
|
|
145
|
+
function Ye(e) {
|
|
146
|
+
if (e && !(Ot.indexOf(e) < 0))
|
|
147
147
|
return e;
|
|
148
148
|
}
|
|
149
|
-
async function
|
|
150
|
-
if (!
|
|
149
|
+
async function vt(e) {
|
|
150
|
+
if (!Se())
|
|
151
151
|
throw new Error("WebAuthn is not supported in this browser");
|
|
152
|
-
const
|
|
152
|
+
const r = { publicKey: {
|
|
153
153
|
...e,
|
|
154
|
-
challenge:
|
|
154
|
+
challenge: re(e.challenge),
|
|
155
155
|
user: {
|
|
156
156
|
...e.user,
|
|
157
|
-
id:
|
|
157
|
+
id: re(e.user.id)
|
|
158
158
|
},
|
|
159
|
-
excludeCredentials: e.excludeCredentials?.map(
|
|
159
|
+
excludeCredentials: e.excludeCredentials?.map(We)
|
|
160
160
|
} };
|
|
161
|
-
|
|
162
|
-
let
|
|
161
|
+
r.signal = Je.createNewAbortSignal();
|
|
162
|
+
let n;
|
|
163
163
|
try {
|
|
164
|
-
|
|
165
|
-
} catch (
|
|
166
|
-
throw
|
|
164
|
+
n = await navigator.credentials.create(r);
|
|
165
|
+
} catch (l) {
|
|
166
|
+
throw It({ error: l, options: r });
|
|
167
167
|
}
|
|
168
|
-
if (!
|
|
168
|
+
if (!n)
|
|
169
169
|
throw new Error("Registration was not completed");
|
|
170
|
-
const { id: a, rawId:
|
|
170
|
+
const { id: a, rawId: o, response: s, type: i } = n;
|
|
171
171
|
let c;
|
|
172
|
-
typeof
|
|
173
|
-
let
|
|
174
|
-
if (typeof
|
|
172
|
+
typeof s.getTransports == "function" && (c = s.getTransports());
|
|
173
|
+
let u;
|
|
174
|
+
if (typeof s.getPublicKeyAlgorithm == "function")
|
|
175
175
|
try {
|
|
176
|
-
|
|
177
|
-
} catch (
|
|
178
|
-
|
|
176
|
+
u = s.getPublicKeyAlgorithm();
|
|
177
|
+
} catch (l) {
|
|
178
|
+
he("getPublicKeyAlgorithm()", l);
|
|
179
179
|
}
|
|
180
|
-
let
|
|
181
|
-
if (typeof
|
|
180
|
+
let p;
|
|
181
|
+
if (typeof s.getPublicKey == "function")
|
|
182
182
|
try {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
} catch (
|
|
186
|
-
|
|
183
|
+
const l = s.getPublicKey();
|
|
184
|
+
l !== null && (p = _(l));
|
|
185
|
+
} catch (l) {
|
|
186
|
+
he("getPublicKey()", l);
|
|
187
187
|
}
|
|
188
|
-
let
|
|
189
|
-
if (typeof
|
|
188
|
+
let f;
|
|
189
|
+
if (typeof s.getAuthenticatorData == "function")
|
|
190
190
|
try {
|
|
191
|
-
|
|
192
|
-
} catch (
|
|
193
|
-
|
|
191
|
+
f = _(s.getAuthenticatorData());
|
|
192
|
+
} catch (l) {
|
|
193
|
+
he("getAuthenticatorData()", l);
|
|
194
194
|
}
|
|
195
195
|
return {
|
|
196
196
|
id: a,
|
|
197
|
-
rawId:
|
|
197
|
+
rawId: _(o),
|
|
198
198
|
response: {
|
|
199
|
-
attestationObject:
|
|
200
|
-
clientDataJSON:
|
|
199
|
+
attestationObject: _(s.attestationObject),
|
|
200
|
+
clientDataJSON: _(s.clientDataJSON),
|
|
201
201
|
transports: c,
|
|
202
|
-
publicKeyAlgorithm:
|
|
203
|
-
publicKey:
|
|
204
|
-
authenticatorData:
|
|
202
|
+
publicKeyAlgorithm: u,
|
|
203
|
+
publicKey: p,
|
|
204
|
+
authenticatorData: f
|
|
205
205
|
},
|
|
206
206
|
type: i,
|
|
207
|
-
clientExtensionResults:
|
|
208
|
-
authenticatorAttachment:
|
|
207
|
+
clientExtensionResults: n.getClientExtensionResults(),
|
|
208
|
+
authenticatorAttachment: Ye(n.authenticatorAttachment)
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function he(e, t) {
|
|
212
212
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
|
|
213
213
|
`, t);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
if (!
|
|
215
|
+
function kt() {
|
|
216
|
+
if (!Se())
|
|
217
217
|
return new Promise((t) => t(!1));
|
|
218
218
|
const e = window.PublicKeyCredential;
|
|
219
219
|
return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
const { publicKey:
|
|
223
|
-
if (!
|
|
221
|
+
function Pt({ error: e, options: t }) {
|
|
222
|
+
const { publicKey: r } = t;
|
|
223
|
+
if (!r)
|
|
224
224
|
throw Error("options was missing required publicKey property");
|
|
225
225
|
if (e.name === "AbortError") {
|
|
226
226
|
if (t.signal instanceof AbortSignal)
|
|
227
|
-
return new
|
|
227
|
+
return new w({
|
|
228
228
|
message: "Authentication ceremony was sent an abort signal",
|
|
229
229
|
code: "ERROR_CEREMONY_ABORTED",
|
|
230
230
|
cause: e
|
|
231
231
|
});
|
|
232
232
|
} else {
|
|
233
233
|
if (e.name === "NotAllowedError")
|
|
234
|
-
return new
|
|
234
|
+
return new w({
|
|
235
235
|
message: e.message,
|
|
236
236
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
237
237
|
cause: e
|
|
238
238
|
});
|
|
239
239
|
if (e.name === "SecurityError") {
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
if (
|
|
243
|
-
return new
|
|
244
|
-
message: `The RP ID "${
|
|
240
|
+
const n = window.location.hostname;
|
|
241
|
+
if (xe(n)) {
|
|
242
|
+
if (r.rpId !== n)
|
|
243
|
+
return new w({
|
|
244
|
+
message: `The RP ID "${r.rpId}" is invalid for this domain`,
|
|
245
245
|
code: "ERROR_INVALID_RP_ID",
|
|
246
246
|
cause: e
|
|
247
247
|
});
|
|
248
|
-
} else return new
|
|
248
|
+
} else return new w({
|
|
249
249
|
message: `${window.location.hostname} is an invalid domain`,
|
|
250
250
|
code: "ERROR_INVALID_DOMAIN",
|
|
251
251
|
cause: e
|
|
252
252
|
});
|
|
253
253
|
} else if (e.name === "UnknownError")
|
|
254
|
-
return new
|
|
254
|
+
return new w({
|
|
255
255
|
message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
|
|
256
256
|
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
257
257
|
cause: e
|
|
@@ -259,71 +259,71 @@ function Yt({ error: e, options: t }) {
|
|
|
259
259
|
}
|
|
260
260
|
return e;
|
|
261
261
|
}
|
|
262
|
-
async function
|
|
263
|
-
if (!
|
|
262
|
+
async function Ct(e, t = !1) {
|
|
263
|
+
if (!Se())
|
|
264
264
|
throw new Error("WebAuthn is not supported in this browser");
|
|
265
|
-
let
|
|
266
|
-
e.allowCredentials?.length !== 0 && (
|
|
267
|
-
const
|
|
265
|
+
let r;
|
|
266
|
+
e.allowCredentials?.length !== 0 && (r = e.allowCredentials?.map(We));
|
|
267
|
+
const n = {
|
|
268
268
|
...e,
|
|
269
|
-
challenge:
|
|
270
|
-
allowCredentials:
|
|
269
|
+
challenge: re(e.challenge),
|
|
270
|
+
allowCredentials: r
|
|
271
271
|
}, a = {};
|
|
272
272
|
if (t) {
|
|
273
|
-
if (!await
|
|
273
|
+
if (!await kt())
|
|
274
274
|
throw Error("Browser does not support WebAuthn autofill");
|
|
275
275
|
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
|
|
276
276
|
throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
|
|
277
|
-
a.mediation = "conditional",
|
|
277
|
+
a.mediation = "conditional", n.allowCredentials = [];
|
|
278
278
|
}
|
|
279
|
-
a.publicKey =
|
|
280
|
-
let
|
|
279
|
+
a.publicKey = n, a.signal = Je.createNewAbortSignal();
|
|
280
|
+
let o;
|
|
281
281
|
try {
|
|
282
|
-
|
|
283
|
-
} catch (
|
|
284
|
-
throw
|
|
282
|
+
o = await navigator.credentials.get(a);
|
|
283
|
+
} catch (f) {
|
|
284
|
+
throw Pt({ error: f, options: a });
|
|
285
285
|
}
|
|
286
|
-
if (!
|
|
286
|
+
if (!o)
|
|
287
287
|
throw new Error("Authentication was not completed");
|
|
288
|
-
const { id:
|
|
289
|
-
let
|
|
290
|
-
return c.userHandle && (
|
|
291
|
-
id:
|
|
292
|
-
rawId:
|
|
288
|
+
const { id: s, rawId: i, response: c, type: u } = o;
|
|
289
|
+
let p;
|
|
290
|
+
return c.userHandle && (p = _(c.userHandle)), {
|
|
291
|
+
id: s,
|
|
292
|
+
rawId: _(i),
|
|
293
293
|
response: {
|
|
294
|
-
authenticatorData:
|
|
295
|
-
clientDataJSON:
|
|
296
|
-
signature:
|
|
297
|
-
userHandle:
|
|
294
|
+
authenticatorData: _(c.authenticatorData),
|
|
295
|
+
clientDataJSON: _(c.clientDataJSON),
|
|
296
|
+
signature: _(c.signature),
|
|
297
|
+
userHandle: p
|
|
298
298
|
},
|
|
299
|
-
type:
|
|
300
|
-
clientExtensionResults:
|
|
301
|
-
authenticatorAttachment:
|
|
299
|
+
type: u,
|
|
300
|
+
clientExtensionResults: o.getClientExtensionResults(),
|
|
301
|
+
authenticatorAttachment: Ye(o.authenticatorAttachment)
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
304
|
/*!
|
|
305
|
-
@versini/auth-common
|
|
305
|
+
@versini/auth-common v4.0.0
|
|
306
306
|
© 2024 gizmette.com
|
|
307
307
|
*/
|
|
308
308
|
try {
|
|
309
309
|
window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
|
|
310
|
-
version: "
|
|
311
|
-
buildTime: "
|
|
310
|
+
version: "4.0.0",
|
|
311
|
+
buildTime: "08/19/2024 06:11 PM EDT",
|
|
312
312
|
homepage: "https://github.com/aversini/auth-client",
|
|
313
313
|
license: "MIT"
|
|
314
314
|
});
|
|
315
315
|
} catch {
|
|
316
316
|
}
|
|
317
|
-
const
|
|
317
|
+
const oe = {
|
|
318
318
|
ID_TOKEN: "id_token",
|
|
319
319
|
ACCESS_TOKEN: "token",
|
|
320
320
|
ID_AND_ACCESS_TOKEN: "id_token token",
|
|
321
321
|
CODE: "code",
|
|
322
322
|
REFRESH_TOKEN: "refresh_token",
|
|
323
323
|
PASSKEY: "passkey"
|
|
324
|
-
},
|
|
324
|
+
}, Ge = {
|
|
325
325
|
CLIENT_ID: "X-Auth-ClientId"
|
|
326
|
-
},
|
|
326
|
+
}, S = {
|
|
327
327
|
ALG: "RS256",
|
|
328
328
|
USER_ID_KEY: "sub",
|
|
329
329
|
TOKEN_ID_KEY: "__raw",
|
|
@@ -333,8 +333,9 @@ const G = {
|
|
|
333
333
|
EXPIRES_AT_KEY: "exp",
|
|
334
334
|
CREATED_AT_KEY: "iat",
|
|
335
335
|
SCOPES_KEY: "scopes",
|
|
336
|
+
CLIENT_ID_KEY: "aud",
|
|
336
337
|
ISSUER: "gizmette.com"
|
|
337
|
-
},
|
|
338
|
+
}, Nt = `-----BEGIN PUBLIC KEY-----
|
|
338
339
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
|
|
339
340
|
w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
|
|
340
341
|
i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
|
|
@@ -342,56 +343,59 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
|
|
|
342
343
|
l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
|
|
343
344
|
sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
|
|
344
345
|
awIDAQAB
|
|
345
|
-
-----END PUBLIC KEY-----`,
|
|
346
|
-
AUTHENTICATE: "authenticate",
|
|
346
|
+
-----END PUBLIC KEY-----`, ie = {
|
|
347
347
|
CODE: "code",
|
|
348
|
-
LOGOUT: "logout"
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
348
|
+
LOGOUT: "logout",
|
|
349
|
+
LOGIN: "login",
|
|
350
|
+
REFRESH: "refresh"
|
|
351
|
+
}, ce = crypto, Me = (e) => e instanceof CryptoKey, F = new TextEncoder(), G = new TextDecoder();
|
|
352
|
+
function Dt(...e) {
|
|
353
|
+
const t = e.reduce((a, { length: o }) => a + o, 0), r = new Uint8Array(t);
|
|
354
|
+
let n = 0;
|
|
353
355
|
for (const a of e)
|
|
354
|
-
|
|
355
|
-
return
|
|
356
|
+
r.set(a, n), n += a.length;
|
|
357
|
+
return r;
|
|
356
358
|
}
|
|
357
|
-
const
|
|
358
|
-
const t = atob(e),
|
|
359
|
-
for (let
|
|
360
|
-
n
|
|
361
|
-
return
|
|
362
|
-
},
|
|
359
|
+
const Ut = (e) => {
|
|
360
|
+
const t = atob(e), r = new Uint8Array(t.length);
|
|
361
|
+
for (let n = 0; n < t.length; n++)
|
|
362
|
+
r[n] = t.charCodeAt(n);
|
|
363
|
+
return r;
|
|
364
|
+
}, Y = (e) => {
|
|
363
365
|
let t = e;
|
|
364
|
-
t instanceof Uint8Array && (t =
|
|
366
|
+
t instanceof Uint8Array && (t = G.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
365
367
|
try {
|
|
366
|
-
return
|
|
368
|
+
return Ut(t);
|
|
367
369
|
} catch {
|
|
368
370
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
369
371
|
}
|
|
370
372
|
};
|
|
371
|
-
|
|
373
|
+
class D extends Error {
|
|
372
374
|
static get code() {
|
|
373
375
|
return "ERR_JOSE_GENERIC";
|
|
374
376
|
}
|
|
375
377
|
constructor(t) {
|
|
376
|
-
var
|
|
377
|
-
super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (
|
|
378
|
+
var r;
|
|
379
|
+
super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
|
|
378
380
|
}
|
|
379
|
-
}
|
|
381
|
+
}
|
|
382
|
+
class R extends D {
|
|
380
383
|
static get code() {
|
|
381
384
|
return "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
382
385
|
}
|
|
383
|
-
constructor(t,
|
|
384
|
-
super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim =
|
|
386
|
+
constructor(t, r, n = "unspecified", a = "unspecified") {
|
|
387
|
+
super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = n, this.reason = a, this.payload = r;
|
|
385
388
|
}
|
|
386
|
-
}
|
|
389
|
+
}
|
|
390
|
+
class Oe extends D {
|
|
387
391
|
static get code() {
|
|
388
392
|
return "ERR_JWT_EXPIRED";
|
|
389
393
|
}
|
|
390
|
-
constructor(t,
|
|
391
|
-
super(t), this.code = "ERR_JWT_EXPIRED", this.claim =
|
|
394
|
+
constructor(t, r, n = "unspecified", a = "unspecified") {
|
|
395
|
+
super(t), this.code = "ERR_JWT_EXPIRED", this.claim = n, this.reason = a, this.payload = r;
|
|
392
396
|
}
|
|
393
|
-
}
|
|
394
|
-
class
|
|
397
|
+
}
|
|
398
|
+
class Kt extends D {
|
|
395
399
|
constructor() {
|
|
396
400
|
super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
397
401
|
}
|
|
@@ -399,15 +403,15 @@ class qt extends $ {
|
|
|
399
403
|
return "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
400
404
|
}
|
|
401
405
|
}
|
|
402
|
-
|
|
406
|
+
class k extends D {
|
|
403
407
|
constructor() {
|
|
404
408
|
super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
|
|
405
409
|
}
|
|
406
410
|
static get code() {
|
|
407
411
|
return "ERR_JOSE_NOT_SUPPORTED";
|
|
408
412
|
}
|
|
409
|
-
}
|
|
410
|
-
class
|
|
413
|
+
}
|
|
414
|
+
class m extends D {
|
|
411
415
|
constructor() {
|
|
412
416
|
super(...arguments), this.code = "ERR_JWS_INVALID";
|
|
413
417
|
}
|
|
@@ -415,7 +419,7 @@ class A extends $ {
|
|
|
415
419
|
return "ERR_JWS_INVALID";
|
|
416
420
|
}
|
|
417
421
|
}
|
|
418
|
-
let
|
|
422
|
+
let O = class extends D {
|
|
419
423
|
constructor() {
|
|
420
424
|
super(...arguments), this.code = "ERR_JWT_INVALID";
|
|
421
425
|
}
|
|
@@ -423,7 +427,7 @@ let k = class extends $ {
|
|
|
423
427
|
return "ERR_JWT_INVALID";
|
|
424
428
|
}
|
|
425
429
|
};
|
|
426
|
-
class
|
|
430
|
+
class Lt extends D {
|
|
427
431
|
constructor() {
|
|
428
432
|
super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
|
|
429
433
|
}
|
|
@@ -431,16 +435,16 @@ class zt extends $ {
|
|
|
431
435
|
return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
432
436
|
}
|
|
433
437
|
}
|
|
434
|
-
function
|
|
438
|
+
function b(e, t = "algorithm.name") {
|
|
435
439
|
return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
|
|
436
440
|
}
|
|
437
|
-
function
|
|
441
|
+
function B(e, t) {
|
|
438
442
|
return e.name === t;
|
|
439
443
|
}
|
|
440
|
-
function
|
|
444
|
+
function pe(e) {
|
|
441
445
|
return parseInt(e.name.slice(4), 10);
|
|
442
446
|
}
|
|
443
|
-
function
|
|
447
|
+
function $t(e) {
|
|
444
448
|
switch (e) {
|
|
445
449
|
case "ES256":
|
|
446
450
|
return "P-256";
|
|
@@ -452,104 +456,104 @@ function Qt(e) {
|
|
|
452
456
|
throw new Error("unreachable");
|
|
453
457
|
}
|
|
454
458
|
}
|
|
455
|
-
function
|
|
456
|
-
if (t.length && !t.some((
|
|
457
|
-
let
|
|
459
|
+
function Ht(e, t) {
|
|
460
|
+
if (t.length && !t.some((r) => e.usages.includes(r))) {
|
|
461
|
+
let r = "CryptoKey does not support this operation, its usages must include ";
|
|
458
462
|
if (t.length > 2) {
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
} else t.length === 2 ?
|
|
462
|
-
throw new TypeError(
|
|
463
|
+
const n = t.pop();
|
|
464
|
+
r += `one of ${t.join(", ")}, or ${n}.`;
|
|
465
|
+
} else t.length === 2 ? r += `one of ${t[0]} or ${t[1]}.` : r += `${t[0]}.`;
|
|
466
|
+
throw new TypeError(r);
|
|
463
467
|
}
|
|
464
468
|
}
|
|
465
|
-
function
|
|
469
|
+
function Wt(e, t, ...r) {
|
|
466
470
|
switch (t) {
|
|
467
471
|
case "HS256":
|
|
468
472
|
case "HS384":
|
|
469
473
|
case "HS512": {
|
|
470
|
-
if (!
|
|
471
|
-
throw
|
|
472
|
-
const
|
|
473
|
-
if (
|
|
474
|
-
throw
|
|
474
|
+
if (!B(e.algorithm, "HMAC"))
|
|
475
|
+
throw b("HMAC");
|
|
476
|
+
const n = parseInt(t.slice(2), 10);
|
|
477
|
+
if (pe(e.algorithm.hash) !== n)
|
|
478
|
+
throw b(`SHA-${n}`, "algorithm.hash");
|
|
475
479
|
break;
|
|
476
480
|
}
|
|
477
481
|
case "RS256":
|
|
478
482
|
case "RS384":
|
|
479
483
|
case "RS512": {
|
|
480
|
-
if (!
|
|
481
|
-
throw
|
|
482
|
-
const
|
|
483
|
-
if (
|
|
484
|
-
throw
|
|
484
|
+
if (!B(e.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
485
|
+
throw b("RSASSA-PKCS1-v1_5");
|
|
486
|
+
const n = parseInt(t.slice(2), 10);
|
|
487
|
+
if (pe(e.algorithm.hash) !== n)
|
|
488
|
+
throw b(`SHA-${n}`, "algorithm.hash");
|
|
485
489
|
break;
|
|
486
490
|
}
|
|
487
491
|
case "PS256":
|
|
488
492
|
case "PS384":
|
|
489
493
|
case "PS512": {
|
|
490
|
-
if (!
|
|
491
|
-
throw
|
|
492
|
-
const
|
|
493
|
-
if (
|
|
494
|
-
throw
|
|
494
|
+
if (!B(e.algorithm, "RSA-PSS"))
|
|
495
|
+
throw b("RSA-PSS");
|
|
496
|
+
const n = parseInt(t.slice(2), 10);
|
|
497
|
+
if (pe(e.algorithm.hash) !== n)
|
|
498
|
+
throw b(`SHA-${n}`, "algorithm.hash");
|
|
495
499
|
break;
|
|
496
500
|
}
|
|
497
501
|
case "EdDSA": {
|
|
498
502
|
if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
|
|
499
|
-
throw
|
|
503
|
+
throw b("Ed25519 or Ed448");
|
|
500
504
|
break;
|
|
501
505
|
}
|
|
502
506
|
case "ES256":
|
|
503
507
|
case "ES384":
|
|
504
508
|
case "ES512": {
|
|
505
|
-
if (!
|
|
506
|
-
throw
|
|
507
|
-
const
|
|
508
|
-
if (e.algorithm.namedCurve !==
|
|
509
|
-
throw
|
|
509
|
+
if (!B(e.algorithm, "ECDSA"))
|
|
510
|
+
throw b("ECDSA");
|
|
511
|
+
const n = $t(t);
|
|
512
|
+
if (e.algorithm.namedCurve !== n)
|
|
513
|
+
throw b(n, "algorithm.namedCurve");
|
|
510
514
|
break;
|
|
511
515
|
}
|
|
512
516
|
default:
|
|
513
517
|
throw new TypeError("CryptoKey does not support this operation");
|
|
514
518
|
}
|
|
515
|
-
|
|
519
|
+
Ht(e, r);
|
|
516
520
|
}
|
|
517
|
-
function
|
|
518
|
-
var
|
|
519
|
-
if (
|
|
520
|
-
const a =
|
|
521
|
-
e += `one of type ${
|
|
522
|
-
} else
|
|
523
|
-
return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (
|
|
521
|
+
function Ve(e, t, ...r) {
|
|
522
|
+
var n;
|
|
523
|
+
if (r.length > 2) {
|
|
524
|
+
const a = r.pop();
|
|
525
|
+
e += `one of type ${r.join(", ")}, or ${a}.`;
|
|
526
|
+
} else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
|
|
527
|
+
return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (n = t.constructor) != null && n.name && (e += ` Received an instance of ${t.constructor.name}`), e;
|
|
524
528
|
}
|
|
525
|
-
const
|
|
526
|
-
function
|
|
527
|
-
return
|
|
529
|
+
const ve = (e, ...t) => Ve("Key must be ", e, ...t);
|
|
530
|
+
function je(e, t, ...r) {
|
|
531
|
+
return Ve(`Key for the ${e} algorithm must be `, t, ...r);
|
|
528
532
|
}
|
|
529
|
-
const
|
|
533
|
+
const Fe = (e) => Me(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ne = ["CryptoKey"], xt = (...e) => {
|
|
530
534
|
const t = e.filter(Boolean);
|
|
531
535
|
if (t.length === 0 || t.length === 1)
|
|
532
536
|
return !0;
|
|
533
|
-
let
|
|
534
|
-
for (const
|
|
535
|
-
const a = Object.keys(
|
|
536
|
-
if (!
|
|
537
|
-
|
|
537
|
+
let r;
|
|
538
|
+
for (const n of t) {
|
|
539
|
+
const a = Object.keys(n);
|
|
540
|
+
if (!r || r.size === 0) {
|
|
541
|
+
r = new Set(a);
|
|
538
542
|
continue;
|
|
539
543
|
}
|
|
540
|
-
for (const
|
|
541
|
-
if (
|
|
544
|
+
for (const o of a) {
|
|
545
|
+
if (r.has(o))
|
|
542
546
|
return !1;
|
|
543
|
-
|
|
547
|
+
r.add(o);
|
|
544
548
|
}
|
|
545
549
|
}
|
|
546
550
|
return !0;
|
|
547
551
|
};
|
|
548
|
-
function
|
|
552
|
+
function Jt(e) {
|
|
549
553
|
return typeof e == "object" && e !== null;
|
|
550
554
|
}
|
|
551
|
-
function
|
|
552
|
-
if (!
|
|
555
|
+
function ae(e) {
|
|
556
|
+
if (!Jt(e) || Object.prototype.toString.call(e) !== "[object Object]")
|
|
553
557
|
return !1;
|
|
554
558
|
if (Object.getPrototypeOf(e) === null)
|
|
555
559
|
return !0;
|
|
@@ -558,27 +562,27 @@ function le(e) {
|
|
|
558
562
|
t = Object.getPrototypeOf(t);
|
|
559
563
|
return Object.getPrototypeOf(e) === t;
|
|
560
564
|
}
|
|
561
|
-
const
|
|
565
|
+
const Yt = (e, t) => {
|
|
562
566
|
if (e.startsWith("RS") || e.startsWith("PS")) {
|
|
563
|
-
const { modulusLength:
|
|
564
|
-
if (typeof
|
|
567
|
+
const { modulusLength: r } = t.algorithm;
|
|
568
|
+
if (typeof r != "number" || r < 2048)
|
|
565
569
|
throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
|
|
566
570
|
}
|
|
567
571
|
};
|
|
568
|
-
function
|
|
569
|
-
let t,
|
|
572
|
+
function Gt(e) {
|
|
573
|
+
let t, r;
|
|
570
574
|
switch (e.kty) {
|
|
571
575
|
case "RSA": {
|
|
572
576
|
switch (e.alg) {
|
|
573
577
|
case "PS256":
|
|
574
578
|
case "PS384":
|
|
575
579
|
case "PS512":
|
|
576
|
-
t = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` },
|
|
580
|
+
t = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
|
|
577
581
|
break;
|
|
578
582
|
case "RS256":
|
|
579
583
|
case "RS384":
|
|
580
584
|
case "RS512":
|
|
581
|
-
t = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` },
|
|
585
|
+
t = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
|
|
582
586
|
break;
|
|
583
587
|
case "RSA-OAEP":
|
|
584
588
|
case "RSA-OAEP-256":
|
|
@@ -587,595 +591,595 @@ function rn(e) {
|
|
|
587
591
|
t = {
|
|
588
592
|
name: "RSA-OAEP",
|
|
589
593
|
hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
|
|
590
|
-
},
|
|
594
|
+
}, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
591
595
|
break;
|
|
592
596
|
default:
|
|
593
|
-
throw new
|
|
597
|
+
throw new k('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
594
598
|
}
|
|
595
599
|
break;
|
|
596
600
|
}
|
|
597
601
|
case "EC": {
|
|
598
602
|
switch (e.alg) {
|
|
599
603
|
case "ES256":
|
|
600
|
-
t = { name: "ECDSA", namedCurve: "P-256" },
|
|
604
|
+
t = { name: "ECDSA", namedCurve: "P-256" }, r = e.d ? ["sign"] : ["verify"];
|
|
601
605
|
break;
|
|
602
606
|
case "ES384":
|
|
603
|
-
t = { name: "ECDSA", namedCurve: "P-384" },
|
|
607
|
+
t = { name: "ECDSA", namedCurve: "P-384" }, r = e.d ? ["sign"] : ["verify"];
|
|
604
608
|
break;
|
|
605
609
|
case "ES512":
|
|
606
|
-
t = { name: "ECDSA", namedCurve: "P-521" },
|
|
610
|
+
t = { name: "ECDSA", namedCurve: "P-521" }, r = e.d ? ["sign"] : ["verify"];
|
|
607
611
|
break;
|
|
608
612
|
case "ECDH-ES":
|
|
609
613
|
case "ECDH-ES+A128KW":
|
|
610
614
|
case "ECDH-ES+A192KW":
|
|
611
615
|
case "ECDH-ES+A256KW":
|
|
612
|
-
t = { name: "ECDH", namedCurve: e.crv },
|
|
616
|
+
t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
|
|
613
617
|
break;
|
|
614
618
|
default:
|
|
615
|
-
throw new
|
|
619
|
+
throw new k('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
616
620
|
}
|
|
617
621
|
break;
|
|
618
622
|
}
|
|
619
623
|
case "OKP": {
|
|
620
624
|
switch (e.alg) {
|
|
621
625
|
case "EdDSA":
|
|
622
|
-
t = { name: e.crv },
|
|
626
|
+
t = { name: e.crv }, r = e.d ? ["sign"] : ["verify"];
|
|
623
627
|
break;
|
|
624
628
|
case "ECDH-ES":
|
|
625
629
|
case "ECDH-ES+A128KW":
|
|
626
630
|
case "ECDH-ES+A192KW":
|
|
627
631
|
case "ECDH-ES+A256KW":
|
|
628
|
-
t = { name: e.crv },
|
|
632
|
+
t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
|
|
629
633
|
break;
|
|
630
634
|
default:
|
|
631
|
-
throw new
|
|
635
|
+
throw new k('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
632
636
|
}
|
|
633
637
|
break;
|
|
634
638
|
}
|
|
635
639
|
default:
|
|
636
|
-
throw new
|
|
640
|
+
throw new k('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
637
641
|
}
|
|
638
|
-
return { algorithm: t, keyUsages:
|
|
642
|
+
return { algorithm: t, keyUsages: r };
|
|
639
643
|
}
|
|
640
|
-
const
|
|
644
|
+
const Mt = async (e) => {
|
|
641
645
|
if (!e.alg)
|
|
642
646
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
643
|
-
const { algorithm: t, keyUsages:
|
|
647
|
+
const { algorithm: t, keyUsages: r } = Gt(e), n = [
|
|
644
648
|
t,
|
|
645
649
|
e.ext ?? !1,
|
|
646
|
-
e.key_ops ??
|
|
650
|
+
e.key_ops ?? r
|
|
647
651
|
], a = { ...e };
|
|
648
|
-
return delete a.alg, delete a.use,
|
|
649
|
-
},
|
|
650
|
-
let
|
|
651
|
-
const
|
|
652
|
+
return delete a.alg, delete a.use, ce.subtle.importKey("jwk", a, ...n);
|
|
653
|
+
}, Be = (e) => Y(e);
|
|
654
|
+
let fe, ye;
|
|
655
|
+
const qe = (e) => e?.[Symbol.toStringTag] === "KeyObject", ze = async (e, t, r, n) => {
|
|
652
656
|
let a = e.get(t);
|
|
653
|
-
if (a != null && a[
|
|
654
|
-
return a[
|
|
655
|
-
const
|
|
656
|
-
return a ? a[
|
|
657
|
-
},
|
|
658
|
-
if (
|
|
659
|
-
let
|
|
660
|
-
return delete
|
|
657
|
+
if (a != null && a[n])
|
|
658
|
+
return a[n];
|
|
659
|
+
const o = await Mt({ ...r, alg: n });
|
|
660
|
+
return a ? a[n] = o : e.set(t, { [n]: o }), o;
|
|
661
|
+
}, Vt = (e, t) => {
|
|
662
|
+
if (qe(e)) {
|
|
663
|
+
let r = e.export({ format: "jwk" });
|
|
664
|
+
return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Be(r.k) : (ye || (ye = /* @__PURE__ */ new WeakMap()), ze(ye, e, r, t));
|
|
661
665
|
}
|
|
662
666
|
return e;
|
|
663
|
-
},
|
|
664
|
-
if (
|
|
665
|
-
let
|
|
666
|
-
return
|
|
667
|
+
}, jt = (e, t) => {
|
|
668
|
+
if (qe(e)) {
|
|
669
|
+
let r = e.export({ format: "jwk" });
|
|
670
|
+
return r.k ? Be(r.k) : (fe || (fe = /* @__PURE__ */ new WeakMap()), ze(fe, e, r, t));
|
|
667
671
|
}
|
|
668
672
|
return e;
|
|
669
|
-
},
|
|
670
|
-
|
|
671
|
-
const
|
|
672
|
-
if (
|
|
673
|
+
}, Ft = { normalizePublicKey: Vt, normalizePrivateKey: jt }, v = (e, t, r = 0) => {
|
|
674
|
+
r === 0 && (t.unshift(t.length), t.unshift(6));
|
|
675
|
+
const n = e.indexOf(t[0], r);
|
|
676
|
+
if (n === -1)
|
|
673
677
|
return !1;
|
|
674
|
-
const a = e.subarray(
|
|
675
|
-
return a.length !== t.length ? !1 : a.every((
|
|
676
|
-
},
|
|
678
|
+
const a = e.subarray(n, n + t.length);
|
|
679
|
+
return a.length !== t.length ? !1 : a.every((o, s) => o === t[s]) || v(e, t, n + 1);
|
|
680
|
+
}, ke = (e) => {
|
|
677
681
|
switch (!0) {
|
|
678
|
-
case
|
|
682
|
+
case v(e, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
679
683
|
return "P-256";
|
|
680
|
-
case
|
|
684
|
+
case v(e, [43, 129, 4, 0, 34]):
|
|
681
685
|
return "P-384";
|
|
682
|
-
case
|
|
686
|
+
case v(e, [43, 129, 4, 0, 35]):
|
|
683
687
|
return "P-521";
|
|
684
|
-
case
|
|
688
|
+
case v(e, [43, 101, 110]):
|
|
685
689
|
return "X25519";
|
|
686
|
-
case
|
|
690
|
+
case v(e, [43, 101, 111]):
|
|
687
691
|
return "X448";
|
|
688
|
-
case
|
|
692
|
+
case v(e, [43, 101, 112]):
|
|
689
693
|
return "Ed25519";
|
|
690
|
-
case
|
|
694
|
+
case v(e, [43, 101, 113]):
|
|
691
695
|
return "Ed448";
|
|
692
696
|
default:
|
|
693
|
-
throw new
|
|
697
|
+
throw new k("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
|
|
694
698
|
}
|
|
695
|
-
},
|
|
696
|
-
let
|
|
697
|
-
const i = new Uint8Array(atob(
|
|
698
|
-
switch (
|
|
699
|
+
}, Bt = async (e, t, r, n, a) => {
|
|
700
|
+
let o, s;
|
|
701
|
+
const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
|
|
702
|
+
switch (n) {
|
|
699
703
|
case "PS256":
|
|
700
704
|
case "PS384":
|
|
701
705
|
case "PS512":
|
|
702
|
-
|
|
706
|
+
o = { name: "RSA-PSS", hash: `SHA-${n.slice(-3)}` }, s = ["verify"];
|
|
703
707
|
break;
|
|
704
708
|
case "RS256":
|
|
705
709
|
case "RS384":
|
|
706
710
|
case "RS512":
|
|
707
|
-
|
|
711
|
+
o = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${n.slice(-3)}` }, s = ["verify"];
|
|
708
712
|
break;
|
|
709
713
|
case "RSA-OAEP":
|
|
710
714
|
case "RSA-OAEP-256":
|
|
711
715
|
case "RSA-OAEP-384":
|
|
712
716
|
case "RSA-OAEP-512":
|
|
713
|
-
|
|
717
|
+
o = {
|
|
714
718
|
name: "RSA-OAEP",
|
|
715
|
-
hash: `SHA-${parseInt(
|
|
716
|
-
},
|
|
719
|
+
hash: `SHA-${parseInt(n.slice(-3), 10) || 1}`
|
|
720
|
+
}, s = ["encrypt", "wrapKey"];
|
|
717
721
|
break;
|
|
718
722
|
case "ES256":
|
|
719
|
-
|
|
723
|
+
o = { name: "ECDSA", namedCurve: "P-256" }, s = ["verify"];
|
|
720
724
|
break;
|
|
721
725
|
case "ES384":
|
|
722
|
-
|
|
726
|
+
o = { name: "ECDSA", namedCurve: "P-384" }, s = ["verify"];
|
|
723
727
|
break;
|
|
724
728
|
case "ES512":
|
|
725
|
-
|
|
729
|
+
o = { name: "ECDSA", namedCurve: "P-521" }, s = ["verify"];
|
|
726
730
|
break;
|
|
727
731
|
case "ECDH-ES":
|
|
728
732
|
case "ECDH-ES+A128KW":
|
|
729
733
|
case "ECDH-ES+A192KW":
|
|
730
734
|
case "ECDH-ES+A256KW": {
|
|
731
|
-
const c =
|
|
732
|
-
|
|
735
|
+
const c = ke(i);
|
|
736
|
+
o = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, s = [];
|
|
733
737
|
break;
|
|
734
738
|
}
|
|
735
739
|
case "EdDSA":
|
|
736
|
-
|
|
740
|
+
o = { name: ke(i) }, s = ["verify"];
|
|
737
741
|
break;
|
|
738
742
|
default:
|
|
739
|
-
throw new
|
|
743
|
+
throw new k('Invalid or unsupported "alg" (Algorithm) value');
|
|
740
744
|
}
|
|
741
|
-
return
|
|
742
|
-
},
|
|
743
|
-
async function
|
|
745
|
+
return ce.subtle.importKey(t, i, o, !1, s);
|
|
746
|
+
}, qt = (e, t, r) => Bt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
|
|
747
|
+
async function zt(e, t, r) {
|
|
744
748
|
if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
745
749
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
746
|
-
return
|
|
750
|
+
return qt(e, t);
|
|
747
751
|
}
|
|
748
|
-
const
|
|
752
|
+
const ee = (e) => e?.[Symbol.toStringTag], Qt = (e, t) => {
|
|
749
753
|
if (!(t instanceof Uint8Array)) {
|
|
750
|
-
if (!
|
|
751
|
-
throw new TypeError(
|
|
754
|
+
if (!Fe(t))
|
|
755
|
+
throw new TypeError(je(e, t, ...ne, "Uint8Array"));
|
|
752
756
|
if (t.type !== "secret")
|
|
753
|
-
throw new TypeError(`${
|
|
757
|
+
throw new TypeError(`${ee(t)} instances for symmetric algorithms must be of type "secret"`);
|
|
754
758
|
}
|
|
755
|
-
},
|
|
756
|
-
if (!
|
|
757
|
-
throw new TypeError(
|
|
759
|
+
}, Xt = (e, t, r) => {
|
|
760
|
+
if (!Fe(t))
|
|
761
|
+
throw new TypeError(je(e, t, ...ne));
|
|
758
762
|
if (t.type === "secret")
|
|
759
|
-
throw new TypeError(`${
|
|
760
|
-
if (t.algorithm &&
|
|
761
|
-
throw new TypeError(`${
|
|
762
|
-
if (t.algorithm &&
|
|
763
|
-
throw new TypeError(`${
|
|
764
|
-
},
|
|
765
|
-
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ?
|
|
763
|
+
throw new TypeError(`${ee(t)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
764
|
+
if (t.algorithm && r === "verify" && t.type === "private")
|
|
765
|
+
throw new TypeError(`${ee(t)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
766
|
+
if (t.algorithm && r === "encrypt" && t.type === "private")
|
|
767
|
+
throw new TypeError(`${ee(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
768
|
+
}, Zt = (e, t, r) => {
|
|
769
|
+
e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? Qt(e, t) : Xt(e, t, r);
|
|
766
770
|
};
|
|
767
|
-
function
|
|
768
|
-
if (a.crit !== void 0 &&
|
|
771
|
+
function er(e, t, r, n, a) {
|
|
772
|
+
if (a.crit !== void 0 && n?.crit === void 0)
|
|
769
773
|
throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
770
|
-
if (!
|
|
774
|
+
if (!n || n.crit === void 0)
|
|
771
775
|
return /* @__PURE__ */ new Set();
|
|
772
|
-
if (!Array.isArray(
|
|
776
|
+
if (!Array.isArray(n.crit) || n.crit.length === 0 || n.crit.some((s) => typeof s != "string" || s.length === 0))
|
|
773
777
|
throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
774
|
-
let
|
|
775
|
-
|
|
776
|
-
for (const
|
|
777
|
-
if (!
|
|
778
|
-
throw new
|
|
779
|
-
if (a[
|
|
780
|
-
throw new e(`Extension Header Parameter "${
|
|
781
|
-
if (
|
|
782
|
-
throw new e(`Extension Header Parameter "${
|
|
783
|
-
}
|
|
784
|
-
return new Set(
|
|
778
|
+
let o;
|
|
779
|
+
r !== void 0 ? o = new Map([...Object.entries(r), ...t.entries()]) : o = t;
|
|
780
|
+
for (const s of n.crit) {
|
|
781
|
+
if (!o.has(s))
|
|
782
|
+
throw new k(`Extension Header Parameter "${s}" is not recognized`);
|
|
783
|
+
if (a[s] === void 0)
|
|
784
|
+
throw new e(`Extension Header Parameter "${s}" is missing`);
|
|
785
|
+
if (o.get(s) && n[s] === void 0)
|
|
786
|
+
throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`);
|
|
787
|
+
}
|
|
788
|
+
return new Set(n.crit);
|
|
785
789
|
}
|
|
786
|
-
const
|
|
787
|
-
if (t !== void 0 && (!Array.isArray(t) || t.some((
|
|
790
|
+
const tr = (e, t) => {
|
|
791
|
+
if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
|
|
788
792
|
throw new TypeError(`"${e}" option must be an array of strings`);
|
|
789
793
|
if (t)
|
|
790
794
|
return new Set(t);
|
|
791
795
|
};
|
|
792
|
-
function
|
|
793
|
-
const
|
|
796
|
+
function rr(e, t) {
|
|
797
|
+
const r = `SHA-${e.slice(-3)}`;
|
|
794
798
|
switch (e) {
|
|
795
799
|
case "HS256":
|
|
796
800
|
case "HS384":
|
|
797
801
|
case "HS512":
|
|
798
|
-
return { hash:
|
|
802
|
+
return { hash: r, name: "HMAC" };
|
|
799
803
|
case "PS256":
|
|
800
804
|
case "PS384":
|
|
801
805
|
case "PS512":
|
|
802
|
-
return { hash:
|
|
806
|
+
return { hash: r, name: "RSA-PSS", saltLength: e.slice(-3) >> 3 };
|
|
803
807
|
case "RS256":
|
|
804
808
|
case "RS384":
|
|
805
809
|
case "RS512":
|
|
806
|
-
return { hash:
|
|
810
|
+
return { hash: r, name: "RSASSA-PKCS1-v1_5" };
|
|
807
811
|
case "ES256":
|
|
808
812
|
case "ES384":
|
|
809
813
|
case "ES512":
|
|
810
|
-
return { hash:
|
|
814
|
+
return { hash: r, name: "ECDSA", namedCurve: t.namedCurve };
|
|
811
815
|
case "EdDSA":
|
|
812
816
|
return { name: t.name };
|
|
813
817
|
default:
|
|
814
|
-
throw new
|
|
818
|
+
throw new k(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
815
819
|
}
|
|
816
820
|
}
|
|
817
|
-
async function
|
|
818
|
-
if (t = await
|
|
819
|
-
return
|
|
821
|
+
async function nr(e, t, r) {
|
|
822
|
+
if (t = await Ft.normalizePublicKey(t, e), Me(t))
|
|
823
|
+
return Wt(t, e, r), t;
|
|
820
824
|
if (t instanceof Uint8Array) {
|
|
821
825
|
if (!e.startsWith("HS"))
|
|
822
|
-
throw new TypeError(
|
|
823
|
-
return
|
|
826
|
+
throw new TypeError(ve(t, ...ne));
|
|
827
|
+
return ce.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
|
|
824
828
|
}
|
|
825
|
-
throw new TypeError(
|
|
829
|
+
throw new TypeError(ve(t, ...ne, "Uint8Array"));
|
|
826
830
|
}
|
|
827
|
-
const
|
|
828
|
-
const a = await
|
|
829
|
-
|
|
830
|
-
const
|
|
831
|
+
const ar = async (e, t, r, n) => {
|
|
832
|
+
const a = await nr(e, t, "verify");
|
|
833
|
+
Yt(e, a);
|
|
834
|
+
const o = rr(e, a.algorithm);
|
|
831
835
|
try {
|
|
832
|
-
return await
|
|
836
|
+
return await ce.subtle.verify(o, a, r, n);
|
|
833
837
|
} catch {
|
|
834
838
|
return !1;
|
|
835
839
|
}
|
|
836
840
|
};
|
|
837
|
-
async function
|
|
838
|
-
if (!
|
|
839
|
-
throw new
|
|
841
|
+
async function sr(e, t, r) {
|
|
842
|
+
if (!ae(e))
|
|
843
|
+
throw new m("Flattened JWS must be an object");
|
|
840
844
|
if (e.protected === void 0 && e.header === void 0)
|
|
841
|
-
throw new
|
|
845
|
+
throw new m('Flattened JWS must have either of the "protected" or "header" members');
|
|
842
846
|
if (e.protected !== void 0 && typeof e.protected != "string")
|
|
843
|
-
throw new
|
|
847
|
+
throw new m("JWS Protected Header incorrect type");
|
|
844
848
|
if (e.payload === void 0)
|
|
845
|
-
throw new
|
|
849
|
+
throw new m("JWS Payload missing");
|
|
846
850
|
if (typeof e.signature != "string")
|
|
847
|
-
throw new
|
|
848
|
-
if (e.header !== void 0 && !
|
|
849
|
-
throw new
|
|
850
|
-
let
|
|
851
|
+
throw new m("JWS Signature missing or incorrect type");
|
|
852
|
+
if (e.header !== void 0 && !ae(e.header))
|
|
853
|
+
throw new m("JWS Unprotected Header incorrect type");
|
|
854
|
+
let n = {};
|
|
851
855
|
if (e.protected)
|
|
852
856
|
try {
|
|
853
|
-
const
|
|
854
|
-
|
|
857
|
+
const T = Y(e.protected);
|
|
858
|
+
n = JSON.parse(G.decode(T));
|
|
855
859
|
} catch {
|
|
856
|
-
throw new
|
|
860
|
+
throw new m("JWS Protected Header is invalid");
|
|
857
861
|
}
|
|
858
|
-
if (!
|
|
859
|
-
throw new
|
|
862
|
+
if (!xt(n, e.header))
|
|
863
|
+
throw new m("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
860
864
|
const a = {
|
|
861
|
-
...
|
|
865
|
+
...n,
|
|
862
866
|
...e.header
|
|
863
|
-
},
|
|
864
|
-
let
|
|
865
|
-
if (
|
|
866
|
-
throw new
|
|
867
|
+
}, o = er(m, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, n, a);
|
|
868
|
+
let s = !0;
|
|
869
|
+
if (o.has("b64") && (s = n.b64, typeof s != "boolean"))
|
|
870
|
+
throw new m('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
867
871
|
const { alg: i } = a;
|
|
868
872
|
if (typeof i != "string" || !i)
|
|
869
|
-
throw new
|
|
870
|
-
const c =
|
|
873
|
+
throw new m('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
874
|
+
const c = r && tr("algorithms", r.algorithms);
|
|
871
875
|
if (c && !c.has(i))
|
|
872
|
-
throw new
|
|
873
|
-
if (
|
|
876
|
+
throw new Kt('"alg" (Algorithm) Header Parameter value not allowed');
|
|
877
|
+
if (s) {
|
|
874
878
|
if (typeof e.payload != "string")
|
|
875
|
-
throw new
|
|
879
|
+
throw new m("JWS Payload must be a string");
|
|
876
880
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
877
|
-
throw new
|
|
878
|
-
let
|
|
879
|
-
typeof t == "function" && (t = await t(
|
|
880
|
-
const
|
|
881
|
-
let
|
|
881
|
+
throw new m("JWS Payload must be a string or an Uint8Array instance");
|
|
882
|
+
let u = !1;
|
|
883
|
+
typeof t == "function" && (t = await t(n, e), u = !0), Zt(i, t, "verify");
|
|
884
|
+
const p = Dt(F.encode(e.protected ?? ""), F.encode("."), typeof e.payload == "string" ? F.encode(e.payload) : e.payload);
|
|
885
|
+
let f;
|
|
882
886
|
try {
|
|
883
|
-
|
|
887
|
+
f = Y(e.signature);
|
|
884
888
|
} catch {
|
|
885
|
-
throw new
|
|
889
|
+
throw new m("Failed to base64url decode the signature");
|
|
886
890
|
}
|
|
887
|
-
if (!await
|
|
888
|
-
throw new
|
|
889
|
-
let
|
|
890
|
-
if (
|
|
891
|
+
if (!await ar(i, t, f, p))
|
|
892
|
+
throw new Lt();
|
|
893
|
+
let l;
|
|
894
|
+
if (s)
|
|
891
895
|
try {
|
|
892
|
-
|
|
896
|
+
l = Y(e.payload);
|
|
893
897
|
} catch {
|
|
894
|
-
throw new
|
|
898
|
+
throw new m("Failed to base64url decode the payload");
|
|
895
899
|
}
|
|
896
|
-
else typeof e.payload == "string" ?
|
|
897
|
-
const
|
|
898
|
-
return e.protected !== void 0 && (
|
|
900
|
+
else typeof e.payload == "string" ? l = F.encode(e.payload) : l = e.payload;
|
|
901
|
+
const A = { payload: l };
|
|
902
|
+
return e.protected !== void 0 && (A.protectedHeader = n), e.header !== void 0 && (A.unprotectedHeader = e.header), u ? { ...A, key: t } : A;
|
|
899
903
|
}
|
|
900
|
-
async function
|
|
901
|
-
if (e instanceof Uint8Array && (e =
|
|
902
|
-
throw new
|
|
903
|
-
const { 0:
|
|
904
|
-
if (
|
|
905
|
-
throw new
|
|
906
|
-
const i = await
|
|
904
|
+
async function or(e, t, r) {
|
|
905
|
+
if (e instanceof Uint8Array && (e = G.decode(e)), typeof e != "string")
|
|
906
|
+
throw new m("Compact JWS must be a string or Uint8Array");
|
|
907
|
+
const { 0: n, 1: a, 2: o, length: s } = e.split(".");
|
|
908
|
+
if (s !== 3)
|
|
909
|
+
throw new m("Invalid Compact JWS");
|
|
910
|
+
const i = await sr({ payload: a, protected: n, signature: o }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
|
|
907
911
|
return typeof t == "function" ? { ...c, key: i.key } : c;
|
|
908
912
|
}
|
|
909
|
-
const
|
|
910
|
-
const t =
|
|
913
|
+
const ir = (e) => Math.floor(e.getTime() / 1e3), Qe = 60, Xe = Qe * 60, Ae = Xe * 24, cr = Ae * 7, ur = Ae * 365.25, lr = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Pe = (e) => {
|
|
914
|
+
const t = lr.exec(e);
|
|
911
915
|
if (!t || t[4] && t[1])
|
|
912
916
|
throw new TypeError("Invalid time period format");
|
|
913
|
-
const
|
|
917
|
+
const r = parseFloat(t[2]), n = t[3].toLowerCase();
|
|
914
918
|
let a;
|
|
915
|
-
switch (
|
|
919
|
+
switch (n) {
|
|
916
920
|
case "sec":
|
|
917
921
|
case "secs":
|
|
918
922
|
case "second":
|
|
919
923
|
case "seconds":
|
|
920
924
|
case "s":
|
|
921
|
-
a = Math.round(
|
|
925
|
+
a = Math.round(r);
|
|
922
926
|
break;
|
|
923
927
|
case "minute":
|
|
924
928
|
case "minutes":
|
|
925
929
|
case "min":
|
|
926
930
|
case "mins":
|
|
927
931
|
case "m":
|
|
928
|
-
a = Math.round(
|
|
932
|
+
a = Math.round(r * Qe);
|
|
929
933
|
break;
|
|
930
934
|
case "hour":
|
|
931
935
|
case "hours":
|
|
932
936
|
case "hr":
|
|
933
937
|
case "hrs":
|
|
934
938
|
case "h":
|
|
935
|
-
a = Math.round(
|
|
939
|
+
a = Math.round(r * Xe);
|
|
936
940
|
break;
|
|
937
941
|
case "day":
|
|
938
942
|
case "days":
|
|
939
943
|
case "d":
|
|
940
|
-
a = Math.round(
|
|
944
|
+
a = Math.round(r * Ae);
|
|
941
945
|
break;
|
|
942
946
|
case "week":
|
|
943
947
|
case "weeks":
|
|
944
948
|
case "w":
|
|
945
|
-
a = Math.round(
|
|
949
|
+
a = Math.round(r * cr);
|
|
946
950
|
break;
|
|
947
951
|
default:
|
|
948
|
-
a = Math.round(
|
|
952
|
+
a = Math.round(r * ur);
|
|
949
953
|
break;
|
|
950
954
|
}
|
|
951
955
|
return t[1] === "-" || t[4] === "ago" ? -a : a;
|
|
952
|
-
},
|
|
953
|
-
let
|
|
956
|
+
}, Ce = (e) => e.toLowerCase().replace(/^application\//, ""), dr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, hr = (e, t, r = {}) => {
|
|
957
|
+
let n;
|
|
954
958
|
try {
|
|
955
|
-
|
|
959
|
+
n = JSON.parse(G.decode(t));
|
|
956
960
|
} catch {
|
|
957
961
|
}
|
|
958
|
-
if (!
|
|
959
|
-
throw new
|
|
960
|
-
const { typ: a } =
|
|
961
|
-
if (a && (typeof e.typ != "string" ||
|
|
962
|
-
throw new
|
|
963
|
-
const { requiredClaims:
|
|
964
|
-
|
|
965
|
-
for (const
|
|
966
|
-
if (!(
|
|
967
|
-
throw new
|
|
968
|
-
if (
|
|
969
|
-
throw new
|
|
970
|
-
if (i &&
|
|
971
|
-
throw new
|
|
972
|
-
if (c && !
|
|
973
|
-
throw new
|
|
974
|
-
let
|
|
975
|
-
switch (typeof
|
|
962
|
+
if (!ae(n))
|
|
963
|
+
throw new O("JWT Claims Set must be a top-level JSON object");
|
|
964
|
+
const { typ: a } = r;
|
|
965
|
+
if (a && (typeof e.typ != "string" || Ce(e.typ) !== Ce(a)))
|
|
966
|
+
throw new R('unexpected "typ" JWT header value', n, "typ", "check_failed");
|
|
967
|
+
const { requiredClaims: o = [], issuer: s, subject: i, audience: c, maxTokenAge: u } = r, p = [...o];
|
|
968
|
+
u !== void 0 && p.push("iat"), c !== void 0 && p.push("aud"), i !== void 0 && p.push("sub"), s !== void 0 && p.push("iss");
|
|
969
|
+
for (const T of new Set(p.reverse()))
|
|
970
|
+
if (!(T in n))
|
|
971
|
+
throw new R(`missing required "${T}" claim`, n, T, "missing");
|
|
972
|
+
if (s && !(Array.isArray(s) ? s : [s]).includes(n.iss))
|
|
973
|
+
throw new R('unexpected "iss" claim value', n, "iss", "check_failed");
|
|
974
|
+
if (i && n.sub !== i)
|
|
975
|
+
throw new R('unexpected "sub" claim value', n, "sub", "check_failed");
|
|
976
|
+
if (c && !dr(n.aud, typeof c == "string" ? [c] : c))
|
|
977
|
+
throw new R('unexpected "aud" claim value', n, "aud", "check_failed");
|
|
978
|
+
let f;
|
|
979
|
+
switch (typeof r.clockTolerance) {
|
|
976
980
|
case "string":
|
|
977
|
-
|
|
981
|
+
f = Pe(r.clockTolerance);
|
|
978
982
|
break;
|
|
979
983
|
case "number":
|
|
980
|
-
|
|
984
|
+
f = r.clockTolerance;
|
|
981
985
|
break;
|
|
982
986
|
case "undefined":
|
|
983
|
-
|
|
987
|
+
f = 0;
|
|
984
988
|
break;
|
|
985
989
|
default:
|
|
986
990
|
throw new TypeError("Invalid clockTolerance option type");
|
|
987
991
|
}
|
|
988
|
-
const { currentDate:
|
|
989
|
-
if ((
|
|
990
|
-
throw new
|
|
991
|
-
if (
|
|
992
|
-
if (typeof
|
|
993
|
-
throw new
|
|
994
|
-
if (
|
|
995
|
-
throw new
|
|
996
|
-
}
|
|
997
|
-
if (
|
|
998
|
-
if (typeof
|
|
999
|
-
throw new
|
|
1000
|
-
if (
|
|
1001
|
-
throw new
|
|
992
|
+
const { currentDate: l } = r, A = ir(l || /* @__PURE__ */ new Date());
|
|
993
|
+
if ((n.iat !== void 0 || u) && typeof n.iat != "number")
|
|
994
|
+
throw new R('"iat" claim must be a number', n, "iat", "invalid");
|
|
995
|
+
if (n.nbf !== void 0) {
|
|
996
|
+
if (typeof n.nbf != "number")
|
|
997
|
+
throw new R('"nbf" claim must be a number', n, "nbf", "invalid");
|
|
998
|
+
if (n.nbf > A + f)
|
|
999
|
+
throw new R('"nbf" claim timestamp check failed', n, "nbf", "check_failed");
|
|
1000
|
+
}
|
|
1001
|
+
if (n.exp !== void 0) {
|
|
1002
|
+
if (typeof n.exp != "number")
|
|
1003
|
+
throw new R('"exp" claim must be a number', n, "exp", "invalid");
|
|
1004
|
+
if (n.exp <= A - f)
|
|
1005
|
+
throw new Oe('"exp" claim timestamp check failed', n, "exp", "check_failed");
|
|
1006
|
+
}
|
|
1007
|
+
if (u) {
|
|
1008
|
+
const T = A - n.iat, le = typeof u == "number" ? u : Pe(u);
|
|
1009
|
+
if (T - f > le)
|
|
1010
|
+
throw new Oe('"iat" claim timestamp check failed (too far in the past)', n, "iat", "check_failed");
|
|
1011
|
+
if (T < 0 - f)
|
|
1012
|
+
throw new R('"iat" claim timestamp check failed (it should be in the past)', n, "iat", "check_failed");
|
|
1002
1013
|
}
|
|
1003
|
-
|
|
1004
|
-
const u = f - r.iat, m = typeof y == "number" ? y : $e(y);
|
|
1005
|
-
if (u - h > m)
|
|
1006
|
-
throw new Ne('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
|
|
1007
|
-
if (u < 0 - h)
|
|
1008
|
-
throw new _('"iat" claim timestamp check failed (it should be in the past)', r, "iat", "check_failed");
|
|
1009
|
-
}
|
|
1010
|
-
return r;
|
|
1014
|
+
return n;
|
|
1011
1015
|
};
|
|
1012
|
-
async function
|
|
1013
|
-
var
|
|
1014
|
-
const a = await
|
|
1015
|
-
if ((
|
|
1016
|
-
throw new
|
|
1017
|
-
const
|
|
1018
|
-
return typeof t == "function" ? { ...
|
|
1016
|
+
async function pr(e, t, r) {
|
|
1017
|
+
var n;
|
|
1018
|
+
const a = await or(e, t, r);
|
|
1019
|
+
if ((n = a.protectedHeader.crit) != null && n.includes("b64") && a.protectedHeader.b64 === !1)
|
|
1020
|
+
throw new O("JWTs MUST NOT use unencoded payload");
|
|
1021
|
+
const o = { payload: hr(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
|
|
1022
|
+
return typeof t == "function" ? { ...o, key: a.key } : o;
|
|
1019
1023
|
}
|
|
1020
|
-
const
|
|
1021
|
-
function
|
|
1024
|
+
const fr = Y;
|
|
1025
|
+
function yr(e) {
|
|
1022
1026
|
if (typeof e != "string")
|
|
1023
|
-
throw new
|
|
1024
|
-
const { 1: t, length:
|
|
1025
|
-
if (
|
|
1026
|
-
throw new
|
|
1027
|
-
if (
|
|
1028
|
-
throw new
|
|
1027
|
+
throw new O("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
1028
|
+
const { 1: t, length: r } = e.split(".");
|
|
1029
|
+
if (r === 5)
|
|
1030
|
+
throw new O("Only JWTs using Compact JWS serialization can be decoded");
|
|
1031
|
+
if (r !== 3)
|
|
1032
|
+
throw new O("Invalid JWT");
|
|
1029
1033
|
if (!t)
|
|
1030
|
-
throw new
|
|
1031
|
-
let
|
|
1034
|
+
throw new O("JWTs must contain a payload");
|
|
1035
|
+
let n;
|
|
1032
1036
|
try {
|
|
1033
|
-
|
|
1037
|
+
n = fr(t);
|
|
1034
1038
|
} catch {
|
|
1035
|
-
throw new
|
|
1039
|
+
throw new O("Failed to base64url decode the payload");
|
|
1036
1040
|
}
|
|
1037
1041
|
let a;
|
|
1038
1042
|
try {
|
|
1039
|
-
a = JSON.parse(
|
|
1043
|
+
a = JSON.parse(G.decode(n));
|
|
1040
1044
|
} catch {
|
|
1041
|
-
throw new
|
|
1045
|
+
throw new O("Failed to parse the decoded payload as JSON");
|
|
1042
1046
|
}
|
|
1043
|
-
if (!
|
|
1044
|
-
throw new
|
|
1047
|
+
if (!ae(a))
|
|
1048
|
+
throw new O("Invalid JWT Claims Set");
|
|
1045
1049
|
return a;
|
|
1046
1050
|
}
|
|
1047
|
-
const
|
|
1051
|
+
const H = async (e) => {
|
|
1048
1052
|
try {
|
|
1049
|
-
const t =
|
|
1050
|
-
return await
|
|
1051
|
-
issuer:
|
|
1053
|
+
const t = S.ALG, r = await zt(Nt, t);
|
|
1054
|
+
return await pr(e, r, {
|
|
1055
|
+
issuer: S.ISSUER
|
|
1052
1056
|
});
|
|
1053
1057
|
} catch {
|
|
1054
1058
|
return;
|
|
1055
1059
|
}
|
|
1056
|
-
},
|
|
1060
|
+
}, gr = (e) => {
|
|
1057
1061
|
try {
|
|
1058
|
-
return
|
|
1062
|
+
return yr(e);
|
|
1059
1063
|
} catch {
|
|
1060
1064
|
return;
|
|
1061
1065
|
}
|
|
1062
1066
|
};
|
|
1063
|
-
var
|
|
1064
|
-
for (var
|
|
1065
|
-
|
|
1066
|
-
function
|
|
1067
|
-
return (
|
|
1067
|
+
var g = [];
|
|
1068
|
+
for (var ge = 0; ge < 256; ++ge)
|
|
1069
|
+
g.push((ge + 256).toString(16).slice(1));
|
|
1070
|
+
function Er(e, t = 0) {
|
|
1071
|
+
return (g[e[t + 0]] + g[e[t + 1]] + g[e[t + 2]] + g[e[t + 3]] + "-" + g[e[t + 4]] + g[e[t + 5]] + "-" + g[e[t + 6]] + g[e[t + 7]] + "-" + g[e[t + 8]] + g[e[t + 9]] + "-" + g[e[t + 10]] + g[e[t + 11]] + g[e[t + 12]] + g[e[t + 13]] + g[e[t + 14]] + g[e[t + 15]]).toLowerCase();
|
|
1068
1072
|
}
|
|
1069
|
-
var
|
|
1070
|
-
function
|
|
1071
|
-
if (!
|
|
1073
|
+
var q, mr = new Uint8Array(16);
|
|
1074
|
+
function wr() {
|
|
1075
|
+
if (!q && (q = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !q))
|
|
1072
1076
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1073
|
-
return
|
|
1077
|
+
return q(mr);
|
|
1074
1078
|
}
|
|
1075
|
-
var
|
|
1076
|
-
const
|
|
1077
|
-
randomUUID:
|
|
1079
|
+
var Sr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1080
|
+
const Ne = {
|
|
1081
|
+
randomUUID: Sr
|
|
1078
1082
|
};
|
|
1079
|
-
function
|
|
1080
|
-
if (
|
|
1081
|
-
return
|
|
1083
|
+
function De(e, t, r) {
|
|
1084
|
+
if (Ne.randomUUID && !t && !e)
|
|
1085
|
+
return Ne.randomUUID();
|
|
1082
1086
|
e = e || {};
|
|
1083
|
-
var
|
|
1084
|
-
return
|
|
1087
|
+
var n = e.random || (e.rng || wr)();
|
|
1088
|
+
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Er(n);
|
|
1085
1089
|
}
|
|
1086
|
-
const
|
|
1090
|
+
const Ue = globalThis.crypto, Ar = (e) => `${De()}${De()}`.slice(0, e), Tr = (e) => btoa(
|
|
1087
1091
|
[...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
|
|
1088
1092
|
);
|
|
1089
|
-
async function
|
|
1090
|
-
if (!
|
|
1093
|
+
async function Rr(e) {
|
|
1094
|
+
if (!Ue.subtle)
|
|
1091
1095
|
throw new Error(
|
|
1092
1096
|
"crypto.subtle is available only in secure contexts (HTTPS)."
|
|
1093
1097
|
);
|
|
1094
|
-
const t = new TextEncoder().encode(e),
|
|
1095
|
-
return
|
|
1098
|
+
const t = new TextEncoder().encode(e), r = await Ue.subtle.digest("SHA-256", t);
|
|
1099
|
+
return Tr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1096
1100
|
}
|
|
1097
|
-
async function
|
|
1098
|
-
const
|
|
1101
|
+
async function _r(e) {
|
|
1102
|
+
const r = Ar(43), n = await Rr(r);
|
|
1099
1103
|
return {
|
|
1100
|
-
code_verifier:
|
|
1101
|
-
code_challenge:
|
|
1104
|
+
code_verifier: r,
|
|
1105
|
+
code_challenge: n
|
|
1102
1106
|
};
|
|
1103
1107
|
}
|
|
1104
|
-
const
|
|
1105
|
-
var
|
|
1106
|
-
const
|
|
1107
|
-
if (!
|
|
1108
|
+
const Br = async (e, t) => {
|
|
1109
|
+
var r;
|
|
1110
|
+
const n = await H(e);
|
|
1111
|
+
if (!n || !Array.isArray((r = n.payload) == null ? void 0 : r[S.SCOPES_KEY]))
|
|
1108
1112
|
return !1;
|
|
1109
|
-
const a =
|
|
1110
|
-
return Array.isArray(t) ? t.every((
|
|
1111
|
-
(
|
|
1113
|
+
const a = n.payload[S.SCOPES_KEY];
|
|
1114
|
+
return Array.isArray(t) ? t.every((o) => a.includes(o)) : Object.keys(t).some(
|
|
1115
|
+
(o) => t[o].every((s) => a.includes(s))
|
|
1112
1116
|
);
|
|
1113
1117
|
};
|
|
1114
|
-
function
|
|
1118
|
+
function Ze(e, t) {
|
|
1115
1119
|
window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
|
|
1116
1120
|
}
|
|
1117
|
-
const
|
|
1118
|
-
const
|
|
1121
|
+
const Ke = (e, t) => {
|
|
1122
|
+
const r = JSON.stringify(
|
|
1119
1123
|
typeof t == "function" ? t() : t
|
|
1120
1124
|
);
|
|
1121
|
-
window.localStorage.setItem(e,
|
|
1122
|
-
},
|
|
1123
|
-
window.localStorage.removeItem(e),
|
|
1124
|
-
},
|
|
1125
|
-
function
|
|
1125
|
+
window.localStorage.setItem(e, r), Ze(e, r);
|
|
1126
|
+
}, Ir = (e) => {
|
|
1127
|
+
window.localStorage.removeItem(e), Ze(e, null);
|
|
1128
|
+
}, Le = (e) => window.localStorage.getItem(e), br = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
|
|
1129
|
+
function z({
|
|
1126
1130
|
key: e,
|
|
1127
1131
|
initialValue: t
|
|
1128
1132
|
}) {
|
|
1129
|
-
const
|
|
1130
|
-
(
|
|
1133
|
+
const r = St(br, () => Le(e)), n = N(
|
|
1134
|
+
(s) => {
|
|
1131
1135
|
try {
|
|
1132
|
-
const i = typeof
|
|
1133
|
-
i == null ?
|
|
1136
|
+
const i = typeof s == "function" ? s(JSON.parse(r)) : s;
|
|
1137
|
+
i == null ? Ir(e) : Ke(e, i);
|
|
1134
1138
|
} catch (i) {
|
|
1135
1139
|
console.warn(i);
|
|
1136
1140
|
}
|
|
1137
1141
|
},
|
|
1138
|
-
[e,
|
|
1139
|
-
), a =
|
|
1140
|
-
|
|
1141
|
-
}, [t,
|
|
1142
|
-
|
|
1143
|
-
}, [
|
|
1144
|
-
return
|
|
1142
|
+
[e, r]
|
|
1143
|
+
), a = N(() => {
|
|
1144
|
+
n(t);
|
|
1145
|
+
}, [t, n]), o = N(() => {
|
|
1146
|
+
n(null);
|
|
1147
|
+
}, [n]);
|
|
1148
|
+
return He(() => {
|
|
1145
1149
|
try {
|
|
1146
|
-
|
|
1147
|
-
} catch (
|
|
1148
|
-
console.warn(
|
|
1150
|
+
Le(e) === null && typeof t < "u" && Ke(e, t);
|
|
1151
|
+
} catch (s) {
|
|
1152
|
+
console.warn(s);
|
|
1149
1153
|
}
|
|
1150
|
-
}, [e, t]), [
|
|
1154
|
+
}, [e, t]), [r ? JSON.parse(r) : null, n, a, o];
|
|
1151
1155
|
}
|
|
1152
|
-
var
|
|
1153
|
-
for (var
|
|
1154
|
-
|
|
1155
|
-
function
|
|
1156
|
-
return (
|
|
1156
|
+
var E = [];
|
|
1157
|
+
for (var Ee = 0; Ee < 256; ++Ee)
|
|
1158
|
+
E.push((Ee + 256).toString(16).slice(1));
|
|
1159
|
+
function Or(e, t = 0) {
|
|
1160
|
+
return (E[e[t + 0]] + E[e[t + 1]] + E[e[t + 2]] + E[e[t + 3]] + "-" + E[e[t + 4]] + E[e[t + 5]] + "-" + E[e[t + 6]] + E[e[t + 7]] + "-" + E[e[t + 8]] + E[e[t + 9]] + "-" + E[e[t + 10]] + E[e[t + 11]] + E[e[t + 12]] + E[e[t + 13]] + E[e[t + 14]] + E[e[t + 15]]).toLowerCase();
|
|
1157
1161
|
}
|
|
1158
|
-
var
|
|
1159
|
-
function
|
|
1160
|
-
if (!
|
|
1162
|
+
var Q, vr = new Uint8Array(16);
|
|
1163
|
+
function kr() {
|
|
1164
|
+
if (!Q && (Q = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Q))
|
|
1161
1165
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1162
|
-
return
|
|
1166
|
+
return Q(vr);
|
|
1163
1167
|
}
|
|
1164
|
-
var
|
|
1165
|
-
const
|
|
1166
|
-
randomUUID:
|
|
1168
|
+
var Pr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1169
|
+
const $e = {
|
|
1170
|
+
randomUUID: Pr
|
|
1167
1171
|
};
|
|
1168
|
-
function
|
|
1169
|
-
if (
|
|
1170
|
-
return
|
|
1172
|
+
function me(e, t, r) {
|
|
1173
|
+
if ($e.randomUUID && !t && !e)
|
|
1174
|
+
return $e.randomUUID();
|
|
1171
1175
|
e = e || {};
|
|
1172
|
-
var
|
|
1173
|
-
return
|
|
1176
|
+
var n = e.random || (e.rng || kr)();
|
|
1177
|
+
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Or(n);
|
|
1174
1178
|
}
|
|
1175
|
-
const
|
|
1179
|
+
const U = "Your session has expired. For your security, please log in again to continue.", Cr = "Your session has been successfully terminated.", we = "Login failed. Please try again.", Nr = "Error getting access token, please re-authenticate.", Dr = "You forgot to wrap your component in <AuthProvider>.", se = {
|
|
1176
1180
|
dev: "https://auth.gizmette.local.com:3003",
|
|
1177
1181
|
prod: "https://mylogin.gizmette.com/auth"
|
|
1178
|
-
},
|
|
1182
|
+
}, X = "@@auth@@", J = "LOADING", te = "LOGIN", et = "LOGOUT", M = "success", I = "failure", tt = "include", rt = "POST", nt = "application/json", Z = {
|
|
1179
1183
|
GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
|
|
1180
1184
|
$clientId: String!,
|
|
1181
1185
|
$username: String!,
|
|
@@ -1237,14 +1241,14 @@ const H = "Your session has expired. For your security, please log in again to c
|
|
|
1237
1241
|
$authentication: AuthenticationOptionsInput!,
|
|
1238
1242
|
$nonce: String!,
|
|
1239
1243
|
$domain: String,
|
|
1240
|
-
$
|
|
1244
|
+
$sessionExpiration: String) {
|
|
1241
1245
|
verifyPasskeyAuthentication(
|
|
1242
1246
|
clientId: $clientId,
|
|
1243
1247
|
id: $id,
|
|
1244
1248
|
authentication: $authentication,
|
|
1245
1249
|
nonce: $nonce,
|
|
1246
1250
|
domain: $domain,
|
|
1247
|
-
|
|
1251
|
+
sessionExpiration: $sessionExpiration) {
|
|
1248
1252
|
status,
|
|
1249
1253
|
idToken,
|
|
1250
1254
|
accessToken,
|
|
@@ -1253,396 +1257,39 @@ const H = "Your session has expired. For your security, please log in again to c
|
|
|
1253
1257
|
username,
|
|
1254
1258
|
}
|
|
1255
1259
|
}`
|
|
1256
|
-
}
|
|
1257
|
-
/*!
|
|
1258
|
-
@versini/ui-fingerprint v1.0.1
|
|
1259
|
-
© 2024 gizmette.com
|
|
1260
|
-
*/
|
|
1261
|
-
try {
|
|
1262
|
-
window.__VERSINI_UI_FINGERPRINT__ || (window.__VERSINI_UI_FINGERPRINT__ = {
|
|
1263
|
-
version: "1.0.1",
|
|
1264
|
-
buildTime: "07/18/2024 09:17 AM EDT",
|
|
1265
|
-
homepage: "https://github.com/aversini/ui-components",
|
|
1266
|
-
license: "MIT"
|
|
1267
|
-
});
|
|
1268
|
-
} catch {
|
|
1269
|
-
}
|
|
1270
|
-
const qn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), dt = async (e) => {
|
|
1271
|
-
if (e === "")
|
|
1272
|
-
return "";
|
|
1273
|
-
const t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
1274
|
-
return Array.from(new Uint8Array(n)).map((r) => r.toString(16).padStart(2, "0")).join("");
|
|
1275
|
-
};
|
|
1276
|
-
function Je(e, t) {
|
|
1277
|
-
return new Promise((n) => setTimeout(n, e, t));
|
|
1278
|
-
}
|
|
1279
|
-
async function zn(e, t, n = 50) {
|
|
1280
|
-
var r, a, s;
|
|
1281
|
-
const o = document;
|
|
1282
|
-
for (; !o.body; )
|
|
1283
|
-
await Je(n);
|
|
1284
|
-
const i = o.createElement("iframe");
|
|
1285
|
-
try {
|
|
1286
|
-
for (await new Promise((c, y) => {
|
|
1287
|
-
let l = !1;
|
|
1288
|
-
const h = () => {
|
|
1289
|
-
l = !0, c();
|
|
1290
|
-
}, g = (m) => {
|
|
1291
|
-
l = !0, y(m);
|
|
1292
|
-
};
|
|
1293
|
-
i.onload = h, i.onerror = g;
|
|
1294
|
-
const { style: f } = i;
|
|
1295
|
-
f.setProperty("display", "block", "important"), f.position = "absolute", f.top = "0", f.left = "0", f.visibility = "hidden", i.src = "about:blank", o.body.appendChild(i);
|
|
1296
|
-
const u = () => {
|
|
1297
|
-
var m, R;
|
|
1298
|
-
l || (((R = (m = i.contentWindow) == null ? void 0 : m.document) == null ? void 0 : R.readyState) === "complete" ? h() : setTimeout(u, 10));
|
|
1299
|
-
};
|
|
1300
|
-
u();
|
|
1301
|
-
}); !((a = (r = i.contentWindow) == null ? void 0 : r.document) != null && a.body); )
|
|
1302
|
-
await Je(n);
|
|
1303
|
-
return await e(i, i.contentWindow);
|
|
1304
|
-
} finally {
|
|
1305
|
-
(s = i.parentNode) == null || s.removeChild(i);
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
const Qn = {
|
|
1309
|
-
audio: {
|
|
1310
|
-
sampleHash: "",
|
|
1311
|
-
oscillator: "",
|
|
1312
|
-
maxChannels: 0,
|
|
1313
|
-
channelCountMode: ""
|
|
1314
|
-
}
|
|
1315
|
-
}, Xn = async (e) => new Promise((t) => {
|
|
1316
|
-
try {
|
|
1317
|
-
const n = new window.OfflineAudioContext(1, 5e3, 44100), r = n.createBufferSource(), a = n.createOscillator();
|
|
1318
|
-
a.frequency.value = 1e3;
|
|
1319
|
-
const s = n.createDynamicsCompressor();
|
|
1320
|
-
s.threshold.value = -50, s.knee.value = 40, s.ratio.value = 12, s.attack.value = 0, s.release.value = 0.2, a.connect(s), s.connect(n.destination), a.start(), n.startRendering(), n.oncomplete = (o) => {
|
|
1321
|
-
const i = o.renderedBuffer.getChannelData(0);
|
|
1322
|
-
a.disconnect(), s.disconnect(), t({
|
|
1323
|
-
audio: {
|
|
1324
|
-
sampleHash: qn(i),
|
|
1325
|
-
oscillator: a.type,
|
|
1326
|
-
maxChannels: n.destination.maxChannelCount,
|
|
1327
|
-
channelCountMode: r.channelCountMode
|
|
1328
|
-
}
|
|
1329
|
-
});
|
|
1330
|
-
};
|
|
1331
|
-
} catch {
|
|
1332
|
-
t({
|
|
1333
|
-
audio: {
|
|
1334
|
-
sampleHash: "",
|
|
1335
|
-
oscillator: "",
|
|
1336
|
-
maxChannels: 0,
|
|
1337
|
-
channelCountMode: ""
|
|
1338
|
-
}
|
|
1339
|
-
});
|
|
1340
|
-
}
|
|
1341
|
-
}), ht = { browser: "" }, Zn = async (e) => typeof navigator > "u" ? ht : { browser: navigator.userAgent }, pt = {
|
|
1342
|
-
canvas: {
|
|
1343
|
-
data: ""
|
|
1344
|
-
}
|
|
1345
|
-
}, er = async (e) => {
|
|
1346
|
-
try {
|
|
1347
|
-
const t = Array.from(
|
|
1348
|
-
{ length: 3 },
|
|
1349
|
-
() => tr(300, 30)
|
|
1350
|
-
), n = rr(t, 300, 30);
|
|
1351
|
-
return {
|
|
1352
|
-
canvas: {
|
|
1353
|
-
data: (await dt(n.data.toString())).toString()
|
|
1354
|
-
}
|
|
1355
|
-
};
|
|
1356
|
-
} catch {
|
|
1357
|
-
return pt;
|
|
1358
|
-
}
|
|
1359
|
-
}, tr = (e, t) => {
|
|
1360
|
-
const n = document.createElement("canvas"), r = n.getContext("2d");
|
|
1361
|
-
if (!r)
|
|
1362
|
-
return new ImageData(1, 1);
|
|
1363
|
-
n.width = e, n.height = t;
|
|
1364
|
-
const a = r.createLinearGradient(0, 0, n.width, n.height);
|
|
1365
|
-
a.addColorStop(0, "red"), a.addColorStop(1 / 6, "orange"), a.addColorStop(2 / 6, "yellow"), a.addColorStop(3 / 6, "green"), a.addColorStop(4 / 6, "blue"), a.addColorStop(5 / 6, "indigo"), a.addColorStop(1, "violet"), r.fillStyle = a, r.fillRect(0, 0, n.width, n.height);
|
|
1366
|
-
const s = "mmMwWLliI0O&1 - Les sanglots longs des violons de l'automne blessent mon coeur d'une langueur monotone";
|
|
1367
|
-
return r.font = "26.321px Arial", r.fillStyle = "black", r.fillText(s, -5, 15), r.fillStyle = "rgba(0, 0, 255, 0.5)", r.fillText(s, -3.3, 17.7), r.beginPath(), r.moveTo(0, 0), r.lineTo(n.width * 2 / 7, n.height), r.strokeStyle = "white", r.lineWidth = 2, r.stroke(), r.getImageData(0, 0, n.width, n.height);
|
|
1368
|
-
}, nr = (e) => {
|
|
1369
|
-
if (e.length === 0)
|
|
1370
|
-
return 0;
|
|
1371
|
-
const t = {};
|
|
1372
|
-
for (const r of e)
|
|
1373
|
-
t[r] = (t[r] || 0) + 1;
|
|
1374
|
-
let n = e[0];
|
|
1375
|
-
for (const r in t)
|
|
1376
|
-
t[r] > t[n] && (n = parseInt(r, 10));
|
|
1377
|
-
return n;
|
|
1378
|
-
}, rr = (e, t, n) => {
|
|
1379
|
-
const r = [];
|
|
1380
|
-
for (let o = 0; o < e[0].data.length; o++) {
|
|
1381
|
-
const i = [];
|
|
1382
|
-
for (let c = 0; c < e.length; c++)
|
|
1383
|
-
i.push(e[c].data[o]);
|
|
1384
|
-
r.push(nr(i));
|
|
1385
|
-
}
|
|
1386
|
-
const a = r, s = new Uint8ClampedArray(a);
|
|
1387
|
-
return new ImageData(s, t, n);
|
|
1388
|
-
}, ar = [], or = "mmMwWLliI0O&1", sr = "48px", L = ["monospace", "sans-serif", "serif"], Ye = [
|
|
1389
|
-
"sans-serif-thin",
|
|
1390
|
-
"ARNO PRO",
|
|
1391
|
-
"Agency FB",
|
|
1392
|
-
"Arabic Typesetting",
|
|
1393
|
-
"Arial Unicode MS",
|
|
1394
|
-
"AvantGarde Bk BT",
|
|
1395
|
-
"BankGothic Md BT",
|
|
1396
|
-
"Bitstream Vera Sans Mono",
|
|
1397
|
-
"Calibri",
|
|
1398
|
-
"Century",
|
|
1399
|
-
"Century Gothic",
|
|
1400
|
-
"Clarendon",
|
|
1401
|
-
"EUROSTILE",
|
|
1402
|
-
"Franklin Gothic",
|
|
1403
|
-
"GOTHAM",
|
|
1404
|
-
"Gill Sans",
|
|
1405
|
-
"Helvetica Neue",
|
|
1406
|
-
"Letter Gothic",
|
|
1407
|
-
"Menlo",
|
|
1408
|
-
"MS Outlook",
|
|
1409
|
-
"MS Reference Specialty",
|
|
1410
|
-
"MS UI Gothic",
|
|
1411
|
-
"MT Extra",
|
|
1412
|
-
"MYRIAD PRO",
|
|
1413
|
-
"Marlett",
|
|
1414
|
-
"Microsoft Uighur",
|
|
1415
|
-
"Minion Pro",
|
|
1416
|
-
"Monotype Corsiva",
|
|
1417
|
-
"PMingLiU",
|
|
1418
|
-
"Pristina",
|
|
1419
|
-
"SCRIPTINA",
|
|
1420
|
-
"SimHei",
|
|
1421
|
-
"Small Fonts",
|
|
1422
|
-
"Staccato222 BT",
|
|
1423
|
-
"TRAJAN PRO",
|
|
1424
|
-
"Univers CE 55 Medium",
|
|
1425
|
-
"ZWAdobeF"
|
|
1426
|
-
], ir = async (e) => zn(async (t, { document: n }) => {
|
|
1427
|
-
const r = n.body;
|
|
1428
|
-
r.style.fontSize = sr;
|
|
1429
|
-
const a = n.createElement("div");
|
|
1430
|
-
a.style.setProperty("visibility", "hidden", "important");
|
|
1431
|
-
const s = {}, o = {}, i = (u) => {
|
|
1432
|
-
const m = n.createElement("span"), { style: R } = m;
|
|
1433
|
-
return R.position = "absolute", R.top = "0", R.left = "0", R.fontFamily = u, m.textContent = or, a.appendChild(m), m;
|
|
1434
|
-
}, c = (u, m) => i(`'${u}',${m}`), y = () => L.map(i), l = () => {
|
|
1435
|
-
const u = {};
|
|
1436
|
-
for (const m of Ye)
|
|
1437
|
-
u[m] = L.map(
|
|
1438
|
-
(R) => c(m, R)
|
|
1439
|
-
);
|
|
1440
|
-
return u;
|
|
1441
|
-
}, h = (u) => L.some(
|
|
1442
|
-
(m, R) => u[R].offsetWidth !== s[m] || u[R].offsetHeight !== o[m]
|
|
1443
|
-
), g = y(), f = l();
|
|
1444
|
-
r.appendChild(a);
|
|
1445
|
-
for (let u = 0; u < L.length; u++)
|
|
1446
|
-
s[L[u]] = g[u].offsetWidth, o[L[u]] = g[u].offsetHeight;
|
|
1447
|
-
return Ye.filter((u) => h(f[u]));
|
|
1448
|
-
}), ft = {
|
|
1449
|
-
vendor: "",
|
|
1450
|
-
vendorUnmasked: "",
|
|
1451
|
-
renderer: "",
|
|
1452
|
-
rendererUnmasked: "",
|
|
1453
|
-
version: "",
|
|
1454
|
-
shadingLanguageVersion: ""
|
|
1455
|
-
}, yt = {
|
|
1456
|
-
hardware: {
|
|
1457
|
-
videocard: ft,
|
|
1458
|
-
architecture: 0,
|
|
1459
|
-
deviceMemory: "undefined",
|
|
1460
|
-
jsHeapSizeLimit: 0
|
|
1461
|
-
}
|
|
1462
|
-
};
|
|
1463
|
-
function cr() {
|
|
1464
|
-
const e = document.createElement("canvas"), t = e.getContext("webgl") ?? e.getContext("experimental-webgl");
|
|
1465
|
-
if (t && "getParameter" in t) {
|
|
1466
|
-
const n = t.getExtension("WEBGL_debug_renderer_info");
|
|
1467
|
-
return {
|
|
1468
|
-
vendor: (t.getParameter(t.VENDOR) || "").toString(),
|
|
1469
|
-
vendorUnmasked: n ? (t.getParameter(n.UNMASKED_VENDOR_WEBGL) || "").toString() : "",
|
|
1470
|
-
renderer: (t.getParameter(t.RENDERER) || "").toString(),
|
|
1471
|
-
rendererUnmasked: n ? (t.getParameter(n.UNMASKED_RENDERER_WEBGL) || "").toString() : "",
|
|
1472
|
-
version: (t.getParameter(t.VERSION) || "").toString(),
|
|
1473
|
-
shadingLanguageVersion: (t.getParameter(t.SHADING_LANGUAGE_VERSION) || "").toString()
|
|
1474
|
-
};
|
|
1475
|
-
}
|
|
1476
|
-
return ft;
|
|
1477
|
-
}
|
|
1478
|
-
function ur() {
|
|
1479
|
-
const e = new Float32Array(1), t = new Uint8Array(e.buffer);
|
|
1480
|
-
return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
|
|
1481
|
-
}
|
|
1482
|
-
const lr = () => navigator.deviceMemory || 0, dr = () => window.performance && window.performance.memory || {
|
|
1483
|
-
jsHeapSizeLimit: 0
|
|
1484
|
-
}, hr = async (e) => new Promise((t) => {
|
|
1485
|
-
try {
|
|
1486
|
-
const n = lr(), r = dr();
|
|
1487
|
-
t({
|
|
1488
|
-
hardware: {
|
|
1489
|
-
videocard: cr(),
|
|
1490
|
-
architecture: ur(),
|
|
1491
|
-
deviceMemory: n.toString() || "undefined",
|
|
1492
|
-
jsHeapSizeLimit: r.jsHeapSizeLimit || 0
|
|
1493
|
-
}
|
|
1494
|
-
});
|
|
1495
|
-
} catch {
|
|
1496
|
-
t(yt);
|
|
1497
|
-
}
|
|
1498
|
-
}), pr = {
|
|
1499
|
-
locales: {
|
|
1500
|
-
languages: "",
|
|
1501
|
-
timezone: ""
|
|
1502
|
-
}
|
|
1503
|
-
}, fr = async (e) => new Promise((t) => {
|
|
1504
|
-
t({
|
|
1505
|
-
locales: {
|
|
1506
|
-
languages: navigator.language,
|
|
1507
|
-
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
1508
|
-
}
|
|
1509
|
-
});
|
|
1510
|
-
}), gt = {
|
|
1511
|
-
screen: {
|
|
1512
|
-
colorDepth: 0,
|
|
1513
|
-
pixelDepth: 0,
|
|
1514
|
-
isTouchScreen: !1,
|
|
1515
|
-
maxTouchPoints: 0,
|
|
1516
|
-
mediaMatches: []
|
|
1517
|
-
}
|
|
1518
|
-
}, yr = async (e) => new Promise((t) => {
|
|
1519
|
-
try {
|
|
1520
|
-
const n = window.screen, r = {
|
|
1521
|
-
screen: {
|
|
1522
|
-
colorDepth: n.colorDepth,
|
|
1523
|
-
pixelDepth: n.pixelDepth,
|
|
1524
|
-
isTouchScreen: navigator.maxTouchPoints > 0,
|
|
1525
|
-
maxTouchPoints: navigator.maxTouchPoints,
|
|
1526
|
-
mediaMatches: gr()
|
|
1527
|
-
}
|
|
1528
|
-
};
|
|
1529
|
-
t(r);
|
|
1530
|
-
} catch {
|
|
1531
|
-
t(gt);
|
|
1532
|
-
}
|
|
1533
|
-
});
|
|
1534
|
-
function gr() {
|
|
1535
|
-
const e = [], t = {
|
|
1536
|
-
"prefers-contrast": [
|
|
1537
|
-
"high",
|
|
1538
|
-
"more",
|
|
1539
|
-
"low",
|
|
1540
|
-
"less",
|
|
1541
|
-
"forced",
|
|
1542
|
-
"no-preference"
|
|
1543
|
-
],
|
|
1544
|
-
"any-hover": ["hover", "none"],
|
|
1545
|
-
"any-pointer": ["none", "coarse", "fine"],
|
|
1546
|
-
pointer: ["none", "coarse", "fine"],
|
|
1547
|
-
hover: ["hover", "none"],
|
|
1548
|
-
update: ["fast", "slow"],
|
|
1549
|
-
"inverted-colors": ["inverted", "none"],
|
|
1550
|
-
"prefers-reduced-motion": ["reduce", "no-preference"],
|
|
1551
|
-
"prefers-reduced-transparency": ["reduce", "no-preference"],
|
|
1552
|
-
scripting: ["none", "initial-only", "enabled"],
|
|
1553
|
-
"forced-colors": ["active", "none"],
|
|
1554
|
-
"color-gamut": ["srgb", "p3", "rec2020"]
|
|
1555
|
-
};
|
|
1556
|
-
return Object.keys(t).forEach((n) => {
|
|
1557
|
-
t[n].forEach((r) => {
|
|
1558
|
-
matchMedia(`(${n}: ${r})`).matches && e.push(`${n}: ${r}`);
|
|
1559
|
-
});
|
|
1560
|
-
}), e;
|
|
1561
|
-
}
|
|
1562
|
-
const mr = async (e) => {
|
|
1563
|
-
try {
|
|
1564
|
-
return {
|
|
1565
|
-
system: {
|
|
1566
|
-
platform: navigator.platform,
|
|
1567
|
-
cookieEnabled: navigator.cookieEnabled,
|
|
1568
|
-
productSub: navigator.productSub,
|
|
1569
|
-
product: navigator.product
|
|
1570
|
-
}
|
|
1571
|
-
};
|
|
1572
|
-
} catch {
|
|
1573
|
-
return mt;
|
|
1574
|
-
}
|
|
1575
|
-
}, mt = {
|
|
1576
|
-
system: {
|
|
1577
|
-
platform: "",
|
|
1578
|
-
cookieEnabled: !1,
|
|
1579
|
-
productSub: "",
|
|
1580
|
-
product: ""
|
|
1581
|
-
}
|
|
1582
|
-
}, Er = async (e) => {
|
|
1583
|
-
try {
|
|
1584
|
-
return Promise.all([
|
|
1585
|
-
Xn(e),
|
|
1586
|
-
Zn(),
|
|
1587
|
-
er(e),
|
|
1588
|
-
ir(),
|
|
1589
|
-
hr(e),
|
|
1590
|
-
fr(),
|
|
1591
|
-
yr(e),
|
|
1592
|
-
mr(e)
|
|
1593
|
-
]);
|
|
1594
|
-
} catch {
|
|
1595
|
-
return [
|
|
1596
|
-
Qn,
|
|
1597
|
-
ht,
|
|
1598
|
-
pt,
|
|
1599
|
-
ar,
|
|
1600
|
-
yt,
|
|
1601
|
-
pr,
|
|
1602
|
-
gt,
|
|
1603
|
-
mt
|
|
1604
|
-
];
|
|
1605
|
-
}
|
|
1606
|
-
}, wr = async (e) => {
|
|
1607
|
-
try {
|
|
1608
|
-
const t = await Er(e);
|
|
1609
|
-
return await dt(JSON.stringify(t));
|
|
1610
|
-
} catch {
|
|
1611
|
-
return "";
|
|
1612
|
-
}
|
|
1613
|
-
}, W = {
|
|
1260
|
+
}, K = {
|
|
1614
1261
|
GET_REGISTRATION_OPTIONS: {
|
|
1615
|
-
schema:
|
|
1262
|
+
schema: Z.GET_REGISTRATION_OPTIONS,
|
|
1616
1263
|
method: "getPasskeyRegistrationOptions"
|
|
1617
1264
|
},
|
|
1618
1265
|
VERIFY_REGISTRATION: {
|
|
1619
|
-
schema:
|
|
1266
|
+
schema: Z.VERIFY_REGISTRATION,
|
|
1620
1267
|
method: "verifyPasskeyRegistration"
|
|
1621
1268
|
},
|
|
1622
1269
|
GET_AUTHENTICATION_OPTIONS: {
|
|
1623
|
-
schema:
|
|
1270
|
+
schema: Z.GET_AUTHENTICATION_OPTIONS,
|
|
1624
1271
|
method: "getPasskeyAuthenticationOptions"
|
|
1625
1272
|
},
|
|
1626
1273
|
VERIFY_AUTHENTICATION: {
|
|
1627
|
-
schema:
|
|
1274
|
+
schema: Z.VERIFY_AUTHENTICATION,
|
|
1628
1275
|
method: "verifyPasskeyAuthentication"
|
|
1629
1276
|
}
|
|
1630
|
-
},
|
|
1277
|
+
}, L = async ({
|
|
1631
1278
|
accessToken: e,
|
|
1632
1279
|
type: t,
|
|
1633
|
-
clientId:
|
|
1634
|
-
params:
|
|
1280
|
+
clientId: r,
|
|
1281
|
+
params: n = {}
|
|
1635
1282
|
}) => {
|
|
1636
1283
|
try {
|
|
1637
|
-
const a =
|
|
1638
|
-
|
|
1284
|
+
const a = n, o = `Bearer ${e}`, s = await fetch(
|
|
1285
|
+
at ? `${se.dev}/graphql` : `${se.prod}/graphql`,
|
|
1639
1286
|
{
|
|
1640
|
-
credentials:
|
|
1641
|
-
method:
|
|
1287
|
+
credentials: tt,
|
|
1288
|
+
method: rt,
|
|
1642
1289
|
headers: {
|
|
1643
|
-
authorization:
|
|
1644
|
-
"Content-Type":
|
|
1645
|
-
[
|
|
1290
|
+
authorization: o,
|
|
1291
|
+
"Content-Type": nt,
|
|
1292
|
+
[Ge.CLIENT_ID]: `${r}`
|
|
1646
1293
|
},
|
|
1647
1294
|
body: JSON.stringify({
|
|
1648
1295
|
query: t.schema,
|
|
@@ -1650,118 +1297,109 @@ const mr = async (e) => {
|
|
|
1650
1297
|
})
|
|
1651
1298
|
}
|
|
1652
1299
|
);
|
|
1653
|
-
if (
|
|
1654
|
-
return { status:
|
|
1655
|
-
const { data: i } = await
|
|
1300
|
+
if (s.status !== 200)
|
|
1301
|
+
return { status: I, data: [] };
|
|
1302
|
+
const { data: i } = await s.json();
|
|
1656
1303
|
return {
|
|
1657
|
-
status:
|
|
1304
|
+
status: M,
|
|
1658
1305
|
data: i[t.method]
|
|
1659
1306
|
};
|
|
1660
1307
|
} catch (a) {
|
|
1661
|
-
return console.error(a), { status:
|
|
1308
|
+
return console.error(a), { status: I, data: [] };
|
|
1662
1309
|
}
|
|
1663
|
-
},
|
|
1310
|
+
}, ue = async ({
|
|
1664
1311
|
type: e,
|
|
1665
1312
|
clientId: t,
|
|
1666
|
-
params:
|
|
1313
|
+
params: r = {}
|
|
1667
1314
|
}) => {
|
|
1668
1315
|
try {
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1316
|
+
const n = await fetch(
|
|
1317
|
+
at ? `${se.dev}/${e}` : `${se.prod}/${e}`,
|
|
1671
1318
|
{
|
|
1672
|
-
credentials:
|
|
1673
|
-
method:
|
|
1319
|
+
credentials: tt,
|
|
1320
|
+
method: rt,
|
|
1674
1321
|
headers: {
|
|
1675
|
-
"Content-Type":
|
|
1676
|
-
[
|
|
1322
|
+
"Content-Type": nt,
|
|
1323
|
+
[Ge.CLIENT_ID]: `${t}`
|
|
1677
1324
|
},
|
|
1678
|
-
body: JSON.stringify(
|
|
1325
|
+
body: JSON.stringify(r)
|
|
1679
1326
|
}
|
|
1680
1327
|
);
|
|
1681
|
-
if (
|
|
1682
|
-
return { status:
|
|
1683
|
-
const { data: a } = await
|
|
1328
|
+
if (n.status !== 200)
|
|
1329
|
+
return { status: I, data: [] };
|
|
1330
|
+
const { data: a } = await n.json();
|
|
1684
1331
|
return {
|
|
1685
|
-
status:
|
|
1332
|
+
status: M,
|
|
1686
1333
|
data: a || []
|
|
1687
1334
|
};
|
|
1688
|
-
} catch (
|
|
1689
|
-
return console.error(
|
|
1335
|
+
} catch (n) {
|
|
1336
|
+
return console.error(n), { status: I, data: [] };
|
|
1690
1337
|
}
|
|
1691
|
-
},
|
|
1338
|
+
}, Ur = process.env.NODE_ENV === "production", at = !Ur, st = {
|
|
1692
1339
|
isLoading: !0,
|
|
1693
1340
|
isAuthenticated: !1,
|
|
1694
|
-
authenticationType: null,
|
|
1695
1341
|
user: void 0,
|
|
1696
1342
|
logoutReason: "",
|
|
1697
1343
|
debug: !1
|
|
1698
|
-
},
|
|
1344
|
+
}, Kr = (e) => {
|
|
1699
1345
|
try {
|
|
1700
|
-
const t =
|
|
1701
|
-
return t ? t[
|
|
1346
|
+
const t = gr(e);
|
|
1347
|
+
return t ? t[S.USER_ID_KEY] : "";
|
|
1702
1348
|
} catch {
|
|
1703
1349
|
return "";
|
|
1704
1350
|
}
|
|
1705
|
-
},
|
|
1351
|
+
}, Lr = async ({
|
|
1706
1352
|
userId: e,
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
refreshToken: r,
|
|
1710
|
-
clientId: a,
|
|
1711
|
-
domain: s
|
|
1353
|
+
clientId: t,
|
|
1354
|
+
domain: r
|
|
1712
1355
|
}) => {
|
|
1713
1356
|
try {
|
|
1714
1357
|
return {
|
|
1715
|
-
status: (await
|
|
1716
|
-
type:
|
|
1717
|
-
clientId:
|
|
1358
|
+
status: (await ue({
|
|
1359
|
+
type: ie.LOGOUT,
|
|
1360
|
+
clientId: t,
|
|
1718
1361
|
params: {
|
|
1719
1362
|
userId: e,
|
|
1720
|
-
|
|
1721
|
-
accessToken: n,
|
|
1722
|
-
refreshToken: r,
|
|
1723
|
-
domain: s
|
|
1363
|
+
domain: r
|
|
1724
1364
|
}
|
|
1725
|
-
}))?.status ||
|
|
1365
|
+
}))?.status || I
|
|
1726
1366
|
};
|
|
1727
1367
|
} catch {
|
|
1728
1368
|
return {
|
|
1729
|
-
status:
|
|
1369
|
+
status: I
|
|
1730
1370
|
};
|
|
1731
1371
|
}
|
|
1732
|
-
},
|
|
1372
|
+
}, $r = async ({
|
|
1733
1373
|
username: e,
|
|
1734
1374
|
password: t,
|
|
1735
|
-
clientId:
|
|
1736
|
-
nonce:
|
|
1375
|
+
clientId: r,
|
|
1376
|
+
nonce: n,
|
|
1737
1377
|
type: a,
|
|
1738
|
-
sessionExpiration:
|
|
1739
|
-
code:
|
|
1378
|
+
sessionExpiration: o,
|
|
1379
|
+
code: s,
|
|
1740
1380
|
code_verifier: i,
|
|
1741
|
-
domain: c
|
|
1742
|
-
fingerprint: y
|
|
1381
|
+
domain: c
|
|
1743
1382
|
}) => {
|
|
1744
1383
|
try {
|
|
1745
|
-
const
|
|
1746
|
-
type:
|
|
1747
|
-
clientId:
|
|
1384
|
+
const u = await ue({
|
|
1385
|
+
type: ie.LOGIN,
|
|
1386
|
+
clientId: r,
|
|
1748
1387
|
params: {
|
|
1749
|
-
type: a ||
|
|
1388
|
+
type: a || oe.ID_AND_ACCESS_TOKEN,
|
|
1750
1389
|
username: e,
|
|
1751
1390
|
password: t,
|
|
1752
|
-
sessionExpiration:
|
|
1753
|
-
nonce:
|
|
1754
|
-
code:
|
|
1391
|
+
sessionExpiration: o,
|
|
1392
|
+
nonce: n,
|
|
1393
|
+
code: s,
|
|
1755
1394
|
code_verifier: i,
|
|
1756
|
-
domain: c
|
|
1757
|
-
fingerprint: y
|
|
1395
|
+
domain: c
|
|
1758
1396
|
}
|
|
1759
|
-
}),
|
|
1760
|
-
return
|
|
1761
|
-
idToken:
|
|
1762
|
-
accessToken:
|
|
1763
|
-
refreshToken:
|
|
1764
|
-
userId:
|
|
1397
|
+
}), p = await H(u?.data?.idToken);
|
|
1398
|
+
return p && p.payload[S.USER_ID_KEY] !== "" && p.payload[S.NONCE_KEY] === n ? {
|
|
1399
|
+
idToken: u.data.idToken,
|
|
1400
|
+
accessToken: u.data.accessToken,
|
|
1401
|
+
refreshToken: u.data.refreshToken,
|
|
1402
|
+
userId: p.payload[S.USER_ID_KEY],
|
|
1765
1403
|
status: !0
|
|
1766
1404
|
} : {
|
|
1767
1405
|
status: !1
|
|
@@ -1771,60 +1409,59 @@ const mr = async (e) => {
|
|
|
1771
1409
|
status: !1
|
|
1772
1410
|
};
|
|
1773
1411
|
}
|
|
1774
|
-
},
|
|
1412
|
+
}, Hr = async ({
|
|
1775
1413
|
nonce: e,
|
|
1776
1414
|
clientId: t,
|
|
1777
|
-
code_challenge:
|
|
1415
|
+
code_challenge: r
|
|
1778
1416
|
}) => {
|
|
1779
1417
|
try {
|
|
1780
|
-
const
|
|
1781
|
-
type:
|
|
1418
|
+
const n = await ue({
|
|
1419
|
+
type: ie.CODE,
|
|
1782
1420
|
clientId: t,
|
|
1783
1421
|
params: {
|
|
1784
|
-
type:
|
|
1422
|
+
type: oe.CODE,
|
|
1785
1423
|
nonce: e,
|
|
1786
|
-
code_challenge:
|
|
1424
|
+
code_challenge: r
|
|
1787
1425
|
}
|
|
1788
1426
|
});
|
|
1789
|
-
return
|
|
1790
|
-
status:
|
|
1791
|
-
data:
|
|
1427
|
+
return n?.data?.code ? {
|
|
1428
|
+
status: M,
|
|
1429
|
+
data: n.data.code
|
|
1792
1430
|
} : {
|
|
1793
|
-
status:
|
|
1431
|
+
status: I,
|
|
1794
1432
|
data: ""
|
|
1795
1433
|
};
|
|
1796
1434
|
} catch {
|
|
1797
1435
|
return {
|
|
1798
|
-
status:
|
|
1436
|
+
status: I,
|
|
1799
1437
|
data: ""
|
|
1800
1438
|
};
|
|
1801
1439
|
}
|
|
1802
|
-
},
|
|
1440
|
+
}, Wr = async ({
|
|
1803
1441
|
clientId: e,
|
|
1804
1442
|
userId: t,
|
|
1805
|
-
nonce:
|
|
1806
|
-
refreshToken:
|
|
1443
|
+
nonce: r,
|
|
1444
|
+
refreshToken: n,
|
|
1807
1445
|
accessToken: a,
|
|
1808
|
-
domain:
|
|
1446
|
+
domain: o
|
|
1809
1447
|
}) => {
|
|
1810
1448
|
try {
|
|
1811
|
-
const
|
|
1812
|
-
type:
|
|
1449
|
+
const s = await ue({
|
|
1450
|
+
type: ie.REFRESH,
|
|
1813
1451
|
clientId: e,
|
|
1814
1452
|
params: {
|
|
1815
|
-
type:
|
|
1453
|
+
type: oe.REFRESH_TOKEN,
|
|
1816
1454
|
userId: t,
|
|
1817
|
-
nonce:
|
|
1818
|
-
refreshToken:
|
|
1455
|
+
nonce: r,
|
|
1456
|
+
refreshToken: n,
|
|
1819
1457
|
accessToken: a,
|
|
1820
|
-
domain:
|
|
1821
|
-
fingerprint: await St()
|
|
1458
|
+
domain: o
|
|
1822
1459
|
}
|
|
1823
|
-
}), i = await
|
|
1824
|
-
return i && i.payload[
|
|
1825
|
-
accessToken:
|
|
1826
|
-
refreshToken:
|
|
1827
|
-
userId: i.payload[
|
|
1460
|
+
}), i = await H(s?.data?.accessToken);
|
|
1461
|
+
return i && i.payload[S.USER_ID_KEY] !== "" && i.payload[S.NONCE_KEY] === r ? {
|
|
1462
|
+
accessToken: s.data.accessToken,
|
|
1463
|
+
refreshToken: s.data.refreshToken,
|
|
1464
|
+
userId: i.payload[S.USER_ID_KEY],
|
|
1828
1465
|
status: !0
|
|
1829
1466
|
} : {
|
|
1830
1467
|
status: !1
|
|
@@ -1834,30 +1471,24 @@ const mr = async (e) => {
|
|
|
1834
1471
|
status: !1
|
|
1835
1472
|
};
|
|
1836
1473
|
}
|
|
1837
|
-
}, St = async () => {
|
|
1838
|
-
try {
|
|
1839
|
-
return await wr();
|
|
1840
|
-
} catch {
|
|
1841
|
-
return "";
|
|
1842
|
-
}
|
|
1843
1474
|
};
|
|
1844
|
-
class
|
|
1845
|
-
constructor(t = null,
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
this.accessToken = t || "", this.refreshToken =
|
|
1475
|
+
class xr {
|
|
1476
|
+
constructor(t = null, r = null) {
|
|
1477
|
+
j(this, "refreshTokenPromise", null);
|
|
1478
|
+
j(this, "accessToken");
|
|
1479
|
+
j(this, "refreshToken");
|
|
1480
|
+
this.accessToken = t || "", this.refreshToken = r || "";
|
|
1850
1481
|
}
|
|
1851
1482
|
async refreshtoken({
|
|
1852
1483
|
clientId: t,
|
|
1853
|
-
userId:
|
|
1854
|
-
nonce:
|
|
1484
|
+
userId: r,
|
|
1485
|
+
nonce: n,
|
|
1855
1486
|
domain: a
|
|
1856
1487
|
}) {
|
|
1857
1488
|
this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
|
|
1858
1489
|
clientId: t,
|
|
1859
|
-
userId:
|
|
1860
|
-
nonce:
|
|
1490
|
+
userId: r,
|
|
1491
|
+
nonce: n,
|
|
1861
1492
|
domain: a
|
|
1862
1493
|
}));
|
|
1863
1494
|
try {
|
|
@@ -1868,284 +1499,243 @@ class Ir {
|
|
|
1868
1499
|
}
|
|
1869
1500
|
async _refreshToken({
|
|
1870
1501
|
clientId: t,
|
|
1871
|
-
userId:
|
|
1872
|
-
nonce:
|
|
1502
|
+
userId: r,
|
|
1503
|
+
nonce: n,
|
|
1873
1504
|
domain: a
|
|
1874
1505
|
}) {
|
|
1875
|
-
const
|
|
1876
|
-
if (
|
|
1877
|
-
const
|
|
1506
|
+
const o = await H(this.refreshToken);
|
|
1507
|
+
if (o && o.payload[S.USER_ID_KEY] !== "") {
|
|
1508
|
+
const s = await Wr({
|
|
1878
1509
|
clientId: t,
|
|
1879
|
-
userId:
|
|
1880
|
-
nonce:
|
|
1510
|
+
userId: r,
|
|
1511
|
+
nonce: n,
|
|
1881
1512
|
refreshToken: this.refreshToken,
|
|
1882
1513
|
accessToken: this.accessToken,
|
|
1883
1514
|
domain: a
|
|
1884
1515
|
});
|
|
1885
|
-
return
|
|
1886
|
-
status:
|
|
1887
|
-
newAccessToken:
|
|
1888
|
-
newRefreshToken:
|
|
1516
|
+
return s.status ? (this.accessToken = s.accessToken, this.refreshToken = s.refreshToken, {
|
|
1517
|
+
status: M,
|
|
1518
|
+
newAccessToken: s.accessToken,
|
|
1519
|
+
newRefreshToken: s.refreshToken
|
|
1889
1520
|
}) : {
|
|
1890
|
-
status:
|
|
1521
|
+
status: I
|
|
1891
1522
|
};
|
|
1892
1523
|
} else
|
|
1893
1524
|
return {
|
|
1894
|
-
status:
|
|
1525
|
+
status: I
|
|
1895
1526
|
};
|
|
1896
1527
|
}
|
|
1897
1528
|
}
|
|
1898
|
-
const
|
|
1529
|
+
const Jr = (e) => N(
|
|
1899
1530
|
(...t) => {
|
|
1900
1531
|
e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
|
|
1901
1532
|
},
|
|
1902
1533
|
[e]
|
|
1903
|
-
),
|
|
1904
|
-
throw new Error(
|
|
1905
|
-
},
|
|
1534
|
+
), $ = () => {
|
|
1535
|
+
throw new Error(Dr);
|
|
1536
|
+
}, ot = At({
|
|
1906
1537
|
isAuthenticated: !1,
|
|
1907
1538
|
isLoading: !1,
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
loginWithPasskey: M,
|
|
1539
|
+
login: $,
|
|
1540
|
+
logout: $,
|
|
1541
|
+
getAccessToken: $,
|
|
1542
|
+
getIdToken: $,
|
|
1543
|
+
registeringForPasskey: $,
|
|
1544
|
+
loginWithPasskey: $,
|
|
1915
1545
|
logoutReason: ""
|
|
1916
|
-
}),
|
|
1917
|
-
state:
|
|
1546
|
+
}), Yr = wt.createContext({
|
|
1547
|
+
state: st,
|
|
1918
1548
|
dispatch: () => {
|
|
1919
1549
|
}
|
|
1920
|
-
}),
|
|
1550
|
+
}), Gr = (e, t) => t?.type === J ? {
|
|
1921
1551
|
...e,
|
|
1922
1552
|
isLoading: t.payload.isLoading
|
|
1923
|
-
} : t?.type ===
|
|
1553
|
+
} : t?.type === te ? {
|
|
1924
1554
|
...e,
|
|
1925
1555
|
isLoading: !1,
|
|
1926
1556
|
isAuthenticated: !0,
|
|
1927
1557
|
user: t.payload.user,
|
|
1928
|
-
authenticationType: t.payload.authenticationType,
|
|
1929
1558
|
logoutReason: ""
|
|
1930
|
-
} : t?.type ===
|
|
1559
|
+
} : t?.type === et ? {
|
|
1931
1560
|
...e,
|
|
1932
1561
|
isLoading: !1,
|
|
1933
1562
|
isAuthenticated: !1,
|
|
1934
1563
|
user: void 0,
|
|
1935
|
-
authenticationType: null,
|
|
1936
1564
|
logoutReason: t.payload.logoutReason
|
|
1937
|
-
} : e,
|
|
1565
|
+
} : e, qr = ({
|
|
1938
1566
|
children: e,
|
|
1939
1567
|
sessionExpiration: t,
|
|
1940
|
-
clientId:
|
|
1941
|
-
domain:
|
|
1568
|
+
clientId: r,
|
|
1569
|
+
domain: n = "",
|
|
1942
1570
|
debug: a = !1
|
|
1943
1571
|
}) => {
|
|
1944
|
-
const [
|
|
1945
|
-
...
|
|
1572
|
+
const [o, s] = Tt(Gr, {
|
|
1573
|
+
...st,
|
|
1946
1574
|
debug: a
|
|
1947
|
-
}), i =
|
|
1948
|
-
key: `${
|
|
1949
|
-
}), [
|
|
1950
|
-
key: `${
|
|
1951
|
-
}), [
|
|
1575
|
+
}), i = Jr(a), c = Rt(!1), [u, p, , f] = z({
|
|
1576
|
+
key: `${X}::${r}::@@user@@`
|
|
1577
|
+
}), [l, A, , T] = z({
|
|
1578
|
+
key: `${X}::${r}::@@access@@`
|
|
1579
|
+
}), [le, de, , Te] = z(
|
|
1952
1580
|
{
|
|
1953
|
-
key: `${
|
|
1581
|
+
key: `${X}::${r}::@@refresh@@`
|
|
1954
1582
|
}
|
|
1955
|
-
), [
|
|
1956
|
-
key: `${
|
|
1957
|
-
}),
|
|
1958
|
-
i("removeLocalStorage: removing local storage"),
|
|
1583
|
+
), [it, Re, , _e] = z({
|
|
1584
|
+
key: `${X}::${r}::@@nonce@@`
|
|
1585
|
+
}), ct = new xr(l, le), V = N(() => {
|
|
1586
|
+
i("removeLocalStorage: removing local storage"), f(), T(), Te(), _e();
|
|
1959
1587
|
}, [
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
Ce,
|
|
1588
|
+
T,
|
|
1589
|
+
f,
|
|
1963
1590
|
_e,
|
|
1591
|
+
Te,
|
|
1964
1592
|
i
|
|
1965
|
-
]),
|
|
1593
|
+
]), W = N(
|
|
1966
1594
|
(d) => {
|
|
1967
1595
|
i(
|
|
1968
1596
|
"removeStateAndLocalStorage: removing state and local storage with reason: ",
|
|
1969
1597
|
d
|
|
1970
|
-
),
|
|
1971
|
-
type:
|
|
1598
|
+
), s({
|
|
1599
|
+
type: et,
|
|
1972
1600
|
payload: {
|
|
1973
|
-
logoutReason: d ||
|
|
1601
|
+
logoutReason: d || U
|
|
1974
1602
|
}
|
|
1975
|
-
}),
|
|
1603
|
+
}), V(), s({ type: J, payload: { isLoading: !1 } });
|
|
1976
1604
|
},
|
|
1977
|
-
[
|
|
1978
|
-
),
|
|
1605
|
+
[V, i]
|
|
1606
|
+
), P = N(
|
|
1979
1607
|
async (d) => {
|
|
1980
1608
|
i("invalidateAndLogout: invalidating and logging out");
|
|
1981
|
-
const { user:
|
|
1982
|
-
|
|
1609
|
+
const { user: y } = o, h = y?.userId || Kr(u);
|
|
1610
|
+
h || i(
|
|
1983
1611
|
"invalidateAndLogout: user cannot be identified, logging out without userId"
|
|
1984
|
-
), await
|
|
1985
|
-
userId:
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
clientId: n,
|
|
1990
|
-
domain: r
|
|
1991
|
-
}), K(d || H);
|
|
1612
|
+
), await Lr({
|
|
1613
|
+
userId: h,
|
|
1614
|
+
clientId: r,
|
|
1615
|
+
domain: n
|
|
1616
|
+
}), W(d || U);
|
|
1992
1617
|
},
|
|
1993
|
-
[
|
|
1994
|
-
f,
|
|
1995
|
-
s,
|
|
1996
|
-
n,
|
|
1997
|
-
r,
|
|
1998
|
-
l,
|
|
1999
|
-
R,
|
|
2000
|
-
K,
|
|
2001
|
-
i
|
|
2002
|
-
]
|
|
1618
|
+
[u, o, r, n, W, i]
|
|
2003
1619
|
);
|
|
2004
|
-
|
|
2005
|
-
y.current = "";
|
|
2006
|
-
}), []), Re(() => {
|
|
1620
|
+
He(() => {
|
|
2007
1621
|
if (!c.current)
|
|
2008
|
-
return
|
|
1622
|
+
return o.isLoading && u !== null ? (async () => {
|
|
2009
1623
|
try {
|
|
2010
|
-
const d = await
|
|
2011
|
-
d && d.payload[
|
|
2012
|
-
type:
|
|
1624
|
+
const d = await H(u);
|
|
1625
|
+
d && d.payload[S.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), s({
|
|
1626
|
+
type: te,
|
|
2013
1627
|
payload: {
|
|
2014
|
-
authenticationType: d.payload[T.AUTH_TYPE_KEY],
|
|
2015
1628
|
user: {
|
|
2016
|
-
userId: d.payload[
|
|
2017
|
-
username: d.payload[
|
|
1629
|
+
userId: d.payload[S.USER_ID_KEY],
|
|
1630
|
+
username: d.payload[S.USERNAME_KEY]
|
|
2018
1631
|
}
|
|
2019
1632
|
}
|
|
2020
|
-
})) : (i("useEffect: invalid JWT, invalidating and logging out"), await
|
|
1633
|
+
})) : (i("useEffect: invalid JWT, invalidating and logging out"), await P(U));
|
|
2021
1634
|
} catch {
|
|
2022
1635
|
i(
|
|
2023
1636
|
"useEffect: exception validating JWT, invalidating and logging out"
|
|
2024
|
-
), await
|
|
1637
|
+
), await P(U);
|
|
2025
1638
|
}
|
|
2026
|
-
})() : (i("useEffect: setting the loading state to false"),
|
|
1639
|
+
})() : (i("useEffect: setting the loading state to false"), s({ type: J, payload: { isLoading: !1 } })), () => {
|
|
2027
1640
|
c.current = !0;
|
|
2028
1641
|
};
|
|
2029
|
-
}, [
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
1642
|
+
}, [o.isLoading, u, P, i]);
|
|
1643
|
+
const ut = async (d, y) => {
|
|
1644
|
+
s({ type: J, payload: { isLoading: !0 } }), V();
|
|
1645
|
+
const h = me();
|
|
1646
|
+
Re(h), i("login: Logging in with password");
|
|
1647
|
+
const C = oe.CODE, { code_verifier: yt, code_challenge: gt } = await _r(), Ie = await Hr({
|
|
1648
|
+
nonce: h,
|
|
1649
|
+
clientId: r,
|
|
1650
|
+
code_challenge: gt
|
|
1651
|
+
});
|
|
1652
|
+
if (Ie.status) {
|
|
1653
|
+
const x = await $r({
|
|
1654
|
+
username: d,
|
|
1655
|
+
password: y,
|
|
1656
|
+
clientId: r,
|
|
1657
|
+
sessionExpiration: t,
|
|
1658
|
+
nonce: h,
|
|
1659
|
+
type: C,
|
|
1660
|
+
code: Ie.data,
|
|
1661
|
+
code_verifier: yt,
|
|
1662
|
+
domain: n
|
|
2038
1663
|
});
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
nonce: I,
|
|
2046
|
-
type: p,
|
|
2047
|
-
code: Pe.data,
|
|
2048
|
-
code_verifier: kt,
|
|
2049
|
-
domain: r,
|
|
2050
|
-
fingerprint: y.current
|
|
2051
|
-
});
|
|
2052
|
-
return V.status ? (h(V.idToken), u(V.accessToken), z(V.refreshToken), o({
|
|
2053
|
-
type: F,
|
|
2054
|
-
payload: {
|
|
2055
|
-
authenticationType: p,
|
|
2056
|
-
user: {
|
|
2057
|
-
userId: V.userId,
|
|
2058
|
-
username: d
|
|
2059
|
-
}
|
|
1664
|
+
return x.status ? (p(x.idToken), A(x.accessToken), de(x.refreshToken), s({
|
|
1665
|
+
type: te,
|
|
1666
|
+
payload: {
|
|
1667
|
+
user: {
|
|
1668
|
+
userId: x.userId,
|
|
1669
|
+
username: d
|
|
2060
1670
|
}
|
|
2061
|
-
}), !0) : (K(ae), !1);
|
|
2062
|
-
}
|
|
2063
|
-
return !1;
|
|
2064
|
-
}
|
|
2065
|
-
const Y = await Ve({
|
|
2066
|
-
username: d,
|
|
2067
|
-
password: E,
|
|
2068
|
-
clientId: n,
|
|
2069
|
-
sessionExpiration: t,
|
|
2070
|
-
nonce: I,
|
|
2071
|
-
type: p,
|
|
2072
|
-
domain: r,
|
|
2073
|
-
fingerprint: y.current
|
|
2074
|
-
});
|
|
2075
|
-
return Y.status ? (h(Y.idToken), u(Y.accessToken), z(Y.refreshToken), o({
|
|
2076
|
-
type: F,
|
|
2077
|
-
payload: {
|
|
2078
|
-
authenticationType: p,
|
|
2079
|
-
user: {
|
|
2080
|
-
userId: Y.userId,
|
|
2081
|
-
username: d
|
|
2082
1671
|
}
|
|
2083
|
-
}
|
|
2084
|
-
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
1672
|
+
}), !0) : (W(we), !1);
|
|
1673
|
+
}
|
|
1674
|
+
return !1;
|
|
1675
|
+
}, lt = async (d) => {
|
|
1676
|
+
d?.preventDefault(), await P(Cr);
|
|
1677
|
+
}, dt = async () => {
|
|
1678
|
+
const { isAuthenticated: d, user: y } = o;
|
|
2089
1679
|
try {
|
|
2090
|
-
if (d &&
|
|
2091
|
-
if (
|
|
1680
|
+
if (d && y && y.userId) {
|
|
1681
|
+
if (l) {
|
|
2092
1682
|
i("getAccessToken");
|
|
2093
|
-
const
|
|
2094
|
-
if (
|
|
2095
|
-
return
|
|
1683
|
+
const C = await H(l);
|
|
1684
|
+
if (C && C.payload[S.USER_ID_KEY] !== "")
|
|
1685
|
+
return l;
|
|
2096
1686
|
}
|
|
2097
1687
|
i("getAccessToken: invalid access token, trying to refresh it");
|
|
2098
|
-
const
|
|
2099
|
-
clientId:
|
|
2100
|
-
userId:
|
|
2101
|
-
nonce:
|
|
2102
|
-
domain:
|
|
1688
|
+
const h = await ct.refreshtoken({
|
|
1689
|
+
clientId: r,
|
|
1690
|
+
userId: y.userId,
|
|
1691
|
+
nonce: it,
|
|
1692
|
+
domain: n
|
|
2103
1693
|
});
|
|
2104
|
-
return
|
|
1694
|
+
return h.status && h.status === "success" && h.newAccessToken ? (A(h.newAccessToken), de(h.newRefreshToken), h.newAccessToken) : (i(
|
|
2105
1695
|
"getAccessToken: invalid refresh token, need to re-authenticate"
|
|
2106
|
-
), await
|
|
1696
|
+
), await P(U), "");
|
|
2107
1697
|
}
|
|
2108
1698
|
return i(
|
|
2109
1699
|
"getAccessToken: user is not authenticated, cannot get access token"
|
|
2110
|
-
), await
|
|
1700
|
+
), await P(U), "";
|
|
2111
1701
|
} catch {
|
|
2112
1702
|
return i(
|
|
2113
1703
|
"getAccessToken: exception occurred, invalidating and logging out"
|
|
2114
|
-
), await
|
|
1704
|
+
), await P(Nr), "";
|
|
2115
1705
|
}
|
|
2116
|
-
},
|
|
2117
|
-
const { user: d } =
|
|
2118
|
-
let
|
|
2119
|
-
accessToken:
|
|
2120
|
-
clientId:
|
|
2121
|
-
type:
|
|
1706
|
+
}, ht = () => o.isAuthenticated && u ? u : "", pt = async () => {
|
|
1707
|
+
const { user: d } = o;
|
|
1708
|
+
let y = await L({
|
|
1709
|
+
accessToken: l,
|
|
1710
|
+
clientId: r,
|
|
1711
|
+
type: K.GET_REGISTRATION_OPTIONS,
|
|
2122
1712
|
params: {
|
|
2123
|
-
clientId:
|
|
1713
|
+
clientId: r,
|
|
2124
1714
|
id: d?.userId,
|
|
2125
1715
|
username: d?.username
|
|
2126
1716
|
}
|
|
2127
1717
|
});
|
|
2128
|
-
if (
|
|
1718
|
+
if (y.status)
|
|
2129
1719
|
try {
|
|
2130
|
-
const
|
|
2131
|
-
return
|
|
2132
|
-
accessToken:
|
|
2133
|
-
clientId:
|
|
2134
|
-
type:
|
|
1720
|
+
const h = await vt(y.data);
|
|
1721
|
+
return y = await L({
|
|
1722
|
+
accessToken: l,
|
|
1723
|
+
clientId: r,
|
|
1724
|
+
type: K.VERIFY_REGISTRATION,
|
|
2135
1725
|
params: {
|
|
2136
|
-
clientId:
|
|
1726
|
+
clientId: r,
|
|
2137
1727
|
id: d?.userId,
|
|
2138
1728
|
username: d?.username,
|
|
2139
|
-
registration:
|
|
1729
|
+
registration: h
|
|
2140
1730
|
}
|
|
2141
|
-
}), !!(
|
|
1731
|
+
}), !!(y.status && y.data.length > 0);
|
|
2142
1732
|
} catch {
|
|
2143
|
-
return await
|
|
2144
|
-
accessToken:
|
|
2145
|
-
clientId:
|
|
2146
|
-
type:
|
|
1733
|
+
return await L({
|
|
1734
|
+
accessToken: l,
|
|
1735
|
+
clientId: r,
|
|
1736
|
+
type: K.VERIFY_REGISTRATION,
|
|
2147
1737
|
params: {
|
|
2148
|
-
clientId:
|
|
1738
|
+
clientId: r,
|
|
2149
1739
|
id: d?.userId,
|
|
2150
1740
|
username: d?.username,
|
|
2151
1741
|
registration: {}
|
|
@@ -2153,80 +1743,80 @@ const _r = (e) => U(
|
|
|
2153
1743
|
}), !1;
|
|
2154
1744
|
}
|
|
2155
1745
|
return !1;
|
|
2156
|
-
},
|
|
2157
|
-
|
|
2158
|
-
const d =
|
|
2159
|
-
|
|
2160
|
-
const
|
|
2161
|
-
let
|
|
2162
|
-
accessToken:
|
|
2163
|
-
clientId:
|
|
2164
|
-
type:
|
|
1746
|
+
}, ft = async () => {
|
|
1747
|
+
s({ type: J, payload: { isLoading: !0 } }), V();
|
|
1748
|
+
const d = me();
|
|
1749
|
+
Re(d), i("loginWithPasskey");
|
|
1750
|
+
const y = me();
|
|
1751
|
+
let h = await L({
|
|
1752
|
+
accessToken: l,
|
|
1753
|
+
clientId: r,
|
|
1754
|
+
type: K.GET_AUTHENTICATION_OPTIONS,
|
|
2165
1755
|
params: {
|
|
2166
|
-
id:
|
|
2167
|
-
clientId:
|
|
1756
|
+
id: y,
|
|
1757
|
+
clientId: r
|
|
2168
1758
|
}
|
|
2169
1759
|
});
|
|
2170
|
-
if (
|
|
1760
|
+
if (h.status)
|
|
2171
1761
|
try {
|
|
2172
|
-
const
|
|
2173
|
-
return
|
|
2174
|
-
accessToken:
|
|
2175
|
-
clientId:
|
|
2176
|
-
type:
|
|
1762
|
+
const C = await Ct(h.data);
|
|
1763
|
+
return h = await L({
|
|
1764
|
+
accessToken: l,
|
|
1765
|
+
clientId: r,
|
|
1766
|
+
type: K.VERIFY_AUTHENTICATION,
|
|
2177
1767
|
params: {
|
|
2178
|
-
clientId:
|
|
2179
|
-
id:
|
|
2180
|
-
authentication:
|
|
1768
|
+
clientId: r,
|
|
1769
|
+
id: y,
|
|
1770
|
+
authentication: C,
|
|
2181
1771
|
nonce: d,
|
|
2182
|
-
domain:
|
|
2183
|
-
|
|
1772
|
+
domain: n,
|
|
1773
|
+
sessionExpiration: t
|
|
2184
1774
|
}
|
|
2185
|
-
}),
|
|
2186
|
-
type:
|
|
1775
|
+
}), h.data.status === M ? (p(h.data.idToken), A(h.data.accessToken), de(h.data.refreshToken), s({
|
|
1776
|
+
type: te,
|
|
2187
1777
|
payload: {
|
|
2188
|
-
authenticationType: G.PASSKEY,
|
|
2189
1778
|
user: {
|
|
2190
|
-
userId:
|
|
2191
|
-
username:
|
|
1779
|
+
userId: h.data.userId,
|
|
1780
|
+
username: h.data.username
|
|
2192
1781
|
}
|
|
2193
1782
|
}
|
|
2194
|
-
}), !0) : (
|
|
1783
|
+
}), !0) : (W(we), !1);
|
|
2195
1784
|
} catch {
|
|
2196
|
-
return await
|
|
2197
|
-
accessToken:
|
|
2198
|
-
clientId:
|
|
2199
|
-
type:
|
|
1785
|
+
return await L({
|
|
1786
|
+
accessToken: l,
|
|
1787
|
+
clientId: r,
|
|
1788
|
+
type: K.VERIFY_AUTHENTICATION,
|
|
2200
1789
|
params: {
|
|
2201
|
-
clientId:
|
|
2202
|
-
id:
|
|
1790
|
+
clientId: r,
|
|
1791
|
+
id: y,
|
|
2203
1792
|
authentication: {},
|
|
2204
1793
|
nonce: d,
|
|
2205
|
-
domain:
|
|
1794
|
+
domain: n,
|
|
1795
|
+
sessionExpiration: t
|
|
2206
1796
|
}
|
|
2207
|
-
}),
|
|
1797
|
+
}), W(we), !1;
|
|
2208
1798
|
}
|
|
2209
1799
|
return !1;
|
|
2210
1800
|
};
|
|
2211
|
-
return /* @__PURE__ */
|
|
2212
|
-
|
|
1801
|
+
return /* @__PURE__ */ be(Yr.Provider, { value: { state: o, dispatch: s }, children: /* @__PURE__ */ be(
|
|
1802
|
+
ot.Provider,
|
|
2213
1803
|
{
|
|
2214
1804
|
value: {
|
|
2215
|
-
...
|
|
2216
|
-
login:
|
|
2217
|
-
logout:
|
|
2218
|
-
getAccessToken:
|
|
2219
|
-
getIdToken:
|
|
2220
|
-
registeringForPasskey:
|
|
2221
|
-
loginWithPasskey:
|
|
1805
|
+
...o,
|
|
1806
|
+
login: ut,
|
|
1807
|
+
logout: lt,
|
|
1808
|
+
getAccessToken: dt,
|
|
1809
|
+
getIdToken: ht,
|
|
1810
|
+
registeringForPasskey: pt,
|
|
1811
|
+
loginWithPasskey: ft
|
|
2222
1812
|
},
|
|
2223
1813
|
children: e
|
|
2224
1814
|
}
|
|
2225
1815
|
) });
|
|
2226
|
-
},
|
|
1816
|
+
}, zr = (e = ot) => _t(e);
|
|
2227
1817
|
export {
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
1818
|
+
oe as AUTH_TYPES,
|
|
1819
|
+
qr as AuthProvider,
|
|
1820
|
+
Br as isGranted,
|
|
1821
|
+
zr as useAuth
|
|
2232
1822
|
};
|