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.d.mts CHANGED
@@ -517,11 +517,14 @@ interface AuthClient {
517
517
  * workspace's passkeys (`methods().passkeyHere` is false), the browser goes
518
518
  * to Cauthy's page for that step alone and comes back signed in, at
519
519
  * `returnTo`: then the answer is `redirected`. `cancelled`: the person
520
- * closed the browser's prompt.
520
+ * closed the browser's prompt. `email`, when the person typed it: the
521
+ * browser is told which passkeys are theirs, so a security key that did
522
+ * not keep its passkey (one made before cauthy-auth 0.18.0) is found too.
521
523
  */
522
524
  passkey(options?: {
523
525
  returnTo?: string;
524
526
  locale?: string;
527
+ email?: string;
525
528
  }): Promise<AuthResult<'signed_in', {
526
529
  session: PublicSession;
527
530
  }> | AuthResult<'redirected'>>;
package/dist/react.d.ts CHANGED
@@ -517,11 +517,14 @@ interface AuthClient {
517
517
  * workspace's passkeys (`methods().passkeyHere` is false), the browser goes
518
518
  * to Cauthy's page for that step alone and comes back signed in, at
519
519
  * `returnTo`: then the answer is `redirected`. `cancelled`: the person
520
- * closed the browser's prompt.
520
+ * closed the browser's prompt. `email`, when the person typed it: the
521
+ * browser is told which passkeys are theirs, so a security key that did
522
+ * not keep its passkey (one made before cauthy-auth 0.18.0) is found too.
521
523
  */
522
524
  passkey(options?: {
523
525
  returnTo?: string;
524
526
  locale?: string;
527
+ email?: string;
525
528
  }): Promise<AuthResult<'signed_in', {
526
529
  session: PublicSession;
527
530
  }> | AuthResult<'redirected'>>;
package/dist/react.js CHANGED
@@ -309,7 +309,8 @@ function createAuthClient(options = {}) {
309
309
  async passkey(o) {
310
310
  const m = await methods();
311
311
  if (m.passkeyHere && canUsePasskeys()) {
312
- const r = await ceremony("/sign-in/passkey/begin", "/sign-in/passkey/finish", {}, getPasskey);
312
+ const email = o?.email?.trim() ?? "";
313
+ const r = await ceremony("/sign-in/passkey/begin", "/sign-in/passkey/finish", email !== "" && checkEmail(email) === null ? { email } : {}, getPasskey);
313
314
  if (r.ok || r.error.code !== "passkey_unavailable" || !m.passkeyOnCauthy) return r;
314
315
  } else if (!m.passkeyOnCauthy) {
315
316
  return { ok: false, error: { code: "passkey_unavailable", message: "Passkeys cannot be used here." } };
@@ -976,7 +977,7 @@ function SignIn(props) {
976
977
  autofill.current?.abort();
977
978
  f.setBusy(true);
978
979
  f.setError(null);
979
- const r = await auth.signIn.passkey({ returnTo: props.returnTo, locale: props.locale });
980
+ const r = await auth.signIn.passkey({ returnTo: props.returnTo, locale: props.locale, email });
980
981
  if (r.ok && r.status === "redirected") return;
981
982
  f.setBusy(false);
982
983
  if (!r.ok) setOffer((n) => n + 1);