Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uid-promise

Package Overview
Dependencies
Maintainers
6
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uid-promise

generates a cryptographically strong random uid

  • 2.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
564K
decreased by-35.46%
Maintainers
6
Weekly downloads
 
Created
Source

uid-promise

Creates a cryptographically secure UID with a 62 character range that can be safely used in URLs.

Usage

Install the package:

npm i uid-promise

Then import it:

import { uid } = from 'uid-promise';

Finally, call it:

await uid(20);

API

uid(Number len) => Promise

  • Return a Promise that resolves with a string of random characters of length len
  • len must always be provided, else the promise is rejected
  • Under the hood, crypto.randomBytes is used
  • Character set: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789

Authors

  • Guillermo Rauch (@rauchg) - Vercel
  • Leo Lamprecht (@notquiteleo) - Vercel

FAQs

Package last updated on 18 May 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc