Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@thi.ng/ksuid

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/ksuid - npm Package Compare versions

Comparing version 3.1.14 to 3.1.15

2

aksuid.d.ts

@@ -29,5 +29,5 @@ import type { BaseN } from "@thi.ng/base-n";

protected ensureSize(buf: Uint8Array): Uint8Array;
protected ensureTime(t: number): number;
protected ensureTime(t: number, max?: number): number;
protected u32(buf: Uint8Array, i?: number): number;
}
//# sourceMappingURL=aksuid.d.ts.map

@@ -48,4 +48,5 @@ import { BASE62 } from "@thi.ng/base-n/62";

}
ensureTime(t) {
ensureTime(t, max) {
assert(t >= 0, "configured base epoch must be in the past");
max && assert(t <= max, `given epoch is out of range ([0...${max}])`);
return t;

@@ -52,0 +53,0 @@ }

# Change Log
- **Last updated**: 2023-08-04T10:58:19Z
- **Last updated**: 2023-08-06T09:21:31Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -12,2 +12,11 @@

### [3.1.15](https://github.com/thi-ng/umbrella/tree/@thi.ng/ksuid@3.1.15) (2023-08-06)
#### 🩹 Bug fixes
- fix [#403](https://github.com/thi-ng/umbrella/issues/403), update KSUID32 epoch handling ([abbfc5a](https://github.com/thi-ng/umbrella/commit/abbfc5a))
- update .ensureTime() to check against optional max value
- fix int coercion in KSUID32.timeOnlyBinary()
- update readme
## [3.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/ksuid@3.1.0) (2023-02-10)

@@ -14,0 +23,0 @@

import { AKSUID } from "./aksuid.js";
const MAX_EPOCH = -1 >>> 0;
export class KSUID32 extends AKSUID {

@@ -12,3 +13,3 @@ constructor(opts) {

const buf = new Uint8Array(this.size);
const t = this.ensureTime(((epoch - this.epoch) / 1000) | 0);
const t = this.ensureTime((epoch - this.epoch) / 1000, MAX_EPOCH) >>> 0;
buf.set([t >>> 24, (t >> 16) & 0xff, (t >> 8) & 0xff, t & 0xff]);

@@ -15,0 +16,0 @@ return buf;

{
"name": "@thi.ng/ksuid",
"version": "3.1.14",
"version": "3.1.15",
"description": "Configurable K-sortable unique IDs, ULIDs, binary & base-N encoded, 32/48/64bit time resolutions",

@@ -39,3 +39,3 @@ "type": "module",

"dependencies": {
"@thi.ng/base-n": "^2.5.6",
"@thi.ng/base-n": "^2.5.7",
"@thi.ng/errors": "^2.3.0",

@@ -118,3 +118,3 @@ "@thi.ng/random": "^3.5.1",

},
"gitHead": "9fa3f7f8169efa30e3c71b43c82f77393581c3b5\n"
"gitHead": "888293c74f2e9a481d500d4ec319f1e2bd765ec6\n"
}

@@ -32,12 +32,12 @@ <!-- This file is generated - DO NOT EDIT! -->

| Feature | KSUID default | ULID default |
|---------------------------------------|------------------------|------------------------|
| Configurable bit size | 160 bits | 128 bits |
| Base-N encoding scheme | base62<sup>(1)</sup> | base32 (Crockford) |
| Timestamp resolution | seconds (32 bits) | milliseconds (48 bits) |
| | milliseconds (64 bits) | |
| Epoch start time offset | approx. 2020-09-13 | none |
| Time-only base ID generation | ✅ | ✅ |
| ID parsing / decomposition | ✅ | ✅ |
| Configurable RNG source<sup>(2)</sup> | ✅ | ✅ |
| Feature | KSUID default | ULID default |
|---------------------------------------|----------------------------------|------------------------|
| Configurable bit size | 160 bits | 128 bits |
| Base-N encoding scheme | base62<sup>(1)</sup> | base32 (Crockford) |
| Timestamp resolution | seconds (32 bits) | milliseconds (48 bits) |
| | milliseconds (64 bits) | |
| Epoch start time offset | approx. 2020-09-13<sup>(2)</sup> | none |
| Time-only base ID generation | ✅ | ✅ |
| ID parsing / decomposition | ✅ | ✅ |
| Configurable RNG source<sup>(3)</sup> | ✅ | ✅ |

@@ -47,3 +47,4 @@ - <sup>(1)</sup> See

for alternatives
- <sup>(2)</sup> Default: `window.crypto`, `Math.random` as fallback
- <sup>(2)</sup> With the default offset, the max. supported date for `KSUID32` is 2156-10-20T18:54:55Z
- <sup>(3)</sup> Default: `window.crypto`, `Math.random` as fallback

@@ -115,3 +116,3 @@ IDs generated w/ this package are composed of a 32, 48 or 64 bit Unix epochs and

Package sizes (brotli'd, pre-treeshake): ESM: 769 bytes
Package sizes (brotli'd, pre-treeshake): ESM: 809 bytes

@@ -118,0 +119,0 @@ ## Dependencies

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc