@cedros/login-react 0.0.33 → 0.0.34
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/mockServiceWorker.js +349 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3225,39 +3225,39 @@ function fs() {
|
|
|
3225
3225
|
a(!0), n(null);
|
|
3226
3226
|
try {
|
|
3227
3227
|
const w = await l.post(
|
|
3228
|
-
"/webauthn/
|
|
3228
|
+
"/webauthn/auth/options",
|
|
3229
3229
|
{}
|
|
3230
|
-
), p =
|
|
3230
|
+
), p = nr(w.options), h = await navigator.credentials.get({
|
|
3231
3231
|
publicKey: p
|
|
3232
3232
|
});
|
|
3233
3233
|
if (!h)
|
|
3234
|
-
throw new Error("Passkey
|
|
3235
|
-
const y = await l.post("/webauthn/
|
|
3234
|
+
throw new Error("Passkey authentication returned no credential");
|
|
3235
|
+
const y = await l.post("/webauthn/auth/verify", {
|
|
3236
3236
|
challengeId: w.challengeId,
|
|
3237
3237
|
credential: Te(h)
|
|
3238
3238
|
});
|
|
3239
3239
|
return t.callbacks?.onLoginSuccess?.(y.user, "webauthn"), r?.handleLoginSuccess(y.user, y.tokens), y;
|
|
3240
3240
|
} catch (w) {
|
|
3241
|
-
if (w instanceof Error && (w.name === "
|
|
3241
|
+
if (w instanceof Error && (w.name === "NotAllowedError" || w.name === "InvalidStateError"))
|
|
3242
3242
|
try {
|
|
3243
3243
|
const b = await l.post(
|
|
3244
|
-
"/webauthn/
|
|
3244
|
+
"/webauthn/signup/options",
|
|
3245
3245
|
{}
|
|
3246
|
-
), v =
|
|
3246
|
+
), v = ut(b.options), N = await navigator.credentials.create({
|
|
3247
3247
|
publicKey: v
|
|
3248
3248
|
});
|
|
3249
3249
|
if (!N)
|
|
3250
|
-
throw new Error("Passkey
|
|
3251
|
-
const E = await l.post("/webauthn/
|
|
3250
|
+
throw new Error("Passkey signup returned no credential");
|
|
3251
|
+
const E = await l.post("/webauthn/signup/verify", {
|
|
3252
3252
|
challengeId: b.challengeId,
|
|
3253
3253
|
credential: Te(N)
|
|
3254
3254
|
});
|
|
3255
3255
|
return t.callbacks?.onLoginSuccess?.(E.user, "webauthn"), r?.handleLoginSuccess(E.user, E.tokens), E;
|
|
3256
3256
|
} catch (b) {
|
|
3257
|
-
const N = Be(b) ?? W(b, "Unable to
|
|
3257
|
+
const N = Be(b) ?? W(b, "Unable to create passkey. Please try again.");
|
|
3258
3258
|
throw n(N), N;
|
|
3259
3259
|
}
|
|
3260
|
-
const y = Be(w) ?? W(w, "
|
|
3260
|
+
const y = Be(w) ?? W(w, "Unable to sign in with passkey. Please try again.");
|
|
3261
3261
|
throw n(y), y;
|
|
3262
3262
|
} finally {
|
|
3263
3263
|
a(!1);
|