strossle-id

0.1.1 • Public • Published

Strossle-id

Unique Strossle ID generator

Syntax

Strossle ID is composed of 38 hexadecimal characters:

VVVVRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRCC

  • First 4 characters VVVV represent the version of the ID
  • Next are 32 RRR...RRR random characters
  • The ID is concluded with 2 checksum CC characters

Installation

Install by running npm install strossle-id

Usage

const strossleId = require('strossle-id');
 
// Generate a new random id
let newID = strossleId.generate();
 
// Validate id
strossleId.validate(newID); // true
 
// OPTIONAL - generate a specific version of strossle-ID
let idVersion = 1;
let earlyVersionID = strossleId.generate(idVersion);

ID Versions

Version Description State
1 (current) Using metrohash128 and crc8 Supported

Note: If an unsupported version is provided as parameter to generate() function, the function defaults to current version.

Tests

Run mocha test/unit-test.js

Readme

Keywords

none

Package Sidebar

Install

npm i strossle-id

Weekly Downloads

1

Version

0.1.1

License

ISC

Last publish

Collaborators

  • rejaha
  • danvanwijk
  • espelund
  • domagoj.perisic
  • henkesteen
  • vincent.eldefors
  • bondza
  • strossle-admin