Miss any of our Open RFC calls?Watch the recordings here! »

crypto-uid

0.3.0 • Public • Published

UID Generator

A small package for generating cryptographically secure UIDs in the browser, safe for both cookie and URL usage.

Travis (.org) branch

This package is a mirror of uid-safe, but meant to be used in a browser env. Additionally, it comes bundled with TypeScript typings.

Table of Contents

Installation


You can install this package from NPM:

npm add crypto-uid

Or with Yarn:

yarn add crypto-uid

CDN

For CDN, you can use unpkg:

https://unpkg.com/crypto-uid/dist/bundles/crypto-uid.umd.min.js

The global namespace for crypto-uid is cryptoUid:

const id = cryptoUid(6);

Usage


ES6

Generate a random UID:

import uid from 'crypto-uid';
const id = uid(6);

CommonJS

Generate a random UID:

const uid = require('crypto-uid');
const id = uid(6);

Browser Support


You can expect this lib to run wherever Web Crypto API is supported.

Contribute


If you wish to contribute, please use the following guidelines:

Install

npm i crypto-uid

DownloadsWeekly Downloads

30

Version

0.3.0

License

MIT

Unpacked Size

41.1 kB

Total Files

27

Last publish

Collaborators

  • avatar