eska-id
v0.1.4
Published
☀️ A simple, functional and customizable ID system.
Downloads
6
Readme
Install
npm i eska-id
Features
- Really simple to understand and implement
- Guaranteed uniqueness
- Timestamped
- Shorter than UUIDs
- Cryptographically secure by design
The ID
Eska IDs consist of 3 sections: the prefix, the Superflake and the tail, which is simply a cryptographically secure random string.
Superflake
Superflake is a revolutionary technology based on Twitter's Snowflake. Superflake is generated by concatenating:
- a 42-bit timestamp,
- a 10-bit node ID, and
- a 12-bit sequential number.
If you want to generate Superflakes without using Eska or implementing your own code, use this library.
Example
import { Eska } from "eska-id";
// Initialize Eska
const eska = new Eska({ prefix: { content: "u" } });
// Generate an Eska ID
eska.generate();
// => u_692461092816395059286eafdfb2a12963b