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

secure-id

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

secure-id

Secure id generator for Browsers, Node.js, and ReactNative written in TypeScript.

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

secure-id

Secure id generator for Browsers, Node.js, and ReactNative written in TypeScript.

Features

  • Secure: Generates cryptographically secure random ids using window.crypto for Browsers, require('crypto') for Node.js, and react-native-get-random-values for ReactNative.
  • Fast: Much faster than uuid4.
  • Tiny: Only 612 bytes of gzipped, minified.

Compatible for es6+

Install

npm install secure-id

Usage

import {create} from 'secure-id

// function create(characters: string): (length: number) => string
const {generate, validate} = create('ab01')(6)

// id -> 'b110ba', 'a01aab', '0bba01' etc.
const id = generate()

// true
validate(id)
validate('aaaaaa')
validate('01ab00')

// false
validate('aaaaa') //invalid length
validate('aaaaad') //invalid characters

FAQs

Package last updated on 02 Nov 2020

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