- Notifications
You must be signed in to change notification settings - Fork10
crypto-utils/uid-safe
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
URL and cookie safe UIDs
Create cryptographically secure UIDs safe for both cookie and URL usage.This is in contrast to modules such asuid2whose UIDs are actually skewed due to the use of%
and unnecessarilytruncate the UID. Use this if you could still use UIDs with-
and_
inthem.
$ npm install uid-safe
varuid=require('uid-safe')
Asynchronously create a UID with a specific byte length. Becausebase64
encoding is used underneath, this is not the string length. For example,to create a UID of length 24, you want a byte length of 18.
uid(18,function(err,string){if(err)throwerr// do something with the string})
Asynchronously create a UID with a specific byte length and return aPromise
.
Note: To use promises in Node.jsprior to 0.12, promises must be"polyfilled" usingglobal.Promise = require('bluebird')
.
uid(18).then(function(string){// do something with the string})
A synchronous version of above.
varstring=uid.sync(18)
About
URL and cookie safe UIDs
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published