@nhost/react
Version:
Nhost React library
34 lines (33 loc) • 1.43 kB
TypeScript
import { RequestOptions, SignUpSecurityKeyOptions, SignUpSecurityKeyState } from '@nhost/nhost-js';
type SignUpSecurityKeyHandlerResult = Omit<SignUpSecurityKeyState, 'isLoading'>;
interface SignUpSecurityKeyHandler {
(email: string, options?: SignUpSecurityKeyOptions, requestOptions?: RequestOptions): Promise<SignUpSecurityKeyHandlerResult>;
}
export interface SignUpSecurityKeyHookResult extends SignUpSecurityKeyState {
/** Used for a new user to sign up with a security key. Returns a promise with the current context */
signUpEmailSecurityKey: SignUpSecurityKeyHandler;
}
interface SignUpSecurityKeyHook {
(options?: SignUpSecurityKeyOptions): SignUpSecurityKeyHookResult;
}
/**
* Use the hook `useSignUpEmailSecurityKeyEmail` to sign up a user with security key and an email using the WebAuthn API.
*
* @example
* ```tsx
* const { signUpEmailSecurityKey, needsEmailVerification, isLoading, isSuccess, isError, error } = useSignUpEmailSecurityKeyEmail()
*
* console.log({ needsEmailVerification, isLoading, isSuccess, isError, error });
*
* const handleFormSubmit = async (e) => {
* e.preventDefault();
*
* await signUpEmailSecurityKey('joe@example.com')
* }
* ```
*
* @docs https://docs.nhost.io/reference/react/use-sign-up-security-key
*/
export declare const useSignUpEmailSecurityKeyEmail: SignUpSecurityKeyHook;
export {};
//# sourceMappingURL=useSignUpEmailSecurityKey.d.ts.map