Sample
@types/node 17.0.45
Verified sample for npm @types/node 17.0.45. The contract ran on node 22 · linux alpine/x64 · docker and passed: @types/node package.json declares type…
sha256:38410997c42dff1d3dcee31ae574ab966decf2d410a515ded46b664fcafa0ca3
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 alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
Case
HOW- Goal
- verify pkg:npm/%40types/node@17.0.45
- Packages
- Environment
- node 22.23.2
- Created
- 2026-08-23T05:52:50Z
Contract
- @types/node package.json declares type definitions entry point index.d.ts and version 17.0.45
- @types/node index.d.ts references core Node.js module declaration files including buffer, crypto, events, fs, and stream
- @types/node buffer.d.ts declares Buffer interface and BufferEncoding type
- @types/node crypto.d.ts declares createHash, createHmac, and randomBytes cryptographic functions
- @types/node events.d.ts declares EventEmitter class and listenerCount method
- @types/node fs.d.ts declares readFileSync and writeFileSync signatures
- @types/node stream.d.ts declares Readable, Writable, and Transform stream classes
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/%40types/node@17.0.45
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/node@17.0.45
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:fa740061caf7c0cbb61b4dfbc413554ee73b94fb37ce2257de4e3c5f9347c07b","contract":["@types/node package.json declares type definitions entry point index.d.ts and version 17.0.45","@types/node index.d.ts references core Node.js module declaration files including buffer, crypto, events, fs, and stream","@types/node buffer.d.ts declares Buffer interface and BufferEncoding type","@types/node crypto.d.ts declares createHash, createHmac, and randomBytes cryptographic functions","@types/node events.d.ts declares EventEmitter class and listenerCount method","@types/node fs.d.ts declares readFileSync and writeFileSync signatures","@types/node stream.d.ts declares Readable, Writable, and Transform stream classes"],"goal":"verify pkg:npm/%40types/node@17.0.45","kind":"HOW","packages":["pkg:npm/%40types/node@17.0.45"],"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/%40types/node@17.0.45"],"schemaVersion":1,"subject":"pkg:npm/%40types/node@17.0.45","verifierAdapter":"node-typescript@1"}
{
"name": "sample-node-types",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-node-types",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/node": "17.0.45"
}
},
"node_modules/@types/node": {
"version": "17.0.45",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz",
"integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==",
"license": "MIT"
}
}
}
{
"name": "sample-node-types",
"version": "1.0.0",
"private": true,
"license": "MIT-0",
"dependencies": {
"@types/node": "17.0.45"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40types/node@17.0.45",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/node@17.0.45"
]
}
const fs = require('node:fs');
const path = require('node:path');
/**
* Resolves the path to the @types/node declaration directory.
* @returns {string} Absolute path to @types/node directory
*/
function getNodeTypesDir() {
const pkgJsonPath = require.resolve('@types/node/package.json');
return path.dirname(pkgJsonPath);
}
/**
* Resolves the path to a specific declaration file inside @types/node.
* @param {string} [subPath='index.d.ts'] - Relative declaration file path
* @returns {string} Absolute path to the declaration file
*/
function getDeclarationPath(subPath = 'index.d.ts') {
const baseDir = getNodeTypesDir();
return path.join(baseDir, subPath);
}
/**
* Loads the text content of a declaration file in @types/node.
* @param {string} [subPath='index.d.ts'] - Relative declaration file path
* @returns {string} Text content of the declaration file
*/
function loadDeclarationContent(subPath = 'index.d.ts') {
const declPath = getDeclarationPath(subPath);
return fs.readFileSync(declPath, 'utf8');
}
/**
* Inspects core Node.js TypeScript declaration files and signatures.
* @returns {object} Summary of discovered type definitions
*/
function inspectTypeDefinitions() {
const indexContent = loadDeclarationContent('index.d.ts');
const bufferContent = loadDeclarationContent('buffer.d.ts');
const cryptoContent = loadDeclarationContent('crypto.d.ts');
const eventsContent = loadDeclarationContent('events.d.ts');
const fsContent = loadDeclarationContent('fs.d.ts');
const streamContent = loadDeclarationContent('stream.d.ts');
return {
indexHasBuffer: indexContent.includes('buffer.d.ts'),
indexHasCrypto: indexContent.includes('crypto.d.ts'),
indexHasEvents: indexContent.includes('events.d.ts'),
indexHasFs: indexContent.includes('fs.d.ts'),
indexHasStream: indexContent.includes('stream.d.ts'),
bufferHasInterface: bufferContent.includes('interface Buffer'),
bufferHasEncoding: bufferContent.includes('type BufferEncoding ='),
cryptoHasCreateHash: cryptoContent.includes('function createHash('),
cryptoHasCreateHmac: cryptoContent.includes('function createHmac('),
cryptoHasRandomBytes: cryptoContent.includes('function randomBytes('),
eventsHasEventEmitter: eventsContent.includes('class EventEmitter'),
eventsHasListenerCount: eventsContent.includes('listenerCount('),
fsHasReadFileSync: fsContent.includes('function readFileSync('),
fsHasWriteFileSync: fsContent.includes('function writeFileSync('),
streamHasReadable: streamContent.includes('class Readable'),
streamHasWritable: streamContent.includes('class Writable'),
streamHasTransform: streamContent.includes('class Transform')
};
}
module.exports = {
getNodeTypesDir,
getDeclarationPath,
loadDeclarationContent,
inspectTypeDefinitions
};
const assert = require('node:assert');
const fs = require('node:fs');
const path = require('node:path');
const {
getNodeTypesDir,
getDeclarationPath,
loadDeclarationContent,
inspectTypeDefinitions
} = require('../src/index.js');
// 1. Verify package manifest exports and metadata
const pkgJson = require('@types/node/package.json');
assert.strictEqual(pkgJson.name, '@types/node', 'package name should match @types/node');
assert.strictEqual(pkgJson.version, '17.0.45', 'package version should match 17.0.45');
assert.strictEqual(pkgJson.types, 'index.d.ts', 'package types entry should point to index.d.ts');
// 2. Verify declaration files existence
const indexDeclPath = getDeclarationPath('index.d.ts');
assert.strictEqual(fs.existsSync(indexDeclPath), true, 'index.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('buffer.d.ts')), true, 'buffer.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('crypto.d.ts')), true, 'crypto.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('events.d.ts')), true, 'events.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('fs.d.ts')), true, 'fs.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('stream.d.ts')), true, 'stream.d.ts should exist on disk');
// 3. Verify index.d.ts references core modules
const indexContent = loadDeclarationContent('index.d.ts');
assert.strictEqual(typeof indexContent, 'string', 'index.d.ts content should be a string');
assert.strictEqual(indexContent.includes('buffer.d.ts'), true, 'index.d.ts should reference buffer.d.ts');
assert.strictEqual(indexContent.includes('crypto.d.ts'), true, 'index.d.ts should reference crypto.d.ts');
assert.strictEqual(indexContent.includes('events.d.ts'), true, 'index.d.ts should reference events.d.ts');
assert.strictEqual(indexContent.includes('fs.d.ts'), true, 'index.d.ts should reference fs.d.ts');
assert.strictEqual(indexContent.includes('stream.d.ts'), true, 'index.d.ts should reference stream.d.ts');
// 4. Verify buffer.d.ts declarations
const bufferContent = loadDeclarationContent('buffer.d.ts');
assert.strictEqual(bufferContent.includes('interface Buffer'), true, 'buffer.d.ts must declare Buffer interface');
assert.strictEqual(bufferContent.includes('type BufferEncoding ='), true, 'buffer.d.ts must declare BufferEncoding type');
// 5. Verify crypto.d.ts declarations
const cryptoContent = loadDeclarationContent('crypto.d.ts');
assert.strictEqual(cryptoContent.includes('function createHash('), true, 'crypto.d.ts must declare createHash');
assert.strictEqual(cryptoContent.includes('function createHmac('), true, 'crypto.d.ts must declare createHmac');
assert.strictEqual(cryptoContent.includes('function randomBytes('), true, 'crypto.d.ts must declare randomBytes');
// 6. Verify events.d.ts declarations
const eventsContent = loadDeclarationContent('events.d.ts');
assert.strictEqual(eventsContent.includes('class EventEmitter'), true, 'events.d.ts must declare EventEmitter class');
assert.strictEqual(eventsContent.includes('listenerCount('), true, 'events.d.ts must declare listenerCount');
// 7. Verify fs.d.ts declarations
const fsContent = loadDeclarationContent('fs.d.ts');
assert.strictEqual(fsContent.includes('function readFileSync('), true, 'fs.d.ts must declare readFileSync');
assert.strictEqual(fsContent.includes('function writeFileSync('), true, 'fs.d.ts must declare writeFileSync');
// 8. Verify stream.d.ts declarations
const streamContent = loadDeclarationContent('stream.d.ts');
assert.strictEqual(streamContent.includes('class Readable'), true, 'stream.d.ts must declare Readable class');
assert.strictEqual(streamContent.includes('class Writable'), true, 'stream.d.ts must declare Writable class');
assert.strictEqual(streamContent.includes('class Transform'), true, 'stream.d.ts must declare Transform class');
// 9. Verify helper inspection module
const inspection = inspectTypeDefinitions();
assert.strictEqual(inspection.indexHasBuffer, true, 'inspection should confirm buffer reference');
assert.strictEqual(inspection.indexHasCrypto, true, 'inspection should confirm crypto reference');
assert.strictEqual(inspection.indexHasEvents, true, 'inspection should confirm events reference');
assert.strictEqual(inspection.indexHasFs, true, 'inspection should confirm fs reference');
assert.strictEqual(inspection.indexHasStream, true, 'inspection should confirm stream reference');
assert.strictEqual(inspection.bufferHasInterface, true, 'inspection should confirm Buffer interface');
assert.strictEqual(inspection.bufferHasEncoding, true, 'inspection should confirm BufferEncoding type');
assert.strictEqual(inspection.cryptoHasCreateHash, true, 'inspection should confirm createHash function');
assert.strictEqual(inspection.cryptoHasCreateHmac, true, 'inspection should confirm createHmac function');
assert.strictEqual(inspection.cryptoHasRandomBytes, true, 'inspection should confirm randomBytes function');
assert.strictEqual(inspection.eventsHasEventEmitter, true, 'inspection should confirm EventEmitter class');
assert.strictEqual(inspection.eventsHasListenerCount, true, 'inspection should confirm listenerCount method');
assert.strictEqual(inspection.fsHasReadFileSync, true, 'inspection should confirm readFileSync function');
assert.strictEqual(inspection.fsHasWriteFileSync, true, 'inspection should confirm writeFileSync function');
assert.strictEqual(inspection.streamHasReadable, true, 'inspection should confirm Readable class');
assert.strictEqual(inspection.streamHasWritable, true, 'inspection should confirm Writable class');
assert.strictEqual(inspection.streamHasTransform, true, 'inspection should confirm Transform class');
console.log('Contract tests passed successfully.');
Origin Seeder
anonymous