@passflow/core 0.42.1 → 0.43.1
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/README.md +36 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +88 -11
- package/dist/index.d.ts +88 -11
- package/dist/index.mjs +1250 -1226
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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",
|
|
@@ -2296,17 +2297,35 @@ export type TwoFactorCompletionOptions = {
|
|
|
2296
2297
|
trustDevice?: boolean;
|
|
2297
2298
|
};
|
|
2298
2299
|
/**
|
|
2299
|
-
* A device the user
|
|
2300
|
+
* A device of the user's on this app: one that holds a grant to stand in for
|
|
2301
|
+
* their second factor, a device key, or both.
|
|
2300
2302
|
*/
|
|
2301
2303
|
export type TwoFactorTrustedDevice = {
|
|
2302
2304
|
id: string;
|
|
2303
2305
|
user_agent?: string;
|
|
2306
|
+
/** True while the device holds a grant that stands in for the second factor. */
|
|
2307
|
+
trusted: boolean;
|
|
2304
2308
|
created_at: string;
|
|
2309
|
+
/** When the grant ends; absent on a device without one. */
|
|
2310
|
+
expires_at?: string;
|
|
2305
2311
|
last_used_at?: string;
|
|
2306
|
-
|
|
2312
|
+
/** Set when the device enrolled a device key. */
|
|
2313
|
+
device_key?: TwoFactorTrustedDeviceKey;
|
|
2314
|
+
/** Set when the device can approve sign-ins by push. */
|
|
2315
|
+
push_approval?: TwoFactorTrustedDevicePush;
|
|
2307
2316
|
/** True for the device the request came from. */
|
|
2308
2317
|
current: boolean;
|
|
2309
2318
|
};
|
|
2319
|
+
/** A device's enrolled device key, as `TwoFactorTrustedDevice.device_key`. */
|
|
2320
|
+
export type TwoFactorTrustedDeviceKey = {
|
|
2321
|
+
key_storage: 'software' | 'hardware';
|
|
2322
|
+
enrolled_at: string;
|
|
2323
|
+
last_proof_at?: string;
|
|
2324
|
+
};
|
|
2325
|
+
/** A device's push approval, as `TwoFactorTrustedDevice.push_approval`. */
|
|
2326
|
+
export type TwoFactorTrustedDevicePush = {
|
|
2327
|
+
registered_at: string;
|
|
2328
|
+
};
|
|
2310
2329
|
/** GET /v2/user/2fa/trusted-devices */
|
|
2311
2330
|
export type TwoFactorTrustedDevicesResponse = {
|
|
2312
2331
|
devices: TwoFactorTrustedDevice[];
|
|
@@ -2367,8 +2386,8 @@ export type TwoFactorSetupMagicLinkSession = {
|
|
|
2367
2386
|
userId: string;
|
|
2368
2387
|
appId?: string | null;
|
|
2369
2388
|
scope: '2fa_setup';
|
|
2370
|
-
/** `true` when the link replaces an enrolled authenticator.
|
|
2371
|
-
reset
|
|
2389
|
+
/** `true` when the link replaces an enrolled authenticator. */
|
|
2390
|
+
reset: boolean;
|
|
2372
2391
|
timestamp: number;
|
|
2373
2392
|
expiresAt: number;
|
|
2374
2393
|
};
|
|
@@ -2409,6 +2428,10 @@ export interface TwoFactorChallengeResponse {
|
|
|
2409
2428
|
code_sent_to?: string;
|
|
2410
2429
|
/** Minutes the code stays valid, whole and at least 1. Emailed and texted codes only. */
|
|
2411
2430
|
expires_in_minutes?: number;
|
|
2431
|
+
/** The number the user types on the approving device. Push challenges only. */
|
|
2432
|
+
number_match?: string;
|
|
2433
|
+
/** Seconds the push can still be answered. Push challenges only. */
|
|
2434
|
+
expires_in_seconds?: number;
|
|
2412
2435
|
webauthn_options?: unknown;
|
|
2413
2436
|
/** Digits in the TOTP code. TOTP challenges only. */
|
|
2414
2437
|
totp_digits?: 6 | 8;
|
|
@@ -2426,14 +2449,20 @@ export interface TwoFactorChallengeResponse {
|
|
|
2426
2449
|
account_hint?: string;
|
|
2427
2450
|
}
|
|
2428
2451
|
/**
|
|
2429
|
-
* Verify Request for v2 2FA flow
|
|
2452
|
+
* Verify Request for v2 2FA flow. A push completion (`push_webpush`) carries no `response`: the
|
|
2453
|
+
* approved request is claimed. Every other method sends the code or the WebAuthn response.
|
|
2430
2454
|
*/
|
|
2431
|
-
export
|
|
2455
|
+
export type TwoFactorVerifyRequestV2 = {
|
|
2432
2456
|
challenge_id: string;
|
|
2433
2457
|
method: TwoFactorMethod;
|
|
2434
2458
|
response: string;
|
|
2435
2459
|
trust_device?: boolean;
|
|
2436
|
-
}
|
|
2460
|
+
} | {
|
|
2461
|
+
challenge_id: string;
|
|
2462
|
+
method: 'push_webpush';
|
|
2463
|
+
response?: undefined;
|
|
2464
|
+
trust_device?: boolean;
|
|
2465
|
+
};
|
|
2437
2466
|
/**
|
|
2438
2467
|
* Verify Response from v2 2FA flow
|
|
2439
2468
|
*/
|
|
@@ -2444,6 +2473,17 @@ export interface TwoFactorVerifyResponseV2 extends TwoFactorParentAnswer {
|
|
|
2444
2473
|
/** On a PKCE app; `TwoFactorService` redeems it, so its callers never see one. */
|
|
2445
2474
|
code?: string;
|
|
2446
2475
|
}
|
|
2476
|
+
/**
|
|
2477
|
+
* The state of a sign-in's push approval (`twoFactor.pushStatus`). On `approved`, finish the
|
|
2478
|
+
* sign-in with `verifyV2({ challenge_id, method: 'push_webpush' })`.
|
|
2479
|
+
*/
|
|
2480
|
+
export type TwoFactorPushStatusResponse = {
|
|
2481
|
+
status: 'pending';
|
|
2482
|
+
/** Seconds the push can still be answered; 0 when the server sent none. */
|
|
2483
|
+
expires_in_seconds: number;
|
|
2484
|
+
} | {
|
|
2485
|
+
status: 'approved';
|
|
2486
|
+
};
|
|
2447
2487
|
/**
|
|
2448
2488
|
* Registered Two-Factor Method
|
|
2449
2489
|
*/
|
|
@@ -2638,7 +2678,7 @@ export declare enum PassflowEvent {
|
|
|
2638
2678
|
* The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
|
|
2639
2679
|
* emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
|
|
2640
2680
|
*/
|
|
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';
|
|
2681
|
+
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
2682
|
/**
|
|
2643
2683
|
* Error payload interface for structured error information
|
|
2644
2684
|
*/
|
|
@@ -3576,6 +3616,13 @@ export declare class TwoFactorApiClient {
|
|
|
3576
3616
|
* `tfaToken`, when given, goes as the Bearer token the route is gated on.
|
|
3577
3617
|
*/
|
|
3578
3618
|
switchToAlternative(payload: TwoFactorAlternativeRequest, tfaToken?: string): Promise<TwoFactorChallengeResponse>;
|
|
3619
|
+
/**
|
|
3620
|
+
* The state of the sign-in's push approval
|
|
3621
|
+
* POST /v2/auth/2fa/push/status
|
|
3622
|
+
* `tfaToken`, when given, goes as the Bearer token the route is gated on.
|
|
3623
|
+
* A pending answer without `expires_in_seconds` reads as 0 seconds left.
|
|
3624
|
+
*/
|
|
3625
|
+
pushStatus(challengeId: string, tfaToken?: string): Promise<TwoFactorPushStatusResponse>;
|
|
3579
3626
|
/**
|
|
3580
3627
|
* List the devices the user trusted on this app
|
|
3581
3628
|
* GET /v2/user/2fa/trusted-devices
|
|
@@ -3729,8 +3776,19 @@ export declare const ERROR_MESSAGE_MAX_LENGTH = 200;
|
|
|
3729
3776
|
*
|
|
3730
3777
|
* @module device-key/proof
|
|
3731
3778
|
*/
|
|
3732
|
-
/** What a proof is for: enrolling the key, a first-factor sign-in, or a
|
|
3733
|
-
type DeviceProofUse = 'enrol' | 'sign_in' | 'refresh';
|
|
3779
|
+
/** What a proof is for: enrolling the key, a first-factor sign-in, a refresh, or a push approval step. */
|
|
3780
|
+
type DeviceProofUse = 'enrol' | 'sign_in' | 'refresh' | DevicePushProofUse;
|
|
3781
|
+
/**
|
|
3782
|
+
* The push-approval uses: `push_enrol` registers this browser for push approvals, `push_info` reads
|
|
3783
|
+
* a pending approval, `push_approve` and `push_deny` answer it.
|
|
3784
|
+
*/
|
|
3785
|
+
type DevicePushProofUse = 'push_enrol' | 'push_info' | 'push_approve' | 'push_deny';
|
|
3786
|
+
/**
|
|
3787
|
+
* The `jti` the server expects in a `push_info`, `push_deny` or `push_approve` proof: base64url
|
|
3788
|
+
* (no padding) of SHA-256 of the UTF-8 bytes of `challengeId + "\n" + number`. `number` is empty
|
|
3789
|
+
* for info and deny, and the number the user typed for approve.
|
|
3790
|
+
*/
|
|
3791
|
+
export declare function pushChallengeOf(challengeId: string, number?: string): Promise<string>;
|
|
3734
3792
|
interface DeviceKeyService {
|
|
3735
3793
|
/** IndexedDB and `crypto.subtle` exist. False: proofs are undefined, enrolment rejects, the rest does nothing. */
|
|
3736
3794
|
readonly supported: boolean;
|
|
@@ -5574,6 +5632,12 @@ export declare class TwoFactorService {
|
|
|
5574
5632
|
* Switch to alternative 2FA method during challenge
|
|
5575
5633
|
*/
|
|
5576
5634
|
switchToAlternative(payload: TwoFactorAlternativeRequest): Promise<TwoFactorChallengeResponse>;
|
|
5635
|
+
/**
|
|
5636
|
+
* The state of this sign-in's push approval: `pending` with the seconds left, or `approved`
|
|
5637
|
+
* (then finish with `verifyV2({ challenge_id, method: 'push_webpush' })`). A denied push rejects
|
|
5638
|
+
* with 403 `error.2fa.push.denied`, an expired one with 401 `error.2fa.push.expired`.
|
|
5639
|
+
*/
|
|
5640
|
+
pushStatus(challengeId: string): Promise<TwoFactorPushStatusResponse>;
|
|
5577
5641
|
/**
|
|
5578
5642
|
* List the devices the user trusted to skip the second factor on this app.
|
|
5579
5643
|
* The one this request came from has `current: true`.
|
|
@@ -6544,6 +6608,8 @@ export declare class Passflow {
|
|
|
6544
6608
|
private tokenCacheService;
|
|
6545
6609
|
private twoFactorService;
|
|
6546
6610
|
private antiBot;
|
|
6611
|
+
/** This instance's device key: present with `deviceKey: true` outside BFF mode. */
|
|
6612
|
+
private readonly deviceKeyService;
|
|
6547
6613
|
tenant: TenantService;
|
|
6548
6614
|
twoFactor: TwoFactorService;
|
|
6549
6615
|
/**
|
|
@@ -7358,6 +7424,17 @@ export declare class Passflow {
|
|
|
7358
7424
|
* @throws {Error} with the option off, in BFF mode, or without IndexedDB and WebCrypto
|
|
7359
7425
|
*/
|
|
7360
7426
|
enrolDeviceKey(): Promise<void>;
|
|
7427
|
+
/**
|
|
7428
|
+
* A device proof for a push-approval request, signed by this browser's enrolled device key with
|
|
7429
|
+
* the next counter value. `jti` is the challenge from `POST /auth/device/challenge` for
|
|
7430
|
+
* `push_enrol`, and `pushChallengeOf(challengeId, number)` for the others. Send it with the
|
|
7431
|
+
* device id (`getDeviceId()`) in `X-Passflow-DeviceId`.
|
|
7432
|
+
*
|
|
7433
|
+
* @returns undefined with the `deviceKey` option off, in BFF mode, without IndexedDB and
|
|
7434
|
+
* WebCrypto, or when no enrolled key is stored
|
|
7435
|
+
* @throws {Error} when IndexedDB or WebCrypto fails while reading the key or signing
|
|
7436
|
+
*/
|
|
7437
|
+
devicePushProof(use: DevicePushProofUse, jti: string): Promise<string | undefined>;
|
|
7361
7438
|
/**
|
|
7362
7439
|
* Send a password reset email to the user.
|
|
7363
7440
|
*
|
|
@@ -8328,4 +8405,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
8328
8405
|
* @returns true if valid username format, false otherwise
|
|
8329
8406
|
*/
|
|
8330
8407
|
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 };
|
|
8408
|
+
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",
|
|
@@ -2296,17 +2297,35 @@ export type TwoFactorCompletionOptions = {
|
|
|
2296
2297
|
trustDevice?: boolean;
|
|
2297
2298
|
};
|
|
2298
2299
|
/**
|
|
2299
|
-
* A device the user
|
|
2300
|
+
* A device of the user's on this app: one that holds a grant to stand in for
|
|
2301
|
+
* their second factor, a device key, or both.
|
|
2300
2302
|
*/
|
|
2301
2303
|
export type TwoFactorTrustedDevice = {
|
|
2302
2304
|
id: string;
|
|
2303
2305
|
user_agent?: string;
|
|
2306
|
+
/** True while the device holds a grant that stands in for the second factor. */
|
|
2307
|
+
trusted: boolean;
|
|
2304
2308
|
created_at: string;
|
|
2309
|
+
/** When the grant ends; absent on a device without one. */
|
|
2310
|
+
expires_at?: string;
|
|
2305
2311
|
last_used_at?: string;
|
|
2306
|
-
|
|
2312
|
+
/** Set when the device enrolled a device key. */
|
|
2313
|
+
device_key?: TwoFactorTrustedDeviceKey;
|
|
2314
|
+
/** Set when the device can approve sign-ins by push. */
|
|
2315
|
+
push_approval?: TwoFactorTrustedDevicePush;
|
|
2307
2316
|
/** True for the device the request came from. */
|
|
2308
2317
|
current: boolean;
|
|
2309
2318
|
};
|
|
2319
|
+
/** A device's enrolled device key, as `TwoFactorTrustedDevice.device_key`. */
|
|
2320
|
+
export type TwoFactorTrustedDeviceKey = {
|
|
2321
|
+
key_storage: 'software' | 'hardware';
|
|
2322
|
+
enrolled_at: string;
|
|
2323
|
+
last_proof_at?: string;
|
|
2324
|
+
};
|
|
2325
|
+
/** A device's push approval, as `TwoFactorTrustedDevice.push_approval`. */
|
|
2326
|
+
export type TwoFactorTrustedDevicePush = {
|
|
2327
|
+
registered_at: string;
|
|
2328
|
+
};
|
|
2310
2329
|
/** GET /v2/user/2fa/trusted-devices */
|
|
2311
2330
|
export type TwoFactorTrustedDevicesResponse = {
|
|
2312
2331
|
devices: TwoFactorTrustedDevice[];
|
|
@@ -2367,8 +2386,8 @@ export type TwoFactorSetupMagicLinkSession = {
|
|
|
2367
2386
|
userId: string;
|
|
2368
2387
|
appId?: string | null;
|
|
2369
2388
|
scope: '2fa_setup';
|
|
2370
|
-
/** `true` when the link replaces an enrolled authenticator.
|
|
2371
|
-
reset
|
|
2389
|
+
/** `true` when the link replaces an enrolled authenticator. */
|
|
2390
|
+
reset: boolean;
|
|
2372
2391
|
timestamp: number;
|
|
2373
2392
|
expiresAt: number;
|
|
2374
2393
|
};
|
|
@@ -2409,6 +2428,10 @@ export interface TwoFactorChallengeResponse {
|
|
|
2409
2428
|
code_sent_to?: string;
|
|
2410
2429
|
/** Minutes the code stays valid, whole and at least 1. Emailed and texted codes only. */
|
|
2411
2430
|
expires_in_minutes?: number;
|
|
2431
|
+
/** The number the user types on the approving device. Push challenges only. */
|
|
2432
|
+
number_match?: string;
|
|
2433
|
+
/** Seconds the push can still be answered. Push challenges only. */
|
|
2434
|
+
expires_in_seconds?: number;
|
|
2412
2435
|
webauthn_options?: unknown;
|
|
2413
2436
|
/** Digits in the TOTP code. TOTP challenges only. */
|
|
2414
2437
|
totp_digits?: 6 | 8;
|
|
@@ -2426,14 +2449,20 @@ export interface TwoFactorChallengeResponse {
|
|
|
2426
2449
|
account_hint?: string;
|
|
2427
2450
|
}
|
|
2428
2451
|
/**
|
|
2429
|
-
* Verify Request for v2 2FA flow
|
|
2452
|
+
* Verify Request for v2 2FA flow. A push completion (`push_webpush`) carries no `response`: the
|
|
2453
|
+
* approved request is claimed. Every other method sends the code or the WebAuthn response.
|
|
2430
2454
|
*/
|
|
2431
|
-
export
|
|
2455
|
+
export type TwoFactorVerifyRequestV2 = {
|
|
2432
2456
|
challenge_id: string;
|
|
2433
2457
|
method: TwoFactorMethod;
|
|
2434
2458
|
response: string;
|
|
2435
2459
|
trust_device?: boolean;
|
|
2436
|
-
}
|
|
2460
|
+
} | {
|
|
2461
|
+
challenge_id: string;
|
|
2462
|
+
method: 'push_webpush';
|
|
2463
|
+
response?: undefined;
|
|
2464
|
+
trust_device?: boolean;
|
|
2465
|
+
};
|
|
2437
2466
|
/**
|
|
2438
2467
|
* Verify Response from v2 2FA flow
|
|
2439
2468
|
*/
|
|
@@ -2444,6 +2473,17 @@ export interface TwoFactorVerifyResponseV2 extends TwoFactorParentAnswer {
|
|
|
2444
2473
|
/** On a PKCE app; `TwoFactorService` redeems it, so its callers never see one. */
|
|
2445
2474
|
code?: string;
|
|
2446
2475
|
}
|
|
2476
|
+
/**
|
|
2477
|
+
* The state of a sign-in's push approval (`twoFactor.pushStatus`). On `approved`, finish the
|
|
2478
|
+
* sign-in with `verifyV2({ challenge_id, method: 'push_webpush' })`.
|
|
2479
|
+
*/
|
|
2480
|
+
export type TwoFactorPushStatusResponse = {
|
|
2481
|
+
status: 'pending';
|
|
2482
|
+
/** Seconds the push can still be answered; 0 when the server sent none. */
|
|
2483
|
+
expires_in_seconds: number;
|
|
2484
|
+
} | {
|
|
2485
|
+
status: 'approved';
|
|
2486
|
+
};
|
|
2447
2487
|
/**
|
|
2448
2488
|
* Registered Two-Factor Method
|
|
2449
2489
|
*/
|
|
@@ -2638,7 +2678,7 @@ export declare enum PassflowEvent {
|
|
|
2638
2678
|
* The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
|
|
2639
2679
|
* emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
|
|
2640
2680
|
*/
|
|
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';
|
|
2681
|
+
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
2682
|
/**
|
|
2643
2683
|
* Error payload interface for structured error information
|
|
2644
2684
|
*/
|
|
@@ -3576,6 +3616,13 @@ export declare class TwoFactorApiClient {
|
|
|
3576
3616
|
* `tfaToken`, when given, goes as the Bearer token the route is gated on.
|
|
3577
3617
|
*/
|
|
3578
3618
|
switchToAlternative(payload: TwoFactorAlternativeRequest, tfaToken?: string): Promise<TwoFactorChallengeResponse>;
|
|
3619
|
+
/**
|
|
3620
|
+
* The state of the sign-in's push approval
|
|
3621
|
+
* POST /v2/auth/2fa/push/status
|
|
3622
|
+
* `tfaToken`, when given, goes as the Bearer token the route is gated on.
|
|
3623
|
+
* A pending answer without `expires_in_seconds` reads as 0 seconds left.
|
|
3624
|
+
*/
|
|
3625
|
+
pushStatus(challengeId: string, tfaToken?: string): Promise<TwoFactorPushStatusResponse>;
|
|
3579
3626
|
/**
|
|
3580
3627
|
* List the devices the user trusted on this app
|
|
3581
3628
|
* GET /v2/user/2fa/trusted-devices
|
|
@@ -3729,8 +3776,19 @@ export declare const ERROR_MESSAGE_MAX_LENGTH = 200;
|
|
|
3729
3776
|
*
|
|
3730
3777
|
* @module device-key/proof
|
|
3731
3778
|
*/
|
|
3732
|
-
/** What a proof is for: enrolling the key, a first-factor sign-in, or a
|
|
3733
|
-
type DeviceProofUse = 'enrol' | 'sign_in' | 'refresh';
|
|
3779
|
+
/** What a proof is for: enrolling the key, a first-factor sign-in, a refresh, or a push approval step. */
|
|
3780
|
+
type DeviceProofUse = 'enrol' | 'sign_in' | 'refresh' | DevicePushProofUse;
|
|
3781
|
+
/**
|
|
3782
|
+
* The push-approval uses: `push_enrol` registers this browser for push approvals, `push_info` reads
|
|
3783
|
+
* a pending approval, `push_approve` and `push_deny` answer it.
|
|
3784
|
+
*/
|
|
3785
|
+
type DevicePushProofUse = 'push_enrol' | 'push_info' | 'push_approve' | 'push_deny';
|
|
3786
|
+
/**
|
|
3787
|
+
* The `jti` the server expects in a `push_info`, `push_deny` or `push_approve` proof: base64url
|
|
3788
|
+
* (no padding) of SHA-256 of the UTF-8 bytes of `challengeId + "\n" + number`. `number` is empty
|
|
3789
|
+
* for info and deny, and the number the user typed for approve.
|
|
3790
|
+
*/
|
|
3791
|
+
export declare function pushChallengeOf(challengeId: string, number?: string): Promise<string>;
|
|
3734
3792
|
interface DeviceKeyService {
|
|
3735
3793
|
/** IndexedDB and `crypto.subtle` exist. False: proofs are undefined, enrolment rejects, the rest does nothing. */
|
|
3736
3794
|
readonly supported: boolean;
|
|
@@ -5574,6 +5632,12 @@ export declare class TwoFactorService {
|
|
|
5574
5632
|
* Switch to alternative 2FA method during challenge
|
|
5575
5633
|
*/
|
|
5576
5634
|
switchToAlternative(payload: TwoFactorAlternativeRequest): Promise<TwoFactorChallengeResponse>;
|
|
5635
|
+
/**
|
|
5636
|
+
* The state of this sign-in's push approval: `pending` with the seconds left, or `approved`
|
|
5637
|
+
* (then finish with `verifyV2({ challenge_id, method: 'push_webpush' })`). A denied push rejects
|
|
5638
|
+
* with 403 `error.2fa.push.denied`, an expired one with 401 `error.2fa.push.expired`.
|
|
5639
|
+
*/
|
|
5640
|
+
pushStatus(challengeId: string): Promise<TwoFactorPushStatusResponse>;
|
|
5577
5641
|
/**
|
|
5578
5642
|
* List the devices the user trusted to skip the second factor on this app.
|
|
5579
5643
|
* The one this request came from has `current: true`.
|
|
@@ -6544,6 +6608,8 @@ export declare class Passflow {
|
|
|
6544
6608
|
private tokenCacheService;
|
|
6545
6609
|
private twoFactorService;
|
|
6546
6610
|
private antiBot;
|
|
6611
|
+
/** This instance's device key: present with `deviceKey: true` outside BFF mode. */
|
|
6612
|
+
private readonly deviceKeyService;
|
|
6547
6613
|
tenant: TenantService;
|
|
6548
6614
|
twoFactor: TwoFactorService;
|
|
6549
6615
|
/**
|
|
@@ -7358,6 +7424,17 @@ export declare class Passflow {
|
|
|
7358
7424
|
* @throws {Error} with the option off, in BFF mode, or without IndexedDB and WebCrypto
|
|
7359
7425
|
*/
|
|
7360
7426
|
enrolDeviceKey(): Promise<void>;
|
|
7427
|
+
/**
|
|
7428
|
+
* A device proof for a push-approval request, signed by this browser's enrolled device key with
|
|
7429
|
+
* the next counter value. `jti` is the challenge from `POST /auth/device/challenge` for
|
|
7430
|
+
* `push_enrol`, and `pushChallengeOf(challengeId, number)` for the others. Send it with the
|
|
7431
|
+
* device id (`getDeviceId()`) in `X-Passflow-DeviceId`.
|
|
7432
|
+
*
|
|
7433
|
+
* @returns undefined with the `deviceKey` option off, in BFF mode, without IndexedDB and
|
|
7434
|
+
* WebCrypto, or when no enrolled key is stored
|
|
7435
|
+
* @throws {Error} when IndexedDB or WebCrypto fails while reading the key or signing
|
|
7436
|
+
*/
|
|
7437
|
+
devicePushProof(use: DevicePushProofUse, jti: string): Promise<string | undefined>;
|
|
7361
7438
|
/**
|
|
7362
7439
|
* Send a password reset email to the user.
|
|
7363
7440
|
*
|
|
@@ -8328,4 +8405,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
8328
8405
|
* @returns true if valid username format, false otherwise
|
|
8329
8406
|
*/
|
|
8330
8407
|
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 };
|
|
8408
|
+
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 };
|