
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
uid-number-bands
Advanced tools
Unique identifier (ID) number generator within band ranges.
This schema, was developed for Kurunt, the scalable message processing framework, where you have multiple inputs receiving messages for processing that each require a unique ID represented as a sequential integer in nanosecond format.
1374207372000000001
1374207372000000002
1374207372000000003
...
npm install uid-number-bands
var uidNumberBands = require('uid-number-bands');
var util = require('util');
var BAND = 0;
var BANDS = 100;
// [band, bands, boolean: start id at 1, callback function (optional)].
uidNumberBands.init(BAND, BANDS);
// uidNumberBands.make(spacing) returns id object: id.uid, id.idn, id.unixtime, id.normalized_uid, id.freshsec.
var id = uidNumberBands.make();
console.log('set id: ' + util.inspect(id));
// can parse the uid.
var id = uidNumberBands.parse(id.uid);
console.log('parsed id: ' + util.inspect(id));
BANDS (integer) represents the maximum number of generators. BANDS is divisible by (999,999,999 + 1). The + 1 is because the band range starts at 0.
BAND (integer) represents the generator being used.
So if BANDS = 100 then; (999,999,999 + 1) / 100 = 10,000,000 maximum IDs per second per generator (band).
The UID returned combines unixtime and the IDN (padded), for example: 1382454272 & 999999999 = "1382454272999999999"
100 BANDS = 10,000,000 IDs per second.
------------------------------------------------
| BAND (BANDS = 100) | ID RANGE |
------------------------------------------------
| 0 | 000,000,000:009,999,999 |
| 1 | 010,000,000:019,999,999 |
| 2 | 020,000,000:029,999,999 |
| 3 | 030,000,000:039,999,999 |
| 4 | 040,000,000:049,999,999 |
| 5 | 050,000,000:059,999,999 |
| 6 | 060,000,000:069,999,999 |
| 7 | 070,000,000:079,999,999 |
| 8 | 080,000,000:089,999,999 |
| 9 | 090,000,000:099,999,999 |
| 10 | 100,000,000:109,999,999 |
| 99 | 990,000,000:999,999,999 |
------------------------------------------------
1000 BANDS = 1,000,000 IDs per second.
------------------------------------------------
| BAND (BANDS = 1000)| ID RANGE |
------------------------------------------------
| 0 | 000,000,000:000,999,999 |
| 1 | 001,000,000:001,999,999 |
| 2 | 002,000,000:002,999,999 |
| 3 | 003,000,000:003,999,999 |
| 4 | 004,000,000:004,999,999 |
| 5 | 005,000,000:005,999,999 |
| 6 | 006,000,000:006,999,999 |
| 7 | 007,000,000:007,999,999 |
| 8 | 008,000,000:008,999,999 |
| 9 | 009,000,000:009,999,999 |
| 10 | 010,000,000:010,999,999 |
| 999 | 999,000,000:999,999,999 |
------------------------------------------------
MIT or Apache 2.0
FAQs
Unique ID number generator within band ranges.
We found that uid-number-bands demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.