Socket
Socket
Sign inDemoInstall

custom-id

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.1.0

2

index.js

@@ -44,3 +44,3 @@ /*!

}
var multiply = customId.uniqueId || 97232;
var multiply = customId.uniqueId || 1;
var crypticNotSecure = Math.floor(Math.random() * multiply);

@@ -47,0 +47,0 @@ var crypticSecureFun = cryptoRandom() * multiply;

{
"name": "custom-id",
"author": "Md Fazlul Karim <fazlulkarimrocky@gmail.com> (https://twitter.com/fazlulkarimweb)",
"version": "1.0.3",
"version": "1.1.0",
"main": "node.js",

@@ -6,0 +6,0 @@ "repository": "github:fazlulkarimweb/custom-id",

# Custom ID
A tiny (3 KB), unique but customizable, 🀠 human-friendly but secure, encrypted but beautiful,πŸ±β€πŸ‰ string ID generator for JavaScript πŸŽ‰πŸŽ‰πŸŽ‰
A tiny, unique but customizable,🀠 human-friendly but secure, encrypted but beautiful,πŸ±β€πŸ‰intuitive string ID generator for JavaScript πŸŽ‰πŸŽ‰
## Inspiration
It is built for both human and machine. We use familiar letters (from given name & email) in our randomly generated ID. **People can easily recognize those familiar letters as they use it every time, everyday, every moment.** You can randomly generate IDs with uuid or nanoid, but these are not generated for human. These are for machine. This library is for both of them.
# Use Case
As it's human-friendly you can use it as an OTP(one-time password), transaction ID, activation code, SMS code, Invitation key, React component key, Database random ID etc. Your imagination is your limitation. πŸŽ‰πŸŽ‰
As it's human-friendly you can use it as **an OTP(one-time password), transaction ID, activation code, SMS code, Invitation key, React component key, Database random ID** etc. Your imagination is your limitation. πŸŽ‰πŸŽ‰
## Installation
You can view download the package from here - [custom-id npm](https://www.npmjs.com/package/custom-id)
You can download this package from here - [custom-id npm](https://www.npmjs.com/package/custom-id)

@@ -27,3 +31,3 @@ ```bash

You can generate an ID instantly by giving an empty object as the argument. πŸ‘€πŸ‘€πŸ‘€
You can generate an ID instantly by giving **an empty object as the argument**. πŸ‘€πŸ‘€πŸ‘€

@@ -33,3 +37,3 @@ ```js

customId({}); // An automatic 8 string ID will be generated
customId({}); // Voila... A random 8 character string will be generated automatically
```

@@ -39,5 +43,5 @@

✌✌ 2 Number + 2 String + 2 Number + 2 String ✌✌
✌✌** 2 Number + 2 Letter + 2 Number + 2 Letter = 8 characters ** ✌✌
All those number and string will be generated randomly. We use the cryptographic method for generating ids.
All those number and letter will be generated randomly. We use cryptography to generate ids (if available).

@@ -48,3 +52,3 @@ ![client-id example](https://i.ibb.co/qdpTBXt/Screenshot-269.png)

The most beautiful & unique advantage of this library is its customizability.
The most beautiful & unique advantage of this library is its **customizability**.

@@ -62,7 +66,7 @@ ```js

## customId.name (optional)
## customId.name (string || optional)
You can provide a name for randomization. We sanitize the string by removing space, full stop or any special characters. Then we randomize those words and select the strings from those words.
You can provide a name for randomization. We sanitize the string by removing space, full stop or any special characters. Then we **randomize those characters** and select required number of characters(by default 2 characters) from those characters.
If no name is provided, we just select two random alphabets.
If no name is provided, we just select two random alphabet.

@@ -77,5 +81,5 @@ ```js

You can provide an email too. We sanitize the email and convert it to a string by removing space or any special characters. Then we randomize those words and select the strings from those words.
You can provide an email too. We sanitize the email and convert it to a string by removing space or any special characters. Then we randomize those characters and select required number of characters(by default 2 characters) from those words.
If no email is provided, we just select two random alphabets.
If no email is provided, we just select two random alphabet.

@@ -90,22 +94,24 @@ ```js

Okay... we need flexibility sometimes. Our automatic structure is -
Okay... you need flexibility too. Our by default structure is -
✌✌ 2 Number + 2 String + 2 Number + 2 String ✌✌
✌✌ 2 Number + 2 Letter + 2 Number + 2 Letter = 8 character random Id✌✌
(For example: 89KL43ZY)
We can alter this behavior as we wish. if we pass customId.randomLength the value of 4 the result will be -
We can alter this pattern too. if we pass customId.randomLength the value of 4, the result will be -
✌✌ 4 Number + 4 String + 4 Number + 4 String ✌✌
Power is in your hand. You can make it super strong or super easy. It's your call. Use long key combination for really important random number. And use small key combination like 4K8L for OTP or inivitaion code.
```js
customId({
randomLength: 4 // Optional
randomLength: 4 // Optional // By default it's 2
});
```
## customId.lowerCase (boolean || optional)
✌✌ ** 4 Number + 4 String + 4 Number + 4 String = 16 character **✌✌
(For example: 9831MKLS7621GHYX)
We sanitize your string by toUpperCase() method. So every ID created is always in uppercase format. But you may want it in lowercase format. You have the freedom. 😎😎
Power is in your hand. You can make it super strong or super easy. It's your call. Use long key combination for really important random number. And use small key combination like 4K8L for OTP or inivitaion code.
## customId.lowerCase (bool || optional)
We sanitize your string by toUpperCase() method. It's for easy readibility. So every ID created is always in uppercase format. But you may want it in lowercase format. You have the freedom. 😎😎
```js

@@ -119,3 +125,3 @@ customId({

It's all about control & more security. If you want to manipulate your randomly generated string, you can give an unique ID. Our encryption based algorithm will use this number to make a killing combination of IDs. It's completely optional. You can give a static number or node js environment variable to increase your security.
It's all about control & security. If you want to manipulate your randomly generated string, you can give an unique ID. Our encryption based algorithm will use this number to make a totally unpredictable combination of IDs. We just multiply the given number with the randomly generated number and cherrypick required characters from that multiplied number randomly. It's completely optional. You can give a static number or node js environment variable to increase unpredictabilty while generating IDs. This is how we can use both server & client machine to generate random ID. (nightmare for hackers & sniffersπŸ˜‚)

@@ -132,2 +138,14 @@ ```js

## Example Custom ID
```js
customId({
name: "Fazlul Karim",
email: "fazlulkarimrocky@gmail.com"
});
```
Rendered ID will be like below -
**19UI91RR 69KI16LU 64IA13AG 34LA94KC 58ZU48MA**
## Contributing

@@ -134,0 +152,0 @@

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