@versini/auth-provider 8.1.0 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.js +262 -254
- package/dist/hooks.js +2 -6
- package/dist/index.js +2 -6
- package/package.json +7 -11
package/dist/auth.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Ce = (e, t, n) => t in e ?
|
|
1
|
+
var ke = Object.defineProperty;
|
|
2
|
+
var Ce = (e, t, n) => t in e ? ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var K = (e, t, n) => Ce(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { jsx as
|
|
4
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
5
5
|
import { HEADERS as ie, decodeToken as ve, JWT as T, API_TYPE as M, AUTH_TYPES as C, verifyAndExtractToken as D, pkceChallengePair as Ue } from "@versini/auth-common";
|
|
6
6
|
import De, { useSyncExternalStore as Le, useCallback as S, useEffect as ce, createContext as $e, useContext as Ke, useReducer as Ye, useRef as Ge } from "react";
|
|
7
7
|
import { AuthHookContext as He } from "./AuthHookContext-C9a2AwWZ.js";
|
|
8
|
-
/*!
|
|
9
|
-
@versini/auth-provider v8.1.0
|
|
10
|
-
© 2025 gizmette.com
|
|
11
|
-
*/
|
|
12
8
|
try {
|
|
13
9
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
14
|
-
version: "8.1.
|
|
15
|
-
buildTime: "
|
|
10
|
+
version: "8.1.2",
|
|
11
|
+
buildTime: "01/23/2026 08:37 PM EST",
|
|
16
12
|
homepage: "https://github.com/aversini/auth-client",
|
|
17
13
|
license: "MIT"
|
|
18
14
|
});
|
|
@@ -26,15 +22,15 @@ function R(e) {
|
|
|
26
22
|
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
27
23
|
}
|
|
28
24
|
function F(e) {
|
|
29
|
-
const t = e.replace(/-/g, "+").replace(/_/g, "/"), n = (4 - t.length % 4) % 4, a = t.padEnd(t.length + n, "="), s = atob(a),
|
|
30
|
-
for (let
|
|
31
|
-
c[
|
|
32
|
-
return
|
|
25
|
+
const t = e.replace(/-/g, "+").replace(/_/g, "/"), n = (4 - t.length % 4) % 4, a = t.padEnd(t.length + n, "="), s = atob(a), i = new ArrayBuffer(s.length), c = new Uint8Array(i);
|
|
26
|
+
for (let o = 0; o < s.length; o++)
|
|
27
|
+
c[o] = s.charCodeAt(o);
|
|
28
|
+
return i;
|
|
33
29
|
}
|
|
34
30
|
function X() {
|
|
35
|
-
return
|
|
31
|
+
return xe.stubThis(globalThis?.PublicKeyCredential !== void 0 && typeof globalThis.PublicKeyCredential == "function");
|
|
36
32
|
}
|
|
37
|
-
const
|
|
33
|
+
const xe = {
|
|
38
34
|
stubThis: (e) => e
|
|
39
35
|
};
|
|
40
36
|
function ue(e) {
|
|
@@ -56,7 +52,7 @@ function le(e) {
|
|
|
56
52
|
e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)
|
|
57
53
|
);
|
|
58
54
|
}
|
|
59
|
-
class
|
|
55
|
+
class f extends Error {
|
|
60
56
|
constructor({ message: t, code: n, cause: a, name: s }) {
|
|
61
57
|
super(t, { cause: a }), Object.defineProperty(this, "code", {
|
|
62
58
|
enumerable: !0,
|
|
@@ -66,20 +62,20 @@ class p extends Error {
|
|
|
66
62
|
}), this.name = s ?? a.name, this.code = n;
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
|
-
function
|
|
65
|
+
function Ve({ error: e, options: t }) {
|
|
70
66
|
const { publicKey: n } = t;
|
|
71
67
|
if (!n)
|
|
72
68
|
throw Error("options was missing required publicKey property");
|
|
73
69
|
if (e.name === "AbortError") {
|
|
74
70
|
if (t.signal instanceof AbortSignal)
|
|
75
|
-
return new
|
|
71
|
+
return new f({
|
|
76
72
|
message: "Registration ceremony was sent an abort signal",
|
|
77
73
|
code: "ERROR_CEREMONY_ABORTED",
|
|
78
74
|
cause: e
|
|
79
75
|
});
|
|
80
76
|
} else if (e.name === "ConstraintError") {
|
|
81
77
|
if (n.authenticatorSelection?.requireResidentKey === !0)
|
|
82
|
-
return new
|
|
78
|
+
return new f({
|
|
83
79
|
message: "Discoverable credentials were required but no available authenticator supported it",
|
|
84
80
|
code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
|
|
85
81
|
cause: e
|
|
@@ -88,36 +84,36 @@ function xe({ error: e, options: t }) {
|
|
|
88
84
|
// @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024
|
|
89
85
|
t.mediation === "conditional" && n.authenticatorSelection?.userVerification === "required"
|
|
90
86
|
)
|
|
91
|
-
return new
|
|
87
|
+
return new f({
|
|
92
88
|
message: "User verification was required during automatic registration but it could not be performed",
|
|
93
89
|
code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
|
|
94
90
|
cause: e
|
|
95
91
|
});
|
|
96
92
|
if (n.authenticatorSelection?.userVerification === "required")
|
|
97
|
-
return new
|
|
93
|
+
return new f({
|
|
98
94
|
message: "User verification was required but no available authenticator supported it",
|
|
99
95
|
code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
|
|
100
96
|
cause: e
|
|
101
97
|
});
|
|
102
98
|
} else {
|
|
103
99
|
if (e.name === "InvalidStateError")
|
|
104
|
-
return new
|
|
100
|
+
return new f({
|
|
105
101
|
message: "The authenticator was previously registered",
|
|
106
102
|
code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
|
|
107
103
|
cause: e
|
|
108
104
|
});
|
|
109
105
|
if (e.name === "NotAllowedError")
|
|
110
|
-
return new
|
|
106
|
+
return new f({
|
|
111
107
|
message: e.message,
|
|
112
108
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
113
109
|
cause: e
|
|
114
110
|
});
|
|
115
111
|
if (e.name === "NotSupportedError")
|
|
116
|
-
return n.pubKeyCredParams.filter((s) => s.type === "public-key").length === 0 ? new
|
|
112
|
+
return n.pubKeyCredParams.filter((s) => s.type === "public-key").length === 0 ? new f({
|
|
117
113
|
message: 'No entry in pubKeyCredParams was of type "public-key"',
|
|
118
114
|
code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
|
|
119
115
|
cause: e
|
|
120
|
-
}) : new
|
|
116
|
+
}) : new f({
|
|
121
117
|
message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
|
|
122
118
|
code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
|
|
123
119
|
cause: e
|
|
@@ -126,25 +122,25 @@ function xe({ error: e, options: t }) {
|
|
|
126
122
|
const a = globalThis.location.hostname;
|
|
127
123
|
if (le(a)) {
|
|
128
124
|
if (n.rp.id !== a)
|
|
129
|
-
return new
|
|
125
|
+
return new f({
|
|
130
126
|
message: `The RP ID "${n.rp.id}" is invalid for this domain`,
|
|
131
127
|
code: "ERROR_INVALID_RP_ID",
|
|
132
128
|
cause: e
|
|
133
129
|
});
|
|
134
|
-
} else return new
|
|
130
|
+
} else return new f({
|
|
135
131
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
136
132
|
code: "ERROR_INVALID_DOMAIN",
|
|
137
133
|
cause: e
|
|
138
134
|
});
|
|
139
135
|
} else if (e.name === "TypeError") {
|
|
140
136
|
if (n.user.id.byteLength < 1 || n.user.id.byteLength > 64)
|
|
141
|
-
return new
|
|
137
|
+
return new f({
|
|
142
138
|
message: "User ID was not between 1 and 64 characters",
|
|
143
139
|
code: "ERROR_INVALID_USER_ID_LENGTH",
|
|
144
140
|
cause: e
|
|
145
141
|
});
|
|
146
142
|
} else if (e.name === "UnknownError")
|
|
147
|
-
return new
|
|
143
|
+
return new f({
|
|
148
144
|
message: "The authenticator was unable to process the specified options, or could not create a new credential",
|
|
149
145
|
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
150
146
|
cause: e
|
|
@@ -196,53 +192,53 @@ async function Je(e) {
|
|
|
196
192
|
excludeCredentials: t.excludeCredentials?.map(ue)
|
|
197
193
|
}, s = {};
|
|
198
194
|
n && (s.mediation = "conditional"), s.publicKey = a, s.signal = de.createNewAbortSignal();
|
|
199
|
-
let
|
|
195
|
+
let i;
|
|
200
196
|
try {
|
|
201
|
-
|
|
202
|
-
} catch (
|
|
203
|
-
throw
|
|
197
|
+
i = await navigator.credentials.create(s);
|
|
198
|
+
} catch (y) {
|
|
199
|
+
throw Ve({ error: y, options: s });
|
|
204
200
|
}
|
|
205
|
-
if (!
|
|
201
|
+
if (!i)
|
|
206
202
|
throw new Error("Registration was not completed");
|
|
207
|
-
const { id: c, rawId:
|
|
203
|
+
const { id: c, rawId: o, response: r, type: w } = i;
|
|
208
204
|
let d;
|
|
209
|
-
typeof
|
|
205
|
+
typeof r.getTransports == "function" && (d = r.getTransports());
|
|
210
206
|
let m;
|
|
211
|
-
if (typeof
|
|
207
|
+
if (typeof r.getPublicKeyAlgorithm == "function")
|
|
212
208
|
try {
|
|
213
|
-
m =
|
|
214
|
-
} catch (
|
|
215
|
-
j("getPublicKeyAlgorithm()",
|
|
209
|
+
m = r.getPublicKeyAlgorithm();
|
|
210
|
+
} catch (y) {
|
|
211
|
+
j("getPublicKeyAlgorithm()", y);
|
|
216
212
|
}
|
|
217
|
-
let
|
|
218
|
-
if (typeof
|
|
213
|
+
let E;
|
|
214
|
+
if (typeof r.getPublicKey == "function")
|
|
219
215
|
try {
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
} catch (
|
|
223
|
-
j("getPublicKey()",
|
|
216
|
+
const y = r.getPublicKey();
|
|
217
|
+
y !== null && (E = R(y));
|
|
218
|
+
} catch (y) {
|
|
219
|
+
j("getPublicKey()", y);
|
|
224
220
|
}
|
|
225
|
-
let
|
|
226
|
-
if (typeof
|
|
221
|
+
let p;
|
|
222
|
+
if (typeof r.getAuthenticatorData == "function")
|
|
227
223
|
try {
|
|
228
|
-
|
|
229
|
-
} catch (
|
|
230
|
-
j("getAuthenticatorData()",
|
|
224
|
+
p = R(r.getAuthenticatorData());
|
|
225
|
+
} catch (y) {
|
|
226
|
+
j("getAuthenticatorData()", y);
|
|
231
227
|
}
|
|
232
228
|
return {
|
|
233
229
|
id: c,
|
|
234
|
-
rawId: R(
|
|
230
|
+
rawId: R(o),
|
|
235
231
|
response: {
|
|
236
|
-
attestationObject: R(
|
|
237
|
-
clientDataJSON: R(
|
|
232
|
+
attestationObject: R(r.attestationObject),
|
|
233
|
+
clientDataJSON: R(r.clientDataJSON),
|
|
238
234
|
transports: d,
|
|
239
235
|
publicKeyAlgorithm: m,
|
|
240
|
-
publicKey:
|
|
241
|
-
authenticatorData:
|
|
236
|
+
publicKey: E,
|
|
237
|
+
authenticatorData: p
|
|
242
238
|
},
|
|
243
239
|
type: w,
|
|
244
|
-
clientExtensionResults:
|
|
245
|
-
authenticatorAttachment: he(
|
|
240
|
+
clientExtensionResults: i.getClientExtensionResults(),
|
|
241
|
+
authenticatorAttachment: he(i.authenticatorAttachment)
|
|
246
242
|
};
|
|
247
243
|
}
|
|
248
244
|
function j(e, t) {
|
|
@@ -264,14 +260,14 @@ function je({ error: e, options: t }) {
|
|
|
264
260
|
throw Error("options was missing required publicKey property");
|
|
265
261
|
if (e.name === "AbortError") {
|
|
266
262
|
if (t.signal instanceof AbortSignal)
|
|
267
|
-
return new
|
|
263
|
+
return new f({
|
|
268
264
|
message: "Authentication ceremony was sent an abort signal",
|
|
269
265
|
code: "ERROR_CEREMONY_ABORTED",
|
|
270
266
|
cause: e
|
|
271
267
|
});
|
|
272
268
|
} else {
|
|
273
269
|
if (e.name === "NotAllowedError")
|
|
274
|
-
return new
|
|
270
|
+
return new f({
|
|
275
271
|
message: e.message,
|
|
276
272
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
277
273
|
cause: e
|
|
@@ -280,18 +276,18 @@ function je({ error: e, options: t }) {
|
|
|
280
276
|
const a = globalThis.location.hostname;
|
|
281
277
|
if (le(a)) {
|
|
282
278
|
if (n.rpId !== a)
|
|
283
|
-
return new
|
|
279
|
+
return new f({
|
|
284
280
|
message: `The RP ID "${n.rpId}" is invalid for this domain`,
|
|
285
281
|
code: "ERROR_INVALID_RP_ID",
|
|
286
282
|
cause: e
|
|
287
283
|
});
|
|
288
|
-
} else return new
|
|
284
|
+
} else return new f({
|
|
289
285
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
290
286
|
code: "ERROR_INVALID_DOMAIN",
|
|
291
287
|
cause: e
|
|
292
288
|
});
|
|
293
289
|
} else if (e.name === "UnknownError")
|
|
294
|
-
return new
|
|
290
|
+
return new f({
|
|
295
291
|
message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
|
|
296
292
|
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
297
293
|
cause: e
|
|
@@ -306,7 +302,7 @@ async function Be(e) {
|
|
|
306
302
|
throw new Error("WebAuthn is not supported in this browser");
|
|
307
303
|
let s;
|
|
308
304
|
t.allowCredentials?.length !== 0 && (s = t.allowCredentials?.map(ue));
|
|
309
|
-
const
|
|
305
|
+
const i = {
|
|
310
306
|
...t,
|
|
311
307
|
challenge: F(t.challenge),
|
|
312
308
|
allowCredentials: s
|
|
@@ -316,70 +312,81 @@ async function Be(e) {
|
|
|
316
312
|
throw Error("Browser does not support WebAuthn autofill");
|
|
317
313
|
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && a)
|
|
318
314
|
throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
|
|
319
|
-
c.mediation = "conditional",
|
|
315
|
+
c.mediation = "conditional", i.allowCredentials = [];
|
|
320
316
|
}
|
|
321
|
-
c.publicKey =
|
|
322
|
-
let
|
|
317
|
+
c.publicKey = i, c.signal = de.createNewAbortSignal();
|
|
318
|
+
let o;
|
|
323
319
|
try {
|
|
324
|
-
|
|
325
|
-
} catch (
|
|
326
|
-
throw je({ error:
|
|
320
|
+
o = await navigator.credentials.get(c);
|
|
321
|
+
} catch (p) {
|
|
322
|
+
throw je({ error: p, options: c });
|
|
327
323
|
}
|
|
328
|
-
if (!
|
|
324
|
+
if (!o)
|
|
329
325
|
throw new Error("Authentication was not completed");
|
|
330
|
-
const { id:
|
|
331
|
-
let
|
|
332
|
-
return d.userHandle && (
|
|
333
|
-
id:
|
|
326
|
+
const { id: r, rawId: w, response: d, type: m } = o;
|
|
327
|
+
let E;
|
|
328
|
+
return d.userHandle && (E = R(d.userHandle)), {
|
|
329
|
+
id: r,
|
|
334
330
|
rawId: R(w),
|
|
335
331
|
response: {
|
|
336
332
|
authenticatorData: R(d.authenticatorData),
|
|
337
333
|
clientDataJSON: R(d.clientDataJSON),
|
|
338
334
|
signature: R(d.signature),
|
|
339
|
-
userHandle:
|
|
335
|
+
userHandle: E
|
|
340
336
|
},
|
|
341
337
|
type: m,
|
|
342
|
-
clientExtensionResults:
|
|
343
|
-
authenticatorAttachment: he(
|
|
338
|
+
clientExtensionResults: o.getClientExtensionResults(),
|
|
339
|
+
authenticatorAttachment: he(o.authenticatorAttachment)
|
|
344
340
|
};
|
|
345
341
|
}
|
|
346
342
|
function ge(e, t) {
|
|
347
|
-
window.dispatchEvent(new StorageEvent("storage", {
|
|
343
|
+
window.dispatchEvent(new StorageEvent("storage", {
|
|
344
|
+
key: e,
|
|
345
|
+
newValue: t
|
|
346
|
+
}));
|
|
348
347
|
}
|
|
349
348
|
const se = (e, t) => {
|
|
350
|
-
const n = JSON.stringify(
|
|
351
|
-
typeof t == "function" ? t() : t
|
|
352
|
-
);
|
|
349
|
+
const n = JSON.stringify(typeof t == "function" ? t() : t);
|
|
353
350
|
window.localStorage.setItem(e, n), ge(e, n);
|
|
354
351
|
}, qe = (e) => {
|
|
355
352
|
window.localStorage.removeItem(e), ge(e, null);
|
|
356
353
|
}, re = (e) => window.localStorage.getItem(e), ze = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
|
|
357
|
-
function Y({
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
(
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}, [
|
|
354
|
+
function Y({ key: e, initialValue: t }) {
|
|
355
|
+
const a = Le(ze, () => re(e)), s = S((o) => {
|
|
356
|
+
try {
|
|
357
|
+
const r = typeof o == "function" ? o(JSON.parse(a)) : o;
|
|
358
|
+
r == null ? qe(e) : se(e, r);
|
|
359
|
+
} catch (r) {
|
|
360
|
+
console.warn(r);
|
|
361
|
+
}
|
|
362
|
+
}, [
|
|
363
|
+
e,
|
|
364
|
+
a
|
|
365
|
+
]), i = S(() => {
|
|
366
|
+
s(t);
|
|
367
|
+
}, [
|
|
368
|
+
t,
|
|
369
|
+
s
|
|
370
|
+
]), c = S(() => {
|
|
371
|
+
s(null);
|
|
372
|
+
}, [
|
|
373
|
+
s
|
|
374
|
+
]);
|
|
376
375
|
return ce(() => {
|
|
377
376
|
try {
|
|
378
377
|
re(e) === null && typeof t < "u" && se(e, t);
|
|
379
|
-
} catch (
|
|
380
|
-
console.warn(
|
|
378
|
+
} catch (o) {
|
|
379
|
+
console.warn(o);
|
|
381
380
|
}
|
|
382
|
-
}, [
|
|
381
|
+
}, [
|
|
382
|
+
e,
|
|
383
|
+
t
|
|
384
|
+
]), [
|
|
385
|
+
a ? JSON.parse(a) : null,
|
|
386
|
+
s,
|
|
387
|
+
i,
|
|
388
|
+
c
|
|
389
|
+
];
|
|
383
390
|
}
|
|
384
391
|
const g = [];
|
|
385
392
|
for (let e = 0; e < 256; ++e)
|
|
@@ -398,16 +405,17 @@ function Ze() {
|
|
|
398
405
|
return q(Xe);
|
|
399
406
|
}
|
|
400
407
|
const et = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), oe = { randomUUID: et };
|
|
401
|
-
function
|
|
402
|
-
if (oe.randomUUID && !e)
|
|
403
|
-
return oe.randomUUID();
|
|
408
|
+
function tt(e, t, n) {
|
|
404
409
|
e = e || {};
|
|
405
410
|
const a = e.random ?? e.rng?.() ?? Ze();
|
|
406
411
|
if (a.length < 16)
|
|
407
412
|
throw new Error("Random bytes length must be >= 16");
|
|
408
413
|
return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Qe(a);
|
|
409
414
|
}
|
|
410
|
-
|
|
415
|
+
function z(e, t, n) {
|
|
416
|
+
return oe.randomUUID && !e ? oe.randomUUID() : tt(e);
|
|
417
|
+
}
|
|
418
|
+
const O = "Your session has expired. For your security, please log in again to continue.", nt = "Your session has been successfully terminated.", Q = "Login failed. Please try again.", at = "Error getting access token, please re-authenticate.", st = "You forgot to wrap your component in <AuthProvider>.", G = "@@auth@@", U = "LOADING", V = "LOGIN", fe = "LOGOUT", L = "success", A = "failure", pe = "include", Te = "POST", Ee = "application/json", H = {
|
|
411
419
|
GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
|
|
412
420
|
$clientId: String!,
|
|
413
421
|
$username: String!,
|
|
@@ -505,7 +513,7 @@ const b = "Your session has expired. For your security, please log in again to c
|
|
|
505
513
|
schema: H.VERIFY_AUTHENTICATION,
|
|
506
514
|
method: "verifyPasskeyAuthentication"
|
|
507
515
|
}
|
|
508
|
-
},
|
|
516
|
+
}, P = async ({
|
|
509
517
|
accessToken: e,
|
|
510
518
|
type: t,
|
|
511
519
|
clientId: n,
|
|
@@ -513,12 +521,12 @@ const b = "Your session has expired. For your security, please log in again to c
|
|
|
513
521
|
endpoint: s
|
|
514
522
|
}) => {
|
|
515
523
|
try {
|
|
516
|
-
const
|
|
517
|
-
credentials:
|
|
524
|
+
const i = `Bearer ${e}`, c = await fetch(`${s}/graphql`, {
|
|
525
|
+
credentials: pe,
|
|
518
526
|
method: Te,
|
|
519
527
|
headers: {
|
|
520
|
-
authorization:
|
|
521
|
-
"Content-Type":
|
|
528
|
+
authorization: i,
|
|
529
|
+
"Content-Type": Ee,
|
|
522
530
|
[ie.CLIENT_ID]: `${n}`
|
|
523
531
|
},
|
|
524
532
|
body: JSON.stringify({
|
|
@@ -528,13 +536,13 @@ const b = "Your session has expired. For your security, please log in again to c
|
|
|
528
536
|
});
|
|
529
537
|
if (c.status !== 200)
|
|
530
538
|
return { status: A, data: [] };
|
|
531
|
-
const { data:
|
|
539
|
+
const { data: o } = await c.json();
|
|
532
540
|
return {
|
|
533
541
|
status: L,
|
|
534
|
-
data:
|
|
542
|
+
data: o[t.method]
|
|
535
543
|
};
|
|
536
|
-
} catch (
|
|
537
|
-
return console.error(
|
|
544
|
+
} catch (i) {
|
|
545
|
+
return console.error(i), { status: A, data: [] };
|
|
538
546
|
}
|
|
539
547
|
}, J = async ({
|
|
540
548
|
type: e,
|
|
@@ -544,39 +552,39 @@ const b = "Your session has expired. For your security, please log in again to c
|
|
|
544
552
|
}) => {
|
|
545
553
|
try {
|
|
546
554
|
const s = await fetch(`${a}/${e}`, {
|
|
547
|
-
credentials:
|
|
555
|
+
credentials: pe,
|
|
548
556
|
method: Te,
|
|
549
557
|
headers: {
|
|
550
|
-
"Content-Type":
|
|
558
|
+
"Content-Type": Ee,
|
|
551
559
|
[ie.CLIENT_ID]: `${t}`
|
|
552
560
|
},
|
|
553
561
|
body: JSON.stringify(n)
|
|
554
562
|
});
|
|
555
563
|
if (s.status !== 200)
|
|
556
564
|
return { status: A, data: [] };
|
|
557
|
-
const { data:
|
|
565
|
+
const { data: i } = await s.json();
|
|
558
566
|
return {
|
|
559
567
|
status: L,
|
|
560
|
-
data:
|
|
568
|
+
data: i || []
|
|
561
569
|
};
|
|
562
570
|
} catch (s) {
|
|
563
571
|
return console.error(s), { status: A, data: [] };
|
|
564
572
|
}
|
|
565
|
-
},
|
|
573
|
+
}, rt = process.env.NODE_ENV === "production", ot = !rt, ye = {
|
|
566
574
|
isLoading: !0,
|
|
567
575
|
isAuthenticated: !1,
|
|
568
576
|
user: void 0,
|
|
569
577
|
logoutReason: "",
|
|
570
578
|
debug: !1,
|
|
571
579
|
authenticationType: ""
|
|
572
|
-
},
|
|
580
|
+
}, it = (e) => {
|
|
573
581
|
try {
|
|
574
582
|
const t = ve(e);
|
|
575
583
|
return t ? t[T.USER_ID_KEY] : "";
|
|
576
584
|
} catch {
|
|
577
585
|
return "";
|
|
578
586
|
}
|
|
579
|
-
},
|
|
587
|
+
}, ct = async ({
|
|
580
588
|
userId: e,
|
|
581
589
|
clientId: t,
|
|
582
590
|
domain: n,
|
|
@@ -601,16 +609,16 @@ const b = "Your session has expired. For your security, please log in again to c
|
|
|
601
609
|
status: A
|
|
602
610
|
};
|
|
603
611
|
}
|
|
604
|
-
},
|
|
612
|
+
}, ut = async ({
|
|
605
613
|
username: e,
|
|
606
614
|
password: t,
|
|
607
615
|
clientId: n,
|
|
608
616
|
nonce: a,
|
|
609
617
|
type: s,
|
|
610
|
-
sessionExpiration:
|
|
618
|
+
sessionExpiration: i,
|
|
611
619
|
code: c,
|
|
612
|
-
code_verifier:
|
|
613
|
-
domain:
|
|
620
|
+
code_verifier: o,
|
|
621
|
+
domain: r,
|
|
614
622
|
ua: w,
|
|
615
623
|
endpoint: d
|
|
616
624
|
}) => {
|
|
@@ -623,20 +631,20 @@ const b = "Your session has expired. For your security, please log in again to c
|
|
|
623
631
|
type: s || C.ID_AND_ACCESS_TOKEN,
|
|
624
632
|
username: e,
|
|
625
633
|
password: t,
|
|
626
|
-
sessionExpiration:
|
|
634
|
+
sessionExpiration: i,
|
|
627
635
|
nonce: a,
|
|
628
636
|
code: c,
|
|
629
|
-
code_verifier:
|
|
630
|
-
domain:
|
|
637
|
+
code_verifier: o,
|
|
638
|
+
domain: r,
|
|
631
639
|
ua: w
|
|
632
640
|
}
|
|
633
|
-
}),
|
|
634
|
-
return
|
|
641
|
+
}), E = await D(m?.data?.idToken);
|
|
642
|
+
return E && E.payload[T.USER_ID_KEY] !== "" && E.payload[T.NONCE_KEY] === a ? {
|
|
635
643
|
idToken: m.data.idToken,
|
|
636
644
|
accessToken: m.data.accessToken,
|
|
637
645
|
refreshToken: m.data.refreshToken,
|
|
638
|
-
userId:
|
|
639
|
-
email:
|
|
646
|
+
userId: E.payload[T.USER_ID_KEY],
|
|
647
|
+
email: E.payload[T.EMAIL_KEY],
|
|
640
648
|
status: !0
|
|
641
649
|
} : {
|
|
642
650
|
status: !1
|
|
@@ -646,7 +654,7 @@ const b = "Your session has expired. For your security, please log in again to c
|
|
|
646
654
|
status: !1
|
|
647
655
|
};
|
|
648
656
|
}
|
|
649
|
-
},
|
|
657
|
+
}, lt = async ({
|
|
650
658
|
nonce: e,
|
|
651
659
|
clientId: t,
|
|
652
660
|
code_challenge: n,
|
|
@@ -676,17 +684,17 @@ const b = "Your session has expired. For your security, please log in again to c
|
|
|
676
684
|
data: ""
|
|
677
685
|
};
|
|
678
686
|
}
|
|
679
|
-
},
|
|
687
|
+
}, dt = async ({
|
|
680
688
|
clientId: e,
|
|
681
689
|
userId: t,
|
|
682
690
|
nonce: n,
|
|
683
691
|
refreshToken: a,
|
|
684
692
|
accessToken: s,
|
|
685
|
-
domain:
|
|
693
|
+
domain: i,
|
|
686
694
|
endpoint: c
|
|
687
695
|
}) => {
|
|
688
696
|
try {
|
|
689
|
-
const
|
|
697
|
+
const o = await J({
|
|
690
698
|
endpoint: c,
|
|
691
699
|
type: M.REFRESH,
|
|
692
700
|
clientId: e,
|
|
@@ -696,13 +704,13 @@ const b = "Your session has expired. For your security, please log in again to c
|
|
|
696
704
|
nonce: n,
|
|
697
705
|
refreshToken: a,
|
|
698
706
|
accessToken: s,
|
|
699
|
-
domain:
|
|
707
|
+
domain: i
|
|
700
708
|
}
|
|
701
|
-
}),
|
|
702
|
-
return
|
|
703
|
-
accessToken:
|
|
704
|
-
refreshToken:
|
|
705
|
-
userId:
|
|
709
|
+
}), r = await D(o?.data?.accessToken);
|
|
710
|
+
return r && r.payload[T.USER_ID_KEY] !== "" && r.payload[T.NONCE_KEY] === n ? {
|
|
711
|
+
accessToken: o.data.accessToken,
|
|
712
|
+
refreshToken: o.data.refreshToken,
|
|
713
|
+
userId: r.payload[T.USER_ID_KEY],
|
|
706
714
|
status: !0
|
|
707
715
|
} : {
|
|
708
716
|
status: !1
|
|
@@ -713,7 +721,7 @@ const b = "Your session has expired. For your security, please log in again to c
|
|
|
713
721
|
};
|
|
714
722
|
}
|
|
715
723
|
};
|
|
716
|
-
class
|
|
724
|
+
class ht {
|
|
717
725
|
constructor(t = null, n = null) {
|
|
718
726
|
K(this, "refreshTokenPromise", null);
|
|
719
727
|
K(this, "accessToken");
|
|
@@ -725,10 +733,10 @@ class dt {
|
|
|
725
733
|
userId: n,
|
|
726
734
|
nonce: a,
|
|
727
735
|
domain: s,
|
|
728
|
-
endpoint:
|
|
736
|
+
endpoint: i
|
|
729
737
|
}) {
|
|
730
738
|
this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
|
|
731
|
-
endpoint:
|
|
739
|
+
endpoint: i,
|
|
732
740
|
clientId: t,
|
|
733
741
|
userId: n,
|
|
734
742
|
nonce: a,
|
|
@@ -745,23 +753,23 @@ class dt {
|
|
|
745
753
|
clientId: n,
|
|
746
754
|
userId: a,
|
|
747
755
|
nonce: s,
|
|
748
|
-
domain:
|
|
756
|
+
domain: i
|
|
749
757
|
}) {
|
|
750
758
|
const c = await D(this.refreshToken);
|
|
751
759
|
if (c && c.payload[T.USER_ID_KEY] !== "") {
|
|
752
|
-
const
|
|
760
|
+
const o = await dt({
|
|
753
761
|
endpoint: t,
|
|
754
762
|
clientId: n,
|
|
755
763
|
userId: a,
|
|
756
764
|
nonce: s,
|
|
757
765
|
refreshToken: this.refreshToken,
|
|
758
766
|
accessToken: this.accessToken,
|
|
759
|
-
domain:
|
|
767
|
+
domain: i
|
|
760
768
|
});
|
|
761
|
-
return
|
|
769
|
+
return o.status ? (this.accessToken = o.accessToken, this.refreshToken = o.refreshToken, {
|
|
762
770
|
status: L,
|
|
763
|
-
newAccessToken:
|
|
764
|
-
newRefreshToken:
|
|
771
|
+
newAccessToken: o.accessToken,
|
|
772
|
+
newRefreshToken: o.refreshToken
|
|
765
773
|
}) : {
|
|
766
774
|
status: A
|
|
767
775
|
};
|
|
@@ -771,64 +779,64 @@ class dt {
|
|
|
771
779
|
};
|
|
772
780
|
}
|
|
773
781
|
}
|
|
774
|
-
const
|
|
775
|
-
throw new Error(
|
|
782
|
+
const k = () => {
|
|
783
|
+
throw new Error(st);
|
|
776
784
|
}, me = $e({
|
|
777
785
|
isAuthenticated: !1,
|
|
778
786
|
isLoading: !1,
|
|
779
|
-
login:
|
|
780
|
-
logout:
|
|
781
|
-
getAccessToken:
|
|
782
|
-
getIdToken:
|
|
783
|
-
registeringForPasskey:
|
|
784
|
-
loginWithPasskey:
|
|
787
|
+
login: k,
|
|
788
|
+
logout: k,
|
|
789
|
+
getAccessToken: k,
|
|
790
|
+
getIdToken: k,
|
|
791
|
+
registeringForPasskey: k,
|
|
792
|
+
loginWithPasskey: k,
|
|
785
793
|
logoutReason: "",
|
|
786
794
|
authenticationType: ""
|
|
787
|
-
}),
|
|
795
|
+
}), gt = () => ({
|
|
788
796
|
...Ke(me)
|
|
789
|
-
}),
|
|
797
|
+
}), ft = (e) => S(
|
|
790
798
|
(...t) => {
|
|
791
799
|
e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
|
|
792
800
|
},
|
|
793
801
|
[e]
|
|
794
802
|
), pt = De.createContext({
|
|
795
|
-
state:
|
|
803
|
+
state: ye,
|
|
796
804
|
dispatch: () => {
|
|
797
805
|
}
|
|
798
|
-
}),
|
|
806
|
+
}), Tt = (e, t) => t?.type === U ? {
|
|
799
807
|
...e,
|
|
800
808
|
isLoading: t.payload.isLoading
|
|
801
|
-
} : t?.type ===
|
|
809
|
+
} : t?.type === V ? {
|
|
802
810
|
...e,
|
|
803
811
|
isLoading: !1,
|
|
804
812
|
isAuthenticated: !0,
|
|
805
813
|
user: t.payload.user,
|
|
806
814
|
authenticationType: t.payload.authenticationType,
|
|
807
815
|
logoutReason: ""
|
|
808
|
-
} : t?.type ===
|
|
816
|
+
} : t?.type === fe ? {
|
|
809
817
|
...e,
|
|
810
818
|
isLoading: !1,
|
|
811
819
|
isAuthenticated: !1,
|
|
812
820
|
user: void 0,
|
|
813
821
|
authenticationType: "",
|
|
814
822
|
logoutReason: t.payload.logoutReason
|
|
815
|
-
} : e,
|
|
816
|
-
const t =
|
|
817
|
-
return /* @__PURE__ */
|
|
818
|
-
},
|
|
823
|
+
} : e, Et = ({ children: e }) => {
|
|
824
|
+
const t = gt();
|
|
825
|
+
return /* @__PURE__ */ x(He.Provider, { value: t, children: e });
|
|
826
|
+
}, It = ({
|
|
819
827
|
children: e,
|
|
820
828
|
sessionExpiration: t,
|
|
821
829
|
clientId: n,
|
|
822
830
|
domain: a = "",
|
|
823
831
|
debug: s = !1,
|
|
824
|
-
endpoint:
|
|
832
|
+
endpoint: i = ot ? "https://auth.gizmette.local.com:3003" : "https://mylogin.gizmette.com/auth"
|
|
825
833
|
}) => {
|
|
826
|
-
const [c,
|
|
827
|
-
...
|
|
834
|
+
const [c, o] = Ye(Tt, {
|
|
835
|
+
...ye,
|
|
828
836
|
debug: s
|
|
829
|
-
}),
|
|
837
|
+
}), r = ft(s), w = Ge(!1), [d, m, , E] = Y({
|
|
830
838
|
key: `${G}::${n}::@@user@@`
|
|
831
|
-
}), [
|
|
839
|
+
}), [p, y, , Z] = Y({
|
|
832
840
|
key: `${G}::${n}::@@access@@`
|
|
833
841
|
}), [Re, W, , ee] = Y(
|
|
834
842
|
{
|
|
@@ -836,40 +844,40 @@ const P = () => {
|
|
|
836
844
|
}
|
|
837
845
|
), [Ae, te, , ne] = Y({
|
|
838
846
|
key: `${G}::${n}::@@nonce@@`
|
|
839
|
-
}), we = new
|
|
840
|
-
|
|
847
|
+
}), we = new ht(p, Re), $ = S(() => {
|
|
848
|
+
r("removeLocalStorage: removing local storage"), E(), Z(), ee(), ne();
|
|
841
849
|
}, [
|
|
842
850
|
Z,
|
|
843
|
-
|
|
851
|
+
E,
|
|
844
852
|
ne,
|
|
845
853
|
ee,
|
|
846
|
-
|
|
854
|
+
r
|
|
847
855
|
]), v = S(
|
|
848
856
|
(u) => {
|
|
849
|
-
|
|
857
|
+
r(
|
|
850
858
|
"removeStateAndLocalStorage: removing state and local storage with reason: ",
|
|
851
859
|
u
|
|
852
|
-
),
|
|
853
|
-
type:
|
|
860
|
+
), o({
|
|
861
|
+
type: fe,
|
|
854
862
|
payload: {
|
|
855
|
-
logoutReason: u ||
|
|
863
|
+
logoutReason: u || O
|
|
856
864
|
}
|
|
857
|
-
}), $(),
|
|
865
|
+
}), $(), o({ type: U, payload: { isLoading: !1 } });
|
|
858
866
|
},
|
|
859
|
-
[$,
|
|
867
|
+
[$, r]
|
|
860
868
|
), I = S(
|
|
861
869
|
async (u) => {
|
|
862
|
-
|
|
863
|
-
const { user: h } = c, l = h?.userId ||
|
|
864
|
-
l ||
|
|
870
|
+
r("invalidateAndLogout: invalidating and logging out");
|
|
871
|
+
const { user: h } = c, l = h?.userId || it(d);
|
|
872
|
+
l || r(
|
|
865
873
|
"invalidateAndLogout: user cannot be identified, logging out without userId"
|
|
866
|
-
), await
|
|
874
|
+
), await ct({
|
|
867
875
|
userId: l,
|
|
868
876
|
clientId: n,
|
|
869
877
|
domain: a,
|
|
870
878
|
idToken: d,
|
|
871
|
-
endpoint:
|
|
872
|
-
}), v(u ||
|
|
879
|
+
endpoint: i
|
|
880
|
+
}), v(u || O);
|
|
873
881
|
},
|
|
874
882
|
[
|
|
875
883
|
d,
|
|
@@ -877,8 +885,8 @@ const P = () => {
|
|
|
877
885
|
n,
|
|
878
886
|
a,
|
|
879
887
|
v,
|
|
880
|
-
|
|
881
|
-
|
|
888
|
+
r,
|
|
889
|
+
i
|
|
882
890
|
]
|
|
883
891
|
);
|
|
884
892
|
ce(() => {
|
|
@@ -886,8 +894,8 @@ const P = () => {
|
|
|
886
894
|
return c.isLoading && d !== null ? (async () => {
|
|
887
895
|
try {
|
|
888
896
|
const u = await D(d);
|
|
889
|
-
u && u.payload[T.USER_ID_KEY] !== "" ? (
|
|
890
|
-
type:
|
|
897
|
+
u && u.payload[T.USER_ID_KEY] !== "" ? (r("useEffect: setting the authentication state"), o({
|
|
898
|
+
type: V,
|
|
891
899
|
payload: {
|
|
892
900
|
authenticationType: u.payload[T.AUTH_TYPE_KEY],
|
|
893
901
|
user: {
|
|
@@ -896,29 +904,29 @@ const P = () => {
|
|
|
896
904
|
email: u.payload[T.EMAIL_KEY]
|
|
897
905
|
}
|
|
898
906
|
}
|
|
899
|
-
})) : (
|
|
907
|
+
})) : (r("useEffect: invalid JWT, invalidating and logging out"), await I(O));
|
|
900
908
|
} catch {
|
|
901
|
-
|
|
909
|
+
r(
|
|
902
910
|
"useEffect: exception validating JWT, invalidating and logging out"
|
|
903
|
-
), await I(
|
|
911
|
+
), await I(O);
|
|
904
912
|
}
|
|
905
|
-
})() : (
|
|
913
|
+
})() : (r("useEffect: setting the loading state to false"), o({ type: U, payload: { isLoading: !1 } })), () => {
|
|
906
914
|
w.current = !0;
|
|
907
915
|
};
|
|
908
|
-
}, [c.isLoading, d, I,
|
|
916
|
+
}, [c.isLoading, d, I, r]);
|
|
909
917
|
const Ie = async (u, h) => {
|
|
910
|
-
|
|
918
|
+
o({ type: U, payload: { isLoading: !0 } }), $();
|
|
911
919
|
const l = z();
|
|
912
|
-
te(l),
|
|
913
|
-
const { code_verifier: _, code_challenge:
|
|
914
|
-
endpoint:
|
|
920
|
+
te(l), r("login: Logging in with password");
|
|
921
|
+
const { code_verifier: _, code_challenge: Pe } = await Ue(), ae = await lt({
|
|
922
|
+
endpoint: i,
|
|
915
923
|
nonce: l,
|
|
916
924
|
clientId: n,
|
|
917
|
-
code_challenge:
|
|
925
|
+
code_challenge: Pe
|
|
918
926
|
});
|
|
919
927
|
if (ae.status) {
|
|
920
|
-
const
|
|
921
|
-
endpoint:
|
|
928
|
+
const b = await ut({
|
|
929
|
+
endpoint: i,
|
|
922
930
|
username: u,
|
|
923
931
|
password: h,
|
|
924
932
|
clientId: n,
|
|
@@ -930,56 +938,56 @@ const P = () => {
|
|
|
930
938
|
domain: a,
|
|
931
939
|
ua: navigator.userAgent
|
|
932
940
|
});
|
|
933
|
-
return
|
|
934
|
-
type:
|
|
941
|
+
return b.status ? (m(b.idToken), y(b.accessToken), W(b.refreshToken), o({
|
|
942
|
+
type: V,
|
|
935
943
|
payload: {
|
|
936
944
|
authenticationType: C.CODE,
|
|
937
945
|
user: {
|
|
938
|
-
userId:
|
|
946
|
+
userId: b.userId,
|
|
939
947
|
username: u,
|
|
940
|
-
email:
|
|
948
|
+
email: b.email
|
|
941
949
|
}
|
|
942
950
|
}
|
|
943
951
|
}), !0) : (v(Q), !1);
|
|
944
952
|
}
|
|
945
953
|
return !1;
|
|
946
954
|
}, _e = async (u) => {
|
|
947
|
-
u?.preventDefault(), await I(
|
|
955
|
+
u?.preventDefault(), await I(nt);
|
|
948
956
|
}, Se = async () => {
|
|
949
957
|
const { isAuthenticated: u, user: h } = c;
|
|
950
958
|
try {
|
|
951
959
|
if (u && h && h.userId) {
|
|
952
|
-
if (
|
|
953
|
-
|
|
954
|
-
const _ = await D(
|
|
960
|
+
if (p) {
|
|
961
|
+
r("getAccessToken");
|
|
962
|
+
const _ = await D(p);
|
|
955
963
|
if (_ && _.payload[T.USER_ID_KEY] !== "")
|
|
956
|
-
return
|
|
964
|
+
return p;
|
|
957
965
|
}
|
|
958
|
-
|
|
966
|
+
r("getAccessToken: invalid access token, trying to refresh it");
|
|
959
967
|
const l = await we.refreshtoken({
|
|
960
|
-
endpoint:
|
|
968
|
+
endpoint: i,
|
|
961
969
|
clientId: n,
|
|
962
970
|
userId: h.userId,
|
|
963
971
|
nonce: Ae,
|
|
964
972
|
domain: a
|
|
965
973
|
});
|
|
966
|
-
return l.status && l.status === "success" && l.newAccessToken ? (
|
|
974
|
+
return l.status && l.status === "success" && l.newAccessToken ? (y(l.newAccessToken), W(l.newRefreshToken), l.newAccessToken) : (r(
|
|
967
975
|
"getAccessToken: invalid refresh token, need to re-authenticate"
|
|
968
|
-
), await I(
|
|
976
|
+
), await I(O), "");
|
|
969
977
|
}
|
|
970
|
-
return
|
|
978
|
+
return r(
|
|
971
979
|
"getAccessToken: user is not authenticated, cannot get access token"
|
|
972
|
-
), await I(
|
|
980
|
+
), await I(O), "";
|
|
973
981
|
} catch {
|
|
974
|
-
return
|
|
982
|
+
return r(
|
|
975
983
|
"getAccessToken: exception occurred, invalidating and logging out"
|
|
976
|
-
), await I(
|
|
984
|
+
), await I(at), "";
|
|
977
985
|
}
|
|
978
|
-
},
|
|
986
|
+
}, be = () => c.isAuthenticated && d ? d : "", Oe = async () => {
|
|
979
987
|
const { user: u } = c;
|
|
980
|
-
let h = await
|
|
981
|
-
endpoint:
|
|
982
|
-
accessToken:
|
|
988
|
+
let h = await P({
|
|
989
|
+
endpoint: i,
|
|
990
|
+
accessToken: p,
|
|
983
991
|
clientId: n,
|
|
984
992
|
type: N.GET_REGISTRATION_OPTIONS,
|
|
985
993
|
params: {
|
|
@@ -993,9 +1001,9 @@ const P = () => {
|
|
|
993
1001
|
const l = await Je({
|
|
994
1002
|
optionsJSON: h.data
|
|
995
1003
|
});
|
|
996
|
-
return h = await
|
|
997
|
-
endpoint:
|
|
998
|
-
accessToken:
|
|
1004
|
+
return h = await P({
|
|
1005
|
+
endpoint: i,
|
|
1006
|
+
accessToken: p,
|
|
999
1007
|
clientId: n,
|
|
1000
1008
|
type: N.VERIFY_REGISTRATION,
|
|
1001
1009
|
params: {
|
|
@@ -1006,9 +1014,9 @@ const P = () => {
|
|
|
1006
1014
|
}
|
|
1007
1015
|
}), !!(h.status && h.data.length > 0);
|
|
1008
1016
|
} catch {
|
|
1009
|
-
return await
|
|
1010
|
-
endpoint:
|
|
1011
|
-
accessToken:
|
|
1017
|
+
return await P({
|
|
1018
|
+
endpoint: i,
|
|
1019
|
+
accessToken: p,
|
|
1012
1020
|
clientId: n,
|
|
1013
1021
|
type: N.VERIFY_REGISTRATION,
|
|
1014
1022
|
params: {
|
|
@@ -1021,13 +1029,13 @@ const P = () => {
|
|
|
1021
1029
|
}
|
|
1022
1030
|
return !1;
|
|
1023
1031
|
}, Ne = async () => {
|
|
1024
|
-
|
|
1032
|
+
o({ type: U, payload: { isLoading: !0 } }), $();
|
|
1025
1033
|
const u = z();
|
|
1026
|
-
te(u),
|
|
1034
|
+
te(u), r("loginWithPasskey");
|
|
1027
1035
|
const h = z();
|
|
1028
|
-
let l = await
|
|
1029
|
-
endpoint:
|
|
1030
|
-
accessToken:
|
|
1036
|
+
let l = await P({
|
|
1037
|
+
endpoint: i,
|
|
1038
|
+
accessToken: p,
|
|
1031
1039
|
clientId: n,
|
|
1032
1040
|
type: N.GET_AUTHENTICATION_OPTIONS,
|
|
1033
1041
|
params: {
|
|
@@ -1040,9 +1048,9 @@ const P = () => {
|
|
|
1040
1048
|
const _ = await Be({
|
|
1041
1049
|
optionsJSON: l.data
|
|
1042
1050
|
});
|
|
1043
|
-
return l = await
|
|
1044
|
-
endpoint:
|
|
1045
|
-
accessToken:
|
|
1051
|
+
return l = await P({
|
|
1052
|
+
endpoint: i,
|
|
1053
|
+
accessToken: p,
|
|
1046
1054
|
clientId: n,
|
|
1047
1055
|
type: N.VERIFY_AUTHENTICATION,
|
|
1048
1056
|
params: {
|
|
@@ -1054,8 +1062,8 @@ const P = () => {
|
|
|
1054
1062
|
sessionExpiration: t,
|
|
1055
1063
|
ua: navigator.userAgent
|
|
1056
1064
|
}
|
|
1057
|
-
}), l.data.status === L ? (m(l.data.idToken),
|
|
1058
|
-
type:
|
|
1065
|
+
}), l.data.status === L ? (m(l.data.idToken), y(l.data.accessToken), W(l.data.refreshToken), o({
|
|
1066
|
+
type: V,
|
|
1059
1067
|
payload: {
|
|
1060
1068
|
authenticationType: C.PASSKEY,
|
|
1061
1069
|
user: {
|
|
@@ -1066,9 +1074,9 @@ const P = () => {
|
|
|
1066
1074
|
}
|
|
1067
1075
|
}), !0) : (v(Q), !1);
|
|
1068
1076
|
} catch {
|
|
1069
|
-
return await
|
|
1070
|
-
endpoint:
|
|
1071
|
-
accessToken:
|
|
1077
|
+
return await P({
|
|
1078
|
+
endpoint: i,
|
|
1079
|
+
accessToken: p,
|
|
1072
1080
|
clientId: n,
|
|
1073
1081
|
type: N.VERIFY_AUTHENTICATION,
|
|
1074
1082
|
params: {
|
|
@@ -1083,7 +1091,7 @@ const P = () => {
|
|
|
1083
1091
|
}
|
|
1084
1092
|
return !1;
|
|
1085
1093
|
};
|
|
1086
|
-
return /* @__PURE__ */
|
|
1094
|
+
return /* @__PURE__ */ x(pt.Provider, { value: { state: c, dispatch: o }, children: /* @__PURE__ */ x(
|
|
1087
1095
|
me.Provider,
|
|
1088
1096
|
{
|
|
1089
1097
|
value: {
|
|
@@ -1091,14 +1099,14 @@ const P = () => {
|
|
|
1091
1099
|
login: Ie,
|
|
1092
1100
|
logout: _e,
|
|
1093
1101
|
getAccessToken: Se,
|
|
1094
|
-
getIdToken:
|
|
1095
|
-
registeringForPasskey:
|
|
1102
|
+
getIdToken: be,
|
|
1103
|
+
registeringForPasskey: Oe,
|
|
1096
1104
|
loginWithPasskey: Ne
|
|
1097
1105
|
},
|
|
1098
|
-
children: /* @__PURE__ */
|
|
1106
|
+
children: /* @__PURE__ */ x(Et, { children: e })
|
|
1099
1107
|
}
|
|
1100
1108
|
) });
|
|
1101
1109
|
};
|
|
1102
1110
|
export {
|
|
1103
|
-
|
|
1111
|
+
It as AuthProvider
|
|
1104
1112
|
};
|
package/dist/hooks.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { useContext as o } from "react";
|
|
2
2
|
import { AuthHookContext as e } from "./AuthHookContext-C9a2AwWZ.js";
|
|
3
|
-
/*!
|
|
4
|
-
@versini/auth-provider v8.1.0
|
|
5
|
-
© 2025 gizmette.com
|
|
6
|
-
*/
|
|
7
3
|
try {
|
|
8
4
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
9
|
-
version: "8.1.
|
|
10
|
-
buildTime: "
|
|
5
|
+
version: "8.1.2",
|
|
6
|
+
buildTime: "01/23/2026 08:37 PM EST",
|
|
11
7
|
homepage: "https://github.com/aversini/auth-client",
|
|
12
8
|
license: "MIT"
|
|
13
9
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { AUTH_TYPES as r, isGranted as t } from "@versini/auth-common";
|
|
2
|
-
/*!
|
|
3
|
-
@versini/auth-provider v8.1.0
|
|
4
|
-
© 2025 gizmette.com
|
|
5
|
-
*/
|
|
6
2
|
try {
|
|
7
3
|
window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
|
|
8
|
-
version: "8.1.
|
|
9
|
-
buildTime: "
|
|
4
|
+
version: "8.1.2",
|
|
5
|
+
buildTime: "01/23/2026 08:37 PM EST",
|
|
10
6
|
homepage: "https://github.com/aversini/auth-client",
|
|
11
7
|
license: "MIT"
|
|
12
8
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/auth-provider",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -46,16 +46,12 @@
|
|
|
46
46
|
"test:watch": "vitest",
|
|
47
47
|
"test": "vitest run"
|
|
48
48
|
},
|
|
49
|
-
"peerDependencies": {
|
|
50
|
-
"react": ">=19.0.0",
|
|
51
|
-
"react-dom": ">=19.0.0"
|
|
52
|
-
},
|
|
53
49
|
"dependencies": {
|
|
54
|
-
"@simplewebauthn/browser": "13.
|
|
55
|
-
"@versini/auth-common": "4.6.
|
|
56
|
-
"@versini/ui-hooks": "
|
|
57
|
-
"jose": "6.1.
|
|
58
|
-
"uuid": "
|
|
50
|
+
"@simplewebauthn/browser": "13.2.2",
|
|
51
|
+
"@versini/auth-common": "4.6.2",
|
|
52
|
+
"@versini/ui-hooks": "6.1.1",
|
|
53
|
+
"jose": "6.1.3",
|
|
54
|
+
"uuid": "13.0.0"
|
|
59
55
|
},
|
|
60
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "78e93181feacb67a6de1628448ae7a22fddfdf34"
|
|
61
57
|
}
|