UNPKG

@light-auth/core

Version:

light auth core framework agnostic, using arctic

73 lines (72 loc) 2.59 kB
import type { LightAuthConfig, LightAuthSession, LightAuthUser } from "../models"; /** * Client-side function to login with email and password. * This function should be called from the browser/client-side only. * * @param args - Login parameters * @returns Response with session data or error */ export declare function credentialsLogin<Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(args: { config: LightAuthConfig<Session, User>; email: string; password: string; callbackUrl?: string; }): Promise<{ success: boolean; session?: Partial<Session>; error?: string; }>; /** * Client-side function to register a new user with email and password. * This function should be called from the browser/client-side only. * * @param args - Registration parameters * @returns Response with session data or error */ export declare function credentialsRegister<Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(args: { config: LightAuthConfig<Session, User>; email: string; password: string; name?: string; autoLogin?: boolean; additionalData?: { [key: string]: unknown; }; }): Promise<{ success: boolean; session?: Partial<Session>; user?: Partial<User>; error?: string; message?: string; }>; /** * Client-side function to request a password reset. * This function should be called from the browser/client-side only. * * @param args - Password reset request parameters * @returns Response indicating if reset email was sent */ export declare function credentialsResetPasswordRequest<Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(args: { config: LightAuthConfig<Session, User>; email: string; }): Promise<{ success: boolean; message?: string; error?: string; }>; /** * Client-side function to confirm password reset with token. * This function should be called from the browser/client-side only. * * @param args - Password reset confirmation parameters * @returns Response indicating if password was reset successfully */ export declare function credentialsResetPasswordConfirm<Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(args: { config: LightAuthConfig<Session, User>; token: string; newPassword: string; }): Promise<{ success: boolean; message?: string; error?: string; }>;