Sample
uuid 8.3.2
Verified sample for npm uuid 8.3.2. The contract ran on node 22 · linux debian/x64 · docker and passed: require('uuid') in CommonJS exposes named functions…
sha256:5e1e609c0bdb30c45ffc031cabf7ac1e1877b48bda1ce1cb2c7ea67a784f5ba1
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-11-21 |
Case
HOW- Goal
- verify pkg:npm/uuid@8.3.2
- Packages
- Environment
- node 22.23.2
- Created
- 2026-11-21T16:47:01Z
Contract
- require('uuid') in CommonJS exposes named functions v1, v3, v4, v5, parse, stringify, validate, version and NIL constant
- v4() generates a valid RFC 4122 version 4 UUID string
- v4({ random }) applies version 4 and RFC 4122 variant bits deterministically
- v4({ random }, buf, offset) writes 16 UUID bytes at offset and returns buf
- v1(options) generates a valid version 1 UUID
- v3('example.com', v3.DNS) and v5('example.com', v5.DNS) return deterministic RFC 4122 namespace UUIDs
- parse(uuid) returns a 16-byte Uint8Array that stringify(bytes) round-trips, and parse throws TypeError on invalid input
- validate(NIL) is true with version(NIL) === 0, validate rejects invalid strings and Uint8Array inputs, and version throws TypeError on invalid strings
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:npm/uuid@8.3.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/uuid@8.3.2
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:ee5f4af95d0f40e0ec96882b721f84f15842ab6d5cfb5e77ffa14298b6771e0f","constraints":{"executionContext":"node"},"contract":["require('uuid') in CommonJS exposes named functions v1, v3, v4, v5, parse, stringify, validate, version and NIL constant","v4() generates a valid RFC 4122 version 4 UUID string","v4({ random }) applies version 4 and RFC 4122 variant bits deterministically","v4({ random }, buf, offset) writes 16 UUID bytes at offset and returns buf","v1(options) generates a valid version 1 UUID","v3('example.com', v3.DNS) and v5('example.com', v5.DNS) return deterministic RFC 4122 namespace UUIDs","parse(uuid) returns a 16-byte Uint8Array that stringify(bytes) round-trips, and parse throws TypeError on invalid input","validate(NIL) is true with version(NIL) === 0, validate rejects invalid strings and Uint8Array inputs, and version throws TypeError on invalid strings"],"goal":"verify pkg:npm/uuid@8.3.2","kind":"HOW","packages":["pkg:npm/uuid@8.3.2"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/uuid@8.3.2"],"schemaVersion":1,"subject":"pkg:npm/uuid@8.3.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-uuid-cjs",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-uuid-cjs",
"version": "1.0.0",
"dependencies": {
"uuid": "8.3.2"
}
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).",
"license": "MIT",
"bin": {
"uuid": "dist/bin/uuid"
}
}
}
}
{
"name": "sample-uuid-cjs",
"version": "1.0.0",
"private": true,
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"uuid": "8.3.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/uuid@8.3.2",
"kind": "HOW",
"packages": [
"pkg:npm/uuid@8.3.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
'use strict';
const {
v1,
v3,
v4,
v5,
NIL,
parse,
stringify,
validate,
version,
} = require('uuid');
function createRandomUuid() {
return v4();
}
function createDeterministicV4(seedBytes) {
return v4({ random: Uint8Array.from(seedBytes) });
}
function writeV4IntoBuffer(seedBytes, target, offset) {
return v4({ random: Uint8Array.from(seedBytes) }, target, offset);
}
function createNamespaceUuid(versionNumber, name, namespace) {
if (versionNumber === 3) {
return v3(name, namespace);
}
if (versionNumber === 5) {
return v5(name, namespace);
}
throw new RangeError(`Unsupported namespace UUID version: ${versionNumber}`);
}
function roundTripBytes(uuidString) {
const bytes = parse(uuidString);
return {
bytes,
text: stringify(bytes),
};
}
function inspectUuid(value) {
const valid = validate(value);
return {
valid,
version: valid ? version(value) : null,
};
}
module.exports = {
v1,
v3,
v4,
v5,
NIL,
parse,
stringify,
validate,
version,
createRandomUuid,
createDeterministicV4,
writeV4IntoBuffer,
createNamespaceUuid,
roundTripBytes,
inspectUuid,
};
'use strict';
const assert = require('node:assert/strict');
const uuidPkg = require('uuid');
const {
v1,
v3,
v4,
v5,
NIL,
parse,
stringify,
validate,
version,
createRandomUuid,
createDeterministicV4,
writeV4IntoBuffer,
createNamespaceUuid,
roundTripBytes,
inspectUuid,
} = require('../src/index.js');
// 1. CommonJS package exports named functions rather than a callable default
assert.equal(typeof uuidPkg, 'object');
for (const name of ['v1', 'v3', 'v4', 'v5', 'parse', 'stringify', 'validate', 'version']) {
assert.equal(typeof uuidPkg[name], 'function', `expected ${name} export to be a function`);
}
assert.equal(NIL, '00000000-0000-0000-0000-000000000000');
// 2. v4() generates valid RFC 4122 version 4 UUID strings
const generated = createRandomUuid();
assert.equal(typeof generated, 'string');
assert.equal(validate(generated), true);
assert.equal(version(generated), 4);
// 3. v4({ random }) sets version 4 (0x4_) and RFC 4122 variant (0x8_-0xb_) deterministically
const seed = [
0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36,
];
const deterministicV4 = createDeterministicV4(seed);
assert.equal(deterministicV4, '109156be-c4fb-41ea-b1b4-efe1671c5836');
assert.equal(validate(deterministicV4), true);
assert.equal(version(deterministicV4), 4);
// 4. v4(options, buffer, offset) writes 16 bytes at offset and returns the target buffer
const target = new Uint8Array(20);
const returnedBuf = writeV4IntoBuffer(seed, target, 2);
assert.equal(returnedBuf, target);
assert.equal(stringify(target, 2), deterministicV4);
assert.equal(target[0], 0);
assert.equal(target[1], 0);
assert.equal(target[18], 0);
assert.equal(target[19], 0);
// 5. v1() generates a valid version 1 UUID
const timeBased = v1({
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
clockseq: 0x1234,
msecs: 1700000000000,
nsecs: 5678,
});
assert.equal(validate(timeBased), true);
assert.equal(version(timeBased), 1);
// 6. v3() and v5() produce deterministic RFC 4122 namespace UUIDs
const dnsV3 = createNamespaceUuid(3, 'example.com', v3.DNS);
assert.equal(dnsV3, '9073926b-929f-31c2-abc9-fad77ae3e8eb');
assert.equal(validate(dnsV3), true);
assert.equal(version(dnsV3), 3);
const dnsV5 = createNamespaceUuid(5, 'example.com', v5.DNS);
assert.equal(dnsV5, 'cfbff0d1-9375-5685-968c-48ce8b15ae17');
assert.equal(validate(dnsV5), true);
assert.equal(version(dnsV5), 5);
// 7. parse() and stringify() round-trip canonical UUID bytes and reject invalid strings
const { bytes, text } = roundTripBytes(deterministicV4);
assert.ok(bytes instanceof Uint8Array);
assert.equal(bytes.length, 16);
assert.equal(text, deterministicV4);
assert.throws(() => parse('not-a-uuid'), TypeError);
// 8. NIL, validate(), and version() edge cases
assert.deepEqual(inspectUuid(NIL), { valid: true, version: 0 });
assert.deepEqual(inspectUuid('not-a-uuid'), { valid: false, version: null });
assert.equal(validate(bytes), false);
assert.throws(() => version('not-a-uuid'), TypeError);
console.log('uuid@8.3.2 CJS contract passed');
Origin Seeder
anonymous