0.0.2 • Published 9 years ago
secure-random-value v0.0.2
secure-random-value

Generates cryptographically secure random values
Using Secure Random Value
1. Install as a dependency
yarn add secure-random-value2. Import package
import { RandomString } from 'secure-random-string';3. Get a random value
let random_string = await RandomString();Documentation
Methods
RandomNumber(min?: number, max?: number): Promise<number>
min: number = 0: Minimum value, inclusivemax: number = min + 100: Maximum value, inclusive- Returns a
Promise<number>object.
RandomString(length?: number, charsets?: string | string[]): Promise<string>
length: number = 32: The length of the string to generatecharsets: string | string[] = ['alpha', 'alpha_upper', 'numeric']: The set of characters to pick from. There are a few built in character sets. You can also pass in an array of charactes to pick from:['a', 'b', 'c', '1', '2', '3']- Returns a
Promise<string>object.
Properties
Built in character sets
'alpha':/[a-z]/'alpha_upper':/[A-Z]/'numeric':/[0-9]/'emojis': A selection of easily identifiable emojis, including 😀 👍 🐱 😎 🔥