cauthy-auth 0.18.0 → 0.19.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
@@ -402,7 +402,7 @@ function createAuthClient(options = {}) {
402
402
  },
403
403
  addPasskey(f = {}) {
404
404
  if (!canUsePasskeys()) return Promise.resolve({ ok: false, error: { code: "passkey_unavailable", message: "This browser cannot make passkeys." } });
405
- return ceremony("/me/passkeys/add/begin", "/me/passkeys/add/finish", { password: f.password ?? "" }, makePasskey, { name: f.name ?? "" });
405
+ return ceremony("/me/passkeys/add/begin", "/me/passkeys/add/finish", { password: f.password ?? "", ...f.kind ? { kind: f.kind } : {} }, makePasskey, { name: f.name ?? "" });
406
406
  },
407
407
  removePasskey: (id) => post("/me/passkeys/remove", { id }, null)
408
408
  },
@@ -543,6 +543,9 @@ var TEXTS = {
543
543
  passkeyName: "A name for this device (optional)",
544
544
  addPasskey: "Add a passkey on this device",
545
545
  removePasskey: "Remove",
546
+ addPasskeyDevice: "Add this device (fingerprint or face)",
547
+ addSecurityKey: "Add a security key",
548
+ passkeyKinds: { security_key: "Security key", synced: "Synced across your devices", device: "On this device only" },
546
549
  passkeyAdded: "The passkey was added. Next time, sign in with it.",
547
550
  passkeyUnnamed: "Passkey",
548
551
  sessions: "Where you are signed in",
@@ -655,6 +658,9 @@ var TEXTS = {
655
658
  passkeyName: "Un nombre para este dispositivo (opcional)",
656
659
  addPasskey: "Agregar una llave en este dispositivo",
657
660
  removePasskey: "Quitar",
661
+ addPasskeyDevice: "Agregar este dispositivo (huella o rostro)",
662
+ addSecurityKey: "Agregar una llave f\xEDsica",
663
+ passkeyKinds: { security_key: "Llave f\xEDsica", synced: "Sincronizada entre tus dispositivos", device: "Solo en un dispositivo" },
658
664
  passkeyAdded: "La llave de acceso qued\xF3 agregada. La pr\xF3xima vez, entra con ella.",
659
665
  passkeyUnnamed: "Llave de acceso",
660
666
  sessions: "D\xF3nde tienes la sesi\xF3n abierta",
@@ -1230,9 +1236,9 @@ function PasskeysPart({ props, account, accountUrl, when }) {
1230
1236
  /* @__PURE__ */ jsx("a", { className: f.cx("link"), href: accountUrl, children: f.t.managePasskeys })
1231
1237
  ] });
1232
1238
  }
1233
- const add = async (e) => {
1234
- e.preventDefault();
1235
- const r = await run(() => auth.account.addPasskey({ name, password }));
1239
+ const add = async (e, kind = "device") => {
1240
+ e?.preventDefault();
1241
+ const r = await run(() => auth.account.addPasskey({ name, password, kind }));
1236
1242
  if (!r.ok) {
1237
1243
  if (r.error.code === "cancelled") f.setError(null);
1238
1244
  return;
@@ -1252,6 +1258,7 @@ function PasskeysPart({ props, account, accountUrl, when }) {
1252
1258
  general && /* @__PURE__ */ jsx("p", { role: "alert", className: f.cx("error"), children: f.say(general) }),
1253
1259
  list.length === 0 ? /* @__PURE__ */ jsx("p", { className: f.cx("notice"), children: f.t.noPasskeys }) : /* @__PURE__ */ jsx("ul", { className: f.cx("sessions"), children: list.map((p) => /* @__PURE__ */ jsxs("li", { className: f.cx("session"), children: [
1254
1260
  p.name || f.t.passkeyUnnamed,
1261
+ p.kind !== "unknown" ? ` \xB7 ${f.t.passkeyKinds[p.kind]}` : "",
1255
1262
  " \xB7 ",
1256
1263
  when(p.createdAt),
1257
1264
  " ",
@@ -1259,7 +1266,8 @@ function PasskeysPart({ props, account, accountUrl, when }) {
1259
1266
  ] }, p.id)) }),
1260
1267
  /* @__PURE__ */ jsx(Field, { f, name: "name", type: "text", label: f.t.passkeyName, value: name, autoComplete: "off", onChange: setName }),
1261
1268
  account.hasPassword && /* @__PURE__ */ jsx(Field, { f, name: "password", type: "password", label: f.t.currentPassword, value: password, autoComplete: "current-password", required: true, onChange: setPassword }),
1262
- /* @__PURE__ */ jsx(f.Button, { type: "submit", disabled: f.busy, className: f.cx("button"), children: f.t.addPasskey }),
1269
+ /* @__PURE__ */ jsx(f.Button, { type: "submit", disabled: f.busy, className: f.cx("button"), children: f.t.addPasskeyDevice }),
1270
+ /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => void add(null, "security_key"), children: f.t.addSecurityKey }),
1263
1271
  done && /* @__PURE__ */ jsx("p", { role: "status", className: f.cx("notice"), children: done })
1264
1272
  ] });
1265
1273
  }