cauthy-auth 0.25.0 → 0.26.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/client.d.mts CHANGED
@@ -430,21 +430,34 @@ interface AuthClient {
430
430
  }): Promise<AuthResult<'signed_in', {
431
431
  session: PublicSession;
432
432
  }>>;
433
- /** With address and password. `mfa_required`: ask for the code and call `signIn.mfa`. */
433
+ /**
434
+ * With address and password. `mfa_required`: ask for the code and call
435
+ * `signIn.mfa`. `method: 'email'` says the code was just mailed to the
436
+ * account's address (it has no factor of its own and the workspace, or
437
+ * the sign-in's risk, asked a second step): say so, and offer
438
+ * `mfaSendEmail` for another.
439
+ */
434
440
  email(form: {
435
441
  email: string;
436
442
  password: string;
437
443
  captchaToken?: string;
438
444
  }): Promise<AuthResult<'signed_in', {
439
445
  session: PublicSession;
440
- }> | AuthResult<'mfa_required'>>;
441
- /** The second step: the code of the authenticator app, or a recovery code. */
446
+ }> | AuthResult<'mfa_required', {
447
+ method?: 'email';
448
+ }>>;
449
+ /** The second step: the code of the authenticator app, the phone, the email, or a recovery code. */
442
450
  mfa(form: {
443
451
  code: string;
444
452
  }): Promise<AuthResult<'signed_in', {
445
453
  session: PublicSession;
446
454
  }>>;
447
- /** While the second step is asked for: whether the account has an authenticator app, the phone (masked) a code can be sent to, and phones that approve sign-ins. */
455
+ /**
456
+ * While the second step is asked for: whether the account has an
457
+ * authenticator app, the phone (masked) a code can be sent to, phones
458
+ * that approve sign-ins, and the address (masked) a code went to when
459
+ * the step is by email.
460
+ */
448
461
  mfaMethods(): Promise<AuthResult<'ok', {
449
462
  totp: boolean;
450
463
  phone: {
@@ -454,6 +467,13 @@ interface AuthClient {
454
467
  push: {
455
468
  devices: number;
456
469
  } | null;
470
+ email: {
471
+ to: string;
472
+ } | null;
473
+ }>>;
474
+ /** Mails the sign-in's code again, when its second step is by email; `mfa` takes it. A few per sign-in. */
475
+ mfaSendEmail(): Promise<AuthResult<'sent', {
476
+ sentTo: string;
457
477
  }>>;
458
478
  /**
459
479
  * Sends a push to the account's phones (the application's app, with
package/dist/client.d.ts CHANGED
@@ -430,21 +430,34 @@ interface AuthClient {
430
430
  }): Promise<AuthResult<'signed_in', {
431
431
  session: PublicSession;
432
432
  }>>;
433
- /** With address and password. `mfa_required`: ask for the code and call `signIn.mfa`. */
433
+ /**
434
+ * With address and password. `mfa_required`: ask for the code and call
435
+ * `signIn.mfa`. `method: 'email'` says the code was just mailed to the
436
+ * account's address (it has no factor of its own and the workspace, or
437
+ * the sign-in's risk, asked a second step): say so, and offer
438
+ * `mfaSendEmail` for another.
439
+ */
434
440
  email(form: {
435
441
  email: string;
436
442
  password: string;
437
443
  captchaToken?: string;
438
444
  }): Promise<AuthResult<'signed_in', {
439
445
  session: PublicSession;
440
- }> | AuthResult<'mfa_required'>>;
441
- /** The second step: the code of the authenticator app, or a recovery code. */
446
+ }> | AuthResult<'mfa_required', {
447
+ method?: 'email';
448
+ }>>;
449
+ /** The second step: the code of the authenticator app, the phone, the email, or a recovery code. */
442
450
  mfa(form: {
443
451
  code: string;
444
452
  }): Promise<AuthResult<'signed_in', {
445
453
  session: PublicSession;
446
454
  }>>;
447
- /** While the second step is asked for: whether the account has an authenticator app, the phone (masked) a code can be sent to, and phones that approve sign-ins. */
455
+ /**
456
+ * While the second step is asked for: whether the account has an
457
+ * authenticator app, the phone (masked) a code can be sent to, phones
458
+ * that approve sign-ins, and the address (masked) a code went to when
459
+ * the step is by email.
460
+ */
448
461
  mfaMethods(): Promise<AuthResult<'ok', {
449
462
  totp: boolean;
450
463
  phone: {
@@ -454,6 +467,13 @@ interface AuthClient {
454
467
  push: {
455
468
  devices: number;
456
469
  } | null;
470
+ email: {
471
+ to: string;
472
+ } | null;
473
+ }>>;
474
+ /** Mails the sign-in's code again, when its second step is by email; `mfa` takes it. A few per sign-in. */
475
+ mfaSendEmail(): Promise<AuthResult<'sent', {
476
+ sentTo: string;
457
477
  }>>;
458
478
  /**
459
479
  * Sends a push to the account's phones (the application's app, with
package/dist/client.js CHANGED
@@ -400,6 +400,7 @@ function createAuthClient(options = {}) {
400
400
  mfa: (f) => post("/sign-in/mfa", { code: f.code }, checkCode(f.code)),
401
401
  mfaMethods: () => post("/sign-in/mfa/methods", {}, null),
402
402
  mfaSendCode: () => post("/sign-in/mfa/send", {}, null),
403
+ mfaSendEmail: () => post("/sign-in/mfa/email", {}, null),
403
404
  mfaPush: () => post("/sign-in/mfa/push", {}, null),
404
405
  async mfaPushWait(o = {}) {
405
406
  const status = await new Promise((resolve) => {