npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@spidermines/uuidv8

v1.0.1

Published

Generate UUID version 8 identifiers as defined in RFC 9562 — custom-use UUIDs with cryptographically random fields

Readme

@spidermines/uuidv8

Generate UUID version 8 identifiers as defined in RFC 9562.

f6440f3e-14a2-8293-add2-1066de13086a
         ^^^^                          ← version = 8
                   ^                  ← variant = 10xx

What is UUID v8?

UUID v8 is a custom-use UUID format introduced in RFC 9562 alongside the more widely known v7. Where v7 is opinionated (millisecond timestamp + random bits), v8 leaves 122 of its 128 bits entirely up to you.

The spec only mandates two things:

| Bits | Field | Value | |------|-------|-------| | 48–51 | version | 1000 (= 8) | | 64–65 | variant | 10 |

Everything else — the remaining 122 bits split across custom_a, custom_b, and custom_c — is yours to define.

This package fills all custom fields with cryptographically random bytes, making it a drop-in for any situation where you need a universally unique, opaque identifier and none of the earlier UUID versions quite fit.


When to use UUID v8

| Situation | Good fit? | |-----------|-----------| | You need a random, unique ID with no embedded meaning | Yes — same collision resistance as v4 | | You want a UUID that signals "custom / vendor-specific" to readers of your schema | Yes — the 8 version nibble is a clear marker | | You are building a proprietary UUID layout (e.g. embedding a shard ID or timestamp in your own format) | Yes — swap in your own bits instead of random ones | | You need time-sortable IDs | No — use UUID v7 | | You need backwards compatibility with systems that only accept v4 | No — use UUID v4 |


Installation

npm install @spidermines/uuidv8

Requires Node.js 18 or later (uses the built-in crypto module — no extra dependencies).


Usage

CommonJS

const { uuidv8, validate } = require('@spidermines/uuidv8');

const id = uuidv8();
console.log(id);             // "f6440f3e-14a2-8293-add2-1066de13086a"
console.log(validate(id));   // true

ES Modules

import { uuidv8, validate } from '@spidermines/uuidv8';
// or use the default export:
import uuidv8 from '@spidermines/uuidv8';

const id = uuidv8();
console.log(id);             // "017f22e2-79b0-8cc3-98c4-dc0c0c07398f"
console.log(validate(id));   // true

TypeScript

Types are bundled — no @types/ package needed.

import { uuidv8, validate } from '@spidermines/uuidv8';

const id: string = uuidv8();
const ok: boolean = validate(id);

API

uuidv8(): string

Returns a new UUID v8 string with cryptographically random custom fields.

uuidv8(); // "a1b2c3d4-e5f6-8abc-9def-0123456789ab"

The returned string is always lowercase and follows the standard 8-4-4-4-12 hyphenated format.

validate(uuid: string): boolean

Returns true if the given string is a valid UUID v8 (correct format, version nibble = 8, variant bits = 10xx). Returns false for anything else, including other UUID versions.

validate('a1b2c3d4-e5f6-8abc-9def-0123456789ab'); // true  — valid v8
validate('f47ac10b-58cc-4372-a567-0e02b2c3d479'); // false — this is v4
validate('not-a-uuid');                            // false
validate(null);                                    // false

UUID v8 layout

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          custom_a                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           custom_a            |  ver  |       custom_b        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|var|                       custom_c                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           custom_c                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Field | Bits | Value (this package) | |-------|------|----------------------| | custom_a | 48 | random | | ver | 4 | 8 | | custom_b | 12 | random | | var | 2 | 10 | | custom_c | 62 | random |


License

GPL-3.0