UNPKG

universal_authentication

Version:

Seamless and Secure Authentication for Modern Web Applications: Easily integrate OTP-based email verification, Google OAuth, GitHub, Microsoft, and Okta login into your Node.js app. Modular, flexible, and database-agnostic, this package simplifies user au

13 lines (12 loc) 594 B
import { sendEmail } from "../utils/sendEmail.utils"; // config file for developer or user that can easily use the following data in their project / program export type AuthConfig = { hashAlgorithm?: "crypto" | "bcrypt"; generateSecureKey?: () => string; checkUserExist?: (email: string) => Promise<boolean>; createUser?: (userData: any) => Promise<any>; createAuthRecord?: (authData: any) => Promise<any>; getUserByEmail?: (email: string) => Promise<any>; getAuthRecord?: (id: string) => Promise<any>; sendEmail?: typeof sendEmail; // Use email sending function };