Node-Pin: Secure OTP/PIN Generation for Email Verification and More

Introduction

Node-Pin is a simple library designed for generating random PINs and seeded random data in Node.js applications. It offers flexibility for both secure random PIN generation and deterministic outcomes for testing or simulations.

Features

Installation

To install Node-Pin in your project, run the following command:

npm install node-pin

Usage

RandomPinGenerator

Generate a 6-digit PIN:

const { RandomPinGenerator } = require('node-pin');
RandomPinGenerator.generate(6).then(pin => console.log(`Generated PIN: ${pin}`));

SeededRandomGenerator

Generate seeded random data:

const { SeededRandomGenerator } = require('node-pin');
const generator = new SeededRandomGenerator('my-seed');
console.log(generator.getRandomHex(4));
console.log(generator.getRandomNumber(1, 100));

Contributing

Contributions to Node-Pin are welcome! Please read the contribution guidelines on our GitHub repository.