@passflow/core 0.28.0 → 0.30.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/README.md +111 -6
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +192 -43
- package/dist/index.d.ts +192 -43
- package/dist/index.mjs +1167 -931
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1059,7 +1059,9 @@ export declare enum PassflowEndpointPaths {
|
|
|
1059
1059
|
TwoFactorTrustedDeviceRevoke = "/v2/user/2fa/trusted-devices/:id",
|
|
1060
1060
|
cliAuthStatus = "/cli/auth/status/:sessionId",
|
|
1061
1061
|
cliAuthComplete = "/cli/auth/complete",
|
|
1062
|
-
upgradeStart = "/auth/upgrade/start"
|
|
1062
|
+
upgradeStart = "/auth/upgrade/start",
|
|
1063
|
+
hostedUpgradeStart = "/auth/session/upgrade/start",
|
|
1064
|
+
hostedUpgrade = "/auth/session/upgrade"
|
|
1063
1065
|
}
|
|
1064
1066
|
export declare enum PassflowAdminEndpointPaths {
|
|
1065
1067
|
passkeyRegisterStart = "/admin/auth/passkey/register/start",
|
|
@@ -1205,6 +1207,7 @@ export type UpgradeStartWire = {
|
|
|
1205
1207
|
};
|
|
1206
1208
|
/**
|
|
1207
1209
|
* The `upgrade` field of `POST /auth/refresh` — the commit round.
|
|
1210
|
+
* Also the whole body of `POST /auth/session/upgrade`.
|
|
1208
1211
|
*
|
|
1209
1212
|
* The server types `assertion` as `json.RawMessage`, so a new factor can extend
|
|
1210
1213
|
* the payload without a wire-format change.
|
|
@@ -1404,6 +1407,17 @@ export type PassflowPasswordlessStatusResponse = {
|
|
|
1404
1407
|
} | {
|
|
1405
1408
|
status: 'approved';
|
|
1406
1409
|
code: string;
|
|
1410
|
+
} |
|
|
1411
|
+
/**
|
|
1412
|
+
* A sign-in under an OIDC parent ends where every parent sign-in ends: with the relying party's
|
|
1413
|
+
* `redirect_url`, or with a `tfa_token` when a second factor is owed.
|
|
1414
|
+
*/
|
|
1415
|
+
{
|
|
1416
|
+
status?: undefined;
|
|
1417
|
+
redirect_url?: string;
|
|
1418
|
+
tfa_token?: string;
|
|
1419
|
+
requires_2fa?: boolean;
|
|
1420
|
+
challenge_id?: string;
|
|
1407
1421
|
};
|
|
1408
1422
|
export type PassflowPasswordlessApprovalInfoPayload = {
|
|
1409
1423
|
challenge_id: string;
|
|
@@ -1417,6 +1431,10 @@ export type PassflowPasswordlessApprovalDecidePayload = {
|
|
|
1417
1431
|
export type PassflowPasswordlessApprovalDecideResponse = {
|
|
1418
1432
|
state: 'approved' | 'denied';
|
|
1419
1433
|
};
|
|
1434
|
+
/**
|
|
1435
|
+
* How a passwordless wait ended. Under an OIDC parent, `signed-in` carries only `redirect_url`
|
|
1436
|
+
* (the relying party's address with its code) in `tokens`, and no tokens.
|
|
1437
|
+
*/
|
|
1420
1438
|
export type PasswordlessWaitResult = {
|
|
1421
1439
|
status: 'signed-in';
|
|
1422
1440
|
tokens: PassflowAuthorizationResponse;
|
|
@@ -1435,6 +1453,8 @@ export type PasswordlessApprovalInfo = {
|
|
|
1435
1453
|
country: string;
|
|
1436
1454
|
} | null;
|
|
1437
1455
|
attempts_left: number;
|
|
1456
|
+
/** `true` when approving takes one click and no number is typed. */
|
|
1457
|
+
one_click?: boolean;
|
|
1438
1458
|
};
|
|
1439
1459
|
export declare enum Providers {
|
|
1440
1460
|
google = "google",
|
|
@@ -1478,7 +1498,16 @@ export type AppSettings = {
|
|
|
1478
1498
|
custom_email_templates: boolean;
|
|
1479
1499
|
auth_strategies: AuthStrategies[];
|
|
1480
1500
|
force_passwordless_login: boolean;
|
|
1501
|
+
/**
|
|
1502
|
+
* `true`: hosted sign-in returns an authorization code (SDK mode), which `authRedirect()` redeems.
|
|
1503
|
+
* `false`: hosted sign-in returns tokens in the URL (Simple mode).
|
|
1504
|
+
*/
|
|
1481
1505
|
pkce_enabled: boolean;
|
|
1506
|
+
/**
|
|
1507
|
+
* `true` when the app is a public client (no secret), so a browser can redeem its code. Absent
|
|
1508
|
+
* on servers that do not report it.
|
|
1509
|
+
*/
|
|
1510
|
+
public_client?: boolean;
|
|
1482
1511
|
custom_sms_messages: boolean;
|
|
1483
1512
|
registration_allowed: boolean;
|
|
1484
1513
|
invite_only_registration: boolean;
|
|
@@ -1610,6 +1639,10 @@ export type PassflowFederatedAuthPayload = {
|
|
|
1610
1639
|
create_tenant?: boolean;
|
|
1611
1640
|
code_challenge?: string;
|
|
1612
1641
|
code_challenge_method?: 'S256';
|
|
1642
|
+
/** Echoed back on a Simple-mode landing, so the app can match the return to its start. */
|
|
1643
|
+
state?: string;
|
|
1644
|
+
/** The hosted login's OIDC parent sign-in, when the federated sign-in runs under one. */
|
|
1645
|
+
parent_challenge_id?: string;
|
|
1613
1646
|
};
|
|
1614
1647
|
export type PassflowFederatedAuthExtendedPayload = PassflowFederatedAuthPayload & {
|
|
1615
1648
|
device?: string;
|
|
@@ -2679,6 +2712,17 @@ export declare class UpgradeAPI {
|
|
|
2679
2712
|
* behind the user's back.
|
|
2680
2713
|
*/
|
|
2681
2714
|
startUpgrade(payload: UpgradeStartPayload): Promise<UpgradeStartWire>;
|
|
2715
|
+
/**
|
|
2716
|
+
* Issues an upgrade challenge for the hosted sign-in session. Authenticated by the session
|
|
2717
|
+
* cookie alone: no bearer is sent and no stored token is refreshed first (see `AxiosClient`).
|
|
2718
|
+
* Same answer shape as `startUpgrade`.
|
|
2719
|
+
*/
|
|
2720
|
+
startHostedUpgrade(payload: UpgradeStartPayload): Promise<UpgradeStartWire>;
|
|
2721
|
+
/**
|
|
2722
|
+
* Proves the factor for the hosted sign-in session. The body is the proof itself, not wrapped.
|
|
2723
|
+
* The server answers 204 and issues nothing, so nothing is stored.
|
|
2724
|
+
*/
|
|
2725
|
+
commitHostedUpgrade(upgrade: UpgradeRefreshField): Promise<void>;
|
|
2682
2726
|
}
|
|
2683
2727
|
export declare class UserAPI {
|
|
2684
2728
|
protected axiosClient: AxiosClient;
|
|
@@ -3304,6 +3348,41 @@ export declare class M2MTokenParseError extends M2MError {
|
|
|
3304
3348
|
export declare class M2MConfigError extends M2MError {
|
|
3305
3349
|
constructor(message: string);
|
|
3306
3350
|
}
|
|
3351
|
+
/**
|
|
3352
|
+
* Codes of the errors the hosted sign-in in SDK mode (authorization code + PKCE) reports, both as
|
|
3353
|
+
* `PassflowOidcError.code` on a rejected `authRedirect()` and as `ErrorPayload.code` on the
|
|
3354
|
+
* `Error` event. A landing whose token endpoint answered with an OAuth error other than
|
|
3355
|
+
* `invalid_client` or `invalid_grant` reports `TOKEN_EXCHANGE_FAILED`; an `?error=` landing reports
|
|
3356
|
+
* the OAuth error code the server sent.
|
|
3357
|
+
*/
|
|
3358
|
+
type OidcErrorCode =
|
|
3359
|
+
/** `authRedirect()` got a `url` or `appId` that differs from the instance's. */
|
|
3360
|
+
'OVERRIDE_NOT_SUPPORTED' |
|
|
3361
|
+
/** The page is not a secure context, so the Web Crypto API that PKCE needs is missing. */
|
|
3362
|
+
'SECURE_CONTEXT_REQUIRED' |
|
|
3363
|
+
/** sessionStorage cannot be written, so the proof key cannot survive the redirect. */
|
|
3364
|
+
'STORAGE_UNAVAILABLE' |
|
|
3365
|
+
/** The app is a confidential client (it has a secret), so a browser cannot redeem its code. */
|
|
3366
|
+
'CONFIDENTIAL_CLIENT' |
|
|
3367
|
+
/** The landing's `state` is not the one this tab sent. */
|
|
3368
|
+
'STATE_MISMATCH' |
|
|
3369
|
+
/** This tab's stored proof key is unreadable or expired. */
|
|
3370
|
+
'VERIFIER_MISSING' |
|
|
3371
|
+
/** The ID token is missing although `openid` was asked, or its `nonce` is not the one sent. */
|
|
3372
|
+
'ID_TOKEN_INVALID' |
|
|
3373
|
+
/** The token endpoint could not be reached or answered with an unexpected error. */
|
|
3374
|
+
'TOKEN_EXCHANGE_FAILED' |
|
|
3375
|
+
/** The token endpoint refused the client: it needs a secret. */
|
|
3376
|
+
'invalid_client' |
|
|
3377
|
+
/** The token endpoint refused the code. */
|
|
3378
|
+
'invalid_grant' |
|
|
3379
|
+
/** URL tokens were received but the app is not known to be in Simple mode. */
|
|
3380
|
+
'TOKENS_IN_URL_NOT_ALLOWED';
|
|
3381
|
+
/** An error of the hosted sign-in in SDK mode, with a code a caller can branch on. */
|
|
3382
|
+
export declare class PassflowOidcError extends Error {
|
|
3383
|
+
readonly code: OidcErrorCode | (string & {});
|
|
3384
|
+
constructor(code: OidcErrorCode | (string & {}), message: string);
|
|
3385
|
+
}
|
|
3307
3386
|
/**
|
|
3308
3387
|
* Logger interface for Passflow services
|
|
3309
3388
|
*/
|
|
@@ -3454,7 +3533,7 @@ export declare enum PassflowEvent {
|
|
|
3454
3533
|
* The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
|
|
3455
3534
|
* emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
|
|
3456
3535
|
*/
|
|
3457
|
-
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' | 'auth-redirect.url' | 'auth-redirect' | 'redirect.check' | 'auth.is-authenticated' | 'session.check' | 'tokens.get' | 'tokens.load' | 'tokens.from-url' | 'refresh' | 'upgrade.commit' | 'log-out' | 'reset' | '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';
|
|
3536
|
+
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' | 'auth-redirect.url' | 'auth-redirect' | 'redirect.check' | 'auth.is-authenticated' | 'session.check' | 'tokens.get' | 'tokens.load' | 'tokens.from-url' | 'oidc.redirect' | 'refresh' | 'upgrade.commit' | 'log-out' | 'reset' | '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';
|
|
3458
3537
|
/**
|
|
3459
3538
|
* Error payload interface for structured error information
|
|
3460
3539
|
*/
|
|
@@ -3488,8 +3567,11 @@ type PassflowEventPayload = {
|
|
|
3488
3567
|
/**
|
|
3489
3568
|
* `'federated-landing'`: a federated redirect landed here and this instance exchanged its code.
|
|
3490
3569
|
* `'tokens-in-url'`: tokens received in this page's URL were verified and saved.
|
|
3570
|
+
* `'oidc-landing'`: hosted sign-in returned an authorization code here and this instance redeemed it.
|
|
3491
3571
|
*/
|
|
3492
|
-
source?: 'federated-landing' | 'tokens-in-url';
|
|
3572
|
+
source?: 'federated-landing' | 'tokens-in-url' | 'oidc-landing';
|
|
3573
|
+
/** For `source: 'tokens-in-url'`: the `state` the URL carried with the tokens, when it had one. */
|
|
3574
|
+
state?: string;
|
|
3493
3575
|
};
|
|
3494
3576
|
[PassflowEvent.SignInStart]: {
|
|
3495
3577
|
email?: string;
|
|
@@ -3708,6 +3790,15 @@ export declare class TokenCacheService {
|
|
|
3708
3790
|
getParsedTokens(): ParsedTokens | undefined;
|
|
3709
3791
|
isExpired(): boolean;
|
|
3710
3792
|
}
|
|
3793
|
+
/** Options of `authRedirect()`. `url` and `appId` may only repeat the instance's own values. */
|
|
3794
|
+
export type AuthRedirectOptions = {
|
|
3795
|
+
url?: string;
|
|
3796
|
+
redirectUrl?: string;
|
|
3797
|
+
scopes?: string[];
|
|
3798
|
+
appId?: string;
|
|
3799
|
+
/** Simple mode only: echoed back with the tokens. In SDK mode the SDK generates `state` itself. */
|
|
3800
|
+
state?: string;
|
|
3801
|
+
};
|
|
3711
3802
|
/** How this instance's refresh controller coordinates (architecture §3.3, §3.4). */
|
|
3712
3803
|
export type AuthServiceRefreshOptions = {
|
|
3713
3804
|
coordination: ResolvedCoordination;
|
|
@@ -3730,6 +3821,8 @@ export declare class AuthService {
|
|
|
3730
3821
|
private appId?;
|
|
3731
3822
|
private platform;
|
|
3732
3823
|
private readPkceEnabled?;
|
|
3824
|
+
/** The app's settings, read once per app id; `undefined` while there is no app id. */
|
|
3825
|
+
private readAppSettings?;
|
|
3733
3826
|
private tokenDeliveryManager;
|
|
3734
3827
|
private tokenExchangeConfig?;
|
|
3735
3828
|
private pendingPkce?;
|
|
@@ -3752,7 +3845,16 @@ export declare class AuthService {
|
|
|
3752
3845
|
parsedTokens?: ParsedTokens;
|
|
3753
3846
|
}) => Promise<void>;
|
|
3754
3847
|
expiredSession?: () => Promise<void>;
|
|
3755
|
-
}, appId?: string | undefined, tokenExchangeConfig?: TokenExchangeConfig, platform?: PlatformAdapter, readPkceEnabled?: (() => Promise<boolean>) | undefined, refreshOptions?: AuthServiceRefreshOptions
|
|
3848
|
+
}, appId?: string | undefined, tokenExchangeConfig?: TokenExchangeConfig, platform?: PlatformAdapter, readPkceEnabled?: (() => Promise<boolean>) | undefined, refreshOptions?: AuthServiceRefreshOptions,
|
|
3849
|
+
/** The app's settings, read once per app id; `undefined` while there is no app id. */
|
|
3850
|
+
readAppSettings?: (() => Promise<AppSettings | undefined>) | undefined);
|
|
3851
|
+
/** The app id used for `client_id`, the override check, federated starts and landings. */
|
|
3852
|
+
setAppId(appId: string): void;
|
|
3853
|
+
/**
|
|
3854
|
+
* Whether the app is known to be in Simple mode (`pkce_enabled === false`), the only mode in
|
|
3855
|
+
* which tokens are accepted from a URL. An unknown mode (no app id, a failed read) is not.
|
|
3856
|
+
*/
|
|
3857
|
+
private isSimpleModeApp;
|
|
3756
3858
|
/**
|
|
3757
3859
|
* Initialize session state on page load for cookie/BFF mode
|
|
3758
3860
|
*/
|
|
@@ -4008,12 +4110,24 @@ export declare class AuthService {
|
|
|
4008
4110
|
scopes?: string[];
|
|
4009
4111
|
appId?: string;
|
|
4010
4112
|
}): string;
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4113
|
+
/**
|
|
4114
|
+
* Sends the user to hosted sign-in, in the app's mode. Simple (`pkce_enabled` false or absent,
|
|
4115
|
+
* or no app id): the `/web` URL of `authRedirectUrl()`, plus `state` when given. SDK
|
|
4116
|
+
* (`pkce_enabled` true): `/oidc/authorize` with PKCE, `state` generated here, and `redirect_uri`
|
|
4117
|
+
* = `redirectUrl` or this page's origin and pathname.
|
|
4118
|
+
*
|
|
4119
|
+
* Every failure is one `Error` with operation `auth-redirect` and a rejection; nothing navigates.
|
|
4120
|
+
*/
|
|
4121
|
+
authRedirect(options?: AuthRedirectOptions): Promise<void>;
|
|
4122
|
+
/**
|
|
4123
|
+
* Takes a hosted sign-in landing in SDK mode (`?code=&state=`, or `?error=&state=`).
|
|
4124
|
+
*
|
|
4125
|
+
* @returns false with no app id yet, or with no slot in this tab: nothing is touched and no event
|
|
4126
|
+
* follows. true when this tab holds a slot: the URL is cleaned now, and `SignIn` with
|
|
4127
|
+
* `source: 'oidc-landing'` or one `Error` with operation `oidc.redirect` follows after an await.
|
|
4128
|
+
*/
|
|
4129
|
+
handleOidcLanding(currentUrl: CurrentUrlInfo): boolean;
|
|
4130
|
+
private finishOidcLanding;
|
|
4017
4131
|
/**
|
|
4018
4132
|
* Check if user is authenticated
|
|
4019
4133
|
* CRITICAL: Cookie/BFF mode checks ID token + session state, NOT access_token
|
|
@@ -5427,6 +5541,17 @@ export declare class Passflow {
|
|
|
5427
5541
|
* a global or install a prompt.
|
|
5428
5542
|
*/
|
|
5429
5543
|
readonly upgrade: UpgradeFacade;
|
|
5544
|
+
/**
|
|
5545
|
+
* Step-up of the hosted sign-in session, the HttpOnly cookie the hosted login page holds. Same
|
|
5546
|
+
* surface as `upgrade`, over `POST /auth/session/upgrade/start` and `POST /auth/session/upgrade`:
|
|
5547
|
+
* no bearer is sent, and the server issues nothing, so no tokens are stored. Never touches the
|
|
5548
|
+
* token session that `upgrade` steps up.
|
|
5549
|
+
*
|
|
5550
|
+
* Use only `enable({ prompt })`, called once, then `elevate(challenge, { kind: 'imperative' })`.
|
|
5551
|
+
* Do not pass `interceptFetch` and do not use `withAuth` or `attachAuth`: each of them would step
|
|
5552
|
+
* up the cookie session on a challenge from an unrelated call.
|
|
5553
|
+
*/
|
|
5554
|
+
readonly hostedUpgrade: UpgradeFacade;
|
|
5430
5555
|
/**
|
|
5431
5556
|
* Passflow's own API as an interception scope ("domain 1"), resolved ONCE
|
|
5432
5557
|
* here from `PassflowConfig.url` so no adapter or wrapper ever derives it.
|
|
@@ -5436,7 +5561,7 @@ export declare class Passflow {
|
|
|
5436
5561
|
private readonly upgradeDomain;
|
|
5437
5562
|
private createSessionCallback?;
|
|
5438
5563
|
private expiredSessionCallback?;
|
|
5439
|
-
private
|
|
5564
|
+
private appSettingsRead?;
|
|
5440
5565
|
error?: Error;
|
|
5441
5566
|
private platform;
|
|
5442
5567
|
get origin(): string;
|
|
@@ -5444,10 +5569,13 @@ export declare class Passflow {
|
|
|
5444
5569
|
appId?: string;
|
|
5445
5570
|
constructor(config: PassflowConfig);
|
|
5446
5571
|
/**
|
|
5447
|
-
*
|
|
5448
|
-
* where a round-trip eats into the browser's user-gesture window,
|
|
5449
|
-
*
|
|
5572
|
+
* The current app's settings, `undefined` while there is no app id. A sign-in asks before a
|
|
5573
|
+
* passkey ceremony, where a round-trip eats into the browser's user-gesture window, and
|
|
5574
|
+
* `authRedirect()`, the URL-token reader and `getAppSettings()` ask too, so one read is kept for
|
|
5575
|
+
* the appId. A failed read is not kept: the next caller asks again.
|
|
5450
5576
|
*/
|
|
5577
|
+
private readAppSettings;
|
|
5578
|
+
/** Whether the current app wants PKCE; `false` while there is no app id. */
|
|
5451
5579
|
private readPkceEnabled;
|
|
5452
5580
|
/**
|
|
5453
5581
|
* Update the appId and propagate it to all API clients.
|
|
@@ -5624,10 +5752,12 @@ export declare class Passflow {
|
|
|
5624
5752
|
* Handle OAuth redirect callback and take tokens from the URL query or fragment.
|
|
5625
5753
|
* This method should be called on the redirect page after authentication.
|
|
5626
5754
|
*
|
|
5627
|
-
* The tokens are removed from the URL at once
|
|
5628
|
-
*
|
|
5629
|
-
*
|
|
5630
|
-
*
|
|
5755
|
+
* The tokens are removed from the URL at once. Core accepts URL tokens only for apps in Simple
|
|
5756
|
+
* mode: the app settings are read (`pkce_enabled` must be `false`; an SDK-mode app, no app id or
|
|
5757
|
+
* a failed read is refused with code `TOKENS_IN_URL_NOT_ALLOWED`), then the tokens are verified in
|
|
5758
|
+
* the background against the configured server's published keys and this app id. `SignIn` with
|
|
5759
|
+
* `source: 'tokens-in-url'` (tokens saved; `state` set when the URL carried one), or `Error` with
|
|
5760
|
+
* operation `tokens.from-url` (nothing saved), reports the outcome, so subscribe first.
|
|
5631
5761
|
*
|
|
5632
5762
|
* @example
|
|
5633
5763
|
* ```typescript
|
|
@@ -5639,19 +5769,24 @@ export declare class Passflow {
|
|
|
5639
5769
|
* passflow.handleTokensRedirect();
|
|
5640
5770
|
* ```
|
|
5641
5771
|
*
|
|
5642
|
-
* A PKCE federated landing (`?code=`)
|
|
5643
|
-
*
|
|
5772
|
+
* A PKCE federated landing (`?code=&user_state=`) or a hosted sign-in landing in SDK mode
|
|
5773
|
+
* (`?code=&state=`) returns `undefined` and finishes in the background: `SignIn`,
|
|
5774
|
+
* `TwoFactorRequired` or `Error` is the signal. With `deferFederatedLanding` it is left to
|
|
5644
5775
|
* `completeFederatedLanding()`.
|
|
5645
5776
|
*/
|
|
5646
5777
|
handleTokensRedirect(): void;
|
|
5647
5778
|
/**
|
|
5648
|
-
* Takes a
|
|
5649
|
-
*
|
|
5650
|
-
*
|
|
5651
|
-
*
|
|
5779
|
+
* Takes a landing on this page, for an instance built with `deferFederatedLanding`: a PKCE
|
|
5780
|
+
* federated landing (`?code=&user_state=`), else a hosted sign-in landing in SDK mode
|
|
5781
|
+
* (`?code=&state=`). The code is exchanged in the background, so subscribe first:
|
|
5782
|
+
* - federated: `SignIn` with `source: 'federated-landing'`, `TwoFactorRequired`, or `Error` with
|
|
5783
|
+
* operation `federated.redirect`;
|
|
5784
|
+
* - hosted sign-in: `SignIn` with `source: 'oidc-landing'`, or one `Error` with operation
|
|
5785
|
+
* `oidc.redirect` (also for a landing refused here, such as a `state` this tab did not send).
|
|
5652
5786
|
*
|
|
5653
|
-
* @returns true when this tab started that sign-in
|
|
5654
|
-
* URL nor the stored proof key has changed
|
|
5787
|
+
* @returns true when this tab started that sign-in: the URL is cleaned at once and the outcome
|
|
5788
|
+
* arrives by event. On false, neither the URL nor the stored proof key has changed and no event
|
|
5789
|
+
* follows, so an instance that has its app id can still take it.
|
|
5655
5790
|
*/
|
|
5656
5791
|
completeFederatedLanding(): boolean;
|
|
5657
5792
|
private checkAndSetTokens;
|
|
@@ -5660,6 +5795,8 @@ export declare class Passflow {
|
|
|
5660
5795
|
* `redirectto` stay for the login page. A code this tab did not ask for leaves the URL as it is.
|
|
5661
5796
|
*/
|
|
5662
5797
|
private takeFederatedLanding;
|
|
5798
|
+
/** A hosted sign-in landing in SDK mode (`?code=&state=`); see `completeFederatedLanding()`. */
|
|
5799
|
+
private takeOidcLanding;
|
|
5663
5800
|
/**
|
|
5664
5801
|
* Adopts a `#tfa_token=` fragment: the 2FA token goes to the TwoFactorService
|
|
5665
5802
|
* through `TwoFactorRequired`, exactly as a password sign-in's does, and the
|
|
@@ -5670,8 +5807,9 @@ export declare class Passflow {
|
|
|
5670
5807
|
private adoptTwoFactorTokenFromUrl;
|
|
5671
5808
|
private checkErrorsFromURL;
|
|
5672
5809
|
/**
|
|
5673
|
-
* When a token appears in the query or the fragment, removes every token
|
|
5674
|
-
*
|
|
5810
|
+
* When a token appears in the query or the fragment, removes every token and `client_challenge`
|
|
5811
|
+
* from the query, and the tokens, `client_challenge` and `state` from whichever part carried the
|
|
5812
|
+
* tokens, in one history replace. Other params stay, in the query and in the fragment.
|
|
5675
5813
|
*/
|
|
5676
5814
|
private cleanupUrlParams;
|
|
5677
5815
|
private setTokensToCacheFromLocalStorage;
|
|
@@ -6113,6 +6251,9 @@ export declare class Passflow {
|
|
|
6113
6251
|
/**
|
|
6114
6252
|
* Get application settings and configuration.
|
|
6115
6253
|
*
|
|
6254
|
+
* Read once per app id and kept for this instance (sign-in, `authRedirect()` and the URL-token
|
|
6255
|
+
* reader use the same read); a failed read is not kept, so the next call asks again.
|
|
6256
|
+
*
|
|
6116
6257
|
* @returns Promise with app settings including branding, features, and config
|
|
6117
6258
|
* @throws {PassflowError} If request fails
|
|
6118
6259
|
*
|
|
@@ -6452,28 +6593,36 @@ export declare class Passflow {
|
|
|
6452
6593
|
appId?: string;
|
|
6453
6594
|
}): string;
|
|
6454
6595
|
/**
|
|
6455
|
-
* Redirect to
|
|
6596
|
+
* Redirect to Passflow hosted sign-in, in the app's mode (`pkce_enabled` in its settings).
|
|
6597
|
+
*
|
|
6598
|
+
* - Simple mode (`pkce_enabled` false, or no app id): the `/web` URL of `authRedirectUrl()`.
|
|
6599
|
+
* Hosted sign-in returns tokens in the URL; `options.state` is echoed back with them.
|
|
6600
|
+
* - SDK mode (`pkce_enabled` true): `/oidc/authorize` with PKCE. Hosted sign-in returns an
|
|
6601
|
+
* authorization code, which this SDK redeems on the landing page. `state` is generated here
|
|
6602
|
+
* (`options.state` is not sent), and the default `redirectUrl` is this page's origin and
|
|
6603
|
+
* pathname, so a deep link passes an explicit, registered `redirectUrl`. The app must be a
|
|
6604
|
+
* public client (type SPA).
|
|
6605
|
+
*
|
|
6606
|
+
* Reads the app settings (one read per app id). Every failure emits one `Error` with operation
|
|
6607
|
+
* `auth-redirect` and rejects; nothing navigates then.
|
|
6456
6608
|
*
|
|
6457
6609
|
* @param options - Redirect configuration
|
|
6458
|
-
* @param options.url -
|
|
6459
|
-
* @param options.redirectUrl - URL to
|
|
6610
|
+
* @param options.url - Must equal the instance's `url` when given (`OVERRIDE_NOT_SUPPORTED` otherwise)
|
|
6611
|
+
* @param options.redirectUrl - URL to return to after authentication
|
|
6460
6612
|
* @param options.scopes - Optional scopes to request
|
|
6461
|
-
* @param options.appId -
|
|
6613
|
+
* @param options.appId - Must equal the instance's `appId` when given (`OVERRIDE_NOT_SUPPORTED` otherwise)
|
|
6614
|
+
* @param options.state - Simple mode only: echoed back with the tokens
|
|
6615
|
+
* @throws {PassflowOidcError} `OVERRIDE_NOT_SUPPORTED`, `CONFIDENTIAL_CLIENT`,
|
|
6616
|
+
* `SECURE_CONTEXT_REQUIRED`, `STORAGE_UNAVAILABLE`; or the error of a failed settings read
|
|
6462
6617
|
*
|
|
6463
6618
|
* @example
|
|
6464
6619
|
* ```typescript
|
|
6465
|
-
*
|
|
6466
|
-
* passflow.authRedirect({
|
|
6467
|
-
*
|
|
6468
|
-
* });
|
|
6620
|
+
* if (!passflow.isAuthenticated()) {
|
|
6621
|
+
* await passflow.authRedirect({ redirectUrl: window.location.origin + '/auth/callback' });
|
|
6622
|
+
* }
|
|
6469
6623
|
* ```
|
|
6470
6624
|
*/
|
|
6471
|
-
authRedirect(options?:
|
|
6472
|
-
url?: string;
|
|
6473
|
-
redirectUrl?: string;
|
|
6474
|
-
scopes?: string[];
|
|
6475
|
-
appId?: string;
|
|
6476
|
-
}): void;
|
|
6625
|
+
authRedirect(options?: AuthRedirectOptions): Promise<void>;
|
|
6477
6626
|
/**
|
|
6478
6627
|
* Get the current token delivery mode.
|
|
6479
6628
|
* Returns the mode determined by the server (json_body, cookie, or mobile).
|
|
@@ -6869,4 +7018,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
6869
7018
|
* @returns true if valid username format, false otherwise
|
|
6870
7019
|
*/
|
|
6871
7020
|
export declare function isValidUsername(username: string): boolean;
|
|
6872
|
-
export type { AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, 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 };
|
|
7021
|
+
export type { 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 };
|