@passflow/core 0.44.0 → 0.46.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 +30 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +158 -9
- package/dist/index.d.ts +158 -9
- package/dist/index.mjs +1392 -1308
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1135,6 +1135,7 @@ export declare enum PassflowEndpointPaths {
|
|
|
1135
1135
|
TwoFactorPushStatus = "/v2/auth/2fa/push/status",
|
|
1136
1136
|
TwoFactorTrustedDevices = "/v2/user/2fa/trusted-devices",
|
|
1137
1137
|
TwoFactorTrustedDeviceRevoke = "/v2/user/2fa/trusted-devices/:id",
|
|
1138
|
+
TwoFactorTrustedDevicePushRemove = "/v2/user/2fa/trusted-devices/:id/push",
|
|
1138
1139
|
TwoFactorPreferredMethod = "/v2/user/2fa/preferred-method",
|
|
1139
1140
|
cliAuthStatus = "/cli/auth/status/:sessionId",
|
|
1140
1141
|
cliAuthComplete = "/cli/auth/complete",
|
|
@@ -1412,6 +1413,8 @@ export declare const PASSWORD_CHANGE_REQUIRED_ERROR_ID = "error.api.password.cha
|
|
|
1412
1413
|
export declare const ANTI_BOT_REQUIRED_ERROR_ID = "error.api.anti_bot.required";
|
|
1413
1414
|
/** The anti-bot value was wrong, expired or used before (403). The built-in check is resent once. */
|
|
1414
1415
|
export declare const ANTI_BOT_FAILED_ERROR_ID = "error.api.anti_bot.failed";
|
|
1416
|
+
/** Attack protection refused the sign-in before the credential was checked (403). Not resent. */
|
|
1417
|
+
export declare const SIGN_IN_REFUSED_ERROR_ID = "error.api.sign_in.refused";
|
|
1415
1418
|
/** The server could not check the anti-bot value right now (503, `Retry-After`). */
|
|
1416
1419
|
export declare const ANTI_BOT_UNAVAILABLE_ERROR_ID = "error.api.anti_bot.unavailable";
|
|
1417
1420
|
/** A `human_only` app uses its own provider and `setAntiBotTokenProvider()` was not called. */
|
|
@@ -1489,6 +1492,20 @@ export declare class PassflowRecoveryCodesStepUpRequiredError extends PassflowEr
|
|
|
1489
1492
|
cause?: unknown;
|
|
1490
1493
|
});
|
|
1491
1494
|
}
|
|
1495
|
+
/**
|
|
1496
|
+
* A 403 `error.api.anti_bot.required` or `error.api.anti_bot.failed` that names the check to pass:
|
|
1497
|
+
* the server's attack protection asked for it, also on a `bot_friendly` app. The SDK resends a
|
|
1498
|
+
* covered call once with a value for that check; this error is what a second refusal, or a request
|
|
1499
|
+
* the SDK does not send itself, rejects with. To answer it yourself, pass `antiBot` to
|
|
1500
|
+
* `antiBotToken({ operation, settings: { bot_mode: 'human_only', anti_bot: antiBot } })`.
|
|
1501
|
+
*/
|
|
1502
|
+
export declare class PassflowAntiBotChallengeError extends PassflowError {
|
|
1503
|
+
/** The check the server asks for: its provider and, for the customer's own provider, the site key. */
|
|
1504
|
+
readonly antiBot: AntiBotSettings;
|
|
1505
|
+
constructor(error: PassflowResponseError['error'], antiBot: AntiBotSettings, options?: {
|
|
1506
|
+
cause?: unknown;
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1492
1509
|
/** A change of email or phone number needs a proof the save did not carry (403). */
|
|
1493
1510
|
export declare class PassflowAddressChangeProofRequiredError extends PassflowError {
|
|
1494
1511
|
constructor(error: PassflowResponseError['error'], options?: {
|
|
@@ -1745,6 +1762,21 @@ export type AppSettings = {
|
|
|
1745
1762
|
bot_mode?: BotMode;
|
|
1746
1763
|
/** Only when `human_only`. Absent on a `human_only` app means the built-in check. */
|
|
1747
1764
|
anti_bot?: AntiBotSettings;
|
|
1765
|
+
/** The public values of the browser risk providers the app has on; absent when none is on. */
|
|
1766
|
+
attack_protection?: AttackProtectionSettings;
|
|
1767
|
+
};
|
|
1768
|
+
/**
|
|
1769
|
+
* The browser risk providers whose ids `POST /auth/login` and `POST /auth/register` carry. Each key
|
|
1770
|
+
* is present only when that provider is on; `region` may be empty.
|
|
1771
|
+
*/
|
|
1772
|
+
export type AttackProtectionSettings = {
|
|
1773
|
+
fingerprint?: {
|
|
1774
|
+
public_key: string;
|
|
1775
|
+
region: string;
|
|
1776
|
+
};
|
|
1777
|
+
stytch?: {
|
|
1778
|
+
public_token: string;
|
|
1779
|
+
};
|
|
1748
1780
|
};
|
|
1749
1781
|
/** `human_only`: every sign-in start must carry an anti-bot value in `X-Passflow-Anti-Bot`. */
|
|
1750
1782
|
export type BotMode = 'bot_friendly' | 'human_only';
|
|
@@ -2603,6 +2635,13 @@ type AntiBotOperation = 'sign-in' | 'sign-up' | 'passwordless.start' | 'passkey.
|
|
|
2603
2635
|
type AntiBotTokenContext = {
|
|
2604
2636
|
action: 'passflow_auth';
|
|
2605
2637
|
operation: AntiBotOperation;
|
|
2638
|
+
/**
|
|
2639
|
+
* The provider whose widget to run: the app's own provider, or the one a 403 from the server's
|
|
2640
|
+
* attack protection names. Set on every call the SDK makes.
|
|
2641
|
+
*/
|
|
2642
|
+
provider?: Exclude<AntiBotProviderName, 'builtin'>;
|
|
2643
|
+
/** The provider's public site key, when the app settings or the server's 403 give one. */
|
|
2644
|
+
siteKey?: string;
|
|
2606
2645
|
};
|
|
2607
2646
|
/**
|
|
2608
2647
|
* The customer's own anti-bot provider (Turnstile, hCaptcha, reCAPTCHA): resolves with a token
|
|
@@ -2678,7 +2717,7 @@ export declare enum PassflowEvent {
|
|
|
2678
2717
|
* The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
|
|
2679
2718
|
* emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
|
|
2680
2719
|
*/
|
|
2681
|
-
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';
|
|
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';
|
|
2682
2721
|
/**
|
|
2683
2722
|
* Error payload interface for structured error information
|
|
2684
2723
|
*/
|
|
@@ -2889,15 +2928,23 @@ type AntiBotHeader = {
|
|
|
2889
2928
|
};
|
|
2890
2929
|
/**
|
|
2891
2930
|
* Axios copies this object into each request's config (and each resend's), so the interceptors
|
|
2892
|
-
* may write `builtin` and `
|
|
2931
|
+
* may write `builtin`, `retried` and `settings` on it.
|
|
2893
2932
|
*/
|
|
2894
2933
|
type AntiBotMark = {
|
|
2895
2934
|
operation: AntiBotOperation;
|
|
2896
2935
|
identifier?: string;
|
|
2897
2936
|
/** Set by the request interceptor: the value came from the built-in check. */
|
|
2898
2937
|
builtin?: boolean;
|
|
2899
|
-
/**
|
|
2938
|
+
/**
|
|
2939
|
+
* Set by the response interceptor before the one resend: after `anti_bot.failed` for the built-in
|
|
2940
|
+
* check, or after a 403 that names the check to pass. A request is never sent a third time.
|
|
2941
|
+
*/
|
|
2900
2942
|
retried?: boolean;
|
|
2943
|
+
/**
|
|
2944
|
+
* Set by the response interceptor from a 403's `anti_bot`: the check the server asks for on this
|
|
2945
|
+
* request. The resend's value is produced for it, whatever the app's own bot mode.
|
|
2946
|
+
*/
|
|
2947
|
+
settings?: AntiBotAppSettings;
|
|
2901
2948
|
};
|
|
2902
2949
|
/**
|
|
2903
2950
|
* Handles a challenge the Passflow instance itself received, resolving with a
|
|
@@ -2930,6 +2977,12 @@ type AxiosRefreshHandler = (request: {
|
|
|
2930
2977
|
* without the header, as it always has.
|
|
2931
2978
|
*/
|
|
2932
2979
|
type AxiosAntiBotHandler = (mark: AntiBotMark) => Promise<AntiBotHeader | undefined>;
|
|
2980
|
+
/**
|
|
2981
|
+
* Produces the provider-id headers of a covered request (`X-Passflow-Fingerprint-Event`,
|
|
2982
|
+
* `X-Passflow-Stytch-Telemetry`). Installed by `Passflow` on its auth client. Resolves `{}` for
|
|
2983
|
+
* any request whose answer the risk providers do not judge.
|
|
2984
|
+
*/
|
|
2985
|
+
type AxiosRiskIdHandler = (operation: AntiBotOperation) => Promise<Record<string, string>>;
|
|
2933
2986
|
declare class AxiosClient {
|
|
2934
2987
|
private instance;
|
|
2935
2988
|
protected storageManager: StorageManager;
|
|
@@ -2958,6 +3011,8 @@ declare class AxiosClient {
|
|
|
2958
3011
|
private refreshHandler?;
|
|
2959
3012
|
/** Set by `Passflow` on its auth client. Absent elsewhere: no request is marked there. */
|
|
2960
3013
|
private antiBotHandler?;
|
|
3014
|
+
/** Set by `Passflow` on its auth client. Absent elsewhere: no request is marked there. */
|
|
3015
|
+
private riskIdHandler?;
|
|
2961
3016
|
/**
|
|
2962
3017
|
* Passflow's own API as an interception scope, resolved ONCE here from
|
|
2963
3018
|
* `PassflowConfig.url` so no wrapper or adapter ever derives it. `null` when
|
|
@@ -2997,6 +3052,11 @@ declare class AxiosClient {
|
|
|
2997
3052
|
* every other request is unchanged.
|
|
2998
3053
|
*/
|
|
2999
3054
|
setAntiBotHandler(handler: AxiosAntiBotHandler | undefined): void;
|
|
3055
|
+
/**
|
|
3056
|
+
* Installs (or clears) the provider-id handler. Only requests marked with `withAntiBot` consult
|
|
3057
|
+
* it; every other request is unchanged.
|
|
3058
|
+
*/
|
|
3059
|
+
setRiskIdHandler(handler: AxiosRiskIdHandler | undefined): void;
|
|
3000
3060
|
/**
|
|
3001
3061
|
* Re-issues a request after an elevation. Exposed for the upgrade handler,
|
|
3002
3062
|
* which owns the replay-once decision; the marker preventing a second
|
|
@@ -3054,6 +3114,8 @@ export declare class AuthAPI {
|
|
|
3054
3114
|
setAppId(appId: string): void;
|
|
3055
3115
|
/** Installs (or clears) the handler that produces the anti-bot value of covered calls. */
|
|
3056
3116
|
setAntiBotHandler(handler: AxiosAntiBotHandler | undefined): void;
|
|
3117
|
+
/** Installs (or clears) the handler that produces the provider-id headers of covered calls. */
|
|
3118
|
+
setRiskIdHandler(handler: AxiosRiskIdHandler | undefined): void;
|
|
3057
3119
|
/**
|
|
3058
3120
|
* A built-in anti-bot challenge for this app. `identifier` is used by the server for difficulty
|
|
3059
3121
|
* only. Rejects only with a `PassflowError`.
|
|
@@ -3637,6 +3699,12 @@ export declare class TwoFactorApiClient {
|
|
|
3637
3699
|
* The server answers 404 when the user has no such device.
|
|
3638
3700
|
*/
|
|
3639
3701
|
revokeTrustedDevice(deviceId: string): Promise<void>;
|
|
3702
|
+
/**
|
|
3703
|
+
* Turn off sign-in approvals (push) on one trusted device
|
|
3704
|
+
* DELETE /v2/user/2fa/trusted-devices/:id/push
|
|
3705
|
+
* The device key and trust grant stay. The server answers 404 when the user has no such device.
|
|
3706
|
+
*/
|
|
3707
|
+
removeTrustedDevicePush(deviceId: string): Promise<void>;
|
|
3640
3708
|
/**
|
|
3641
3709
|
* Get the user's preferred 2FA method
|
|
3642
3710
|
* GET /v2/user/2fa/preferred-method
|
|
@@ -3727,6 +3795,25 @@ export declare class UserAPI {
|
|
|
3727
3795
|
*/
|
|
3728
3796
|
updateProfile(patch: PassflowProfileUpdate, proof?: AddressChangeProof): Promise<PassflowSessionUser>;
|
|
3729
3797
|
}
|
|
3798
|
+
/** The requests whose answer the server's risk providers judge. */
|
|
3799
|
+
type RiskIdOperation = 'sign-in' | 'sign-up';
|
|
3800
|
+
/** What a risk id function is asked for: one provider that is on, with its public values. */
|
|
3801
|
+
type RiskIdContext = {
|
|
3802
|
+
provider: 'fingerprint';
|
|
3803
|
+
publicKey: string;
|
|
3804
|
+
region: string;
|
|
3805
|
+
operation: RiskIdOperation;
|
|
3806
|
+
} | {
|
|
3807
|
+
provider: 'stytch';
|
|
3808
|
+
publicToken: string;
|
|
3809
|
+
operation: RiskIdOperation;
|
|
3810
|
+
};
|
|
3811
|
+
/**
|
|
3812
|
+
* Resolves with the provider's id for this request: the Fingerprint agent's `event_id`, or the
|
|
3813
|
+
* Stytch telemetry id. Called once per provider per request; a resend calls it again. The request
|
|
3814
|
+
* waits for it, so it should resolve quickly.
|
|
3815
|
+
*/
|
|
3816
|
+
type RiskIdProvider = (context: RiskIdContext) => Promise<string>;
|
|
3730
3817
|
export declare const APP_ID_HEADER_KEY = "X-Passflow-Clientid";
|
|
3731
3818
|
export declare const AUTHORIZATION_HEADER_KEY = "Authorization";
|
|
3732
3819
|
export declare const DEVICE_ID_HEADER_KEY = "X-Passflow-DeviceId";
|
|
@@ -3737,6 +3824,10 @@ export declare const ANTI_BOT_HEADER_KEY = "X-Passflow-Anti-Bot";
|
|
|
3737
3824
|
export declare const AGENT_TOOL_HEADER_KEY = "X-Passflow-Agent-Tool";
|
|
3738
3825
|
/** A device-key proof (compact JWS) on sign-in and refresh requests, with `PassflowConfig.deviceKey`. */
|
|
3739
3826
|
export declare const DEVICE_PROOF_HEADER_KEY = "X-Passflow-Device-Proof";
|
|
3827
|
+
/** The Fingerprint agent's `event_id` on `signIn` and `signUp`, when the app has Fingerprint on. */
|
|
3828
|
+
export declare const FINGERPRINT_EVENT_HEADER_KEY = "X-Passflow-Fingerprint-Event";
|
|
3829
|
+
/** The Stytch telemetry id on `signIn` and `signUp`, when the app has Stytch on. */
|
|
3830
|
+
export declare const STYTCH_TELEMETRY_HEADER_KEY = "X-Passflow-Stytch-Telemetry";
|
|
3740
3831
|
/** The `action` a token provider receives; a reCAPTCHA score key must be executed with it. */
|
|
3741
3832
|
export declare const ANTI_BOT_ACTION = "passflow_auth";
|
|
3742
3833
|
/**
|
|
@@ -5047,6 +5138,18 @@ export declare class AuthService {
|
|
|
5047
5138
|
* after app-id discovery, and a code this tab did not ask for is not exchanged
|
|
5048
5139
|
*/
|
|
5049
5140
|
handleFederatedCode(code: string): boolean;
|
|
5141
|
+
/**
|
|
5142
|
+
* A `#tfa_token` landing of a federated sign-in: the token goes to the second factor through
|
|
5143
|
+
* `TwoFactorRequired`. A live slot (a PKCE sign-in this tab started) becomes the pending PKCE
|
|
5144
|
+
* sign-in, because the server issued the 2FA token with that sign-in's challenge: the code the
|
|
5145
|
+
* second factor answers with is exchanged with the slot's verifier. The slot is taken. With no
|
|
5146
|
+
* live slot any earlier pending verifier is dropped, since the second factor then answers with
|
|
5147
|
+
* tokens.
|
|
5148
|
+
*
|
|
5149
|
+
* Unlike `handleFederatedCode`, this needs no appId: nothing is exchanged here, and the pending
|
|
5150
|
+
* verifier is kept in sessionStorage for the instance built after app-id discovery.
|
|
5151
|
+
*/
|
|
5152
|
+
handleFederatedTwoFactor(tfaToken: string): void;
|
|
5050
5153
|
private finishFederatedLanding;
|
|
5051
5154
|
private reportFederatedRedirectFailure;
|
|
5052
5155
|
authRedirectUrl(options?: {
|
|
@@ -5659,6 +5762,11 @@ export declare class TwoFactorService {
|
|
|
5659
5762
|
* Rejects with the server's 404 when the user has no such device.
|
|
5660
5763
|
*/
|
|
5661
5764
|
revokeTrustedDevice(deviceId: string): Promise<void>;
|
|
5765
|
+
/**
|
|
5766
|
+
* Turn off sign-in approvals on a trusted device. It stays trusted and keeps its device
|
|
5767
|
+
* key. Rejects with the server's 404 when the user has no such device.
|
|
5768
|
+
*/
|
|
5769
|
+
removeTrustedDevicePush(deviceId: string): Promise<void>;
|
|
5662
5770
|
/**
|
|
5663
5771
|
* The method the user prefers as their second factor on this app, or `null` when there is
|
|
5664
5772
|
* none the app can use now.
|
|
@@ -6619,6 +6727,7 @@ export declare class Passflow {
|
|
|
6619
6727
|
private tokenCacheService;
|
|
6620
6728
|
private twoFactorService;
|
|
6621
6729
|
private antiBot;
|
|
6730
|
+
private riskIds;
|
|
6622
6731
|
/** This instance's device key: present with `deviceKey: true` outside BFF mode. */
|
|
6623
6732
|
private readonly deviceKeyService;
|
|
6624
6733
|
tenant: TenantService;
|
|
@@ -6899,7 +7008,9 @@ export declare class Passflow {
|
|
|
6899
7008
|
/**
|
|
6900
7009
|
* Adopts a `#tfa_token=` fragment: the 2FA token goes to the TwoFactorService
|
|
6901
7010
|
* through `TwoFactorRequired`, exactly as a password sign-in's does, and the
|
|
6902
|
-
* token and `user_state` leave the URL. Nothing is saved as a session.
|
|
7011
|
+
* token and `user_state` leave the URL. Nothing is saved as a session. After a
|
|
7012
|
+
* PKCE federated sign-in this tab started, its verifier becomes the pending PKCE
|
|
7013
|
+
* sign-in, so the code the second factor answers with is exchanged.
|
|
6903
7014
|
*
|
|
6904
7015
|
* @returns true when the URL carried a 2FA token
|
|
6905
7016
|
*/
|
|
@@ -7185,16 +7296,41 @@ export declare class Passflow {
|
|
|
7185
7296
|
/**
|
|
7186
7297
|
* Sets the token provider for an app in `human_only` bot mode that uses its own anti-bot
|
|
7187
7298
|
* provider (Turnstile, hCaptcha, reCAPTCHA). Before each covered sign-in request the SDK calls it
|
|
7188
|
-
* with `{ action: 'passflow_auth', operation }` and sends the token it resolves
|
|
7189
|
-
* `X-Passflow-Anti-Bot`. Not called on a `bot_friendly` app, nor with the built-in check.
|
|
7190
|
-
*
|
|
7299
|
+
* with `{ action: 'passflow_auth', operation, provider, siteKey }` and sends the token it resolves
|
|
7300
|
+
* with in `X-Passflow-Anti-Bot`. Not called on a `bot_friendly` app, nor with the built-in check.
|
|
7301
|
+
*
|
|
7302
|
+
* It is also called on any app when the server's attack protection answers a covered call with
|
|
7303
|
+
* a 403 that names one of these providers: `provider` and `siteKey` then come from that answer,
|
|
7304
|
+
* so the widget to render may differ from the app's own. The call is sent again once with the
|
|
7305
|
+
* token. `undefined` removes it.
|
|
7191
7306
|
*
|
|
7192
7307
|
* @example
|
|
7193
7308
|
* ```typescript
|
|
7194
|
-
* passflow.setAntiBotTokenProvider(() =>
|
|
7309
|
+
* passflow.setAntiBotTokenProvider(({ provider, siteKey }) => renderWidget(provider, siteKey));
|
|
7195
7310
|
* ```
|
|
7196
7311
|
*/
|
|
7197
7312
|
setAntiBotTokenProvider(provider: AntiBotTokenProvider | undefined): void;
|
|
7313
|
+
/**
|
|
7314
|
+
* Sets the function that gives the id of each browser risk provider the app has on
|
|
7315
|
+
* (`attack_protection` in the app settings): the Fingerprint agent's `event_id`, the Stytch
|
|
7316
|
+
* telemetry id. Before each `signIn` and `signUp` request (a resend included) the SDK calls it
|
|
7317
|
+
* once per provider with that provider's public values, and sends the id in
|
|
7318
|
+
* `X-Passflow-Fingerprint-Event` or `X-Passflow-Stytch-Telemetry`. The request waits for it.
|
|
7319
|
+
*
|
|
7320
|
+
* A rejection or `''` sends no header for that provider and the sign-in goes on; so does an app
|
|
7321
|
+
* with a provider on and no function set (a warning is logged). The SDK loads no vendor script.
|
|
7322
|
+
* `undefined` removes it.
|
|
7323
|
+
*
|
|
7324
|
+
* @example
|
|
7325
|
+
* ```typescript
|
|
7326
|
+
* passflow.setRiskIdProvider(async (context) =>
|
|
7327
|
+
* context.provider === 'fingerprint'
|
|
7328
|
+
* ? (await fingerprintAgent.get()).event_id
|
|
7329
|
+
* : stytch.getTelemetryId({ publicToken: context.publicToken }),
|
|
7330
|
+
* );
|
|
7331
|
+
* ```
|
|
7332
|
+
*/
|
|
7333
|
+
setRiskIdProvider(provider: RiskIdProvider | undefined): void;
|
|
7198
7334
|
/**
|
|
7199
7335
|
* A fresh `X-Passflow-Anti-Bot` value for a request the SDK does not send itself:
|
|
7200
7336
|
* `POST /auth/session/exchange`, `/oidc/device/authenticate`, `/oidc/device/passkey/start`.
|
|
@@ -8196,6 +8332,19 @@ export declare class Passflow {
|
|
|
8196
8332
|
* ```
|
|
8197
8333
|
*/
|
|
8198
8334
|
revokeTrustedDevice(id: string): Promise<void>;
|
|
8335
|
+
/**
|
|
8336
|
+
* Turn off sign-in approvals (push) on one of the signed-in user's trusted devices. The device
|
|
8337
|
+
* stays trusted and keeps its device key; it no longer gets approval requests.
|
|
8338
|
+
*
|
|
8339
|
+
* @param deviceId - The trusted device's `id` from `getTrustedDevices()`
|
|
8340
|
+
* @throws {PassflowError} If the request fails, including a 404 for an unknown id
|
|
8341
|
+
*
|
|
8342
|
+
* @example
|
|
8343
|
+
* ```typescript
|
|
8344
|
+
* await passflow.removeTrustedDevicePush(device.id);
|
|
8345
|
+
* ```
|
|
8346
|
+
*/
|
|
8347
|
+
removeTrustedDevicePush(deviceId: string): Promise<void>;
|
|
8199
8348
|
/**
|
|
8200
8349
|
* Read the second factor the signed-in user prefers on this app.
|
|
8201
8350
|
*
|
|
@@ -8416,4 +8565,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
8416
8565
|
* @returns true if valid username format, false otherwise
|
|
8417
8566
|
*/
|
|
8418
8567
|
export declare function isValidUsername(username: string): boolean;
|
|
8419
|
-
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, 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 };
|
|
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 };
|