@better-auth-ui/core
Version:
Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.
39 lines (38 loc) • 1.53 kB
TypeScript
import { AuthPluginBase } from '../../lib/auth-plugin';
/**
* Autocomplete token that opts an input into WebAuthn conditional UI.
*
* Browsers only honour it as the *last* token of the attribute, which is why
* {@link withPasskeyAutoFill} appends rather than prepends.
*/
export declare const webAuthnAutoCompleteToken = "webauthn";
/**
* Append the `webauthn` autocomplete token when passkey autofill is active.
*
* @param autoComplete - The field's regular autocomplete value, e.g. `"email"`.
* @param enabled - Whether the passkey plugin has conditional UI turned on.
*
* @example
* ```tsx
* <input autoComplete={withPasskeyAutoFill("email", passkeyAutoFill)} />
* ```
*/
export declare function withPasskeyAutoFill(autoComplete: string, enabled: boolean): string;
/**
* Whether the registered passkey plugin has conditional UI enabled.
*
* Returns `false` when the passkey plugin isn't registered at all, so sign-in
* forms can call this without knowing which plugins a consumer installed.
*
* @param plugins - The plugin list from `useAuth()`.
*/
export declare function isPasskeyAutoFillEnabled(plugins: AuthPluginBase[]): boolean;
/**
* Whether the browser can service a WebAuthn request with conditional
* mediation, i.e. render passkeys inside the autofill dropdown instead of a
* modal.
*
* Resolves `false` outside the browser and on engines that predate the API,
* so callers can await it unconditionally.
*/
export declare function isConditionalMediationAvailable(): Promise<boolean>;