@passflow/core 0.42.1 → 0.43.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/index.d.cts CHANGED
@@ -1132,6 +1132,7 @@ export declare enum PassflowEndpointPaths {
1132
1132
  TwoFactorChallenge = "/v2/auth/2fa/challenge",
1133
1133
  TwoFactorVerifyV2 = "/v2/auth/2fa/verify",
1134
1134
  TwoFactorAlternative = "/v2/auth/2fa/alternative",
1135
+ TwoFactorPushStatus = "/v2/auth/2fa/push/status",
1135
1136
  TwoFactorTrustedDevices = "/v2/user/2fa/trusted-devices",
1136
1137
  TwoFactorTrustedDeviceRevoke = "/v2/user/2fa/trusted-devices/:id",
1137
1138
  TwoFactorPreferredMethod = "/v2/user/2fa/preferred-method",
@@ -2409,6 +2410,10 @@ export interface TwoFactorChallengeResponse {
2409
2410
  code_sent_to?: string;
2410
2411
  /** Minutes the code stays valid, whole and at least 1. Emailed and texted codes only. */
2411
2412
  expires_in_minutes?: number;
2413
+ /** The number the user types on the approving device. Push challenges only. */
2414
+ number_match?: string;
2415
+ /** Seconds the push can still be answered. Push challenges only. */
2416
+ expires_in_seconds?: number;
2412
2417
  webauthn_options?: unknown;
2413
2418
  /** Digits in the TOTP code. TOTP challenges only. */
2414
2419
  totp_digits?: 6 | 8;
@@ -2426,14 +2431,20 @@ export interface TwoFactorChallengeResponse {
2426
2431
  account_hint?: string;
2427
2432
  }
2428
2433
  /**
2429
- * Verify Request for v2 2FA flow
2434
+ * Verify Request for v2 2FA flow. A push completion (`push_webpush`) carries no `response`: the
2435
+ * approved request is claimed. Every other method sends the code or the WebAuthn response.
2430
2436
  */
2431
- export interface TwoFactorVerifyRequestV2 {
2437
+ export type TwoFactorVerifyRequestV2 = {
2432
2438
  challenge_id: string;
2433
2439
  method: TwoFactorMethod;
2434
2440
  response: string;
2435
2441
  trust_device?: boolean;
2436
- }
2442
+ } | {
2443
+ challenge_id: string;
2444
+ method: 'push_webpush';
2445
+ response?: undefined;
2446
+ trust_device?: boolean;
2447
+ };
2437
2448
  /**
2438
2449
  * Verify Response from v2 2FA flow
2439
2450
  */
@@ -2444,6 +2455,17 @@ export interface TwoFactorVerifyResponseV2 extends TwoFactorParentAnswer {
2444
2455
  /** On a PKCE app; `TwoFactorService` redeems it, so its callers never see one. */
2445
2456
  code?: string;
2446
2457
  }
2458
+ /**
2459
+ * The state of a sign-in's push approval (`twoFactor.pushStatus`). On `approved`, finish the
2460
+ * sign-in with `verifyV2({ challenge_id, method: 'push_webpush' })`.
2461
+ */
2462
+ export type TwoFactorPushStatusResponse = {
2463
+ status: 'pending';
2464
+ /** Seconds the push can still be answered; 0 when the server sent none. */
2465
+ expires_in_seconds: number;
2466
+ } | {
2467
+ status: 'approved';
2468
+ };
2447
2469
  /**
2448
2470
  * Registered Two-Factor Method
2449
2471
  */
@@ -2638,7 +2660,7 @@ export declare enum PassflowEvent {
2638
2660
  * The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
2639
2661
  * emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
2640
2662
  */
2641
- type PassflowOperation = 'sign-in' | 'sign-up' | 'passwordless.start' | 'passwordless.complete' | 'passwordless.wait' | 'passwordless.approval' | 'password-reset.send' | 'password-reset.complete' | 'email-verification.complete' | 'passkey.register' | 'passkey.authenticate' | 'federated.popup' | 'federated.redirect' | 'enterprise.resolve' | 'enterprise.start' | 'auth-redirect.url' | 'auth-redirect' | 'redirect.check' | 'auth.is-authenticated' | 'session.check' | 'session.list' | 'session.revoke' | 'session.revoke-others' | 'tokens.get' | 'tokens.load' | 'tokens.from-url' | 'oidc.redirect' | 'refresh' | 'upgrade.commit' | 'log-out' | 'reset' | 'anti-bot.token' | 'device-key.enrol' | 'settings.app' | 'settings.all' | 'settings.password-policy' | 'settings.passkey' | 'passkey.list' | 'passkey.rename' | 'passkey.delete' | 'passkey.add' | 'tenant.create' | 'invitation.join' | 'invitation.request-link' | 'invitation.list' | 'invitation.delete' | 'invitation.resend' | 'invitation.get-link' | '2fa.status' | '2fa.setup.begin' | '2fa.setup.confirm' | '2fa.enrollment.read' | '2fa.enrollment.setup-link' | '2fa.verify' | '2fa.recovery.use' | '2fa.disable' | '2fa.recovery.regenerate' | '2fa.methods.available' | '2fa.methods.registered' | '2fa.method.setup.start' | '2fa.method.setup.complete' | '2fa.method.remove' | '2fa.challenge.request' | '2fa.challenge.verify' | '2fa.method.switch' | '2fa.trusted-devices.list' | '2fa.trusted-devices.revoke' | '2fa.preferred-method.read' | '2fa.preferred-method.set' | '2fa.preferred-method.clear' | '2fa.recovery-codes.start' | '2fa.recovery-codes.complete' | 'profile.update' | 'profile.address-proof';
2663
+ type PassflowOperation = 'sign-in' | 'sign-up' | 'passwordless.start' | 'passwordless.complete' | 'passwordless.wait' | 'passwordless.approval' | 'password-reset.send' | 'password-reset.complete' | 'email-verification.complete' | 'passkey.register' | 'passkey.authenticate' | 'federated.popup' | 'federated.redirect' | 'enterprise.resolve' | 'enterprise.start' | 'auth-redirect.url' | 'auth-redirect' | 'redirect.check' | 'auth.is-authenticated' | 'session.check' | 'session.list' | 'session.revoke' | 'session.revoke-others' | 'tokens.get' | 'tokens.load' | 'tokens.from-url' | 'oidc.redirect' | 'refresh' | 'upgrade.commit' | 'log-out' | 'reset' | 'anti-bot.token' | 'device-key.enrol' | 'settings.app' | 'settings.all' | 'settings.password-policy' | 'settings.passkey' | 'passkey.list' | 'passkey.rename' | 'passkey.delete' | 'passkey.add' | 'tenant.create' | 'invitation.join' | 'invitation.request-link' | 'invitation.list' | 'invitation.delete' | 'invitation.resend' | 'invitation.get-link' | '2fa.status' | '2fa.setup.begin' | '2fa.setup.confirm' | '2fa.enrollment.read' | '2fa.enrollment.setup-link' | '2fa.verify' | '2fa.recovery.use' | '2fa.disable' | '2fa.recovery.regenerate' | '2fa.methods.available' | '2fa.methods.registered' | '2fa.method.setup.start' | '2fa.method.setup.complete' | '2fa.method.remove' | '2fa.challenge.request' | '2fa.challenge.verify' | '2fa.method.switch' | '2fa.push.status' | '2fa.trusted-devices.list' | '2fa.trusted-devices.revoke' | '2fa.preferred-method.read' | '2fa.preferred-method.set' | '2fa.preferred-method.clear' | '2fa.recovery-codes.start' | '2fa.recovery-codes.complete' | 'profile.update' | 'profile.address-proof';
2642
2664
  /**
2643
2665
  * Error payload interface for structured error information
2644
2666
  */
@@ -3576,6 +3598,13 @@ export declare class TwoFactorApiClient {
3576
3598
  * `tfaToken`, when given, goes as the Bearer token the route is gated on.
3577
3599
  */
3578
3600
  switchToAlternative(payload: TwoFactorAlternativeRequest, tfaToken?: string): Promise<TwoFactorChallengeResponse>;
3601
+ /**
3602
+ * The state of the sign-in's push approval
3603
+ * POST /v2/auth/2fa/push/status
3604
+ * `tfaToken`, when given, goes as the Bearer token the route is gated on.
3605
+ * A pending answer without `expires_in_seconds` reads as 0 seconds left.
3606
+ */
3607
+ pushStatus(challengeId: string, tfaToken?: string): Promise<TwoFactorPushStatusResponse>;
3579
3608
  /**
3580
3609
  * List the devices the user trusted on this app
3581
3610
  * GET /v2/user/2fa/trusted-devices
@@ -3729,8 +3758,19 @@ export declare const ERROR_MESSAGE_MAX_LENGTH = 200;
3729
3758
  *
3730
3759
  * @module device-key/proof
3731
3760
  */
3732
- /** What a proof is for: enrolling the key, a first-factor sign-in, or a refresh. */
3733
- type DeviceProofUse = 'enrol' | 'sign_in' | 'refresh';
3761
+ /** What a proof is for: enrolling the key, a first-factor sign-in, a refresh, or a push approval step. */
3762
+ type DeviceProofUse = 'enrol' | 'sign_in' | 'refresh' | DevicePushProofUse;
3763
+ /**
3764
+ * The push-approval uses: `push_enrol` registers this browser for push approvals, `push_info` reads
3765
+ * a pending approval, `push_approve` and `push_deny` answer it.
3766
+ */
3767
+ type DevicePushProofUse = 'push_enrol' | 'push_info' | 'push_approve' | 'push_deny';
3768
+ /**
3769
+ * The `jti` the server expects in a `push_info`, `push_deny` or `push_approve` proof: base64url
3770
+ * (no padding) of SHA-256 of the UTF-8 bytes of `challengeId + "\n" + number`. `number` is empty
3771
+ * for info and deny, and the number the user typed for approve.
3772
+ */
3773
+ export declare function pushChallengeOf(challengeId: string, number?: string): Promise<string>;
3734
3774
  interface DeviceKeyService {
3735
3775
  /** IndexedDB and `crypto.subtle` exist. False: proofs are undefined, enrolment rejects, the rest does nothing. */
3736
3776
  readonly supported: boolean;
@@ -5574,6 +5614,12 @@ export declare class TwoFactorService {
5574
5614
  * Switch to alternative 2FA method during challenge
5575
5615
  */
5576
5616
  switchToAlternative(payload: TwoFactorAlternativeRequest): Promise<TwoFactorChallengeResponse>;
5617
+ /**
5618
+ * The state of this sign-in's push approval: `pending` with the seconds left, or `approved`
5619
+ * (then finish with `verifyV2({ challenge_id, method: 'push_webpush' })`). A denied push rejects
5620
+ * with 403 `error.2fa.push.denied`, an expired one with 401 `error.2fa.push.expired`.
5621
+ */
5622
+ pushStatus(challengeId: string): Promise<TwoFactorPushStatusResponse>;
5577
5623
  /**
5578
5624
  * List the devices the user trusted to skip the second factor on this app.
5579
5625
  * The one this request came from has `current: true`.
@@ -6544,6 +6590,8 @@ export declare class Passflow {
6544
6590
  private tokenCacheService;
6545
6591
  private twoFactorService;
6546
6592
  private antiBot;
6593
+ /** This instance's device key: present with `deviceKey: true` outside BFF mode. */
6594
+ private readonly deviceKeyService;
6547
6595
  tenant: TenantService;
6548
6596
  twoFactor: TwoFactorService;
6549
6597
  /**
@@ -7358,6 +7406,17 @@ export declare class Passflow {
7358
7406
  * @throws {Error} with the option off, in BFF mode, or without IndexedDB and WebCrypto
7359
7407
  */
7360
7408
  enrolDeviceKey(): Promise<void>;
7409
+ /**
7410
+ * A device proof for a push-approval request, signed by this browser's enrolled device key with
7411
+ * the next counter value. `jti` is the challenge from `POST /auth/device/challenge` for
7412
+ * `push_enrol`, and `pushChallengeOf(challengeId, number)` for the others. Send it with the
7413
+ * device id (`getDeviceId()`) in `X-Passflow-DeviceId`.
7414
+ *
7415
+ * @returns undefined with the `deviceKey` option off, in BFF mode, without IndexedDB and
7416
+ * WebCrypto, or when no enrolled key is stored
7417
+ * @throws {Error} when IndexedDB or WebCrypto fails while reading the key or signing
7418
+ */
7419
+ devicePushProof(use: DevicePushProofUse, jti: string): Promise<string | undefined>;
7361
7420
  /**
7362
7421
  * Send a password reset email to the user.
7363
7422
  *
@@ -8328,4 +8387,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
8328
8387
  * @returns true if valid username format, false otherwise
8329
8388
  */
8330
8389
  export declare function isValidUsername(username: string): boolean;
8331
- export type { AntiBotAppSettings, AntiBotDeviceContext, AntiBotOperation, AntiBotTokenContext, AntiBotTokenProvider, AntiBotTokenRequest, AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, DeviceProofUse, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, OidcErrorCode, OpenAuthUrlOptions, OperationErrorPayload, PassflowEmailVerificationOperation, PassflowEventPayload, PassflowOperation, PassflowRefreshErrorOptions, PassflowSubscriber, PasskeySupport, PlatformAdapter, PlatformStorage, RawUserMembership, RefreshChannel, RefreshClock, RefreshCoordination, RefreshCoordinator, RefreshErrorInfo, RefreshFailureKind, RefreshLockManager, RefreshLockOptions, RefreshTrigger, RegisterOptions, ReplayPolicy, RequestSnapshot, ResponseInterceptorHost, RetryStrategy, SessionExpiredReason, SnapshotHeader, Tenant, TenantMembership, Token, UpgradeAssertContext, UpgradeAssertion, UpgradeChallenge, UpgradeCommitInterruptedReason, UpgradeControllerOptions, UpgradeDiagnostic, UpgradeDiagnosticReason, UpgradeDiagnosticSink, UpgradeElevation, UpgradeEnableOptions, UpgradeEndpoint, UpgradeErrorKind, UpgradeFacade, UpgradeFactor, UpgradeFactorInput, UpgradeFactorType, UpgradeFlightState, UpgradeFlightSummary, UpgradeOptions, UpgradePrepared, UpgradePromptHandler, UpgradePromptRequest, UpgradePromptResult, UpgradeProof, UpgradeReplayInfo, UpgradeResult, UpgradeSessionPin, UpgradeTransport, UpgradeTransportErrorInit, UpgradeWaiterSummary, UserMembership, Waiter, WaiterEntry, WaiterOutcome, WaiterReport, WithAuthOptions };
8390
+ export type { AntiBotAppSettings, AntiBotDeviceContext, AntiBotOperation, AntiBotTokenContext, AntiBotTokenProvider, AntiBotTokenRequest, AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, DeviceProofUse, DevicePushProofUse, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, OidcErrorCode, OpenAuthUrlOptions, OperationErrorPayload, PassflowEmailVerificationOperation, PassflowEventPayload, PassflowOperation, PassflowRefreshErrorOptions, PassflowSubscriber, PasskeySupport, PlatformAdapter, PlatformStorage, RawUserMembership, RefreshChannel, RefreshClock, RefreshCoordination, RefreshCoordinator, RefreshErrorInfo, RefreshFailureKind, RefreshLockManager, RefreshLockOptions, RefreshTrigger, RegisterOptions, ReplayPolicy, RequestSnapshot, ResponseInterceptorHost, RetryStrategy, SessionExpiredReason, SnapshotHeader, Tenant, TenantMembership, Token, UpgradeAssertContext, UpgradeAssertion, UpgradeChallenge, UpgradeCommitInterruptedReason, UpgradeControllerOptions, UpgradeDiagnostic, UpgradeDiagnosticReason, UpgradeDiagnosticSink, UpgradeElevation, UpgradeEnableOptions, UpgradeEndpoint, UpgradeErrorKind, UpgradeFacade, UpgradeFactor, UpgradeFactorInput, UpgradeFactorType, UpgradeFlightState, UpgradeFlightSummary, UpgradeOptions, UpgradePrepared, UpgradePromptHandler, UpgradePromptRequest, UpgradePromptResult, UpgradeProof, UpgradeReplayInfo, UpgradeResult, UpgradeSessionPin, UpgradeTransport, UpgradeTransportErrorInit, UpgradeWaiterSummary, UserMembership, Waiter, WaiterEntry, WaiterOutcome, WaiterReport, WithAuthOptions };
package/dist/index.d.ts CHANGED
@@ -1132,6 +1132,7 @@ export declare enum PassflowEndpointPaths {
1132
1132
  TwoFactorChallenge = "/v2/auth/2fa/challenge",
1133
1133
  TwoFactorVerifyV2 = "/v2/auth/2fa/verify",
1134
1134
  TwoFactorAlternative = "/v2/auth/2fa/alternative",
1135
+ TwoFactorPushStatus = "/v2/auth/2fa/push/status",
1135
1136
  TwoFactorTrustedDevices = "/v2/user/2fa/trusted-devices",
1136
1137
  TwoFactorTrustedDeviceRevoke = "/v2/user/2fa/trusted-devices/:id",
1137
1138
  TwoFactorPreferredMethod = "/v2/user/2fa/preferred-method",
@@ -2409,6 +2410,10 @@ export interface TwoFactorChallengeResponse {
2409
2410
  code_sent_to?: string;
2410
2411
  /** Minutes the code stays valid, whole and at least 1. Emailed and texted codes only. */
2411
2412
  expires_in_minutes?: number;
2413
+ /** The number the user types on the approving device. Push challenges only. */
2414
+ number_match?: string;
2415
+ /** Seconds the push can still be answered. Push challenges only. */
2416
+ expires_in_seconds?: number;
2412
2417
  webauthn_options?: unknown;
2413
2418
  /** Digits in the TOTP code. TOTP challenges only. */
2414
2419
  totp_digits?: 6 | 8;
@@ -2426,14 +2431,20 @@ export interface TwoFactorChallengeResponse {
2426
2431
  account_hint?: string;
2427
2432
  }
2428
2433
  /**
2429
- * Verify Request for v2 2FA flow
2434
+ * Verify Request for v2 2FA flow. A push completion (`push_webpush`) carries no `response`: the
2435
+ * approved request is claimed. Every other method sends the code or the WebAuthn response.
2430
2436
  */
2431
- export interface TwoFactorVerifyRequestV2 {
2437
+ export type TwoFactorVerifyRequestV2 = {
2432
2438
  challenge_id: string;
2433
2439
  method: TwoFactorMethod;
2434
2440
  response: string;
2435
2441
  trust_device?: boolean;
2436
- }
2442
+ } | {
2443
+ challenge_id: string;
2444
+ method: 'push_webpush';
2445
+ response?: undefined;
2446
+ trust_device?: boolean;
2447
+ };
2437
2448
  /**
2438
2449
  * Verify Response from v2 2FA flow
2439
2450
  */
@@ -2444,6 +2455,17 @@ export interface TwoFactorVerifyResponseV2 extends TwoFactorParentAnswer {
2444
2455
  /** On a PKCE app; `TwoFactorService` redeems it, so its callers never see one. */
2445
2456
  code?: string;
2446
2457
  }
2458
+ /**
2459
+ * The state of a sign-in's push approval (`twoFactor.pushStatus`). On `approved`, finish the
2460
+ * sign-in with `verifyV2({ challenge_id, method: 'push_webpush' })`.
2461
+ */
2462
+ export type TwoFactorPushStatusResponse = {
2463
+ status: 'pending';
2464
+ /** Seconds the push can still be answered; 0 when the server sent none. */
2465
+ expires_in_seconds: number;
2466
+ } | {
2467
+ status: 'approved';
2468
+ };
2447
2469
  /**
2448
2470
  * Registered Two-Factor Method
2449
2471
  */
@@ -2638,7 +2660,7 @@ export declare enum PassflowEvent {
2638
2660
  * The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
2639
2661
  * emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
2640
2662
  */
2641
- type PassflowOperation = 'sign-in' | 'sign-up' | 'passwordless.start' | 'passwordless.complete' | 'passwordless.wait' | 'passwordless.approval' | 'password-reset.send' | 'password-reset.complete' | 'email-verification.complete' | 'passkey.register' | 'passkey.authenticate' | 'federated.popup' | 'federated.redirect' | 'enterprise.resolve' | 'enterprise.start' | 'auth-redirect.url' | 'auth-redirect' | 'redirect.check' | 'auth.is-authenticated' | 'session.check' | 'session.list' | 'session.revoke' | 'session.revoke-others' | 'tokens.get' | 'tokens.load' | 'tokens.from-url' | 'oidc.redirect' | 'refresh' | 'upgrade.commit' | 'log-out' | 'reset' | 'anti-bot.token' | 'device-key.enrol' | 'settings.app' | 'settings.all' | 'settings.password-policy' | 'settings.passkey' | 'passkey.list' | 'passkey.rename' | 'passkey.delete' | 'passkey.add' | 'tenant.create' | 'invitation.join' | 'invitation.request-link' | 'invitation.list' | 'invitation.delete' | 'invitation.resend' | 'invitation.get-link' | '2fa.status' | '2fa.setup.begin' | '2fa.setup.confirm' | '2fa.enrollment.read' | '2fa.enrollment.setup-link' | '2fa.verify' | '2fa.recovery.use' | '2fa.disable' | '2fa.recovery.regenerate' | '2fa.methods.available' | '2fa.methods.registered' | '2fa.method.setup.start' | '2fa.method.setup.complete' | '2fa.method.remove' | '2fa.challenge.request' | '2fa.challenge.verify' | '2fa.method.switch' | '2fa.trusted-devices.list' | '2fa.trusted-devices.revoke' | '2fa.preferred-method.read' | '2fa.preferred-method.set' | '2fa.preferred-method.clear' | '2fa.recovery-codes.start' | '2fa.recovery-codes.complete' | 'profile.update' | 'profile.address-proof';
2663
+ type PassflowOperation = 'sign-in' | 'sign-up' | 'passwordless.start' | 'passwordless.complete' | 'passwordless.wait' | 'passwordless.approval' | 'password-reset.send' | 'password-reset.complete' | 'email-verification.complete' | 'passkey.register' | 'passkey.authenticate' | 'federated.popup' | 'federated.redirect' | 'enterprise.resolve' | 'enterprise.start' | 'auth-redirect.url' | 'auth-redirect' | 'redirect.check' | 'auth.is-authenticated' | 'session.check' | 'session.list' | 'session.revoke' | 'session.revoke-others' | 'tokens.get' | 'tokens.load' | 'tokens.from-url' | 'oidc.redirect' | 'refresh' | 'upgrade.commit' | 'log-out' | 'reset' | 'anti-bot.token' | 'device-key.enrol' | 'settings.app' | 'settings.all' | 'settings.password-policy' | 'settings.passkey' | 'passkey.list' | 'passkey.rename' | 'passkey.delete' | 'passkey.add' | 'tenant.create' | 'invitation.join' | 'invitation.request-link' | 'invitation.list' | 'invitation.delete' | 'invitation.resend' | 'invitation.get-link' | '2fa.status' | '2fa.setup.begin' | '2fa.setup.confirm' | '2fa.enrollment.read' | '2fa.enrollment.setup-link' | '2fa.verify' | '2fa.recovery.use' | '2fa.disable' | '2fa.recovery.regenerate' | '2fa.methods.available' | '2fa.methods.registered' | '2fa.method.setup.start' | '2fa.method.setup.complete' | '2fa.method.remove' | '2fa.challenge.request' | '2fa.challenge.verify' | '2fa.method.switch' | '2fa.push.status' | '2fa.trusted-devices.list' | '2fa.trusted-devices.revoke' | '2fa.preferred-method.read' | '2fa.preferred-method.set' | '2fa.preferred-method.clear' | '2fa.recovery-codes.start' | '2fa.recovery-codes.complete' | 'profile.update' | 'profile.address-proof';
2642
2664
  /**
2643
2665
  * Error payload interface for structured error information
2644
2666
  */
@@ -3576,6 +3598,13 @@ export declare class TwoFactorApiClient {
3576
3598
  * `tfaToken`, when given, goes as the Bearer token the route is gated on.
3577
3599
  */
3578
3600
  switchToAlternative(payload: TwoFactorAlternativeRequest, tfaToken?: string): Promise<TwoFactorChallengeResponse>;
3601
+ /**
3602
+ * The state of the sign-in's push approval
3603
+ * POST /v2/auth/2fa/push/status
3604
+ * `tfaToken`, when given, goes as the Bearer token the route is gated on.
3605
+ * A pending answer without `expires_in_seconds` reads as 0 seconds left.
3606
+ */
3607
+ pushStatus(challengeId: string, tfaToken?: string): Promise<TwoFactorPushStatusResponse>;
3579
3608
  /**
3580
3609
  * List the devices the user trusted on this app
3581
3610
  * GET /v2/user/2fa/trusted-devices
@@ -3729,8 +3758,19 @@ export declare const ERROR_MESSAGE_MAX_LENGTH = 200;
3729
3758
  *
3730
3759
  * @module device-key/proof
3731
3760
  */
3732
- /** What a proof is for: enrolling the key, a first-factor sign-in, or a refresh. */
3733
- type DeviceProofUse = 'enrol' | 'sign_in' | 'refresh';
3761
+ /** What a proof is for: enrolling the key, a first-factor sign-in, a refresh, or a push approval step. */
3762
+ type DeviceProofUse = 'enrol' | 'sign_in' | 'refresh' | DevicePushProofUse;
3763
+ /**
3764
+ * The push-approval uses: `push_enrol` registers this browser for push approvals, `push_info` reads
3765
+ * a pending approval, `push_approve` and `push_deny` answer it.
3766
+ */
3767
+ type DevicePushProofUse = 'push_enrol' | 'push_info' | 'push_approve' | 'push_deny';
3768
+ /**
3769
+ * The `jti` the server expects in a `push_info`, `push_deny` or `push_approve` proof: base64url
3770
+ * (no padding) of SHA-256 of the UTF-8 bytes of `challengeId + "\n" + number`. `number` is empty
3771
+ * for info and deny, and the number the user typed for approve.
3772
+ */
3773
+ export declare function pushChallengeOf(challengeId: string, number?: string): Promise<string>;
3734
3774
  interface DeviceKeyService {
3735
3775
  /** IndexedDB and `crypto.subtle` exist. False: proofs are undefined, enrolment rejects, the rest does nothing. */
3736
3776
  readonly supported: boolean;
@@ -5574,6 +5614,12 @@ export declare class TwoFactorService {
5574
5614
  * Switch to alternative 2FA method during challenge
5575
5615
  */
5576
5616
  switchToAlternative(payload: TwoFactorAlternativeRequest): Promise<TwoFactorChallengeResponse>;
5617
+ /**
5618
+ * The state of this sign-in's push approval: `pending` with the seconds left, or `approved`
5619
+ * (then finish with `verifyV2({ challenge_id, method: 'push_webpush' })`). A denied push rejects
5620
+ * with 403 `error.2fa.push.denied`, an expired one with 401 `error.2fa.push.expired`.
5621
+ */
5622
+ pushStatus(challengeId: string): Promise<TwoFactorPushStatusResponse>;
5577
5623
  /**
5578
5624
  * List the devices the user trusted to skip the second factor on this app.
5579
5625
  * The one this request came from has `current: true`.
@@ -6544,6 +6590,8 @@ export declare class Passflow {
6544
6590
  private tokenCacheService;
6545
6591
  private twoFactorService;
6546
6592
  private antiBot;
6593
+ /** This instance's device key: present with `deviceKey: true` outside BFF mode. */
6594
+ private readonly deviceKeyService;
6547
6595
  tenant: TenantService;
6548
6596
  twoFactor: TwoFactorService;
6549
6597
  /**
@@ -7358,6 +7406,17 @@ export declare class Passflow {
7358
7406
  * @throws {Error} with the option off, in BFF mode, or without IndexedDB and WebCrypto
7359
7407
  */
7360
7408
  enrolDeviceKey(): Promise<void>;
7409
+ /**
7410
+ * A device proof for a push-approval request, signed by this browser's enrolled device key with
7411
+ * the next counter value. `jti` is the challenge from `POST /auth/device/challenge` for
7412
+ * `push_enrol`, and `pushChallengeOf(challengeId, number)` for the others. Send it with the
7413
+ * device id (`getDeviceId()`) in `X-Passflow-DeviceId`.
7414
+ *
7415
+ * @returns undefined with the `deviceKey` option off, in BFF mode, without IndexedDB and
7416
+ * WebCrypto, or when no enrolled key is stored
7417
+ * @throws {Error} when IndexedDB or WebCrypto fails while reading the key or signing
7418
+ */
7419
+ devicePushProof(use: DevicePushProofUse, jti: string): Promise<string | undefined>;
7361
7420
  /**
7362
7421
  * Send a password reset email to the user.
7363
7422
  *
@@ -8328,4 +8387,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
8328
8387
  * @returns true if valid username format, false otherwise
8329
8388
  */
8330
8389
  export declare function isValidUsername(username: string): boolean;
8331
- export type { AntiBotAppSettings, AntiBotDeviceContext, AntiBotOperation, AntiBotTokenContext, AntiBotTokenProvider, AntiBotTokenRequest, AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, DeviceProofUse, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, OidcErrorCode, OpenAuthUrlOptions, OperationErrorPayload, PassflowEmailVerificationOperation, PassflowEventPayload, PassflowOperation, PassflowRefreshErrorOptions, PassflowSubscriber, PasskeySupport, PlatformAdapter, PlatformStorage, RawUserMembership, RefreshChannel, RefreshClock, RefreshCoordination, RefreshCoordinator, RefreshErrorInfo, RefreshFailureKind, RefreshLockManager, RefreshLockOptions, RefreshTrigger, RegisterOptions, ReplayPolicy, RequestSnapshot, ResponseInterceptorHost, RetryStrategy, SessionExpiredReason, SnapshotHeader, Tenant, TenantMembership, Token, UpgradeAssertContext, UpgradeAssertion, UpgradeChallenge, UpgradeCommitInterruptedReason, UpgradeControllerOptions, UpgradeDiagnostic, UpgradeDiagnosticReason, UpgradeDiagnosticSink, UpgradeElevation, UpgradeEnableOptions, UpgradeEndpoint, UpgradeErrorKind, UpgradeFacade, UpgradeFactor, UpgradeFactorInput, UpgradeFactorType, UpgradeFlightState, UpgradeFlightSummary, UpgradeOptions, UpgradePrepared, UpgradePromptHandler, UpgradePromptRequest, UpgradePromptResult, UpgradeProof, UpgradeReplayInfo, UpgradeResult, UpgradeSessionPin, UpgradeTransport, UpgradeTransportErrorInit, UpgradeWaiterSummary, UserMembership, Waiter, WaiterEntry, WaiterOutcome, WaiterReport, WithAuthOptions };
8390
+ export type { AntiBotAppSettings, AntiBotDeviceContext, AntiBotOperation, AntiBotTokenContext, AntiBotTokenProvider, AntiBotTokenRequest, AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, DeviceProofUse, DevicePushProofUse, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, OidcErrorCode, OpenAuthUrlOptions, OperationErrorPayload, PassflowEmailVerificationOperation, PassflowEventPayload, PassflowOperation, PassflowRefreshErrorOptions, PassflowSubscriber, PasskeySupport, PlatformAdapter, PlatformStorage, RawUserMembership, RefreshChannel, RefreshClock, RefreshCoordination, RefreshCoordinator, RefreshErrorInfo, RefreshFailureKind, RefreshLockManager, RefreshLockOptions, RefreshTrigger, RegisterOptions, ReplayPolicy, RequestSnapshot, ResponseInterceptorHost, RetryStrategy, SessionExpiredReason, SnapshotHeader, Tenant, TenantMembership, Token, UpgradeAssertContext, UpgradeAssertion, UpgradeChallenge, UpgradeCommitInterruptedReason, UpgradeControllerOptions, UpgradeDiagnostic, UpgradeDiagnosticReason, UpgradeDiagnosticSink, UpgradeElevation, UpgradeEnableOptions, UpgradeEndpoint, UpgradeErrorKind, UpgradeFacade, UpgradeFactor, UpgradeFactorInput, UpgradeFactorType, UpgradeFlightState, UpgradeFlightSummary, UpgradeOptions, UpgradePrepared, UpgradePromptHandler, UpgradePromptRequest, UpgradePromptResult, UpgradeProof, UpgradeReplayInfo, UpgradeResult, UpgradeSessionPin, UpgradeTransport, UpgradeTransportErrorInit, UpgradeWaiterSummary, UserMembership, Waiter, WaiterEntry, WaiterOutcome, WaiterReport, WithAuthOptions };