cauthy-auth 0.17.0 → 0.18.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/react.mjs CHANGED
@@ -272,7 +272,8 @@ function createAuthClient(options = {}) {
272
272
  async passkey(o) {
273
273
  const m = await methods();
274
274
  if (m.passkeyHere && canUsePasskeys()) {
275
- const r = await ceremony("/sign-in/passkey/begin", "/sign-in/passkey/finish", {}, getPasskey);
275
+ const email = o?.email?.trim() ?? "";
276
+ const r = await ceremony("/sign-in/passkey/begin", "/sign-in/passkey/finish", email !== "" && checkEmail(email) === null ? { email } : {}, getPasskey);
276
277
  if (r.ok || r.error.code !== "passkey_unavailable" || !m.passkeyOnCauthy) return r;
277
278
  } else if (!m.passkeyOnCauthy) {
278
279
  return { ok: false, error: { code: "passkey_unavailable", message: "Passkeys cannot be used here." } };
@@ -939,7 +940,7 @@ function SignIn(props) {
939
940
  autofill.current?.abort();
940
941
  f.setBusy(true);
941
942
  f.setError(null);
942
- const r = await auth.signIn.passkey({ returnTo: props.returnTo, locale: props.locale });
943
+ const r = await auth.signIn.passkey({ returnTo: props.returnTo, locale: props.locale, email });
943
944
  if (r.ok && r.status === "redirected") return;
944
945
  f.setBusy(false);
945
946
  if (!r.ok) setOffer((n) => n + 1);