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
- Random PIN Generation: Generate cryptographically secure random PINs of any specified length up to 50 characters.
- Seeded Random Data Generation: Produce consistent sequences of random data based on a provided seed, useful for deterministic outcomes.
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.