Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

crypto-randomizer

irf-dev-toolkit14MIT1.0.0

Generates random strings of Number, Alphabets, AlphaNumeric and AlphaNumericSpecialChars- using the crypto function.

random-string, crypto-string, random-string-generator, crypto-string-generator, secure-string, secure-string-generator, secure-random-string

readme

crypto-randomizer

A npm package that generates random strings using the crypto function.

Installation

To install crypto-randomizer, run the following command:

npm install crypto-randomizer

Usage

To generate a random string, import the generateRandom function from crypto-randomizer and call it with the desired length and type as arguments.

import { generateRandom } from 'crypto-randomizer';

const randomString = generateRandom(8, 'alphabet');
console.log(randomString); // Output: "fghijklm"

Arguments

  • length (optional, default=16): The length of the generated string.
  • type (optional, default='number'): The type of characters to include in the generated string. Possible values are 'number', 'alphabet', 'alphaNumeric', and 'anything'.

Returns

A string of the requested length and type.

Security

crypto-randomizer uses the crypto function to generate random strings, which is a secure method for generating random values. The package has been tested using SonarQube and does not have any known vulnerabilities.

License

crypto-randomizer is released under the MIT License.