@nhost/react
Version:
Nhost React library
33 lines (32 loc) • 1.01 kB
TypeScript
import { ActionErrorState, ActionSuccessState, AddSecurityKeyHandlerResult } from '@nhost/nhost-js';
interface AddSecurityKeyHandler {
(
/** Optional human-readable name of the security key */
nickname?: string): Promise<AddSecurityKeyHandlerResult>;
}
export interface AddSecuritKeyHookResult extends ActionErrorState, ActionSuccessState {
/** Add a security key to the current user with the WebAuthn API */
add: AddSecurityKeyHandler;
}
interface AddSecuritKeyHook {
(): AddSecuritKeyHookResult;
}
/**
* Use the hook `useAddSecurityKey` to add a WebAuthn security key.
*
* @example
* ```tsx
* const { add, isLoading, isSuccess, isError, error } = useAddSecurityKey()
*
* const handleFormSubmit = async (e) => {
* e.preventDefault();
*
* await add('key nickname')
* }
* ```
*
* @docs https://docs.nhost.io/reference/react/use-add-security-key
*/
export declare const useAddSecurityKey: AddSecuritKeyHook;
export {};
//# sourceMappingURL=useAddSecurityKey.d.ts.map