New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@immutabl3/random-token

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@immutabl3/random-token

generates a base-64, url-safe token

latest
Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
4
-20%
Maintainers
1
Weekly downloads
 
Created
Source

random-token

npm install @immutabl3/random-token

Generates a base64, url-safe token. Uses -, _, 0-9, a-z, and A-Z.

Usage

const randomToken = require('@immutabl3/random-token');
const token = randomToken(); // '0XjaS_7F'

API

token([n=8])

Generates a token. Defaults to a length of 8.

Arguments

[n=8] (number): the length of the token

Returns

(string): Returns the token

.valid(token, [n])

Validates a token string. Pass optional length to validate the length of the token as well.

Arguments

[token] (string): the token to validate [n] (number): the length of the token

Returns

(boolean): Returns true is the token is valid

.characters

The string of characters used to generate then token. Use as a reference only. Changing this string will not change token generation.

Tests

To run tests, download the repo and run:

  • npm install
  • npm test

License

MIT

FAQs

Package last updated on 27 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts