@passflow/core 0.28.0 → 0.29.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 +98 -6
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +166 -42
- package/dist/index.d.ts +166 -42
- package/dist/index.mjs +1150 -931
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1404,6 +1404,17 @@ export type PassflowPasswordlessStatusResponse = {
|
|
|
1404
1404
|
} | {
|
|
1405
1405
|
status: 'approved';
|
|
1406
1406
|
code: string;
|
|
1407
|
+
} |
|
|
1408
|
+
/**
|
|
1409
|
+
* A sign-in under an OIDC parent ends where every parent sign-in ends: with the relying party's
|
|
1410
|
+
* `redirect_url`, or with a `tfa_token` when a second factor is owed.
|
|
1411
|
+
*/
|
|
1412
|
+
{
|
|
1413
|
+
status?: undefined;
|
|
1414
|
+
redirect_url?: string;
|
|
1415
|
+
tfa_token?: string;
|
|
1416
|
+
requires_2fa?: boolean;
|
|
1417
|
+
challenge_id?: string;
|
|
1407
1418
|
};
|
|
1408
1419
|
export type PassflowPasswordlessApprovalInfoPayload = {
|
|
1409
1420
|
challenge_id: string;
|
|
@@ -1417,6 +1428,10 @@ export type PassflowPasswordlessApprovalDecidePayload = {
|
|
|
1417
1428
|
export type PassflowPasswordlessApprovalDecideResponse = {
|
|
1418
1429
|
state: 'approved' | 'denied';
|
|
1419
1430
|
};
|
|
1431
|
+
/**
|
|
1432
|
+
* How a passwordless wait ended. Under an OIDC parent, `signed-in` carries only `redirect_url`
|
|
1433
|
+
* (the relying party's address with its code) in `tokens`, and no tokens.
|
|
1434
|
+
*/
|
|
1420
1435
|
export type PasswordlessWaitResult = {
|
|
1421
1436
|
status: 'signed-in';
|
|
1422
1437
|
tokens: PassflowAuthorizationResponse;
|
|
@@ -1435,6 +1450,8 @@ export type PasswordlessApprovalInfo = {
|
|
|
1435
1450
|
country: string;
|
|
1436
1451
|
} | null;
|
|
1437
1452
|
attempts_left: number;
|
|
1453
|
+
/** `true` when approving takes one click and no number is typed. */
|
|
1454
|
+
one_click?: boolean;
|
|
1438
1455
|
};
|
|
1439
1456
|
export declare enum Providers {
|
|
1440
1457
|
google = "google",
|
|
@@ -1478,7 +1495,16 @@ export type AppSettings = {
|
|
|
1478
1495
|
custom_email_templates: boolean;
|
|
1479
1496
|
auth_strategies: AuthStrategies[];
|
|
1480
1497
|
force_passwordless_login: boolean;
|
|
1498
|
+
/**
|
|
1499
|
+
* `true`: hosted sign-in returns an authorization code (SDK mode), which `authRedirect()` redeems.
|
|
1500
|
+
* `false`: hosted sign-in returns tokens in the URL (Simple mode).
|
|
1501
|
+
*/
|
|
1481
1502
|
pkce_enabled: boolean;
|
|
1503
|
+
/**
|
|
1504
|
+
* `true` when the app is a public client (no secret), so a browser can redeem its code. Absent
|
|
1505
|
+
* on servers that do not report it.
|
|
1506
|
+
*/
|
|
1507
|
+
public_client?: boolean;
|
|
1482
1508
|
custom_sms_messages: boolean;
|
|
1483
1509
|
registration_allowed: boolean;
|
|
1484
1510
|
invite_only_registration: boolean;
|
|
@@ -1610,6 +1636,10 @@ export type PassflowFederatedAuthPayload = {
|
|
|
1610
1636
|
create_tenant?: boolean;
|
|
1611
1637
|
code_challenge?: string;
|
|
1612
1638
|
code_challenge_method?: 'S256';
|
|
1639
|
+
/** Echoed back on a Simple-mode landing, so the app can match the return to its start. */
|
|
1640
|
+
state?: string;
|
|
1641
|
+
/** The hosted login's OIDC parent sign-in, when the federated sign-in runs under one. */
|
|
1642
|
+
parent_challenge_id?: string;
|
|
1613
1643
|
};
|
|
1614
1644
|
export type PassflowFederatedAuthExtendedPayload = PassflowFederatedAuthPayload & {
|
|
1615
1645
|
device?: string;
|
|
@@ -3304,6 +3334,41 @@ export declare class M2MTokenParseError extends M2MError {
|
|
|
3304
3334
|
export declare class M2MConfigError extends M2MError {
|
|
3305
3335
|
constructor(message: string);
|
|
3306
3336
|
}
|
|
3337
|
+
/**
|
|
3338
|
+
* Codes of the errors the hosted sign-in in SDK mode (authorization code + PKCE) reports, both as
|
|
3339
|
+
* `PassflowOidcError.code` on a rejected `authRedirect()` and as `ErrorPayload.code` on the
|
|
3340
|
+
* `Error` event. A landing whose token endpoint answered with an OAuth error other than
|
|
3341
|
+
* `invalid_client` or `invalid_grant` reports `TOKEN_EXCHANGE_FAILED`; an `?error=` landing reports
|
|
3342
|
+
* the OAuth error code the server sent.
|
|
3343
|
+
*/
|
|
3344
|
+
type OidcErrorCode =
|
|
3345
|
+
/** `authRedirect()` got a `url` or `appId` that differs from the instance's. */
|
|
3346
|
+
'OVERRIDE_NOT_SUPPORTED' |
|
|
3347
|
+
/** The page is not a secure context, so the Web Crypto API that PKCE needs is missing. */
|
|
3348
|
+
'SECURE_CONTEXT_REQUIRED' |
|
|
3349
|
+
/** sessionStorage cannot be written, so the proof key cannot survive the redirect. */
|
|
3350
|
+
'STORAGE_UNAVAILABLE' |
|
|
3351
|
+
/** The app is a confidential client (it has a secret), so a browser cannot redeem its code. */
|
|
3352
|
+
'CONFIDENTIAL_CLIENT' |
|
|
3353
|
+
/** The landing's `state` is not the one this tab sent. */
|
|
3354
|
+
'STATE_MISMATCH' |
|
|
3355
|
+
/** This tab's stored proof key is unreadable or expired. */
|
|
3356
|
+
'VERIFIER_MISSING' |
|
|
3357
|
+
/** The ID token is missing although `openid` was asked, or its `nonce` is not the one sent. */
|
|
3358
|
+
'ID_TOKEN_INVALID' |
|
|
3359
|
+
/** The token endpoint could not be reached or answered with an unexpected error. */
|
|
3360
|
+
'TOKEN_EXCHANGE_FAILED' |
|
|
3361
|
+
/** The token endpoint refused the client: it needs a secret. */
|
|
3362
|
+
'invalid_client' |
|
|
3363
|
+
/** The token endpoint refused the code. */
|
|
3364
|
+
'invalid_grant' |
|
|
3365
|
+
/** URL tokens were received but the app is not known to be in Simple mode. */
|
|
3366
|
+
'TOKENS_IN_URL_NOT_ALLOWED';
|
|
3367
|
+
/** An error of the hosted sign-in in SDK mode, with a code a caller can branch on. */
|
|
3368
|
+
export declare class PassflowOidcError extends Error {
|
|
3369
|
+
readonly code: OidcErrorCode | (string & {});
|
|
3370
|
+
constructor(code: OidcErrorCode | (string & {}), message: string);
|
|
3371
|
+
}
|
|
3307
3372
|
/**
|
|
3308
3373
|
* Logger interface for Passflow services
|
|
3309
3374
|
*/
|
|
@@ -3454,7 +3519,7 @@ export declare enum PassflowEvent {
|
|
|
3454
3519
|
* The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
|
|
3455
3520
|
* emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
|
|
3456
3521
|
*/
|
|
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';
|
|
3522
|
+
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
3523
|
/**
|
|
3459
3524
|
* Error payload interface for structured error information
|
|
3460
3525
|
*/
|
|
@@ -3488,8 +3553,11 @@ type PassflowEventPayload = {
|
|
|
3488
3553
|
/**
|
|
3489
3554
|
* `'federated-landing'`: a federated redirect landed here and this instance exchanged its code.
|
|
3490
3555
|
* `'tokens-in-url'`: tokens received in this page's URL were verified and saved.
|
|
3556
|
+
* `'oidc-landing'`: hosted sign-in returned an authorization code here and this instance redeemed it.
|
|
3491
3557
|
*/
|
|
3492
|
-
source?: 'federated-landing' | 'tokens-in-url';
|
|
3558
|
+
source?: 'federated-landing' | 'tokens-in-url' | 'oidc-landing';
|
|
3559
|
+
/** For `source: 'tokens-in-url'`: the `state` the URL carried with the tokens, when it had one. */
|
|
3560
|
+
state?: string;
|
|
3493
3561
|
};
|
|
3494
3562
|
[PassflowEvent.SignInStart]: {
|
|
3495
3563
|
email?: string;
|
|
@@ -3708,6 +3776,15 @@ export declare class TokenCacheService {
|
|
|
3708
3776
|
getParsedTokens(): ParsedTokens | undefined;
|
|
3709
3777
|
isExpired(): boolean;
|
|
3710
3778
|
}
|
|
3779
|
+
/** Options of `authRedirect()`. `url` and `appId` may only repeat the instance's own values. */
|
|
3780
|
+
export type AuthRedirectOptions = {
|
|
3781
|
+
url?: string;
|
|
3782
|
+
redirectUrl?: string;
|
|
3783
|
+
scopes?: string[];
|
|
3784
|
+
appId?: string;
|
|
3785
|
+
/** Simple mode only: echoed back with the tokens. In SDK mode the SDK generates `state` itself. */
|
|
3786
|
+
state?: string;
|
|
3787
|
+
};
|
|
3711
3788
|
/** How this instance's refresh controller coordinates (architecture §3.3, §3.4). */
|
|
3712
3789
|
export type AuthServiceRefreshOptions = {
|
|
3713
3790
|
coordination: ResolvedCoordination;
|
|
@@ -3730,6 +3807,8 @@ export declare class AuthService {
|
|
|
3730
3807
|
private appId?;
|
|
3731
3808
|
private platform;
|
|
3732
3809
|
private readPkceEnabled?;
|
|
3810
|
+
/** The app's settings, read once per app id; `undefined` while there is no app id. */
|
|
3811
|
+
private readAppSettings?;
|
|
3733
3812
|
private tokenDeliveryManager;
|
|
3734
3813
|
private tokenExchangeConfig?;
|
|
3735
3814
|
private pendingPkce?;
|
|
@@ -3752,7 +3831,16 @@ export declare class AuthService {
|
|
|
3752
3831
|
parsedTokens?: ParsedTokens;
|
|
3753
3832
|
}) => Promise<void>;
|
|
3754
3833
|
expiredSession?: () => Promise<void>;
|
|
3755
|
-
}, appId?: string | undefined, tokenExchangeConfig?: TokenExchangeConfig, platform?: PlatformAdapter, readPkceEnabled?: (() => Promise<boolean>) | undefined, refreshOptions?: AuthServiceRefreshOptions
|
|
3834
|
+
}, appId?: string | undefined, tokenExchangeConfig?: TokenExchangeConfig, platform?: PlatformAdapter, readPkceEnabled?: (() => Promise<boolean>) | undefined, refreshOptions?: AuthServiceRefreshOptions,
|
|
3835
|
+
/** The app's settings, read once per app id; `undefined` while there is no app id. */
|
|
3836
|
+
readAppSettings?: (() => Promise<AppSettings | undefined>) | undefined);
|
|
3837
|
+
/** The app id used for `client_id`, the override check, federated starts and landings. */
|
|
3838
|
+
setAppId(appId: string): void;
|
|
3839
|
+
/**
|
|
3840
|
+
* Whether the app is known to be in Simple mode (`pkce_enabled === false`), the only mode in
|
|
3841
|
+
* which tokens are accepted from a URL. An unknown mode (no app id, a failed read) is not.
|
|
3842
|
+
*/
|
|
3843
|
+
private isSimpleModeApp;
|
|
3756
3844
|
/**
|
|
3757
3845
|
* Initialize session state on page load for cookie/BFF mode
|
|
3758
3846
|
*/
|
|
@@ -4008,12 +4096,24 @@ export declare class AuthService {
|
|
|
4008
4096
|
scopes?: string[];
|
|
4009
4097
|
appId?: string;
|
|
4010
4098
|
}): string;
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4099
|
+
/**
|
|
4100
|
+
* Sends the user to hosted sign-in, in the app's mode. Simple (`pkce_enabled` false or absent,
|
|
4101
|
+
* or no app id): the `/web` URL of `authRedirectUrl()`, plus `state` when given. SDK
|
|
4102
|
+
* (`pkce_enabled` true): `/oidc/authorize` with PKCE, `state` generated here, and `redirect_uri`
|
|
4103
|
+
* = `redirectUrl` or this page's origin and pathname.
|
|
4104
|
+
*
|
|
4105
|
+
* Every failure is one `Error` with operation `auth-redirect` and a rejection; nothing navigates.
|
|
4106
|
+
*/
|
|
4107
|
+
authRedirect(options?: AuthRedirectOptions): Promise<void>;
|
|
4108
|
+
/**
|
|
4109
|
+
* Takes a hosted sign-in landing in SDK mode (`?code=&state=`, or `?error=&state=`).
|
|
4110
|
+
*
|
|
4111
|
+
* @returns false with no app id yet, or with no slot in this tab: nothing is touched and no event
|
|
4112
|
+
* follows. true when this tab holds a slot: the URL is cleaned now, and `SignIn` with
|
|
4113
|
+
* `source: 'oidc-landing'` or one `Error` with operation `oidc.redirect` follows after an await.
|
|
4114
|
+
*/
|
|
4115
|
+
handleOidcLanding(currentUrl: CurrentUrlInfo): boolean;
|
|
4116
|
+
private finishOidcLanding;
|
|
4017
4117
|
/**
|
|
4018
4118
|
* Check if user is authenticated
|
|
4019
4119
|
* CRITICAL: Cookie/BFF mode checks ID token + session state, NOT access_token
|
|
@@ -5436,7 +5536,7 @@ export declare class Passflow {
|
|
|
5436
5536
|
private readonly upgradeDomain;
|
|
5437
5537
|
private createSessionCallback?;
|
|
5438
5538
|
private expiredSessionCallback?;
|
|
5439
|
-
private
|
|
5539
|
+
private appSettingsRead?;
|
|
5440
5540
|
error?: Error;
|
|
5441
5541
|
private platform;
|
|
5442
5542
|
get origin(): string;
|
|
@@ -5444,10 +5544,13 @@ export declare class Passflow {
|
|
|
5444
5544
|
appId?: string;
|
|
5445
5545
|
constructor(config: PassflowConfig);
|
|
5446
5546
|
/**
|
|
5447
|
-
*
|
|
5448
|
-
* where a round-trip eats into the browser's user-gesture window,
|
|
5449
|
-
*
|
|
5547
|
+
* The current app's settings, `undefined` while there is no app id. A sign-in asks before a
|
|
5548
|
+
* passkey ceremony, where a round-trip eats into the browser's user-gesture window, and
|
|
5549
|
+
* `authRedirect()`, the URL-token reader and `getAppSettings()` ask too, so one read is kept for
|
|
5550
|
+
* the appId. A failed read is not kept: the next caller asks again.
|
|
5450
5551
|
*/
|
|
5552
|
+
private readAppSettings;
|
|
5553
|
+
/** Whether the current app wants PKCE; `false` while there is no app id. */
|
|
5451
5554
|
private readPkceEnabled;
|
|
5452
5555
|
/**
|
|
5453
5556
|
* Update the appId and propagate it to all API clients.
|
|
@@ -5624,10 +5727,12 @@ export declare class Passflow {
|
|
|
5624
5727
|
* Handle OAuth redirect callback and take tokens from the URL query or fragment.
|
|
5625
5728
|
* This method should be called on the redirect page after authentication.
|
|
5626
5729
|
*
|
|
5627
|
-
* The tokens are removed from the URL at once
|
|
5628
|
-
*
|
|
5629
|
-
*
|
|
5630
|
-
*
|
|
5730
|
+
* The tokens are removed from the URL at once. Core accepts URL tokens only for apps in Simple
|
|
5731
|
+
* mode: the app settings are read (`pkce_enabled` must be `false`; an SDK-mode app, no app id or
|
|
5732
|
+
* a failed read is refused with code `TOKENS_IN_URL_NOT_ALLOWED`), then the tokens are verified in
|
|
5733
|
+
* the background against the configured server's published keys and this app id. `SignIn` with
|
|
5734
|
+
* `source: 'tokens-in-url'` (tokens saved; `state` set when the URL carried one), or `Error` with
|
|
5735
|
+
* operation `tokens.from-url` (nothing saved), reports the outcome, so subscribe first.
|
|
5631
5736
|
*
|
|
5632
5737
|
* @example
|
|
5633
5738
|
* ```typescript
|
|
@@ -5639,19 +5744,24 @@ export declare class Passflow {
|
|
|
5639
5744
|
* passflow.handleTokensRedirect();
|
|
5640
5745
|
* ```
|
|
5641
5746
|
*
|
|
5642
|
-
* A PKCE federated landing (`?code=`)
|
|
5643
|
-
*
|
|
5747
|
+
* A PKCE federated landing (`?code=&user_state=`) or a hosted sign-in landing in SDK mode
|
|
5748
|
+
* (`?code=&state=`) returns `undefined` and finishes in the background: `SignIn`,
|
|
5749
|
+
* `TwoFactorRequired` or `Error` is the signal. With `deferFederatedLanding` it is left to
|
|
5644
5750
|
* `completeFederatedLanding()`.
|
|
5645
5751
|
*/
|
|
5646
5752
|
handleTokensRedirect(): void;
|
|
5647
5753
|
/**
|
|
5648
|
-
* Takes a
|
|
5649
|
-
*
|
|
5650
|
-
*
|
|
5651
|
-
*
|
|
5754
|
+
* Takes a landing on this page, for an instance built with `deferFederatedLanding`: a PKCE
|
|
5755
|
+
* federated landing (`?code=&user_state=`), else a hosted sign-in landing in SDK mode
|
|
5756
|
+
* (`?code=&state=`). The code is exchanged in the background, so subscribe first:
|
|
5757
|
+
* - federated: `SignIn` with `source: 'federated-landing'`, `TwoFactorRequired`, or `Error` with
|
|
5758
|
+
* operation `federated.redirect`;
|
|
5759
|
+
* - hosted sign-in: `SignIn` with `source: 'oidc-landing'`, or one `Error` with operation
|
|
5760
|
+
* `oidc.redirect` (also for a landing refused here, such as a `state` this tab did not send).
|
|
5652
5761
|
*
|
|
5653
|
-
* @returns true when this tab started that sign-in
|
|
5654
|
-
* URL nor the stored proof key has changed
|
|
5762
|
+
* @returns true when this tab started that sign-in: the URL is cleaned at once and the outcome
|
|
5763
|
+
* arrives by event. On false, neither the URL nor the stored proof key has changed and no event
|
|
5764
|
+
* follows, so an instance that has its app id can still take it.
|
|
5655
5765
|
*/
|
|
5656
5766
|
completeFederatedLanding(): boolean;
|
|
5657
5767
|
private checkAndSetTokens;
|
|
@@ -5660,6 +5770,8 @@ export declare class Passflow {
|
|
|
5660
5770
|
* `redirectto` stay for the login page. A code this tab did not ask for leaves the URL as it is.
|
|
5661
5771
|
*/
|
|
5662
5772
|
private takeFederatedLanding;
|
|
5773
|
+
/** A hosted sign-in landing in SDK mode (`?code=&state=`); see `completeFederatedLanding()`. */
|
|
5774
|
+
private takeOidcLanding;
|
|
5663
5775
|
/**
|
|
5664
5776
|
* Adopts a `#tfa_token=` fragment: the 2FA token goes to the TwoFactorService
|
|
5665
5777
|
* through `TwoFactorRequired`, exactly as a password sign-in's does, and the
|
|
@@ -5670,8 +5782,9 @@ export declare class Passflow {
|
|
|
5670
5782
|
private adoptTwoFactorTokenFromUrl;
|
|
5671
5783
|
private checkErrorsFromURL;
|
|
5672
5784
|
/**
|
|
5673
|
-
* When a token appears in the query or the fragment, removes every token
|
|
5674
|
-
*
|
|
5785
|
+
* When a token appears in the query or the fragment, removes every token and `client_challenge`
|
|
5786
|
+
* from the query, and the tokens, `client_challenge` and `state` from whichever part carried the
|
|
5787
|
+
* tokens, in one history replace. Other params stay, in the query and in the fragment.
|
|
5675
5788
|
*/
|
|
5676
5789
|
private cleanupUrlParams;
|
|
5677
5790
|
private setTokensToCacheFromLocalStorage;
|
|
@@ -6113,6 +6226,9 @@ export declare class Passflow {
|
|
|
6113
6226
|
/**
|
|
6114
6227
|
* Get application settings and configuration.
|
|
6115
6228
|
*
|
|
6229
|
+
* Read once per app id and kept for this instance (sign-in, `authRedirect()` and the URL-token
|
|
6230
|
+
* reader use the same read); a failed read is not kept, so the next call asks again.
|
|
6231
|
+
*
|
|
6116
6232
|
* @returns Promise with app settings including branding, features, and config
|
|
6117
6233
|
* @throws {PassflowError} If request fails
|
|
6118
6234
|
*
|
|
@@ -6452,28 +6568,36 @@ export declare class Passflow {
|
|
|
6452
6568
|
appId?: string;
|
|
6453
6569
|
}): string;
|
|
6454
6570
|
/**
|
|
6455
|
-
* Redirect to
|
|
6571
|
+
* Redirect to Passflow hosted sign-in, in the app's mode (`pkce_enabled` in its settings).
|
|
6572
|
+
*
|
|
6573
|
+
* - Simple mode (`pkce_enabled` false, or no app id): the `/web` URL of `authRedirectUrl()`.
|
|
6574
|
+
* Hosted sign-in returns tokens in the URL; `options.state` is echoed back with them.
|
|
6575
|
+
* - SDK mode (`pkce_enabled` true): `/oidc/authorize` with PKCE. Hosted sign-in returns an
|
|
6576
|
+
* authorization code, which this SDK redeems on the landing page. `state` is generated here
|
|
6577
|
+
* (`options.state` is not sent), and the default `redirectUrl` is this page's origin and
|
|
6578
|
+
* pathname, so a deep link passes an explicit, registered `redirectUrl`. The app must be a
|
|
6579
|
+
* public client (type SPA).
|
|
6580
|
+
*
|
|
6581
|
+
* Reads the app settings (one read per app id). Every failure emits one `Error` with operation
|
|
6582
|
+
* `auth-redirect` and rejects; nothing navigates then.
|
|
6456
6583
|
*
|
|
6457
6584
|
* @param options - Redirect configuration
|
|
6458
|
-
* @param options.url -
|
|
6459
|
-
* @param options.redirectUrl - URL to
|
|
6585
|
+
* @param options.url - Must equal the instance's `url` when given (`OVERRIDE_NOT_SUPPORTED` otherwise)
|
|
6586
|
+
* @param options.redirectUrl - URL to return to after authentication
|
|
6460
6587
|
* @param options.scopes - Optional scopes to request
|
|
6461
|
-
* @param options.appId -
|
|
6588
|
+
* @param options.appId - Must equal the instance's `appId` when given (`OVERRIDE_NOT_SUPPORTED` otherwise)
|
|
6589
|
+
* @param options.state - Simple mode only: echoed back with the tokens
|
|
6590
|
+
* @throws {PassflowOidcError} `OVERRIDE_NOT_SUPPORTED`, `CONFIDENTIAL_CLIENT`,
|
|
6591
|
+
* `SECURE_CONTEXT_REQUIRED`, `STORAGE_UNAVAILABLE`; or the error of a failed settings read
|
|
6462
6592
|
*
|
|
6463
6593
|
* @example
|
|
6464
6594
|
* ```typescript
|
|
6465
|
-
*
|
|
6466
|
-
* passflow.authRedirect({
|
|
6467
|
-
*
|
|
6468
|
-
* });
|
|
6595
|
+
* if (!passflow.isAuthenticated()) {
|
|
6596
|
+
* await passflow.authRedirect({ redirectUrl: window.location.origin + '/auth/callback' });
|
|
6597
|
+
* }
|
|
6469
6598
|
* ```
|
|
6470
6599
|
*/
|
|
6471
|
-
authRedirect(options?:
|
|
6472
|
-
url?: string;
|
|
6473
|
-
redirectUrl?: string;
|
|
6474
|
-
scopes?: string[];
|
|
6475
|
-
appId?: string;
|
|
6476
|
-
}): void;
|
|
6600
|
+
authRedirect(options?: AuthRedirectOptions): Promise<void>;
|
|
6477
6601
|
/**
|
|
6478
6602
|
* Get the current token delivery mode.
|
|
6479
6603
|
* Returns the mode determined by the server (json_body, cookie, or mobile).
|
|
@@ -6869,4 +6993,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
6869
6993
|
* @returns true if valid username format, false otherwise
|
|
6870
6994
|
*/
|
|
6871
6995
|
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 };
|
|
6996
|
+
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 };
|