@passflow/core 0.45.0 → 0.47.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 +39 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +237 -3
- package/dist/index.d.ts +237 -3
- package/dist/index.mjs +1521 -1308
- 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",
|
|
@@ -1135,6 +1187,7 @@ export declare enum PassflowEndpointPaths {
|
|
|
1135
1187
|
TwoFactorPushStatus = "/v2/auth/2fa/push/status",
|
|
1136
1188
|
TwoFactorTrustedDevices = "/v2/user/2fa/trusted-devices",
|
|
1137
1189
|
TwoFactorTrustedDeviceRevoke = "/v2/user/2fa/trusted-devices/:id",
|
|
1190
|
+
TwoFactorTrustedDevicePushRemove = "/v2/user/2fa/trusted-devices/:id/push",
|
|
1138
1191
|
TwoFactorPreferredMethod = "/v2/user/2fa/preferred-method",
|
|
1139
1192
|
cliAuthStatus = "/cli/auth/status/:sessionId",
|
|
1140
1193
|
cliAuthComplete = "/cli/auth/complete",
|
|
@@ -1333,6 +1386,13 @@ export type PassflowAuthorizationResponse = Tokens & {
|
|
|
1333
1386
|
message?: string;
|
|
1334
1387
|
/** Base64url (no padding) SHA-256 of the refresh token issued with this answer. */
|
|
1335
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';
|
|
1336
1396
|
};
|
|
1337
1397
|
/**
|
|
1338
1398
|
* A sign-up, sign-in or password change that waits for the email to be proven.
|
|
@@ -1705,7 +1765,7 @@ export type AppSettingsConnection = {
|
|
|
1705
1765
|
* The public app-settings read (`GET /app/settings`) sends only `id`, `name`, `description`,
|
|
1706
1766
|
* `offline`, `type`, `custom_email_templates`, `auth_strategies`, the four registration and
|
|
1707
1767
|
* merge flags, `force_passwordless_login`, `login_app_theme`, `pkce_enabled`, `public_client`,
|
|
1708
|
-
* `connections` and `
|
|
1768
|
+
* `connections`, `defaults` and `google` when the server has them; the rest come with admin reads.
|
|
1709
1769
|
*/
|
|
1710
1770
|
export type AppSettings = {
|
|
1711
1771
|
id: string;
|
|
@@ -1761,9 +1821,25 @@ export type AppSettings = {
|
|
|
1761
1821
|
bot_mode?: BotMode;
|
|
1762
1822
|
/** Only when `human_only`. Absent on a `human_only` app means the built-in check. */
|
|
1763
1823
|
anti_bot?: AntiBotSettings;
|
|
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;
|
|
1764
1829
|
/** The public values of the browser risk providers the app has on; absent when none is on. */
|
|
1765
1830
|
attack_protection?: AttackProtectionSettings;
|
|
1766
1831
|
};
|
|
1832
|
+
/** `AppSettings.google`: what the browser's own Google sign-in needs. Every value is public. */
|
|
1833
|
+
export type AppSettingsGoogle = {
|
|
1834
|
+
/** The app's Google OAuth client ID. */
|
|
1835
|
+
client_id: string;
|
|
1836
|
+
/** The FedCM config URL for a sign-in the user started (a click). */
|
|
1837
|
+
fedcm_active_config_url: string;
|
|
1838
|
+
/** The FedCM config URL for a sign-in offered when the page opens. */
|
|
1839
|
+
fedcm_passive_config_url: string;
|
|
1840
|
+
/** How this app receives its tokens. */
|
|
1841
|
+
token_delivery: 'json_body' | 'cookie' | 'mobile';
|
|
1842
|
+
};
|
|
1767
1843
|
/**
|
|
1768
1844
|
* The browser risk providers whose ids `POST /auth/login` and `POST /auth/register` carry. Each key
|
|
1769
1845
|
* is present only when that provider is on; `region` may be empty.
|
|
@@ -1834,6 +1910,59 @@ export type PassflowFederatedStartBody = {
|
|
|
1834
1910
|
export type PassflowFederatedStartResponse = {
|
|
1835
1911
|
auth_url: string;
|
|
1836
1912
|
};
|
|
1913
|
+
/**
|
|
1914
|
+
* `Passflow.googleNativeSignIn`: a Google sign-in through the browser's own account picker (FedCM).
|
|
1915
|
+
*
|
|
1916
|
+
* The call has one cut point: the moment Google hands over the ID token. Before it, `signal` stops
|
|
1917
|
+
* the sign-in and nothing is sent to the server's complete route. From it on, the sign-in runs to
|
|
1918
|
+
* the server's answer and `signal` is ignored.
|
|
1919
|
+
*/
|
|
1920
|
+
export type PassflowGoogleNativePayload = {
|
|
1921
|
+
/** `active`: the user clicked a button. `passive`: offered when the page opens. */
|
|
1922
|
+
mode: 'active' | 'passive';
|
|
1923
|
+
/** Where the sign-in continues. Empty means nothing redirects. */
|
|
1924
|
+
redirect_url?: string;
|
|
1925
|
+
scopes?: string[];
|
|
1926
|
+
create_tenant?: boolean;
|
|
1927
|
+
invite_token?: string;
|
|
1928
|
+
/** The OIDC sign-in this one continues (the hosted login). */
|
|
1929
|
+
parent_challenge_id?: string;
|
|
1930
|
+
/**
|
|
1931
|
+
* Honoured until the ID token is in hand: an abort then rejects the call, posts nothing to the
|
|
1932
|
+
* complete route and emits no event. Ignored once the token is in hand.
|
|
1933
|
+
*/
|
|
1934
|
+
signal?: AbortSignal;
|
|
1935
|
+
/**
|
|
1936
|
+
* Called exactly once, when the ID token is in hand and the signal is not aborted, right before
|
|
1937
|
+
* the complete request. From here the call no longer honours `signal`.
|
|
1938
|
+
*/
|
|
1939
|
+
onToken?: () => void;
|
|
1940
|
+
};
|
|
1941
|
+
/** `POST /auth/federated/native/start/{provider}`. */
|
|
1942
|
+
export type PassflowFederatedNativeStartBody = {
|
|
1943
|
+
device: string;
|
|
1944
|
+
mode: 'active' | 'passive';
|
|
1945
|
+
redirect_url?: string;
|
|
1946
|
+
scopes: string[];
|
|
1947
|
+
create_tenant?: boolean;
|
|
1948
|
+
invite_token?: string;
|
|
1949
|
+
parent_challenge_id?: string;
|
|
1950
|
+
code_challenge?: string;
|
|
1951
|
+
code_challenge_method?: 'S256';
|
|
1952
|
+
};
|
|
1953
|
+
/** The answer of `POST /auth/federated/native/start/{provider}`. */
|
|
1954
|
+
export type PassflowFederatedNativeStartResponse = {
|
|
1955
|
+
challenge_id: string;
|
|
1956
|
+
/** The nonce the provider must put in the ID token. */
|
|
1957
|
+
nonce: string;
|
|
1958
|
+
/** Seconds the challenge stays valid. */
|
|
1959
|
+
expires_in: number;
|
|
1960
|
+
};
|
|
1961
|
+
/** `POST /auth/federated/native/complete/{provider}`. */
|
|
1962
|
+
export type PassflowFederatedNativeCompleteBody = {
|
|
1963
|
+
challenge_id: string;
|
|
1964
|
+
id_token: string;
|
|
1965
|
+
};
|
|
1837
1966
|
/** The identity provider protocol of an enterprise connection. */
|
|
1838
1967
|
export type PassflowEnterpriseProtocol = 'oidc' | 'saml';
|
|
1839
1968
|
/** One connection a picker can offer: nothing more of the connection is sent. */
|
|
@@ -2716,7 +2845,7 @@ export declare enum PassflowEvent {
|
|
|
2716
2845
|
* The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
|
|
2717
2846
|
* emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
|
|
2718
2847
|
*/
|
|
2719
|
-
type PassflowOperation = 'sign-in' | 'sign-up' | 'passwordless.start' | 'passwordless.complete' | 'passwordless.wait' | 'passwordless.approval' | 'password-reset.send' | 'password-reset.complete' | 'email-verification.complete' | 'passkey.register' | 'passkey.authenticate' | 'federated.popup' | 'federated.redirect' | 'enterprise.resolve' | 'enterprise.start' | 'auth-redirect.url' | 'auth-redirect' | 'redirect.check' | 'auth.is-authenticated' | 'session.check' | 'session.list' | 'session.revoke' | 'session.revoke-others' | 'tokens.get' | 'tokens.load' | 'tokens.from-url' | 'oidc.redirect' | 'refresh' | 'upgrade.commit' | 'log-out' | 'reset' | 'anti-bot.token' | 'device-key.enrol' | 'settings.app' | 'settings.all' | 'settings.password-policy' | 'settings.passkey' | 'passkey.list' | 'passkey.rename' | 'passkey.delete' | 'passkey.add' | 'tenant.create' | 'invitation.join' | 'invitation.request-link' | 'invitation.list' | 'invitation.delete' | 'invitation.resend' | 'invitation.get-link' | '2fa.status' | '2fa.setup.begin' | '2fa.setup.confirm' | '2fa.enrollment.read' | '2fa.enrollment.setup-link' | '2fa.verify' | '2fa.recovery.use' | '2fa.disable' | '2fa.recovery.regenerate' | '2fa.methods.available' | '2fa.methods.registered' | '2fa.method.setup.start' | '2fa.method.setup.complete' | '2fa.method.remove' | '2fa.challenge.request' | '2fa.challenge.verify' | '2fa.method.switch' | '2fa.push.status' | '2fa.trusted-devices.list' | '2fa.trusted-devices.revoke' | '2fa.preferred-method.read' | '2fa.preferred-method.set' | '2fa.preferred-method.clear' | '2fa.recovery-codes.start' | '2fa.recovery-codes.complete' | 'profile.update' | 'profile.address-proof';
|
|
2848
|
+
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';
|
|
2720
2849
|
/**
|
|
2721
2850
|
* Error payload interface for structured error information
|
|
2722
2851
|
*/
|
|
@@ -2755,6 +2884,8 @@ type PassflowEventPayload = {
|
|
|
2755
2884
|
source?: 'federated-landing' | 'tokens-in-url' | 'oidc-landing';
|
|
2756
2885
|
/** For `source: 'tokens-in-url'`: the `state` the URL carried with the tokens, when it had one. */
|
|
2757
2886
|
state?: string;
|
|
2887
|
+
/** Set only with `source: 'federated-landing'`: the provider the redirect was started with. */
|
|
2888
|
+
provider?: string;
|
|
2758
2889
|
};
|
|
2759
2890
|
[PassflowEvent.SignInStart]: {
|
|
2760
2891
|
email?: string;
|
|
@@ -3141,6 +3272,19 @@ export declare class AuthAPI {
|
|
|
3141
3272
|
* challenge cookie the answer sets.
|
|
3142
3273
|
*/
|
|
3143
3274
|
federatedStart(provider: string, body: PassflowFederatedStartBody, options?: PassflowAuthOptions): Promise<PassflowFederatedStartResponse>;
|
|
3275
|
+
/**
|
|
3276
|
+
* Starts a native sign-in with the provider (the browser's own account picker) and answers the
|
|
3277
|
+
* nonce the ID token must carry. Anti-bot covered as a federated start, and sent with
|
|
3278
|
+
* credentials, so the browser keeps the binding cookie the hosted login's answer sets. `signal`
|
|
3279
|
+
* cancels the request.
|
|
3280
|
+
*/
|
|
3281
|
+
federatedNativeStart(provider: string, body: PassflowFederatedNativeStartBody, options?: PassflowAuthOptions, signal?: AbortSignal): Promise<PassflowFederatedNativeStartResponse>;
|
|
3282
|
+
/**
|
|
3283
|
+
* Completes a native sign-in with the provider's ID token. The body holds the token, so a
|
|
3284
|
+
* failure rejects with a plain `PassflowError`. `deviceProof`: a `use: "sign_in"` device proof,
|
|
3285
|
+
* sent as `X-Passflow-Device-Proof`.
|
|
3286
|
+
*/
|
|
3287
|
+
federatedNativeComplete(provider: string, body: PassflowFederatedNativeCompleteBody, options?: PassflowAuthOptions, deviceProof?: string): Promise<PassflowAuthorizationResponse>;
|
|
3144
3288
|
/** Which enterprise connections the app offers for the email's domain. Not anti-bot covered. */
|
|
3145
3289
|
enterpriseResolve(email: string): Promise<PassflowEnterpriseResolveResponse>;
|
|
3146
3290
|
/**
|
|
@@ -3698,6 +3842,12 @@ export declare class TwoFactorApiClient {
|
|
|
3698
3842
|
* The server answers 404 when the user has no such device.
|
|
3699
3843
|
*/
|
|
3700
3844
|
revokeTrustedDevice(deviceId: string): Promise<void>;
|
|
3845
|
+
/**
|
|
3846
|
+
* Turn off sign-in approvals (push) on one trusted device
|
|
3847
|
+
* DELETE /v2/user/2fa/trusted-devices/:id/push
|
|
3848
|
+
* The device key and trust grant stay. The server answers 404 when the user has no such device.
|
|
3849
|
+
*/
|
|
3850
|
+
removeTrustedDevicePush(deviceId: string): Promise<void>;
|
|
3701
3851
|
/**
|
|
3702
3852
|
* Get the user's preferred 2FA method
|
|
3703
3853
|
* GET /v2/user/2fa/preferred-method
|
|
@@ -5092,6 +5242,15 @@ export declare class AuthService {
|
|
|
5092
5242
|
resetPassword(newPassword: string, scopes?: string[], token?: string): Promise<PassflowAuthorizationResponse>;
|
|
5093
5243
|
passkeyRegister(payload: PassflowPasskeyRegisterStartPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
5094
5244
|
passkeyAuthenticate(payload: PassflowPasskeyAuthenticateStartPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
5245
|
+
/**
|
|
5246
|
+
* The app's `google` block when the browser's own Google sign-in can be used here; undefined
|
|
5247
|
+
* when the platform lacks it, the settings cannot be read or have no block, or the app gets its
|
|
5248
|
+
* tokens as cookies and this page is on another origin than the Passflow server.
|
|
5249
|
+
*/
|
|
5250
|
+
private googleNativeSettings;
|
|
5251
|
+
/** Whether `googleNativeSignIn` can be used on this page. Never throws. */
|
|
5252
|
+
googleNativeAvailable(): Promise<boolean>;
|
|
5253
|
+
googleNativeSignIn(payload: PassflowGoogleNativePayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
5095
5254
|
/**
|
|
5096
5255
|
* Whether a federated start goes out as a POST (`AuthAPI.federatedStart`) rather than as a
|
|
5097
5256
|
* navigation to `createFederatedAuthUrl`: on a `human_only` app, whose start must carry the
|
|
@@ -5755,6 +5914,11 @@ export declare class TwoFactorService {
|
|
|
5755
5914
|
* Rejects with the server's 404 when the user has no such device.
|
|
5756
5915
|
*/
|
|
5757
5916
|
revokeTrustedDevice(deviceId: string): Promise<void>;
|
|
5917
|
+
/**
|
|
5918
|
+
* Turn off sign-in approvals on a trusted device. It stays trusted and keeps its device
|
|
5919
|
+
* key. Rejects with the server's 404 when the user has no such device.
|
|
5920
|
+
*/
|
|
5921
|
+
removeTrustedDevicePush(deviceId: string): Promise<void>;
|
|
5758
5922
|
/**
|
|
5759
5923
|
* The method the user prefers as their second factor on this app, or `null` when there is
|
|
5760
5924
|
* none the app can use now.
|
|
@@ -7720,6 +7884,63 @@ export declare class Passflow {
|
|
|
7720
7884
|
* ```
|
|
7721
7885
|
*/
|
|
7722
7886
|
passkeyAuthenticate(payload: PassflowPasskeyAuthenticateStartPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
7887
|
+
/**
|
|
7888
|
+
* Whether `googleNativeSignIn` can be used on this page: the browser has its own Google sign-in
|
|
7889
|
+
* (FedCM with `mode` and `params`), the app's settings carry a `google` block, and the app does
|
|
7890
|
+
* not get its tokens as cookies while this page is on another origin than the Passflow server.
|
|
7891
|
+
* Never throws: any failure answers `false`.
|
|
7892
|
+
*/
|
|
7893
|
+
googleNativeAvailable(): Promise<boolean>;
|
|
7894
|
+
/**
|
|
7895
|
+
* Signs in with Google through the browser's own account picker (FedCM), without leaving the
|
|
7896
|
+
* page. The picker is always shown: the user chooses the account.
|
|
7897
|
+
*
|
|
7898
|
+
* The result has the shapes every sign-in has:
|
|
7899
|
+
* - tokens (saved, a `SignIn` event emitted);
|
|
7900
|
+
* - `tfa_token`: a second factor is owed (a `TwoFactorRequired` event emitted);
|
|
7901
|
+
* - `email_verification_required`: the email must be proven first, finish with `verifyEmailCode`;
|
|
7902
|
+
* - under an OIDC parent: `redirect_url` or `form_post`, with `sign_in_method` when the sign-in
|
|
7903
|
+
* completed, as the server sent it.
|
|
7904
|
+
*
|
|
7905
|
+
* It rejects with `NativeSignInError` when Google returned no token, and emits no `Error` event
|
|
7906
|
+
* for it. `reason`:
|
|
7907
|
+
* - `'unsupported'`: this page cannot use the native sign-in, or the click's activation ran out;
|
|
7908
|
+
* - `'provider'`: Google refused after the user chose an account;
|
|
7909
|
+
* - `'dismissed'`: the user closed the picker, or the browser would not show it.
|
|
7910
|
+
*
|
|
7911
|
+
* After a click (`mode: 'active'`), on `'unsupported'` or `'provider'` the caller should fall
|
|
7912
|
+
* back to `federatedAuthWithRedirect`. A `'dismissed'` should leave the page as it is.
|
|
7913
|
+
* A page-open call (`mode: 'passive'`) must never fall back to `federatedAuthWithRedirect`: while
|
|
7914
|
+
* the browser's cool-down after a dismissed prompt lasts it fails with `'unsupported'`, and a
|
|
7915
|
+
* fallback would redirect the page as it loads. On any rejection, leave the page as it is.
|
|
7916
|
+
*
|
|
7917
|
+
* `mode: 'passive'` (offered when the page opens) stays silent until the user has chosen an
|
|
7918
|
+
* account: a refused start emits no `Error` event. A refused complete emits one in both modes,
|
|
7919
|
+
* with operation `'federated.native'`.
|
|
7920
|
+
*
|
|
7921
|
+
* `payload.signal` aborts the call until Google returns the ID token: nothing is sent to the
|
|
7922
|
+
* complete route, no event is emitted, and the call rejects with the signal's reason (an
|
|
7923
|
+
* `AbortError` `DOMException` when the signal has none). Once the token is in hand,
|
|
7924
|
+
* `payload.onToken` is called once and the call runs to the server's answer, ignoring the signal.
|
|
7925
|
+
*
|
|
7926
|
+
* @example
|
|
7927
|
+
* ```typescript
|
|
7928
|
+
* try {
|
|
7929
|
+
* const response = await passflow.googleNativeSignIn({ mode: 'active' });
|
|
7930
|
+
* } catch (error) {
|
|
7931
|
+
* if (error instanceof NativeSignInError) {
|
|
7932
|
+
* // The user closed the picker: leave the page as it is.
|
|
7933
|
+
* if (error.reason === 'dismissed') return;
|
|
7934
|
+
* // 'unsupported' or 'provider': sign in through Google's own page instead.
|
|
7935
|
+
* passflow.federatedAuthWithRedirect({ provider: 'google' });
|
|
7936
|
+
* return;
|
|
7937
|
+
* }
|
|
7938
|
+
* // The server refused the sign-in: show the error to the user.
|
|
7939
|
+
* throw error;
|
|
7940
|
+
* }
|
|
7941
|
+
* ```
|
|
7942
|
+
*/
|
|
7943
|
+
googleNativeSignIn(payload: PassflowGoogleNativePayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
7723
7944
|
/**
|
|
7724
7945
|
* Manually set tokens (useful after custom authentication flows).
|
|
7725
7946
|
* This will save tokens to storage, update cache, and trigger SignIn event.
|
|
@@ -8320,6 +8541,19 @@ export declare class Passflow {
|
|
|
8320
8541
|
* ```
|
|
8321
8542
|
*/
|
|
8322
8543
|
revokeTrustedDevice(id: string): Promise<void>;
|
|
8544
|
+
/**
|
|
8545
|
+
* Turn off sign-in approvals (push) on one of the signed-in user's trusted devices. The device
|
|
8546
|
+
* stays trusted and keeps its device key; it no longer gets approval requests.
|
|
8547
|
+
*
|
|
8548
|
+
* @param deviceId - The trusted device's `id` from `getTrustedDevices()`
|
|
8549
|
+
* @throws {PassflowError} If the request fails, including a 404 for an unknown id
|
|
8550
|
+
*
|
|
8551
|
+
* @example
|
|
8552
|
+
* ```typescript
|
|
8553
|
+
* await passflow.removeTrustedDevicePush(device.id);
|
|
8554
|
+
* ```
|
|
8555
|
+
*/
|
|
8556
|
+
removeTrustedDevicePush(deviceId: string): Promise<void>;
|
|
8323
8557
|
/**
|
|
8324
8558
|
* Read the second factor the signed-in user prefers on this app.
|
|
8325
8559
|
*
|
|
@@ -8540,4 +8774,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
8540
8774
|
* @returns true if valid username format, false otherwise
|
|
8541
8775
|
*/
|
|
8542
8776
|
export declare function isValidUsername(username: string): boolean;
|
|
8543
|
-
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 };
|
|
8777
|
+
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 };
|