Sec-ID

Module for generating IDs for different uses.

Try it out

README


Sec-Id

A package for generating unique IDs.

View On NPMJS.com

🔽Install

$ npm init -y

$ npm install sec-id

added 1 package, and audited 30 packages in 2s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

🔨Usage:

const Generator=require('sec-id')

var NormalId=Generator.GenerateId({length:15})
//Put the length of the Id into the parameter field.

var NumberId=Generator.GenerateNumberId({length:15})

console.log(NormalId)

console.log(NumberId)
//eugjdnsl471Gher
//295739587936457

Secured-Ids

const Generator=require('sec-id')

var NormalId=Generator.GenerateSecId()//This Id is suitable for Secure Purposes

Other Ids

var MixId=Generator.GenerateMixedAlphaId()//Mixed alphabet id
var Upper=Generator.GenerateUpperId()//Uppercase only id
var Lower=Generator.GenerateLowerId()//Lowercase id
var NumberSlash=Generator.GenerateNumHyphId()//Id with number and hyphen -
var Customizr=Generator.GenerateCustomizeId({length:24,datastring:"YourDataString"})//Get ID with custumized characters

🌄Patterns

We support customize patterns

var Pattern=g.GenerateCustomizePatternId({length:15,pattern:"user123#"})
//Use # to be the part you want to have random id.
console.log(Pattern)
//user123E5Gc6K3d
Examples

You can use this function in many ways such as user management system(with the help of other packages)

//Example
var db=[{userid:"User12345678901234567890",password:"1234567",
device:"Windows 11,Chrome,version 100"}]


var newUserID=g.GenerateCustomizePatternId({length:24,pattern:"User#"})
db.push({userid:newUserID,password:request.body.password,device:request.body.device})
response.send("User Created")

🍪Example (Cookies)

request.cookies.LoginId=Generator.GenerateId({length:Math.floor(Math.random()*88)+12})

//You can have an Id to identify users.

🎙Credits

🎉Update Logs

2022/08/20 v2.2

Updated New function

var Pattern=g.GenerateCustomizePatternId({length:15,pattern:"user123#"})

2022/08/19 v2.0,v2.1 Add a function Changed the name

2022/08/19 v1.0 Create the package

🧪Bug reports & Source Codes

Please find me on Github This project ▶ Github Repo