
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
otp-simple-generator
Advanced tools
A simple and lightweight OTP (One-Time Password) generator, retriever, and verifier for JavaScript projects. Works with any JavaScript framework or library (React, Vue, Angular, Node.js, etc.).
npm install otp-simple-generator
Import the package:
import otp from "otp-simple-generator";
The package provides three main methods:
otp.generate(phone, length = 4, expire = 10)
Generates an OTP for the given phone number.
phone
(string): Phone number to associate with the OTP.length
(number, optional): Length of the OTP (default is 4 digits).expire
(number, optional): Expiration time in minutes (default is 10 minutes).Returns an object containing success status, message, and the OTP data.
otp.get(phone)
Retrieves the OTP data stored for the given phone number.
Returns the OTP data object or null
if none found.
otp.verify(phone, otp)
Verifies the provided OTP for the given phone number.
Returns an object with success status and messages in both English and Arabic.
const generated = otp.generate("+964123456789", 6, 5);
console.log(generated);
const data = otp.get("+964123456789");
console.log(data);
const verified = otp.verify("+964123456789", "123456");
console.log(verified);
otp.generate("+964123456789", 6, 5)
{
"success": true,
"message": "OTP generated successfully",
"data": {
"otp": 123456,
"expire": "2025-07-28T12:34:56.789Z",
"phone": "+964123456789"
}
}
otp.get("+964123456789")
{
"otp": 123456,
"expire": "2025-07-28T12:34:56.789Z",
"phone": "+964123456789"
}
otp.verify("+964123456789", "123456")
{
"success": true,
"message": "OTP code verified successfully",
"arMessage": "تم التحقق من رمز التأكيد بنجاح"
}
This package uses simple-json-db as a local JSON key-value store for OTP data.
MIT © Ali Hammad
FAQs
OTP Codes generator and verifier
The npm package otp-simple-generator receives a total of 26 weekly downloads. As such, otp-simple-generator popularity was classified as not popular.
We found that otp-simple-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.