@passflow/core 0.39.1 → 0.39.3

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/index.d.cts CHANGED
@@ -1417,13 +1417,26 @@ export declare const TWO_FACTOR_SEND_LIMIT_ERROR_ID = "error.2fa.rate_limit_exce
1417
1417
  export declare const RECOVERY_CODES_STEP_UP_REQUIRED_ERROR_ID = "error.2fa.recovery_codes.step_up_required";
1418
1418
  /** Id of the 403 a profile save answers with when a change of email or phone number needs a proof. */
1419
1419
  export declare const ADDRESS_CHANGE_PROOF_REQUIRED_ERROR_ID = "error.user.address.change.proof.required";
1420
+ /**
1421
+ * What a refused login-code send answers beside the error: the challenge the sign-in goes on with
1422
+ * (the live code, if one was sent before), the method to suggest, and the methods to switch to. The
1423
+ * refused method is never among `alternative_methods`, which is absent when there are none.
1424
+ */
1425
+ export type TwoFactorSendRefusalChallenge = {
1426
+ challenge_id: string;
1427
+ suggested_method?: TwoFactorMethod;
1428
+ alternative_methods?: TwoFactorMethod[];
1429
+ };
1420
1430
  /**
1421
1431
  * No code was sent: the user's monthly text quota is spent (429). Use another method or try again
1422
1432
  * next month.
1423
1433
  */
1424
1434
  export declare class PassflowSmsQuotaExceededError extends PassflowError {
1435
+ /** The sign-in's challenge to go on with; undefined when the answer carried no `challenge_id`. */
1436
+ readonly challenge?: TwoFactorSendRefusalChallenge;
1425
1437
  constructor(error: PassflowResponseError['error'], options?: {
1426
1438
  cause?: unknown;
1439
+ challenge?: TwoFactorSendRefusalChallenge;
1427
1440
  });
1428
1441
  }
1429
1442
  /**
@@ -1433,8 +1446,11 @@ export declare class PassflowSmsQuotaExceededError extends PassflowError {
1433
1446
  export declare class PassflowSendLimitError extends PassflowError {
1434
1447
  /** Seconds to wait, from `Retry-After`; undefined when the server sent none. */
1435
1448
  readonly retryAfter?: number;
1449
+ /** The sign-in's challenge to go on with; undefined when the answer carried no `challenge_id`. */
1450
+ readonly challenge?: TwoFactorSendRefusalChallenge;
1436
1451
  constructor(error: PassflowResponseError['error'], retryAfter?: number, options?: {
1437
1452
  cause?: unknown;
1453
+ challenge?: TwoFactorSendRefusalChallenge;
1438
1454
  });
1439
1455
  }
1440
1456
  /**
@@ -3398,7 +3414,7 @@ export declare class TwoFactorApiClient {
3398
3414
  */
3399
3415
  beginEnrollment(tfaToken: string): Promise<TwoFactorSetupResponse>;
3400
3416
  /**
3401
- * Confirm 2FA setup on the sign-in itself; `verify` with the same code then finishes it
3417
+ * Confirm 2FA setup on the sign-in itself; `verify` with the next authenticator code then finishes it
3402
3418
  * POST /auth/2fa/setup/confirm
3403
3419
  */
3404
3420
  confirmEnrollment(tfaToken: string, payload: TwoFactorConfirmRequest): Promise<TwoFactorConfirmResponse>;
@@ -5224,7 +5240,7 @@ export declare class TwoFactorService {
5224
5240
  beginEnrollment(): Promise<TwoFactorSetupResponse>;
5225
5241
  /**
5226
5242
  * Confirm 2FA setup on the sign-in itself (`direct`). The sign-in stays pending:
5227
- * show the recovery codes, then `verify` with the same code finishes it.
5243
+ * show the recovery codes, then `verify` with the next authenticator code finishes it.
5228
5244
  */
5229
5245
  confirmEnrollment(code: string): Promise<TwoFactorConfirmResponse>;
5230
5246
  /**
@@ -6635,9 +6651,9 @@ export declare class Passflow {
6635
6651
  private adoptTwoFactorTokenFromUrl;
6636
6652
  private checkErrorsFromURL;
6637
6653
  /**
6638
- * When a token appears in the query or the fragment, removes every token and `client_challenge`
6639
- * from the query, and the tokens, `client_challenge` and `state` from whichever part carried the
6640
- * tokens, in one history replace. Other params stay, in the query and in the fragment.
6654
+ * When a token appears in the query or the fragment, removes every token, `client_challenge` and
6655
+ * `user_state` from the query, and those and `state` from whichever part carried the tokens, in
6656
+ * one history replace. Other params stay, in the query and in the fragment.
6641
6657
  */
6642
6658
  private cleanupUrlParams;
6643
6659
  private setTokensToCacheFromLocalStorage;
@@ -7780,7 +7796,7 @@ export declare class Passflow {
7780
7796
  beginTwoFactorEnrollment(): Promise<TwoFactorSetupResponse>;
7781
7797
  /**
7782
7798
  * Confirm 2FA setup on the pending sign-in. The sign-in stays pending: show the recovery codes,
7783
- * then `verifyTwoFactor` with the same code finishes it.
7799
+ * then `verifyTwoFactor` with the next authenticator code finishes it.
7784
7800
  *
7785
7801
  * @param code - TOTP code from the authenticator app
7786
7802
  * @returns Promise with the recovery codes the user must save
package/dist/index.d.ts CHANGED
@@ -1417,13 +1417,26 @@ export declare const TWO_FACTOR_SEND_LIMIT_ERROR_ID = "error.2fa.rate_limit_exce
1417
1417
  export declare const RECOVERY_CODES_STEP_UP_REQUIRED_ERROR_ID = "error.2fa.recovery_codes.step_up_required";
1418
1418
  /** Id of the 403 a profile save answers with when a change of email or phone number needs a proof. */
1419
1419
  export declare const ADDRESS_CHANGE_PROOF_REQUIRED_ERROR_ID = "error.user.address.change.proof.required";
1420
+ /**
1421
+ * What a refused login-code send answers beside the error: the challenge the sign-in goes on with
1422
+ * (the live code, if one was sent before), the method to suggest, and the methods to switch to. The
1423
+ * refused method is never among `alternative_methods`, which is absent when there are none.
1424
+ */
1425
+ export type TwoFactorSendRefusalChallenge = {
1426
+ challenge_id: string;
1427
+ suggested_method?: TwoFactorMethod;
1428
+ alternative_methods?: TwoFactorMethod[];
1429
+ };
1420
1430
  /**
1421
1431
  * No code was sent: the user's monthly text quota is spent (429). Use another method or try again
1422
1432
  * next month.
1423
1433
  */
1424
1434
  export declare class PassflowSmsQuotaExceededError extends PassflowError {
1435
+ /** The sign-in's challenge to go on with; undefined when the answer carried no `challenge_id`. */
1436
+ readonly challenge?: TwoFactorSendRefusalChallenge;
1425
1437
  constructor(error: PassflowResponseError['error'], options?: {
1426
1438
  cause?: unknown;
1439
+ challenge?: TwoFactorSendRefusalChallenge;
1427
1440
  });
1428
1441
  }
1429
1442
  /**
@@ -1433,8 +1446,11 @@ export declare class PassflowSmsQuotaExceededError extends PassflowError {
1433
1446
  export declare class PassflowSendLimitError extends PassflowError {
1434
1447
  /** Seconds to wait, from `Retry-After`; undefined when the server sent none. */
1435
1448
  readonly retryAfter?: number;
1449
+ /** The sign-in's challenge to go on with; undefined when the answer carried no `challenge_id`. */
1450
+ readonly challenge?: TwoFactorSendRefusalChallenge;
1436
1451
  constructor(error: PassflowResponseError['error'], retryAfter?: number, options?: {
1437
1452
  cause?: unknown;
1453
+ challenge?: TwoFactorSendRefusalChallenge;
1438
1454
  });
1439
1455
  }
1440
1456
  /**
@@ -3398,7 +3414,7 @@ export declare class TwoFactorApiClient {
3398
3414
  */
3399
3415
  beginEnrollment(tfaToken: string): Promise<TwoFactorSetupResponse>;
3400
3416
  /**
3401
- * Confirm 2FA setup on the sign-in itself; `verify` with the same code then finishes it
3417
+ * Confirm 2FA setup on the sign-in itself; `verify` with the next authenticator code then finishes it
3402
3418
  * POST /auth/2fa/setup/confirm
3403
3419
  */
3404
3420
  confirmEnrollment(tfaToken: string, payload: TwoFactorConfirmRequest): Promise<TwoFactorConfirmResponse>;
@@ -5224,7 +5240,7 @@ export declare class TwoFactorService {
5224
5240
  beginEnrollment(): Promise<TwoFactorSetupResponse>;
5225
5241
  /**
5226
5242
  * Confirm 2FA setup on the sign-in itself (`direct`). The sign-in stays pending:
5227
- * show the recovery codes, then `verify` with the same code finishes it.
5243
+ * show the recovery codes, then `verify` with the next authenticator code finishes it.
5228
5244
  */
5229
5245
  confirmEnrollment(code: string): Promise<TwoFactorConfirmResponse>;
5230
5246
  /**
@@ -6635,9 +6651,9 @@ export declare class Passflow {
6635
6651
  private adoptTwoFactorTokenFromUrl;
6636
6652
  private checkErrorsFromURL;
6637
6653
  /**
6638
- * When a token appears in the query or the fragment, removes every token and `client_challenge`
6639
- * from the query, and the tokens, `client_challenge` and `state` from whichever part carried the
6640
- * tokens, in one history replace. Other params stay, in the query and in the fragment.
6654
+ * When a token appears in the query or the fragment, removes every token, `client_challenge` and
6655
+ * `user_state` from the query, and those and `state` from whichever part carried the tokens, in
6656
+ * one history replace. Other params stay, in the query and in the fragment.
6641
6657
  */
6642
6658
  private cleanupUrlParams;
6643
6659
  private setTokensToCacheFromLocalStorage;
@@ -7780,7 +7796,7 @@ export declare class Passflow {
7780
7796
  beginTwoFactorEnrollment(): Promise<TwoFactorSetupResponse>;
7781
7797
  /**
7782
7798
  * Confirm 2FA setup on the pending sign-in. The sign-in stays pending: show the recovery codes,
7783
- * then `verifyTwoFactor` with the same code finishes it.
7799
+ * then `verifyTwoFactor` with the next authenticator code finishes it.
7784
7800
  *
7785
7801
  * @param code - TOTP code from the authenticator app
7786
7802
  * @returns Promise with the recovery codes the user must save