
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
node-verification-code
Advanced tools
Simple library to generate verification codes without dependencies for Node.js
Simple library to generate verification codes without dependencies for Node.js.
This library utilizes in-built Node.js module crypto to effective random numeric sequences generation, but also you can implement your own function to generate random sequences, using simple contract: function (charCount: number <MAX 10>) => string
If digital codes is only what you need - just use getDigitalCode
const { getDigitalCode } = require('node-verification-code')
const smsVerificationCodeBuffer = getDigitalCode(4) // Will produce Buffer contains 4 random digits
// sendSms(phone, smsVerificationCodeBuffer.toString())
You can create custom generator in two ways. Simpliest - using sequenceFromAlphabet helper function as follows:
const { sequenceFromAlphabet, createGenerator } = require('node-verification-code')
// create sequence function
const emojiSequence = sequenceFromAlphabet(['🐶', '🐱', '🐭', '🐹', '🐰'])
// create generator from sequence function
const getEmojiCode = createGenerator(emojiSequence)
getEmojiCode(4) // -> for example: 🐹🐭🐹🐰
You can also create your sequence function by hand:
const { createGenerator } = require('node-verification-code')
// only shown as example, don't do this in real code - crypto module produces better results
const mathRandomSequence = (charCount) => Math.floor(Math.random() * charCount)
const makeMyOwnVerificationCode = createGenerator(mathRandomSequence)
yarn add node-verification-code
yarn test
👤 Tominov Sergey
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator
FAQs
Simple library to generate verification codes without dependencies for Node.js
We found that node-verification-code demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.