import { EmailOTPOptions, SignInEmailOTPHandlerResult, SignInEmailOTPState, VerifyEmailOTPHandlerResult } from '@nhost/nhost-js'; import { ToRefs } from 'vue'; import { NestedRefOfValue, RefOrValue } from './helpers'; export interface SignInEmailOTPHandler { (email: RefOrValue, options?: NestedRefOfValue): Promise; } export interface VerifyEmailOTPHandler { (email: RefOrValue, code: RefOrValue): Promise; } export interface SignEmailOTPComposableResult extends ToRefs { signInEmailOTP: SignInEmailOTPHandler; verifyEmailOTP: VerifyEmailOTPHandler; } /** * Use the `useSignInEmailOTP` composable to sign in a user with a one-time password sent via email. * * ## Usage * * 1. Call the `signInEmailOTP` function with the user's email to send a one-time password (OTP) to that email address. * 2. The state `needsOtp` will be `true`, indicating that an OTP is required. * 3. Once the user receives the OTP via email, call the `verifyEmailOTP` function with the email and the received OTP. * 4. On successful verification, the user is authenticated, and `isSuccess` becomes `true`. * * Any errors during the sign-in or verification process are tracked using `isError` and `error`. While the `signInEmailOTP` and `verifyEmailOTP` actions are in progress, `isLoading` is `true`. * * ## Example * ```ts * const { * signInEmailOTP, * verifyEmailOTP, * error * } = useSignInEmailOTP() * * const requestOtp = async (e: Event) => { * e.preventDefault() * await signInEmailOTP(email.value) * } * * const confirmOtp = async (e: Event) => { * e.preventDefault() * await verifyEmailOTP(email.value, otp.value) * } * * ``` * * @docs https://docs.nhost.io/reference/vue/use-sign-in-email-otp */ export declare function useSignInEmailOTP(options?: NestedRefOfValue): SignEmailOTPComposableResult; //# sourceMappingURL=useSignInEmailOTP.d.ts.map