@cedros/login-react 0.0.32 → 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.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/signup/options",
3228
+ "/webauthn/auth/options",
3229
3229
  {}
3230
- ), p = ut(w.options), h = await navigator.credentials.create({
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 signup returned no credential");
3235
- const y = await l.post("/webauthn/signup/verify", {
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 === "InvalidStateError" || w.name === "NotAllowedError"))
3241
+ if (w instanceof Error && (w.name === "NotAllowedError" || w.name === "InvalidStateError"))
3242
3242
  try {
3243
3243
  const b = await l.post(
3244
- "/webauthn/auth/options",
3244
+ "/webauthn/signup/options",
3245
3245
  {}
3246
- ), v = nr(b.options), N = await navigator.credentials.get({
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 authentication returned no credential");
3251
- const E = await l.post("/webauthn/auth/verify", {
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 sign in with passkey. Please try again.");
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, "Passkey sign-up failed");
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);