random-keygen

Simple random keygen.


Keywords
random, generator, keygen, javascript, nodejs
License
MIT
Install
npm install random-keygen@1.0.4

Documentation

Random Keygen Build Status

Random-Keygen NPM

Simple random key and unique keys.

Install

  npm install random-keygen --save

Or

  yarn add random-keygen

Usage

get([options])

Random one key with the given options. Returns a string.

var randkey = require('random-keygen');

var key = randkey.get({
    length: 10,
    numbers: true
});

console.log(key);

getMulti(amount[, options])

Bulk create multiple keys at once, with the same options for all. Returns an array.

var randkey = require('random-keygen');

var keys = randkey.getMulti(3, {
    length: 10,
    uppercase: false
});

console.log(keys);

Options

Any of these can be passed into the options object for each function.

Name Description Default Value
length Integer, length of key. 10
numbers Boolean, put numbers in key. false
symbols Boolean, put symbols in key. false
uppercase Boolean, use uppercase letters in key. true
excludeSimilarCharacters Boolean, exclude similar chars, like 'i' and 'l'. false
exclude String, characters to be excluded from key. ''
strict Boolean, key must include at least one character from each pool. false