@passflow/core 0.42.0 → 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;
@@ -4567,18 +4607,20 @@ export type LogOutOptions = {
4567
4607
  * ended. It must match one of the app's registered redirect URLs; an unmatched one leaves the
4568
4608
  * user on the Passflow server's start page. Default: the address the hosted sign-in landed on.
4569
4609
  *
4570
- * When set, it is also sent as `post_logout_redirect_uri` in the logout request. For a session
4571
- * from a SAML connection the server then returns the browser there after the identity
4572
- * provider's single logout, instead of its own signed-out page. The server ignores an address
4573
- * that is not a registered redirect URL. Needs Passflow server v0.137.1 or later; older servers
4574
- * ignore it.
4610
+ * It is also sent as `post_logout_redirect_uri` in the logout request. After a hosted sign-in
4611
+ * the request carries the address by default too, the same one the `/oidc/end_session` visit
4612
+ * uses. For a session from a SAML connection the server then returns the browser there after
4613
+ * the identity provider's single logout, instead of its own signed-out page. The server
4614
+ * ignores an address that is not a registered redirect URL. Needs Passflow server v0.137.1 or
4615
+ * later; older servers ignore it.
4575
4616
  */
4576
4617
  postLogoutRedirectUri?: string;
4577
4618
  /**
4578
4619
  * When the logout answer carries `saml_logout_url` (a session from a SAML connection with
4579
4620
  * SP-initiated logout), send the browser there after the local sign-out, so the identity
4580
- * provider ends its session too. Default false: the URL is only returned. A hosted sign-in's
4581
- * `/oidc/end_session` visit takes precedence; the URL is still returned then.
4621
+ * provider ends its session too. Default false: the URL is only returned. After a hosted
4622
+ * sign-in the page goes there instead of `/oidc/end_session`: the session already ended at the
4623
+ * logout request, so `/oidc/end_session` could no longer reach the identity provider.
4582
4624
  */
4583
4625
  followSamlLogout?: boolean;
4584
4626
  };
@@ -4813,7 +4855,8 @@ export declare class AuthService {
4813
4855
  *
4814
4856
  * Emits no `SignOut`: `Passflow.logOut()` emits exactly one, after this resolves.
4815
4857
  *
4816
- * @param postLogoutRedirectUri - sent as `post_logout_redirect_uri` in the logout request when set
4858
+ * @param postLogoutRedirectUri - sent as `post_logout_redirect_uri` in the logout request. After a
4859
+ * hosted sign-in the address the hosted sign-in landed on is sent when this is not set
4817
4860
  * @returns the `sub` of the session that ended, when known, and the SAML identity provider's
4818
4861
  * logout address when the logout answer carried one
4819
4862
  */
@@ -5571,6 +5614,12 @@ export declare class TwoFactorService {
5571
5614
  * Switch to alternative 2FA method during challenge
5572
5615
  */
5573
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>;
5574
5623
  /**
5575
5624
  * List the devices the user trusted to skip the second factor on this app.
5576
5625
  * The one this request came from has `current: true`.
@@ -6541,6 +6590,8 @@ export declare class Passflow {
6541
6590
  private tokenCacheService;
6542
6591
  private twoFactorService;
6543
6592
  private antiBot;
6593
+ /** This instance's device key: present with `deviceKey: true` outside BFF mode. */
6594
+ private readonly deviceKeyService;
6544
6595
  tenant: TenantService;
6545
6596
  twoFactor: TwoFactorService;
6546
6597
  /**
@@ -7139,13 +7190,16 @@ export declare class Passflow {
7139
7190
  * A session from a SAML connection with SP-initiated logout also has a session at the identity
7140
7191
  * provider. The server then answers with its logout address, returned as `samlLogoutUrl` after
7141
7192
  * the local session is cleared. With `followSamlLogout: true` the page goes there after the one
7142
- * `SignOut`; otherwise nothing navigates for it. A hosted sign-in's `/oidc/end_session` visit
7143
- * takes precedence over it.
7193
+ * `SignOut`, instead of `/oidc/end_session`: the session already ended at the logout request,
7194
+ * so the `/oidc/end_session` visit could no longer send the identity provider a LogoutRequest.
7195
+ * Without the option, or without a `samlLogoutUrl`, a hosted sign-in still goes to
7196
+ * `/oidc/end_session`.
7144
7197
  *
7145
7198
  * @param options.postLogoutRedirectUri - where to return after a hosted sign-out; must match one
7146
- * of the app's registered redirect URLs. When set it is also sent in the logout request, and
7147
- * after a SAML single logout the server returns the browser there (Passflow server v0.137.1 or
7148
- * later; older servers ignore it)
7199
+ * of the app's registered redirect URLs. It is also sent in the logout request, and after a SAML
7200
+ * single logout the server returns the browser there (Passflow server v0.137.1 or later; older
7201
+ * servers ignore it). After a hosted sign-in the logout request carries the same return address
7202
+ * the `/oidc/end_session` visit uses: this one, else the address the hosted sign-in landed on
7149
7203
  * @param options.followSamlLogout - navigate to the SAML identity provider's logout address when
7150
7204
  * the server returns one
7151
7205
  * @returns `{ samlLogoutUrl }` when the server returned the identity provider's logout address,
@@ -7352,6 +7406,17 @@ export declare class Passflow {
7352
7406
  * @throws {Error} with the option off, in BFF mode, or without IndexedDB and WebCrypto
7353
7407
  */
7354
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>;
7355
7420
  /**
7356
7421
  * Send a password reset email to the user.
7357
7422
  *
@@ -8322,4 +8387,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
8322
8387
  * @returns true if valid username format, false otherwise
8323
8388
  */
8324
8389
  export declare function isValidUsername(username: string): boolean;
8325
- 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;
@@ -4567,18 +4607,20 @@ export type LogOutOptions = {
4567
4607
  * ended. It must match one of the app's registered redirect URLs; an unmatched one leaves the
4568
4608
  * user on the Passflow server's start page. Default: the address the hosted sign-in landed on.
4569
4609
  *
4570
- * When set, it is also sent as `post_logout_redirect_uri` in the logout request. For a session
4571
- * from a SAML connection the server then returns the browser there after the identity
4572
- * provider's single logout, instead of its own signed-out page. The server ignores an address
4573
- * that is not a registered redirect URL. Needs Passflow server v0.137.1 or later; older servers
4574
- * ignore it.
4610
+ * It is also sent as `post_logout_redirect_uri` in the logout request. After a hosted sign-in
4611
+ * the request carries the address by default too, the same one the `/oidc/end_session` visit
4612
+ * uses. For a session from a SAML connection the server then returns the browser there after
4613
+ * the identity provider's single logout, instead of its own signed-out page. The server
4614
+ * ignores an address that is not a registered redirect URL. Needs Passflow server v0.137.1 or
4615
+ * later; older servers ignore it.
4575
4616
  */
4576
4617
  postLogoutRedirectUri?: string;
4577
4618
  /**
4578
4619
  * When the logout answer carries `saml_logout_url` (a session from a SAML connection with
4579
4620
  * SP-initiated logout), send the browser there after the local sign-out, so the identity
4580
- * provider ends its session too. Default false: the URL is only returned. A hosted sign-in's
4581
- * `/oidc/end_session` visit takes precedence; the URL is still returned then.
4621
+ * provider ends its session too. Default false: the URL is only returned. After a hosted
4622
+ * sign-in the page goes there instead of `/oidc/end_session`: the session already ended at the
4623
+ * logout request, so `/oidc/end_session` could no longer reach the identity provider.
4582
4624
  */
4583
4625
  followSamlLogout?: boolean;
4584
4626
  };
@@ -4813,7 +4855,8 @@ export declare class AuthService {
4813
4855
  *
4814
4856
  * Emits no `SignOut`: `Passflow.logOut()` emits exactly one, after this resolves.
4815
4857
  *
4816
- * @param postLogoutRedirectUri - sent as `post_logout_redirect_uri` in the logout request when set
4858
+ * @param postLogoutRedirectUri - sent as `post_logout_redirect_uri` in the logout request. After a
4859
+ * hosted sign-in the address the hosted sign-in landed on is sent when this is not set
4817
4860
  * @returns the `sub` of the session that ended, when known, and the SAML identity provider's
4818
4861
  * logout address when the logout answer carried one
4819
4862
  */
@@ -5571,6 +5614,12 @@ export declare class TwoFactorService {
5571
5614
  * Switch to alternative 2FA method during challenge
5572
5615
  */
5573
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>;
5574
5623
  /**
5575
5624
  * List the devices the user trusted to skip the second factor on this app.
5576
5625
  * The one this request came from has `current: true`.
@@ -6541,6 +6590,8 @@ export declare class Passflow {
6541
6590
  private tokenCacheService;
6542
6591
  private twoFactorService;
6543
6592
  private antiBot;
6593
+ /** This instance's device key: present with `deviceKey: true` outside BFF mode. */
6594
+ private readonly deviceKeyService;
6544
6595
  tenant: TenantService;
6545
6596
  twoFactor: TwoFactorService;
6546
6597
  /**
@@ -7139,13 +7190,16 @@ export declare class Passflow {
7139
7190
  * A session from a SAML connection with SP-initiated logout also has a session at the identity
7140
7191
  * provider. The server then answers with its logout address, returned as `samlLogoutUrl` after
7141
7192
  * the local session is cleared. With `followSamlLogout: true` the page goes there after the one
7142
- * `SignOut`; otherwise nothing navigates for it. A hosted sign-in's `/oidc/end_session` visit
7143
- * takes precedence over it.
7193
+ * `SignOut`, instead of `/oidc/end_session`: the session already ended at the logout request,
7194
+ * so the `/oidc/end_session` visit could no longer send the identity provider a LogoutRequest.
7195
+ * Without the option, or without a `samlLogoutUrl`, a hosted sign-in still goes to
7196
+ * `/oidc/end_session`.
7144
7197
  *
7145
7198
  * @param options.postLogoutRedirectUri - where to return after a hosted sign-out; must match one
7146
- * of the app's registered redirect URLs. When set it is also sent in the logout request, and
7147
- * after a SAML single logout the server returns the browser there (Passflow server v0.137.1 or
7148
- * later; older servers ignore it)
7199
+ * of the app's registered redirect URLs. It is also sent in the logout request, and after a SAML
7200
+ * single logout the server returns the browser there (Passflow server v0.137.1 or later; older
7201
+ * servers ignore it). After a hosted sign-in the logout request carries the same return address
7202
+ * the `/oidc/end_session` visit uses: this one, else the address the hosted sign-in landed on
7149
7203
  * @param options.followSamlLogout - navigate to the SAML identity provider's logout address when
7150
7204
  * the server returns one
7151
7205
  * @returns `{ samlLogoutUrl }` when the server returned the identity provider's logout address,
@@ -7352,6 +7406,17 @@ export declare class Passflow {
7352
7406
  * @throws {Error} with the option off, in BFF mode, or without IndexedDB and WebCrypto
7353
7407
  */
7354
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>;
7355
7420
  /**
7356
7421
  * Send a password reset email to the user.
7357
7422
  *
@@ -8322,4 +8387,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
8322
8387
  * @returns true if valid username format, false otherwise
8323
8388
  */
8324
8389
  export declare function isValidUsername(username: string): boolean;
8325
- 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 };