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

21 lines (20 loc) 731 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.verifyOtpHandler = void 0; const otpStore_service_1 = require("./otpStore.service"); // OTP Verification Handler Function const verifyOtpHandler = async (email, otp) => { try { // Verify OTP after successful login attempt const isOtpValid = (0, otpStore_service_1.verifyOtp)(email, otp); if (!isOtpValid) { return { status: 401, message: "Invalid or expired OTP" }; } return { status: 200, message: "OTP verified successfully" }; } catch (err) { console.error(err); return { status: 500, message: err.message }; } }; exports.verifyOtpHandler = verifyOtpHandler;