cauthy-auth 0.37.0 → 0.38.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
@@ -732,12 +732,13 @@ interface AccountClient {
732
732
  kinds?: string[];
733
733
  }): Promise<AuthResult<'accepted'>>;
734
734
  mfa: {
735
- /** Starts turning the second step on: show `secret` (or `otpauthUri` as a QR code) to add to an authenticator app, then call `verify`. */
735
+ /** Starts turning the second step on: show `qr` (the `otpauthUri` drawn by Cauthy, a PNG `data:` URI; empty from an older Cauthy) and `secret` to add to an authenticator app, then call `verify`. */
736
736
  setup(form: {
737
737
  password: string;
738
738
  }): Promise<AuthResult<'started', {
739
739
  secret: string;
740
740
  otpauthUri: string;
741
+ qr: string;
741
742
  }>>;
742
743
  /** Turns it on with a code from the app. `recoveryCodes` are shown this once. */
743
744
  verify(form: {
@@ -1222,6 +1223,7 @@ interface AuthTexts {
1222
1223
  turnOff: string;
1223
1224
  addToApp: string;
1224
1225
  openInApp: string;
1226
+ qrAlt: string;
1225
1227
  recoveryCodes: string;
1226
1228
  newRecoveryCodes: string;
1227
1229
  keepCodes: string;
@@ -1299,7 +1301,7 @@ interface AuthTexts {
1299
1301
  /** By error code; one missing shows what the server said. */
1300
1302
  errors: Record<string, string>;
1301
1303
  }
1302
- type Slot = 'form' | 'field' | 'label' | 'input' | 'button' | 'providerButton' | 'providerIcon' | 'link' | 'error' | 'fieldError' | 'hint' | 'notice' | 'pending' | 'separator' | 'footer' | 'check' | 'account' | 'section' | 'heading' | 'secret' | 'codes' | 'sessions' | 'session';
1304
+ type Slot = 'form' | 'field' | 'label' | 'input' | 'button' | 'providerButton' | 'providerIcon' | 'link' | 'error' | 'fieldError' | 'hint' | 'notice' | 'pending' | 'separator' | 'footer' | 'check' | 'account' | 'section' | 'heading' | 'secret' | 'qr' | 'codes' | 'sessions' | 'session';
1303
1305
  interface AuthFormProps {
1304
1306
  /** The language of the built-in sentences. Default: `en`. */
1305
1307
  locale?: 'en' | 'es';
package/dist/react.d.ts CHANGED
@@ -732,12 +732,13 @@ interface AccountClient {
732
732
  kinds?: string[];
733
733
  }): Promise<AuthResult<'accepted'>>;
734
734
  mfa: {
735
- /** Starts turning the second step on: show `secret` (or `otpauthUri` as a QR code) to add to an authenticator app, then call `verify`. */
735
+ /** Starts turning the second step on: show `qr` (the `otpauthUri` drawn by Cauthy, a PNG `data:` URI; empty from an older Cauthy) and `secret` to add to an authenticator app, then call `verify`. */
736
736
  setup(form: {
737
737
  password: string;
738
738
  }): Promise<AuthResult<'started', {
739
739
  secret: string;
740
740
  otpauthUri: string;
741
+ qr: string;
741
742
  }>>;
742
743
  /** Turns it on with a code from the app. `recoveryCodes` are shown this once. */
743
744
  verify(form: {
@@ -1222,6 +1223,7 @@ interface AuthTexts {
1222
1223
  turnOff: string;
1223
1224
  addToApp: string;
1224
1225
  openInApp: string;
1226
+ qrAlt: string;
1225
1227
  recoveryCodes: string;
1226
1228
  newRecoveryCodes: string;
1227
1229
  keepCodes: string;
@@ -1299,7 +1301,7 @@ interface AuthTexts {
1299
1301
  /** By error code; one missing shows what the server said. */
1300
1302
  errors: Record<string, string>;
1301
1303
  }
1302
- type Slot = 'form' | 'field' | 'label' | 'input' | 'button' | 'providerButton' | 'providerIcon' | 'link' | 'error' | 'fieldError' | 'hint' | 'notice' | 'pending' | 'separator' | 'footer' | 'check' | 'account' | 'section' | 'heading' | 'secret' | 'codes' | 'sessions' | 'session';
1304
+ type Slot = 'form' | 'field' | 'label' | 'input' | 'button' | 'providerButton' | 'providerIcon' | 'link' | 'error' | 'fieldError' | 'hint' | 'notice' | 'pending' | 'separator' | 'footer' | 'check' | 'account' | 'section' | 'heading' | 'secret' | 'qr' | 'codes' | 'sessions' | 'session';
1303
1305
  interface AuthFormProps {
1304
1306
  /** The language of the built-in sentences. Default: `en`. */
1305
1307
  locale?: 'en' | 'es';
package/dist/react.js CHANGED
@@ -845,8 +845,9 @@ var TEXTS = {
845
845
  secondStepOff: "Off: signing in asks only for your password.",
846
846
  turnOn: "Turn on",
847
847
  turnOff: "Turn off",
848
- addToApp: "Add this key to your authenticator app, then enter the code it shows.",
848
+ addToApp: "Scan this code with your authenticator app, or add the key below by hand, then enter the code it shows.",
849
849
  openInApp: "Open in an authenticator app",
850
+ qrAlt: "QR code to add this account to an authenticator app",
850
851
  recoveryCodes: "Recovery codes",
851
852
  newRecoveryCodes: "New recovery codes",
852
853
  keepCodes: "Keep these codes somewhere safe. Each works once, and they are not shown again.",
@@ -1036,8 +1037,9 @@ var TEXTS = {
1036
1037
  secondStepOff: "Inactivo: al entrar solo se pide tu contrase\xF1a.",
1037
1038
  turnOn: "Activar",
1038
1039
  turnOff: "Desactivar",
1039
- addToApp: "Agrega esta clave a tu aplicaci\xF3n de autenticaci\xF3n y escribe el c\xF3digo que muestra.",
1040
+ addToApp: "Escanea este c\xF3digo con tu aplicaci\xF3n de autenticaci\xF3n, o agrega a mano la clave de abajo, y escribe el c\xF3digo que muestra.",
1040
1041
  openInApp: "Abrir en una aplicaci\xF3n de autenticaci\xF3n",
1042
+ qrAlt: "C\xF3digo QR para agregar esta cuenta a una aplicaci\xF3n de autenticaci\xF3n",
1041
1043
  recoveryCodes: "C\xF3digos de recuperaci\xF3n",
1042
1044
  newRecoveryCodes: "Nuevos c\xF3digos de recuperaci\xF3n",
1043
1045
  keepCodes: "Guarda estos c\xF3digos en un lugar seguro. Cada uno sirve una vez y no se vuelven a mostrar.",
@@ -2748,7 +2750,7 @@ function SecondStepPart({ props, account, onChanged }) {
2748
2750
  const start = async (e) => {
2749
2751
  e.preventDefault();
2750
2752
  const r = await run(() => auth.account.mfa.setup({ password }));
2751
- if (r.ok) setSetup({ secret: r.secret, otpauthUri: r.otpauthUri });
2753
+ if (r.ok) setSetup({ secret: r.secret, otpauthUri: r.otpauthUri, qr: r.qr ?? "" });
2752
2754
  };
2753
2755
  const confirm = async (e) => {
2754
2756
  e.preventDefault();
@@ -2795,6 +2797,7 @@ function SecondStepPart({ props, account, onChanged }) {
2795
2797
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Wrap, { f, as: "form", slot: "section", section: "secondStep", onSubmit: confirm, noValidate: true, children: [
2796
2798
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Heading, { f, children: f.t.secondStep }),
2797
2799
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Note, { f, children: f.t.addToApp }),
2800
+ setup.qr && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { className: f.cx("qr"), src: setup.qr, width: 220, height: 220, alt: f.t.qrAlt }),
2798
2801
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { className: f.cx("secret"), children: setup.secret }),
2799
2802
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(A, { f, href: setup.otpauthUri, children: f.t.openInApp }),
2800
2803
  general && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Say, { f, tone: "danger", children: f.say(general) }),