Socket
Socket
Sign inDemoInstall

uid-promise

Package Overview
Dependencies
0
Maintainers
6
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    uid-promise

generates a cryptographically strong random uid


Version published
Weekly downloads
426K
decreased by-27.64%
Maintainers
6
Install size
7.67 kB
Created
Weekly downloads
 

Readme

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

Last updated on 18 May 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc