uid-ts
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

uid-ts

Build Status npm version codecov David Greenkeeper badge

URL and cookie safe UIDs written in Typescript

Create cryptographically secure UIDs safe for both cookie and URL usage. This is in contrast to modules such as rand-token and uid2 whose UIDs are actually skewed due to the use of % and unnecessarily truncate the UID. Use this if you could still use UIDs with - and _ in them.

Installation

$ npm install uid-ts

API

import { uid, uidSync } from 'uid-ts';

uid(byteLength)

Asynchronously create a UID with a specific byte length and return a Promise. You can also await the function.

const id = await uid(18);
  // do something with the string

uidSync(byteLength)

A synchronous version of above.

var string = uid.sync(18)

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i uid-ts

Weekly Downloads

20

Version

0.0.3

License

MIT

Last publish

Collaborators

  • chenzhutian