@passflow/core 0.41.0 → 0.42.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 +32 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +170 -19
- package/dist/index.d.ts +170 -19
- package/dist/index.mjs +1391 -1104
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -290,6 +290,7 @@ declare class StorageManager {
|
|
|
290
290
|
appKey(name: string): string;
|
|
291
291
|
private idTokenKey;
|
|
292
292
|
private csrfTokenKey;
|
|
293
|
+
private refreshChallengeKey;
|
|
293
294
|
private deliveryModeKey;
|
|
294
295
|
/** The stored value, or undefined when it is a JWT issued for another app than this one. */
|
|
295
296
|
private ownToken;
|
|
@@ -407,6 +408,13 @@ declare class StorageManager {
|
|
|
407
408
|
* Clear the CSRF token from storage
|
|
408
409
|
*/
|
|
409
410
|
clearCsrfToken(): void;
|
|
411
|
+
/**
|
|
412
|
+
* The `refresh_challenge` of the last token answer: what a cookie-mode refresh signs its device
|
|
413
|
+
* proof over, since the refresh token itself is out of reach in an HttpOnly cookie.
|
|
414
|
+
*/
|
|
415
|
+
getRefreshChallenge(): string | undefined;
|
|
416
|
+
setRefreshChallenge(challenge: string): void;
|
|
417
|
+
clearRefreshChallenge(): void;
|
|
410
418
|
/**
|
|
411
419
|
* Every storage key the token session lives in (JSON tokens, scopes, the cookie-mode ID token,
|
|
412
420
|
* CSRF token and delivery mode). The refresh coordinator filters `storage` events by it, so
|
|
@@ -1135,7 +1143,9 @@ export declare enum PassflowEndpointPaths {
|
|
|
1135
1143
|
antiBotChallenge = "/auth/anti-bot/challenge",
|
|
1136
1144
|
deviceAntiBotChallenge = "/oidc/device/anti-bot/challenge",
|
|
1137
1145
|
enterpriseResolve = "/auth/enterprise/resolve",
|
|
1138
|
-
enterpriseStart = "/auth/enterprise/start"
|
|
1146
|
+
enterpriseStart = "/auth/enterprise/start",
|
|
1147
|
+
deviceChallenge = "/auth/device/challenge",
|
|
1148
|
+
userDeviceKey = "/user/device/key"
|
|
1139
1149
|
}
|
|
1140
1150
|
export declare enum PassflowAdminEndpointPaths {
|
|
1141
1151
|
passkeyRegisterStart = "/admin/auth/passkey/register/start",
|
|
@@ -1237,6 +1247,13 @@ export type PassflowConfig = {
|
|
|
1237
1247
|
* built-in check. Without it the proof of work runs on the main thread.
|
|
1238
1248
|
*/
|
|
1239
1249
|
antiBotWorkerUrl?: string;
|
|
1250
|
+
/**
|
|
1251
|
+
* Device-key proofs at sign-in and refresh. The browser keeps a non-extractable ES256 key in
|
|
1252
|
+
* IndexedDB, enrols it after a second factor, and signs `X-Passflow-Device-Proof` with it;
|
|
1253
|
+
* `/auth/refresh` is sent with credentials. Default false. Ignored in BFF mode (`tokenExchange`).
|
|
1254
|
+
* Needs Passflow server v0.137.0 or later. See `docs/device-key.md`.
|
|
1255
|
+
*/
|
|
1256
|
+
deviceKey?: boolean;
|
|
1240
1257
|
};
|
|
1241
1258
|
export type PassflowUpgradeConfig = {
|
|
1242
1259
|
/** Relying-party id forwarded verbatim to `POST /auth/upgrade/start` for passkey upgrades. */
|
|
@@ -1313,6 +1330,8 @@ export type PassflowAuthorizationResponse = Tokens & {
|
|
|
1313
1330
|
email_verification_required?: boolean;
|
|
1314
1331
|
/** Human-readable text from the server, e.g. "We sent a code to a***@example.com." */
|
|
1315
1332
|
message?: string;
|
|
1333
|
+
/** Base64url (no padding) SHA-256 of the refresh token issued with this answer. */
|
|
1334
|
+
refresh_challenge?: string;
|
|
1316
1335
|
};
|
|
1317
1336
|
/**
|
|
1318
1337
|
* A sign-up, sign-in or password change that waits for the email to be proven.
|
|
@@ -1739,6 +1758,12 @@ export type AntiBotSettings = {
|
|
|
1739
1758
|
* `POST /auth/anti-bot/challenge` and `POST /oidc/device/anti-bot/challenge`. The answer is the
|
|
1740
1759
|
* integer `number` in `[0, max]` with `hex(SHA-256(salt + ":" + number)) === challenge`.
|
|
1741
1760
|
*/
|
|
1761
|
+
/** `POST /auth/device/challenge`: a one-use challenge for an enrol or sign-in device proof. */
|
|
1762
|
+
export type DeviceChallengeResponse = {
|
|
1763
|
+
challenge: string;
|
|
1764
|
+
/** Seconds the challenge stays valid. */
|
|
1765
|
+
expires_in: number;
|
|
1766
|
+
};
|
|
1742
1767
|
export type AntiBotChallenge = {
|
|
1743
1768
|
algorithm: 'SHA-256';
|
|
1744
1769
|
app: string;
|
|
@@ -2613,7 +2638,7 @@ export declare enum PassflowEvent {
|
|
|
2613
2638
|
* The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
|
|
2614
2639
|
* emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
|
|
2615
2640
|
*/
|
|
2616
|
-
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' | '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';
|
|
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';
|
|
2617
2642
|
/**
|
|
2618
2643
|
* Error payload interface for structured error information
|
|
2619
2644
|
*/
|
|
@@ -2979,6 +3004,10 @@ export declare class AppAPI {
|
|
|
2979
3004
|
setAppId(appId: string): void;
|
|
2980
3005
|
getAppSettings(): Promise<AppSettings>;
|
|
2981
3006
|
}
|
|
3007
|
+
/** What a refresh sends for device keys: credentials always, and the proof header when there is a proof. */
|
|
3008
|
+
export type RefreshDeviceArg = {
|
|
3009
|
+
proof?: string;
|
|
3010
|
+
};
|
|
2982
3011
|
export declare class AuthAPI {
|
|
2983
3012
|
protected axiosClient: AxiosClient;
|
|
2984
3013
|
constructor(config: PassflowConfig, storageManager?: StorageManager, deviceService?: DeviceService);
|
|
@@ -2992,6 +3021,11 @@ export declare class AuthAPI {
|
|
|
2992
3021
|
antiBotChallenge(payload: {
|
|
2993
3022
|
identifier?: string;
|
|
2994
3023
|
}): Promise<AntiBotChallenge>;
|
|
3024
|
+
/**
|
|
3025
|
+
* A one-use challenge for an enrol or sign-in device proof, for this app. Rejects only with a
|
|
3026
|
+
* `PassflowError`.
|
|
3027
|
+
*/
|
|
3028
|
+
deviceChallenge(): Promise<DeviceChallengeResponse>;
|
|
2995
3029
|
/**
|
|
2996
3030
|
* A built-in anti-bot challenge for the device verification page, for the app of `user_code`.
|
|
2997
3031
|
* Same-origin only, with the page's CSRF token. Rejects only with a `PassflowError`.
|
|
@@ -3028,9 +3062,14 @@ export declare class AuthAPI {
|
|
|
3028
3062
|
* vocabulary, which is indistinguishable from an expired session on the
|
|
3029
3063
|
* response alone; the marker is what tells the response interceptor not to
|
|
3030
3064
|
* invalidate the session over a mistyped digit.
|
|
3065
|
+
*
|
|
3066
|
+
* `device` is passed with `PassflowConfig.deviceKey` only: the request then goes with
|
|
3067
|
+
* credentials (so a browser that registered a DBSC session sends its cookie), and with the
|
|
3068
|
+
* device-proof header when `device.proof` is set.
|
|
3031
3069
|
*/
|
|
3032
|
-
refreshToken(refreshToken: string, scopes: string[], accessToken?: string, upgrade?: UpgradeRefreshField): Promise<PassflowAuthorizationResponse>;
|
|
3033
|
-
|
|
3070
|
+
refreshToken(refreshToken: string, scopes: string[], accessToken?: string, upgrade?: UpgradeRefreshField, device?: RefreshDeviceArg): Promise<PassflowAuthorizationResponse>;
|
|
3071
|
+
/** `deviceProof`: a `use: "sign_in"` device proof, sent as `X-Passflow-Device-Proof`. */
|
|
3072
|
+
signIn(payload: PassflowSignInPayload, deviceId: string, os: OS, options?: PassflowAuthOptions, deviceProof?: string): Promise<PassflowAuthorizationResponse>;
|
|
3034
3073
|
signUp(payload: PassflowSignUpPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
3035
3074
|
/**
|
|
3036
3075
|
* Redeems the code a PKCE sign-in answered with for the tokens it stands for.
|
|
@@ -3075,7 +3114,8 @@ export declare class AuthAPI {
|
|
|
3075
3114
|
passkeyRegisterStart(payload: PassflowPasskeyRegisterStartPayload, deviceId: string, os: OS, isAdmin?: boolean, options?: PassflowAuthOptions): Promise<PassflowPasskeyStart>;
|
|
3076
3115
|
passkeyRegisterComplete(passkeyData: RegistrationResponseJSON, deviceId: string, challengeId: string, isAdmin?: boolean, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
3077
3116
|
passkeyAuthenticateStart(payload: PassflowPasskeyAuthenticateStartPayload, deviceId: string, os: OS, isAdmin?: boolean, options?: PassflowAuthOptions): Promise<PassflowPasskeyStart>;
|
|
3078
|
-
|
|
3117
|
+
/** `deviceProof`: a `use: "sign_in"` device proof, sent as `X-Passflow-Device-Proof`. */
|
|
3118
|
+
passkeyAuthenticateComplete(passkeyData: AuthenticationResponseJSON, deviceId: string, challengeId: string, isAdmin?: boolean, options?: PassflowAuthOptions, deviceProof?: string): Promise<PassflowAuthorizationResponse>;
|
|
3079
3119
|
passkeyValidate(otp: string, deviceId: string, challengeId: string, isAdmin?: boolean, appId?: string): Promise<PassflowValidationResponse>;
|
|
3080
3120
|
}
|
|
3081
3121
|
export declare class CLIAuthAPI {
|
|
@@ -3607,6 +3647,14 @@ export declare class UserAPI {
|
|
|
3607
3647
|
protected axiosClient: AxiosClient;
|
|
3608
3648
|
constructor(config: PassflowConfig, storageManager?: StorageManager, deviceService?: DeviceService);
|
|
3609
3649
|
setAppId(appId: string): void;
|
|
3650
|
+
/**
|
|
3651
|
+
* Enrols this browser's device key for the signed-in session: `proof` is a `use: "enrol"` device
|
|
3652
|
+
* proof. Answers 200 (the current key) or 201 (a new key replaced the device's old one).
|
|
3653
|
+
*/
|
|
3654
|
+
enrolDeviceKey(body: {
|
|
3655
|
+
proof: string;
|
|
3656
|
+
key_storage: 'software';
|
|
3657
|
+
}): Promise<unknown>;
|
|
3610
3658
|
getUserPasskeys(): Promise<PassflowUserPasskey[]>;
|
|
3611
3659
|
renameUserPasskey(name: string, passkeyId: string): Promise<PassflowSuccessResponse>;
|
|
3612
3660
|
deleteUserPasskey(passkeyId: string): Promise<PassflowSuccessResponse>;
|
|
@@ -3640,6 +3688,8 @@ export declare const DEVICE_TYPE_HEADER_KEY = "X-Passflow-DeviceType";
|
|
|
3640
3688
|
export declare const ANTI_BOT_HEADER_KEY = "X-Passflow-Anti-Bot";
|
|
3641
3689
|
/** Set to `1` on requests an agent tool sends (`PassflowAuthOptions.agentTool`). */
|
|
3642
3690
|
export declare const AGENT_TOOL_HEADER_KEY = "X-Passflow-Agent-Tool";
|
|
3691
|
+
/** A device-key proof (compact JWS) on sign-in and refresh requests, with `PassflowConfig.deviceKey`. */
|
|
3692
|
+
export declare const DEVICE_PROOF_HEADER_KEY = "X-Passflow-Device-Proof";
|
|
3643
3693
|
/** The `action` a token provider receives; a reCAPTCHA score key must be executed with it. */
|
|
3644
3694
|
export declare const ANTI_BOT_ACTION = "passflow_auth";
|
|
3645
3695
|
/**
|
|
@@ -3670,6 +3720,44 @@ export declare const TOKEN_EXPIRY_BUFFER_SECONDS = 30;
|
|
|
3670
3720
|
export declare const USERNAME_MIN_LENGTH = 3;
|
|
3671
3721
|
export declare const USERNAME_MAX_LENGTH = 30;
|
|
3672
3722
|
export declare const ERROR_MESSAGE_MAX_LENGTH = 200;
|
|
3723
|
+
/**
|
|
3724
|
+
* Device-key proofs: a compact JWS signed with ES256 by the browser's device key.
|
|
3725
|
+
*
|
|
3726
|
+
* Header `{"alg":"ES256","typ":"pf-device-proof+jwt","jwk":{kty,crv,x,y}}`, payload
|
|
3727
|
+
* `{"jti","ctr","did","use","iat"}`. WebCrypto's ECDSA signature is already the raw 64-byte
|
|
3728
|
+
* `r||s` form JWS uses. Pure functions: no storage, no network.
|
|
3729
|
+
*
|
|
3730
|
+
* @module device-key/proof
|
|
3731
|
+
*/
|
|
3732
|
+
/** What a proof is for: enrolling the key, a first-factor sign-in, or a refresh. */
|
|
3733
|
+
type DeviceProofUse = 'enrol' | 'sign_in' | 'refresh';
|
|
3734
|
+
interface DeviceKeyService {
|
|
3735
|
+
/** IndexedDB and `crypto.subtle` exist. False: proofs are undefined, enrolment rejects, the rest does nothing. */
|
|
3736
|
+
readonly supported: boolean;
|
|
3737
|
+
/** Whether a key is stored and enrolled. */
|
|
3738
|
+
isEnrolled(): Promise<boolean>;
|
|
3739
|
+
/**
|
|
3740
|
+
* A proof by the enrolled key over `jti`, with the next counter value, or undefined when no key
|
|
3741
|
+
* is stored or it is not enrolled. Each call takes a new counter value, so a retry signs anew.
|
|
3742
|
+
*/
|
|
3743
|
+
proof(use: Exclude<DeviceProofUse, 'enrol'>, jti: string): Promise<string | undefined>;
|
|
3744
|
+
/** Creates the key when there is none, then a `use: "enrol"` proof over `jti`. */
|
|
3745
|
+
enrolProof(jti: string): Promise<string>;
|
|
3746
|
+
markEnrolled(): Promise<void>;
|
|
3747
|
+
clear(): Promise<void>;
|
|
3748
|
+
}
|
|
3749
|
+
/** Error ids an app sees around device keys. */
|
|
3750
|
+
export declare const DeviceKeyErrorId: {
|
|
3751
|
+
/** The key was used with a counter that did not rise, or it was retired: the device was reset, sign in again. */
|
|
3752
|
+
readonly keyReused: 'error.device.key.reused';
|
|
3753
|
+
/** A key-bound session refreshed without a valid proof. */
|
|
3754
|
+
readonly proofRequired: 'error.device.proof.required';
|
|
3755
|
+
/** Enrolment needs a second factor in the last 10 minutes. */
|
|
3756
|
+
readonly stepUpRequired: 'error.device.key.step_up_required';
|
|
3757
|
+
/** The SDK could not read the key or sign with it for a refresh; the key is deleted, sign in again. */
|
|
3758
|
+
readonly proofUnavailable: 'error.device.proof.unavailable';
|
|
3759
|
+
};
|
|
3760
|
+
export type DeviceKeyErrorId = (typeof DeviceKeyErrorId)[keyof typeof DeviceKeyErrorId];
|
|
3673
3761
|
/**
|
|
3674
3762
|
* One `fetch` patch point, many middlewares.
|
|
3675
3763
|
*
|
|
@@ -4458,6 +4546,11 @@ export declare class TokenCacheService {
|
|
|
4458
4546
|
getParsedTokens(): ParsedTokens | undefined;
|
|
4459
4547
|
isExpired(): boolean;
|
|
4460
4548
|
}
|
|
4549
|
+
/** The body of `POST /user/device/key`. */
|
|
4550
|
+
export type DeviceKeyEnrolBody = {
|
|
4551
|
+
proof: string;
|
|
4552
|
+
key_storage: 'software';
|
|
4553
|
+
};
|
|
4461
4554
|
/** Options of `authRedirect()`. `url` and `appId` may only repeat the instance's own values. */
|
|
4462
4555
|
export type AuthRedirectOptions = {
|
|
4463
4556
|
url?: string;
|
|
@@ -4474,18 +4567,20 @@ export type LogOutOptions = {
|
|
|
4474
4567
|
* ended. It must match one of the app's registered redirect URLs; an unmatched one leaves the
|
|
4475
4568
|
* user on the Passflow server's start page. Default: the address the hosted sign-in landed on.
|
|
4476
4569
|
*
|
|
4477
|
-
*
|
|
4478
|
-
*
|
|
4479
|
-
*
|
|
4480
|
-
*
|
|
4481
|
-
*
|
|
4570
|
+
* It is also sent as `post_logout_redirect_uri` in the logout request. After a hosted sign-in
|
|
4571
|
+
* the request carries the address by default too, the same one the `/oidc/end_session` visit
|
|
4572
|
+
* uses. For a session from a SAML connection the server then returns the browser there after
|
|
4573
|
+
* the identity provider's single logout, instead of its own signed-out page. The server
|
|
4574
|
+
* ignores an address that is not a registered redirect URL. Needs Passflow server v0.137.1 or
|
|
4575
|
+
* later; older servers ignore it.
|
|
4482
4576
|
*/
|
|
4483
4577
|
postLogoutRedirectUri?: string;
|
|
4484
4578
|
/**
|
|
4485
4579
|
* When the logout answer carries `saml_logout_url` (a session from a SAML connection with
|
|
4486
4580
|
* SP-initiated logout), send the browser there after the local sign-out, so the identity
|
|
4487
|
-
* provider ends its session too. Default false: the URL is only returned.
|
|
4488
|
-
* `/oidc/end_session
|
|
4581
|
+
* provider ends its session too. Default false: the URL is only returned. After a hosted
|
|
4582
|
+
* sign-in the page goes there instead of `/oidc/end_session`: the session already ended at the
|
|
4583
|
+
* logout request, so `/oidc/end_session` could no longer reach the identity provider.
|
|
4489
4584
|
*/
|
|
4490
4585
|
followSamlLogout?: boolean;
|
|
4491
4586
|
};
|
|
@@ -4502,6 +4597,10 @@ export type AuthServiceRefreshOptions = {
|
|
|
4502
4597
|
coordination: ResolvedCoordination;
|
|
4503
4598
|
/** `PassflowConfig.refreshStrikes`; the controller resolves the default. */
|
|
4504
4599
|
strikes?: number;
|
|
4600
|
+
/** Set with `PassflowConfig.deviceKey` only (never in BFF mode): proofs at sign-in and refresh. */
|
|
4601
|
+
deviceKey?: DeviceKeyService;
|
|
4602
|
+
/** `POST /user/device/key`; needed with `deviceKey`. */
|
|
4603
|
+
enrolDeviceKeyRequest?: (body: DeviceKeyEnrolBody) => Promise<unknown>;
|
|
4505
4604
|
};
|
|
4506
4605
|
/**
|
|
4507
4606
|
* Service for handling authentication related functionality
|
|
@@ -4537,6 +4636,9 @@ export declare class AuthService {
|
|
|
4537
4636
|
* `Passflow` attaches it, `TokenCacheService.getTokensWithRefresh()`.
|
|
4538
4637
|
*/
|
|
4539
4638
|
readonly refresh: RefreshController;
|
|
4639
|
+
/** The device key, with `PassflowConfig.deviceKey` only. Undefined: no device-key code runs. */
|
|
4640
|
+
private readonly deviceKey?;
|
|
4641
|
+
private readonly enrolDeviceKeyRequest?;
|
|
4540
4642
|
constructor(authApi: AuthAPI, deviceService: DeviceService, storageManager: StorageManager, subscribeStore: PassflowStore, tokenCacheService: TokenCacheService, scopes: string[], createTenantForNewUser: boolean, url: string, sessionCallbacks: {
|
|
4541
4643
|
createSession?: ({ tokens, parsedTokens }: {
|
|
4542
4644
|
tokens?: Tokens;
|
|
@@ -4713,7 +4815,8 @@ export declare class AuthService {
|
|
|
4713
4815
|
*
|
|
4714
4816
|
* Emits no `SignOut`: `Passflow.logOut()` emits exactly one, after this resolves.
|
|
4715
4817
|
*
|
|
4716
|
-
* @param postLogoutRedirectUri - sent as `post_logout_redirect_uri` in the logout request
|
|
4818
|
+
* @param postLogoutRedirectUri - sent as `post_logout_redirect_uri` in the logout request. After a
|
|
4819
|
+
* hosted sign-in the address the hosted sign-in landed on is sent when this is not set
|
|
4717
4820
|
* @returns the `sub` of the session that ended, when known, and the SAML identity provider's
|
|
4718
4821
|
* logout address when the logout answer carried one
|
|
4719
4822
|
*/
|
|
@@ -4794,6 +4897,38 @@ export declare class AuthService {
|
|
|
4794
4897
|
* the body's `error.id` or `error.http.<status>`), so it is classified like any other answer.
|
|
4795
4898
|
*/
|
|
4796
4899
|
private createRefreshTransport;
|
|
4900
|
+
/**
|
|
4901
|
+
* A JSON or cookie refresh with `PassflowConfig.deviceKey`: sent with credentials, and with a
|
|
4902
|
+
* proof by the enrolled key over the refresh challenge of the token presented. JSON mode works the
|
|
4903
|
+
* challenge out from the refresh token it sends; cookie mode uses the stored `refresh_challenge`
|
|
4904
|
+
* of the last answer. Each call (each retry, the upgrade commit) signs a new counter value.
|
|
4905
|
+
*
|
|
4906
|
+
* A device error from the server, or a key that cannot be read or sign, deletes the key; the
|
|
4907
|
+
* rejection carries an `error.device.*` id, which ends the session (`classify` row 0).
|
|
4908
|
+
*/
|
|
4909
|
+
private sendDeviceKeyRefresh;
|
|
4910
|
+
/**
|
|
4911
|
+
* A `use: "sign_in"` proof over a new challenge, when the device key is enrolled; undefined
|
|
4912
|
+
* otherwise. A failed challenge request or signature also answers undefined: the sign-in goes on
|
|
4913
|
+
* without a proof and the key stays.
|
|
4914
|
+
*/
|
|
4915
|
+
private signInProof;
|
|
4916
|
+
/**
|
|
4917
|
+
* Creates this browser's device key when there is none and enrols it for the signed-in session:
|
|
4918
|
+
* a challenge, a `use: "enrol"` proof, `POST /user/device/key`. The server needs a second factor
|
|
4919
|
+
* in the last 10 minutes (else 403 `error.device.key.step_up_required`).
|
|
4920
|
+
*
|
|
4921
|
+
* Any failure emits one `Error` (operation `device-key.enrol`) and rejects. On
|
|
4922
|
+
* `error.device.key.reused` the server has reset the device and ended the session: the key is
|
|
4923
|
+
* deleted and this tab signs out (`SignOut`) first.
|
|
4924
|
+
*/
|
|
4925
|
+
enrolDeviceKey(): Promise<void>;
|
|
4926
|
+
/**
|
|
4927
|
+
* Called by `TwoFactorService` once a sign-in's second factor has completed and its tokens are
|
|
4928
|
+
* applied: enrols the device key, which also binds the new session to it. A failure is already
|
|
4929
|
+
* reported as an `Error` event and does not change the sign-in's result.
|
|
4930
|
+
*/
|
|
4931
|
+
secondFactorCompleted(): Promise<void>;
|
|
4797
4932
|
/** The BFF refresh endpoint. A non-OK answer becomes a `PassflowError`; a network failure rejects as is. */
|
|
4798
4933
|
private sendBffRefresh;
|
|
4799
4934
|
/**
|
|
@@ -5228,6 +5363,8 @@ export interface SignInCompleter {
|
|
|
5228
5363
|
forgetPkceSignIn(): void;
|
|
5229
5364
|
/** Reports a finished sign-in: emits `SignIn` with these tokens, then runs the session check. */
|
|
5230
5365
|
notifySignedIn(tokens: Tokens): Promise<void>;
|
|
5366
|
+
/** Runs once the second factor's tokens are applied (device-key enrolment). Must not reject. */
|
|
5367
|
+
secondFactorCompleted?(): Promise<void>;
|
|
5231
5368
|
}
|
|
5232
5369
|
/**
|
|
5233
5370
|
* Service for managing Two-Factor Authentication
|
|
@@ -7005,13 +7142,16 @@ export declare class Passflow {
|
|
|
7005
7142
|
* A session from a SAML connection with SP-initiated logout also has a session at the identity
|
|
7006
7143
|
* provider. The server then answers with its logout address, returned as `samlLogoutUrl` after
|
|
7007
7144
|
* the local session is cleared. With `followSamlLogout: true` the page goes there after the one
|
|
7008
|
-
* `SignOut
|
|
7009
|
-
*
|
|
7145
|
+
* `SignOut`, instead of `/oidc/end_session`: the session already ended at the logout request,
|
|
7146
|
+
* so the `/oidc/end_session` visit could no longer send the identity provider a LogoutRequest.
|
|
7147
|
+
* Without the option, or without a `samlLogoutUrl`, a hosted sign-in still goes to
|
|
7148
|
+
* `/oidc/end_session`.
|
|
7010
7149
|
*
|
|
7011
7150
|
* @param options.postLogoutRedirectUri - where to return after a hosted sign-out; must match one
|
|
7012
|
-
* of the app's registered redirect URLs.
|
|
7013
|
-
*
|
|
7014
|
-
*
|
|
7151
|
+
* of the app's registered redirect URLs. It is also sent in the logout request, and after a SAML
|
|
7152
|
+
* single logout the server returns the browser there (Passflow server v0.137.1 or later; older
|
|
7153
|
+
* servers ignore it). After a hosted sign-in the logout request carries the same return address
|
|
7154
|
+
* the `/oidc/end_session` visit uses: this one, else the address the hosted sign-in landed on
|
|
7015
7155
|
* @param options.followSamlLogout - navigate to the SAML identity provider's logout address when
|
|
7016
7156
|
* the server returns one
|
|
7017
7157
|
* @returns `{ samlLogoutUrl }` when the server returned the identity provider's logout address,
|
|
@@ -7207,6 +7347,17 @@ export declare class Passflow {
|
|
|
7207
7347
|
* ```
|
|
7208
7348
|
*/
|
|
7209
7349
|
refreshToken(): Promise<PassflowAuthorizationResponse>;
|
|
7350
|
+
/**
|
|
7351
|
+
* Creates (if needed) and enrols this browser's device key for the signed-in session, which binds
|
|
7352
|
+
* the session to the key. Needs `deviceKey: true` in the config and a second factor in the last
|
|
7353
|
+
* 10 minutes. A sign-in that completes a second factor already enrols automatically.
|
|
7354
|
+
*
|
|
7355
|
+
* @throws {PassflowError} `error.device.key.step_up_required` (403) without a recent second
|
|
7356
|
+
* factor; `error.device.key.reused` (401) when the server reset the device: the key is deleted
|
|
7357
|
+
* and this tab is signed out. Every failure also emits an `Error` with operation `device-key.enrol`.
|
|
7358
|
+
* @throws {Error} with the option off, in BFF mode, or without IndexedDB and WebCrypto
|
|
7359
|
+
*/
|
|
7360
|
+
enrolDeviceKey(): Promise<void>;
|
|
7210
7361
|
/**
|
|
7211
7362
|
* Send a password reset email to the user.
|
|
7212
7363
|
*
|
|
@@ -8177,4 +8328,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
8177
8328
|
* @returns true if valid username format, false otherwise
|
|
8178
8329
|
*/
|
|
8179
8330
|
export declare function isValidUsername(username: string): boolean;
|
|
8180
|
-
export type { AntiBotAppSettings, AntiBotDeviceContext, AntiBotOperation, AntiBotTokenContext, AntiBotTokenProvider, AntiBotTokenRequest, AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, 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 };
|
|
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 };
|