@passflow/core 0.46.0 → 0.48.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 +46 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +230 -11
- package/dist/index.d.ts +230 -11
- package/dist/index.mjs +1506 -1310
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -496,6 +496,28 @@ type PasskeySupport = {
|
|
|
496
496
|
*/
|
|
497
497
|
startAuthentication(options: PublicKeyCredentialRequestOptionsJSON): Promise<AuthenticationResponseJSON | undefined>;
|
|
498
498
|
};
|
|
499
|
+
/** One request for an ID token from the browser's own identity provider sign-in (FedCM). */
|
|
500
|
+
type IdentityCredentialRequest = {
|
|
501
|
+
/** `active`: the user clicked a button. `passive`: offered when the page opens. */
|
|
502
|
+
mode: 'active' | 'passive';
|
|
503
|
+
/** The identity provider's FedCM config URL for this mode. */
|
|
504
|
+
configURL: string;
|
|
505
|
+
clientId: string;
|
|
506
|
+
/** The nonce the ID token must carry. */
|
|
507
|
+
nonce: string;
|
|
508
|
+
signal?: AbortSignal;
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* Optional native identity provider sign-in. Adapters without it leave
|
|
512
|
+
* `PlatformAdapter.identityCredentials` undefined.
|
|
513
|
+
*/
|
|
514
|
+
type IdentityCredentialSupport = {
|
|
515
|
+
/**
|
|
516
|
+
* Shows the browser's account picker and resolves with the ID token.
|
|
517
|
+
* Rejects only with `NativeSignInError`.
|
|
518
|
+
*/
|
|
519
|
+
get(request: IdentityCredentialRequest): Promise<string>;
|
|
520
|
+
};
|
|
499
521
|
/**
|
|
500
522
|
* Error thrown when the authentication popup is closed by the user
|
|
501
523
|
* before authentication completes. Use `instanceof PopupClosedError`
|
|
@@ -504,6 +526,21 @@ type PasskeySupport = {
|
|
|
504
526
|
export declare class PopupClosedError extends Error {
|
|
505
527
|
constructor(message?: string);
|
|
506
528
|
}
|
|
529
|
+
/**
|
|
530
|
+
* Why a native identity provider sign-in did not return a token:
|
|
531
|
+
* - `unsupported`: this browser or page cannot use it (or the click's activation ran out);
|
|
532
|
+
* - `provider`: the identity provider refused after the user chose an account;
|
|
533
|
+
* - `dismissed`: the user closed the picker, or the browser would not show it.
|
|
534
|
+
*/
|
|
535
|
+
type NativeSignInErrorReason = 'unsupported' | 'provider' | 'dismissed';
|
|
536
|
+
/**
|
|
537
|
+
* Error thrown when a native identity provider sign-in returns no token.
|
|
538
|
+
* Use `instanceof NativeSignInError` and read `reason`.
|
|
539
|
+
*/
|
|
540
|
+
export declare class NativeSignInError extends Error {
|
|
541
|
+
readonly reason: NativeSignInErrorReason;
|
|
542
|
+
constructor(reason: NativeSignInErrorReason, message?: string);
|
|
543
|
+
}
|
|
507
544
|
/**
|
|
508
545
|
* PlatformAdapter abstracts all platform-specific APIs that the
|
|
509
546
|
* Passflow SDK needs. Implement this interface to add support for
|
|
@@ -612,6 +649,12 @@ interface PlatformAdapter {
|
|
|
612
649
|
* this property is undefined. The SDK checks for undefined before calling.
|
|
613
650
|
*/
|
|
614
651
|
readonly passkeys?: PasskeySupport;
|
|
652
|
+
/**
|
|
653
|
+
* Optional native identity provider sign-in (FedCM on the web). If the
|
|
654
|
+
* platform does not support it, this property is undefined. The SDK checks
|
|
655
|
+
* for undefined before calling.
|
|
656
|
+
*/
|
|
657
|
+
readonly identityCredentials?: IdentityCredentialSupport;
|
|
615
658
|
/**
|
|
616
659
|
* Encodes a string to Base64.
|
|
617
660
|
* On web: btoa(str)
|
|
@@ -641,6 +684,8 @@ interface PlatformAdapter {
|
|
|
641
684
|
getDeviceType(): 'web' | 'ios' | 'android';
|
|
642
685
|
}
|
|
643
686
|
export declare class WebAdapter implements PlatformAdapter {
|
|
687
|
+
/** The FedCM probe's result, set on the first read of `identityCredentials`. */
|
|
688
|
+
private identityProbe?;
|
|
644
689
|
get storage(): PlatformStorage;
|
|
645
690
|
/**
|
|
646
691
|
* `storage` is the browser's localStorage, which every tab of the origin shares. False in
|
|
@@ -725,6 +770,11 @@ export declare class WebAdapter implements PlatformAdapter {
|
|
|
725
770
|
* (auth-service.ts:681)
|
|
726
771
|
*/
|
|
727
772
|
readonly passkeys: PasskeySupport;
|
|
773
|
+
/**
|
|
774
|
+
* FedCM, when this browser has it with `mode` and `params`; undefined otherwise. The probe runs
|
|
775
|
+
* once, on the first read, never at import.
|
|
776
|
+
*/
|
|
777
|
+
get identityCredentials(): IdentityCredentialSupport | undefined;
|
|
728
778
|
/**
|
|
729
779
|
* Replaces:
|
|
730
780
|
* btoa(publicKey.user.id)
|
|
@@ -1079,6 +1129,8 @@ export declare enum PassflowEndpointPaths {
|
|
|
1079
1129
|
pkceExchange = "/auth/pkce_exchange",
|
|
1080
1130
|
redirectCheck = "/auth/redirect/check",
|
|
1081
1131
|
signInWithProvider = "/auth/federated/start/",
|
|
1132
|
+
federatedNativeStart = "/auth/federated/native/start/",
|
|
1133
|
+
federatedNativeComplete = "/auth/federated/native/complete/",
|
|
1082
1134
|
passwordless = "/auth/passwordless/start",
|
|
1083
1135
|
passwordlessComplete = "/auth/passwordless/complete",
|
|
1084
1136
|
passwordlessStatus = "/auth/passwordless/status",
|
|
@@ -1334,6 +1386,13 @@ export type PassflowAuthorizationResponse = Tokens & {
|
|
|
1334
1386
|
message?: string;
|
|
1335
1387
|
/** Base64url (no padding) SHA-256 of the refresh token issued with this answer. */
|
|
1336
1388
|
refresh_challenge?: string;
|
|
1389
|
+
/** A sign-in under an OIDC parent that continues with `response_mode=form_post`: post these fields. */
|
|
1390
|
+
form_post?: TwoFactorParentAnswer['form_post'];
|
|
1391
|
+
/**
|
|
1392
|
+
* Set by a native sign-in under an OIDC parent when the sign-in completed; absent when the
|
|
1393
|
+
* relying party is told its request cannot be met.
|
|
1394
|
+
*/
|
|
1395
|
+
sign_in_method?: 'google' | 'other';
|
|
1337
1396
|
};
|
|
1338
1397
|
/**
|
|
1339
1398
|
* A sign-up, sign-in or password change that waits for the email to be proven.
|
|
@@ -1706,7 +1765,7 @@ export type AppSettingsConnection = {
|
|
|
1706
1765
|
* The public app-settings read (`GET /app/settings`) sends only `id`, `name`, `description`,
|
|
1707
1766
|
* `offline`, `type`, `custom_email_templates`, `auth_strategies`, the four registration and
|
|
1708
1767
|
* merge flags, `force_passwordless_login`, `login_app_theme`, `pkce_enabled`, `public_client`,
|
|
1709
|
-
* `connections` and `
|
|
1768
|
+
* `connections`, `defaults` and `google` when the server has them; the rest come with admin reads.
|
|
1710
1769
|
*/
|
|
1711
1770
|
export type AppSettings = {
|
|
1712
1771
|
id: string;
|
|
@@ -1762,9 +1821,28 @@ export type AppSettings = {
|
|
|
1762
1821
|
bot_mode?: BotMode;
|
|
1763
1822
|
/** Only when `human_only`. Absent on a `human_only` app means the built-in check. */
|
|
1764
1823
|
anti_bot?: AntiBotSettings;
|
|
1765
|
-
/**
|
|
1824
|
+
/**
|
|
1825
|
+
* Present only when the app offers Google and the server can verify Google ID tokens itself, so
|
|
1826
|
+
* the browser's own Google sign-in (FedCM) may be used. Absent means it is not available.
|
|
1827
|
+
*/
|
|
1828
|
+
google?: AppSettingsGoogle;
|
|
1829
|
+
/**
|
|
1830
|
+
* Present when a browser risk provider is on (with its public values) or the app's attack
|
|
1831
|
+
* protection may ask for a challenge; absent otherwise.
|
|
1832
|
+
*/
|
|
1766
1833
|
attack_protection?: AttackProtectionSettings;
|
|
1767
1834
|
};
|
|
1835
|
+
/** `AppSettings.google`: what the browser's own Google sign-in needs. Every value is public. */
|
|
1836
|
+
export type AppSettingsGoogle = {
|
|
1837
|
+
/** The app's Google OAuth client ID. */
|
|
1838
|
+
client_id: string;
|
|
1839
|
+
/** The FedCM config URL for a sign-in the user started (a click). */
|
|
1840
|
+
fedcm_active_config_url: string;
|
|
1841
|
+
/** The FedCM config URL for a sign-in offered when the page opens. */
|
|
1842
|
+
fedcm_passive_config_url: string;
|
|
1843
|
+
/** How this app receives its tokens. */
|
|
1844
|
+
token_delivery: 'json_body' | 'cookie' | 'mobile';
|
|
1845
|
+
};
|
|
1768
1846
|
/**
|
|
1769
1847
|
* The browser risk providers whose ids `POST /auth/login` and `POST /auth/register` carry. Each key
|
|
1770
1848
|
* is present only when that provider is on; `region` may be empty.
|
|
@@ -1777,6 +1855,8 @@ export type AttackProtectionSettings = {
|
|
|
1777
1855
|
stytch?: {
|
|
1778
1856
|
public_token: string;
|
|
1779
1857
|
};
|
|
1858
|
+
/** true when the app's attack protection may ask for a challenge; federated starts then go out as a POST. */
|
|
1859
|
+
challenge?: boolean;
|
|
1780
1860
|
};
|
|
1781
1861
|
/** `human_only`: every sign-in start must carry an anti-bot value in `X-Passflow-Anti-Bot`. */
|
|
1782
1862
|
export type BotMode = 'bot_friendly' | 'human_only';
|
|
@@ -1835,6 +1915,59 @@ export type PassflowFederatedStartBody = {
|
|
|
1835
1915
|
export type PassflowFederatedStartResponse = {
|
|
1836
1916
|
auth_url: string;
|
|
1837
1917
|
};
|
|
1918
|
+
/**
|
|
1919
|
+
* `Passflow.googleNativeSignIn`: a Google sign-in through the browser's own account picker (FedCM).
|
|
1920
|
+
*
|
|
1921
|
+
* The call has one cut point: the moment Google hands over the ID token. Before it, `signal` stops
|
|
1922
|
+
* the sign-in and nothing is sent to the server's complete route. From it on, the sign-in runs to
|
|
1923
|
+
* the server's answer and `signal` is ignored.
|
|
1924
|
+
*/
|
|
1925
|
+
export type PassflowGoogleNativePayload = {
|
|
1926
|
+
/** `active`: the user clicked a button. `passive`: offered when the page opens. */
|
|
1927
|
+
mode: 'active' | 'passive';
|
|
1928
|
+
/** Where the sign-in continues. Empty means nothing redirects. */
|
|
1929
|
+
redirect_url?: string;
|
|
1930
|
+
scopes?: string[];
|
|
1931
|
+
create_tenant?: boolean;
|
|
1932
|
+
invite_token?: string;
|
|
1933
|
+
/** The OIDC sign-in this one continues (the hosted login). */
|
|
1934
|
+
parent_challenge_id?: string;
|
|
1935
|
+
/**
|
|
1936
|
+
* Honoured until the ID token is in hand: an abort then rejects the call, posts nothing to the
|
|
1937
|
+
* complete route and emits no event. Ignored once the token is in hand.
|
|
1938
|
+
*/
|
|
1939
|
+
signal?: AbortSignal;
|
|
1940
|
+
/**
|
|
1941
|
+
* Called exactly once, when the ID token is in hand and the signal is not aborted, right before
|
|
1942
|
+
* the complete request. From here the call no longer honours `signal`.
|
|
1943
|
+
*/
|
|
1944
|
+
onToken?: () => void;
|
|
1945
|
+
};
|
|
1946
|
+
/** `POST /auth/federated/native/start/{provider}`. */
|
|
1947
|
+
export type PassflowFederatedNativeStartBody = {
|
|
1948
|
+
device: string;
|
|
1949
|
+
mode: 'active' | 'passive';
|
|
1950
|
+
redirect_url?: string;
|
|
1951
|
+
scopes: string[];
|
|
1952
|
+
create_tenant?: boolean;
|
|
1953
|
+
invite_token?: string;
|
|
1954
|
+
parent_challenge_id?: string;
|
|
1955
|
+
code_challenge?: string;
|
|
1956
|
+
code_challenge_method?: 'S256';
|
|
1957
|
+
};
|
|
1958
|
+
/** The answer of `POST /auth/federated/native/start/{provider}`. */
|
|
1959
|
+
export type PassflowFederatedNativeStartResponse = {
|
|
1960
|
+
challenge_id: string;
|
|
1961
|
+
/** The nonce the provider must put in the ID token. */
|
|
1962
|
+
nonce: string;
|
|
1963
|
+
/** Seconds the challenge stays valid. */
|
|
1964
|
+
expires_in: number;
|
|
1965
|
+
};
|
|
1966
|
+
/** `POST /auth/federated/native/complete/{provider}`. */
|
|
1967
|
+
export type PassflowFederatedNativeCompleteBody = {
|
|
1968
|
+
challenge_id: string;
|
|
1969
|
+
id_token: string;
|
|
1970
|
+
};
|
|
1838
1971
|
/** The identity provider protocol of an enterprise connection. */
|
|
1839
1972
|
export type PassflowEnterpriseProtocol = 'oidc' | 'saml';
|
|
1840
1973
|
/** One connection a picker can offer: nothing more of the connection is sent. */
|
|
@@ -2717,7 +2850,7 @@ export declare enum PassflowEvent {
|
|
|
2717
2850
|
* The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
|
|
2718
2851
|
* emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
|
|
2719
2852
|
*/
|
|
2720
|
-
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.trusted-devices.push.remove' | '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';
|
|
2853
|
+
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' | 'federated.native' | '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.trusted-devices.push.remove' | '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';
|
|
2721
2854
|
/**
|
|
2722
2855
|
* Error payload interface for structured error information
|
|
2723
2856
|
*/
|
|
@@ -2756,6 +2889,8 @@ type PassflowEventPayload = {
|
|
|
2756
2889
|
source?: 'federated-landing' | 'tokens-in-url' | 'oidc-landing';
|
|
2757
2890
|
/** For `source: 'tokens-in-url'`: the `state` the URL carried with the tokens, when it had one. */
|
|
2758
2891
|
state?: string;
|
|
2892
|
+
/** Set only with `source: 'federated-landing'`: the provider the redirect was started with. */
|
|
2893
|
+
provider?: string;
|
|
2759
2894
|
};
|
|
2760
2895
|
[PassflowEvent.SignInStart]: {
|
|
2761
2896
|
email?: string;
|
|
@@ -3142,6 +3277,19 @@ export declare class AuthAPI {
|
|
|
3142
3277
|
* challenge cookie the answer sets.
|
|
3143
3278
|
*/
|
|
3144
3279
|
federatedStart(provider: string, body: PassflowFederatedStartBody, options?: PassflowAuthOptions): Promise<PassflowFederatedStartResponse>;
|
|
3280
|
+
/**
|
|
3281
|
+
* Starts a native sign-in with the provider (the browser's own account picker) and answers the
|
|
3282
|
+
* nonce the ID token must carry. Anti-bot covered as a federated start, and sent with
|
|
3283
|
+
* credentials, so the browser keeps the binding cookie the hosted login's answer sets. `signal`
|
|
3284
|
+
* cancels the request.
|
|
3285
|
+
*/
|
|
3286
|
+
federatedNativeStart(provider: string, body: PassflowFederatedNativeStartBody, options?: PassflowAuthOptions, signal?: AbortSignal): Promise<PassflowFederatedNativeStartResponse>;
|
|
3287
|
+
/**
|
|
3288
|
+
* Completes a native sign-in with the provider's ID token. The body holds the token, so a
|
|
3289
|
+
* failure rejects with a plain `PassflowError`. `deviceProof`: a `use: "sign_in"` device proof,
|
|
3290
|
+
* sent as `X-Passflow-Device-Proof`.
|
|
3291
|
+
*/
|
|
3292
|
+
federatedNativeComplete(provider: string, body: PassflowFederatedNativeCompleteBody, options?: PassflowAuthOptions, deviceProof?: string): Promise<PassflowAuthorizationResponse>;
|
|
3145
3293
|
/** Which enterprise connections the app offers for the email's domain. Not anti-bot covered. */
|
|
3146
3294
|
enterpriseResolve(email: string): Promise<PassflowEnterpriseResolveResponse>;
|
|
3147
3295
|
/**
|
|
@@ -5099,26 +5247,39 @@ export declare class AuthService {
|
|
|
5099
5247
|
resetPassword(newPassword: string, scopes?: string[], token?: string): Promise<PassflowAuthorizationResponse>;
|
|
5100
5248
|
passkeyRegister(payload: PassflowPasskeyRegisterStartPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
5101
5249
|
passkeyAuthenticate(payload: PassflowPasskeyAuthenticateStartPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
5250
|
+
/**
|
|
5251
|
+
* The app's `google` block when the browser's own Google sign-in can be used here; undefined
|
|
5252
|
+
* when the platform lacks it, the settings cannot be read or have no block, or the app gets its
|
|
5253
|
+
* tokens as cookies and this page is on another origin than the Passflow server.
|
|
5254
|
+
*/
|
|
5255
|
+
private googleNativeSettings;
|
|
5256
|
+
/** Whether `googleNativeSignIn` can be used on this page. Never throws. */
|
|
5257
|
+
googleNativeAvailable(): Promise<boolean>;
|
|
5258
|
+
googleNativeSignIn(payload: PassflowGoogleNativePayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
5102
5259
|
/**
|
|
5103
5260
|
* Whether a federated start goes out as a POST (`AuthAPI.federatedStart`) rather than as a
|
|
5104
5261
|
* navigation to `createFederatedAuthUrl`: on a `human_only` app, whose start must carry the
|
|
5105
|
-
* anti-bot header
|
|
5106
|
-
*
|
|
5262
|
+
* anti-bot header; when the settings carry `attack_protection.challenge: true`, so a forced
|
|
5263
|
+
* challenge can be answered and the start resent; and for an agent tool, whose start must carry
|
|
5264
|
+
* its own header. A header cannot ride a navigation. Unknown or unreadable settings keep the
|
|
5265
|
+
* navigation.
|
|
5107
5266
|
*/
|
|
5108
5267
|
private usesFederatedPost;
|
|
5109
5268
|
/** The body of a POST federated start: the same fields the GET start sends as query parameters. */
|
|
5110
5269
|
private federatedStartBody;
|
|
5111
5270
|
/**
|
|
5112
5271
|
* The GET start URL. A `human_only` app refuses a start by navigation (403
|
|
5113
|
-
* `error.api.anti_bot.required`)
|
|
5114
|
-
*
|
|
5272
|
+
* `error.api.anti_bot.required`), and a navigation cannot pass a forced challenge when the app's
|
|
5273
|
+
* attack protection may ask for one; `federatedAuthWithPopup` and `federatedAuthWithRedirect`
|
|
5274
|
+
* POST the start in both cases instead.
|
|
5115
5275
|
*/
|
|
5116
5276
|
createFederatedAuthUrl(payload: PassflowFederatedAuthExtendedPayload): string;
|
|
5117
5277
|
/** The query of a GET start: the same fields `federatedStartBody` sends in a POST, as strings. */
|
|
5118
5278
|
private federatedStartQuery;
|
|
5119
5279
|
/**
|
|
5120
5280
|
* The GET enterprise start, for a top-level navigation. Sends the device id and every field
|
|
5121
|
-
* `createFederatedAuthUrl` sends. A `human_only` app refuses it (403)
|
|
5281
|
+
* `createFederatedAuthUrl` sends. A `human_only` app refuses it (403), and it cannot pass a
|
|
5282
|
+
* forced challenge when the app's attack protection may ask for one: use `enterpriseStart`.
|
|
5122
5283
|
* Its refusals land on the server's error page, not on `redirect_url`. It creates no PKCE pair.
|
|
5123
5284
|
* @throws Error when no app id is set
|
|
5124
5285
|
*/
|
|
@@ -7452,8 +7613,9 @@ export declare class Passflow {
|
|
|
7452
7613
|
/**
|
|
7453
7614
|
* The address of a GET enterprise start, for a plain link or a server-rendered page.
|
|
7454
7615
|
*
|
|
7455
|
-
* Sends no request and emits no event. A `human_only` app refuses this form with 403,
|
|
7456
|
-
*
|
|
7616
|
+
* Sends no request and emits no event. A `human_only` app refuses this form with 403, it cannot
|
|
7617
|
+
* pass a forced challenge when the app's attack protection may ask for one, and every refusal
|
|
7618
|
+
* lands on the server's error page, not on the app. A sign-in button and its picker use
|
|
7457
7619
|
* `enterpriseStart()` or the federated flows with `conn_<connection_id>` instead. No PKCE pair is
|
|
7458
7620
|
* created: on a PKCE app, pass your own `code_challenge` and keep the verifier.
|
|
7459
7621
|
*
|
|
@@ -7732,6 +7894,63 @@ export declare class Passflow {
|
|
|
7732
7894
|
* ```
|
|
7733
7895
|
*/
|
|
7734
7896
|
passkeyAuthenticate(payload: PassflowPasskeyAuthenticateStartPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
7897
|
+
/**
|
|
7898
|
+
* Whether `googleNativeSignIn` can be used on this page: the browser has its own Google sign-in
|
|
7899
|
+
* (FedCM with `mode` and `params`), the app's settings carry a `google` block, and the app does
|
|
7900
|
+
* not get its tokens as cookies while this page is on another origin than the Passflow server.
|
|
7901
|
+
* Never throws: any failure answers `false`.
|
|
7902
|
+
*/
|
|
7903
|
+
googleNativeAvailable(): Promise<boolean>;
|
|
7904
|
+
/**
|
|
7905
|
+
* Signs in with Google through the browser's own account picker (FedCM), without leaving the
|
|
7906
|
+
* page. The picker is always shown: the user chooses the account.
|
|
7907
|
+
*
|
|
7908
|
+
* The result has the shapes every sign-in has:
|
|
7909
|
+
* - tokens (saved, a `SignIn` event emitted);
|
|
7910
|
+
* - `tfa_token`: a second factor is owed (a `TwoFactorRequired` event emitted);
|
|
7911
|
+
* - `email_verification_required`: the email must be proven first, finish with `verifyEmailCode`;
|
|
7912
|
+
* - under an OIDC parent: `redirect_url` or `form_post`, with `sign_in_method` when the sign-in
|
|
7913
|
+
* completed, as the server sent it.
|
|
7914
|
+
*
|
|
7915
|
+
* It rejects with `NativeSignInError` when Google returned no token, and emits no `Error` event
|
|
7916
|
+
* for it. `reason`:
|
|
7917
|
+
* - `'unsupported'`: this page cannot use the native sign-in, or the click's activation ran out;
|
|
7918
|
+
* - `'provider'`: Google refused after the user chose an account;
|
|
7919
|
+
* - `'dismissed'`: the user closed the picker, or the browser would not show it.
|
|
7920
|
+
*
|
|
7921
|
+
* After a click (`mode: 'active'`), on `'unsupported'` or `'provider'` the caller should fall
|
|
7922
|
+
* back to `federatedAuthWithRedirect`. A `'dismissed'` should leave the page as it is.
|
|
7923
|
+
* A page-open call (`mode: 'passive'`) must never fall back to `federatedAuthWithRedirect`: while
|
|
7924
|
+
* the browser's cool-down after a dismissed prompt lasts it fails with `'unsupported'`, and a
|
|
7925
|
+
* fallback would redirect the page as it loads. On any rejection, leave the page as it is.
|
|
7926
|
+
*
|
|
7927
|
+
* `mode: 'passive'` (offered when the page opens) stays silent until the user has chosen an
|
|
7928
|
+
* account: a refused start emits no `Error` event. A refused complete emits one in both modes,
|
|
7929
|
+
* with operation `'federated.native'`.
|
|
7930
|
+
*
|
|
7931
|
+
* `payload.signal` aborts the call until Google returns the ID token: nothing is sent to the
|
|
7932
|
+
* complete route, no event is emitted, and the call rejects with the signal's reason (an
|
|
7933
|
+
* `AbortError` `DOMException` when the signal has none). Once the token is in hand,
|
|
7934
|
+
* `payload.onToken` is called once and the call runs to the server's answer, ignoring the signal.
|
|
7935
|
+
*
|
|
7936
|
+
* @example
|
|
7937
|
+
* ```typescript
|
|
7938
|
+
* try {
|
|
7939
|
+
* const response = await passflow.googleNativeSignIn({ mode: 'active' });
|
|
7940
|
+
* } catch (error) {
|
|
7941
|
+
* if (error instanceof NativeSignInError) {
|
|
7942
|
+
* // The user closed the picker: leave the page as it is.
|
|
7943
|
+
* if (error.reason === 'dismissed') return;
|
|
7944
|
+
* // 'unsupported' or 'provider': sign in through Google's own page instead.
|
|
7945
|
+
* passflow.federatedAuthWithRedirect({ provider: 'google' });
|
|
7946
|
+
* return;
|
|
7947
|
+
* }
|
|
7948
|
+
* // The server refused the sign-in: show the error to the user.
|
|
7949
|
+
* throw error;
|
|
7950
|
+
* }
|
|
7951
|
+
* ```
|
|
7952
|
+
*/
|
|
7953
|
+
googleNativeSignIn(payload: PassflowGoogleNativePayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
7735
7954
|
/**
|
|
7736
7955
|
* Manually set tokens (useful after custom authentication flows).
|
|
7737
7956
|
* This will save tokens to storage, update cache, and trigger SignIn event.
|
|
@@ -8565,4 +8784,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
8565
8784
|
* @returns true if valid username format, false otherwise
|
|
8566
8785
|
*/
|
|
8567
8786
|
export declare function isValidUsername(username: string): boolean;
|
|
8568
|
-
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, RiskIdContext, RiskIdOperation, RiskIdProvider, 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 };
|
|
8787
|
+
export type { AntiBotAppSettings, AntiBotDeviceContext, AntiBotOperation, AntiBotTokenContext, AntiBotTokenProvider, AntiBotTokenRequest, AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, DeviceProofUse, DevicePushProofUse, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, IdentityCredentialRequest, IdentityCredentialSupport, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, NativeSignInErrorReason, 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, RiskIdContext, RiskIdOperation, RiskIdProvider, 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 };
|