Verif is a project that allows verification via SMS and email.
To install the necessary dependencies, run the following command:
npm install nodemailer twilio fs @vonage/server-sdk
The project contains several main functions to send verification codes by email and SMS, and to verify these codes.
To send an email, you can use the sendMail
function. This function generates a random verification code, sends it by email to the user, and stores the code for later verification.
To send an SMS, you can use the sendTwilioMessage
or sendVonageMessage
functions. These functions generate a random verification code, send it by SMS to the user, and store the code for later verification. (Only works with Twilio and Vonage for the moment)
To verify a code, you can use the verifyCode
function. This function checks if the provided code matches the stored code for the user.
Codes are stored in a JSON file thanks to the JsonFileCodeStore
class, which inherits from the CodeStore
class. You can create your own storage class by inheriting from CodeStore
and implementing the storeCode
and verifyCode
methods.
This project was created by FlanZ.