CodeSampleX

Sample

uuid 8.3.2: NIL

Verified sample for npm uuid 8.3.2: NIL. The contract ran on node 22 · linux debian/x64 · docker and passed: require('uuid').NIL equals…

sha256:93310db186d11ee75de712b0d24354fd4a23d18e404cb3f61685323c0a762dc2

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 uuid.NIL in pkg:npm/uuid@8.3.2
Packages
Symbols
  • uuid.NIL
Environment
node 22.23.2
Created
2026-11-21T22:56:37Z

Contract

  1. require('uuid').NIL equals '00000000-0000-0000-0000-000000000000' and destructured { NIL } strictly equals uuid.NIL
  2. uuid.validate(uuid.NIL) returns true and uuid.version(uuid.NIL) returns 0
  3. uuid.parse(uuid.NIL) returns a 16-byte Uint8Array of all zeros and uuid.stringify(new Uint8Array(16)) equals uuid.NIL
  4. uuid.NIL works as a deterministic namespace for uuid.v5('example', uuid.NIL) and differs from generated uuid.v4() values
  5. isNilUuid(uuid.NIL) returns true while non-nil UUIDs, malformed strings, and non-strings return false

Files

  • PROMPT.md
  • csx.json
  • index.js
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

Download the source artifact (tar.gz)

Source

PROMPT.md
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.NIL 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.NIL
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.
csx.json
{"case":{"caseId":"case:sha256:708a628ba7189668c83d101c323cc9d9639d58efed8f0da238c34fb498d497e6","constraints":{"executionContext":"node"},"contract":["require('uuid').NIL equals '00000000-0000-0000-0000-000000000000' and destructured { NIL } strictly equals uuid.NIL","uuid.validate(uuid.NIL) returns true and uuid.version(uuid.NIL) returns 0","uuid.parse(uuid.NIL) returns a 16-byte Uint8Array of all zeros and uuid.stringify(new Uint8Array(16)) equals uuid.NIL","uuid.NIL works as a deterministic namespace for uuid.v5('example', uuid.NIL) and differs from generated uuid.v4() values","isNilUuid(uuid.NIL) returns true while non-nil UUIDs, malformed strings, and non-strings return false"],"goal":"verify uuid.NIL in pkg:npm/uuid@8.3.2","kind":"HOW","packages":["pkg:npm/uuid@8.3.2"],"schemaVersion":1,"symbols":["uuid.NIL"]},"contractCommand":["node","test/contract.cjs"],"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.NIL"],"verifierAdapter":"node-typescript@1"}
index.js
'use strict';

const uuid = require('uuid');

const NIL_UUID = uuid.NIL;

function isNilUuid(value) {
  return typeof value === 'string' && value === uuid.NIL;
}

function nilBytes() {
  return uuid.parse(uuid.NIL);
}

function fromZeroBytes() {
  return uuid.stringify(new Uint8Array(16));
}

function deriveFromNilNamespace(name) {
  return uuid.v5(name, uuid.NIL);
}

module.exports = {
  NIL_UUID,
  isNilUuid,
  nilBytes,
  fromZeroBytes,
  deriveFromNilNamespace,
};
package-lock.json
{
  "name": "uuid-nil-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "uuid-nil-sample",
      "version": "1.0.0",
      "license": "MIT-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"
      }
    }
  }
}
package.json
{
  "name": "uuid-nil-sample",
  "version": "1.0.0",
  "private": true,
  "description": "Minimal CommonJS sample verifying uuid.NIL in uuid@8.3.2",
  "main": "index.js",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "uuid": "8.3.2"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify uuid.NIL in pkg:npm/uuid@8.3.2",
  "kind": "HOW",
  "packages": [
    "pkg:npm/uuid@8.3.2"
  ],
  "symbols": [
    "uuid.NIL"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.cjs
'use strict';

const assert = require('node:assert/strict');
const uuid = require('uuid');
const { NIL } = require('uuid');
const {
  NIL_UUID,
  isNilUuid,
  nilBytes,
  fromZeroBytes,
  deriveFromNilNamespace,
} = require('../index.js');

const EXPECTED_NIL = '00000000-0000-0000-0000-000000000000';

// 1. Constant value and CommonJS named export identity
assert.equal(typeof uuid.NIL, 'string');
assert.equal(uuid.NIL, EXPECTED_NIL);
assert.equal(uuid.NIL.length, 36);
assert.equal(NIL, uuid.NIL);
assert.equal(NIL_UUID, uuid.NIL);

// 2. Validation and version semantics for NIL UUID
assert.equal(uuid.validate(uuid.NIL), true);
assert.equal(uuid.version(uuid.NIL), 0);

// 3. Binary parse / stringify round-trip with 16 zero bytes
const parsed = nilBytes();
assert.ok(parsed instanceof Uint8Array);
assert.equal(parsed.length, 16);
assert.deepEqual(Array.from(parsed), new Array(16).fill(0));
assert.equal(fromZeroBytes(), uuid.NIL);

// 4. NIL UUID as deterministic namespace and distinction from v4
const derivedA = deriveFromNilNamespace('example');
const derivedB = deriveFromNilNamespace('example');
assert.equal(derivedA, derivedB);
assert.equal(uuid.validate(derivedA), true);
assert.equal(uuid.version(derivedA), 5);
assert.notEqual(derivedA, uuid.NIL);

const randomId = uuid.v4();
assert.equal(uuid.validate(randomId), true);
assert.notEqual(randomId, uuid.NIL);

// 5. Helper predicate checks
assert.equal(isNilUuid(uuid.NIL), true);
assert.equal(isNilUuid(EXPECTED_NIL), true);
assert.equal(isNilUuid(randomId), false);
assert.equal(isNilUuid('00000000-0000-0000-0000-000000000001'), false);
assert.equal(isNilUuid('not-a-uuid'), false);
assert.equal(isNilUuid(null), false);

console.log('contract ok: uuid.NIL verified');

Origin Seeder

anonymous