Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

string-token

2.0.0 • Public • Published

String Token

NPM version NPM downloads Build status Test coverage

Generate a random token of any length.

Installation

npm install string-token --save

Usage

import { stringToken } from 'string-token'
 
const token = await stringToken(25) //=> "faJ~iDAh_Eawd7fgXL_~UfnkV"

Tip: The number of possible characters must be a power of 2 (e.g. 32, 64, 128) to ensure the token contains no bias. By default, the library uses _, ~ and alphanumeric characters (making it 64 in total), which ensures the token is also URL-safe by default. You can create your own stringToken with different characters by using createStringToken(chars).

TypeScript

This project is written using TypeScript and publishes the definitions directly to NPM.

License

Apache 2.0

install

npm i string-token

Downloadsweekly downloads

43

version

2.0.0

license

Apache-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability