Sample
uuid 8.3.2: v4
Verified sample for npm uuid 8.3.2: v4. The contract ran on node 22 · linux debian/x64 · docker and passed: require('uuid').v4 is exported in CommonJS while…
sha256:f143ee964bb8708ce9ff111be668380b20f84bf0dde777c6f72546f192151e8d
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-22 |
Case
HOW- Goal
- verify uuid.v4 in pkg:npm/uuid@8.3.2
- Packages
- Symbols
-
- uuid.v4
- Environment
- node 22.23.2
- Created
- 2026-11-22T16:48:17Z
Contract
- require('uuid').v4 is exported in CommonJS while subpath require('uuid/v4') throws ERR_PACKAGE_PATH_NOT_EXPORTED
- uuid.v4() returns distinct 36-character lowercase RFC 4122 version 4 UUID strings
- uuid.v4({ random }) mutates random[6] to version 4 and random[8] to RFC 4122 variant in place and returns the deterministic UUID string
- uuid.v4({ rng }) invokes custom rng to obtain 16 bytes, and options.random takes precedence over options.rng without calling rng
- uuid.v4(options, buf, offset) writes 16 UUID bytes into buf at offset without modifying surrounding bytes and returns the same buf instance
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 uuid.v4 in pkg:npm/uuid@8.3.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/uuid@8.3.2
Demonstrate these symbols/APIs:
- uuid.v4
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:878036e0d5fc5d8281d60a3f01e8e0ceb004012e7061d98698c3c78c36d91b75","constraints":{"executionContext":"node"},"contract":["require('uuid').v4 is exported in CommonJS while subpath require('uuid/v4') throws ERR_PACKAGE_PATH_NOT_EXPORTED","uuid.v4() returns distinct 36-character lowercase RFC 4122 version 4 UUID strings","uuid.v4({ random }) mutates random[6] to version 4 and random[8] to RFC 4122 variant in place and returns the deterministic UUID string","uuid.v4({ rng }) invokes custom rng to obtain 16 bytes, and options.random takes precedence over options.rng without calling rng","uuid.v4(options, buf, offset) writes 16 UUID bytes into buf at offset without modifying surrounding bytes and returns the same buf instance"],"goal":"verify uuid.v4 in pkg:npm/uuid@8.3.2","kind":"HOW","packages":["pkg:npm/uuid@8.3.2"],"schemaVersion":1,"symbols":["uuid.v4"]},"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","symbols":["uuid.v4"],"verifierAdapter":"node-typescript@1"}
{
"name": "uuid-v4-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "uuid-v4-sample",
"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": "uuid-v4-sample",
"version": "1.0.0",
"private": true,
"description": "Minimal CommonJS sample verifying uuid.v4 in uuid@8.3.2",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"uuid": "8.3.2"
}
}
{
"schemaVersion": 1,
"goal": "verify uuid.v4 in pkg:npm/uuid@8.3.2",
"kind": "HOW",
"packages": [
"pkg:npm/uuid@8.3.2"
],
"symbols": [
"uuid.v4"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
'use strict';
const { v4 } = require('uuid');
function generateId() {
return v4();
}
function generateFromRandom(random) {
return v4({ random });
}
function generateFromRng(rng) {
return v4({ rng });
}
function writeIdToBuffer(options, buf, offset) {
return v4(options, buf, offset);
}
module.exports = {
generateId,
generateFromRandom,
generateFromRng,
writeIdToBuffer,
};
'use strict';
const assert = require('node:assert/strict');
const uuid = require('uuid');
const {
generateId,
generateFromRandom,
generateFromRng,
writeIdToBuffer,
} = require('../src/index.js');
const UUID_V4_RE =
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
// 1. CommonJS default import exposes v4; subpath require('uuid/v4') is blocked by exports map
assert.equal(typeof uuid.v4, 'function');
assert.throws(
() => require('uuid/v4'),
(err) => err && err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED'
);
// 2. v4() generates distinct lowercase RFC 4122 v4 strings
const first = generateId();
const second = generateId();
assert.match(first, UUID_V4_RE);
assert.match(second, UUID_V4_RE);
assert.notEqual(first, second);
// 3. v4({ random }) mutates bytes 6 and 8 in place and formats deterministically
const seed = Uint8Array.from([
0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36,
]);
const fromRandom = generateFromRandom(seed);
assert.equal(fromRandom, '109156be-c4fb-41ea-b1b4-efe1671c5836');
assert.equal(seed[6], 0x41);
assert.equal(seed[8], 0xb1);
// 4. v4({ rng }) invokes custom rng; when both random and rng are given, random wins
let rngCalls = 0;
const fromRng = generateFromRng(() => {
rngCalls += 1;
return new Uint8Array(16).fill(0xff);
});
assert.equal(rngCalls, 1);
assert.equal(fromRng, 'ffffffff-ffff-4fff-bfff-ffffffffffff');
let skippedRngCalls = 0;
const randomWins = uuid.v4({
random: new Uint8Array(16).fill(0x00),
rng: () => {
skippedRngCalls += 1;
return new Uint8Array(16).fill(0xff);
},
});
assert.equal(skippedRngCalls, 0);
assert.equal(randomWins, '00000000-0000-4000-8000-000000000000');
// 5. v4(options, buf, offset) writes 16 bytes at offset, preserves surrounding bytes, and returns buf
const target = new Uint8Array(20).fill(0xaa);
const inputBytes = Uint8Array.from([
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
]);
const returned = writeIdToBuffer({ random: inputBytes }, target, 2);
assert.strictEqual(returned, target);
assert.equal(target[0], 0xaa);
assert.equal(target[1], 0xaa);
assert.equal(target[18], 0xaa);
assert.equal(target[19], 0xaa);
assert.deepEqual(
Array.from(target.subarray(2, 18)),
[
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x46, 0x77,
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
]
);
console.log('uuid.v4 contract passed');
Origin Seeder
anonymous