Ejemplo
minizlib 2.1.2
Muestra verificada para npm minizlib 2.1.2. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: Gzip compresses input buffer and Gunzip…
sha256:39ed08176da92665cf4e7d5942ee056ad6ce93b6ce59a7c6d93aac84153b9685
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-28 |
Caso
HOW- Objetivo
- verify pkg:npm/minizlib@2.1.2
- Paquetes
- Entorno
- node 22.23.2
- Creado
- 2026-08-28T07:55:59Z
Contrato
- Gzip compresses input buffer and Gunzip decompresses back to original buffer
- Deflate and Inflate perform standard zlib compression and decompression
- DeflateRaw and InflateRaw handle raw deflate streams without zlib headers
- BrotliCompress compresses payload and BrotliDecompress restores original content
- Gunzip emits error event on malformed compressed payload
- Gzip respects compression level options from constants
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código fuente
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/minizlib@2.1.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/minizlib@2.1.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:192d7df0884e76c7019aad5aeda1414c60becab860ea9e35dd33e2f694b1f06a","constraints":{"executionContext":"node"},"contract":["Gzip compresses input buffer and Gunzip decompresses back to original buffer","Deflate and Inflate perform standard zlib compression and decompression","DeflateRaw and InflateRaw handle raw deflate streams without zlib headers","BrotliCompress compresses payload and BrotliDecompress restores original content","Gunzip emits error event on malformed compressed payload","Gzip respects compression level options from constants"],"goal":"verify pkg:npm/minizlib@2.1.2","kind":"HOW","packages":["pkg:npm/minizlib@2.1.2"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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/minizlib@2.1.2"],"schemaVersion":1,"subject":"pkg:npm/minizlib@2.1.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-minizlib-verify",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-minizlib-verify",
"version": "1.0.0",
"dependencies": {
"minizlib": "2.1.2"
}
},
"node_modules/minipass": {
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
"license": "ISC",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/minizlib": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
"license": "MIT",
"dependencies": {
"minipass": "^3.0.0",
"yallist": "^4.0.0"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"license": "ISC"
}
}
}
{
"name": "sample-minizlib-verify",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"minizlib": "2.1.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/minizlib@2.1.2",
"kind": "HOW",
"packages": [
"pkg:npm/minizlib@2.1.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
Gzip,
Gunzip,
Deflate,
Inflate,
DeflateRaw,
InflateRaw,
BrotliCompress,
BrotliDecompress,
constants
} = require('minizlib');
// 1. Gzip compresses input and Gunzip decompresses back to original buffer
{
const input = Buffer.from('Hello CodeSampleX with minizlib gzip compression!');
const gzip = new Gzip();
gzip.end(input);
const compressed = gzip.read();
assert.ok(Buffer.isBuffer(compressed), 'Gzip output should be a Buffer');
assert.ok(compressed.length > 0, 'Gzip output should not be empty');
assert.strictEqual(compressed[0], 0x1f, 'First gzip magic byte should be 0x1f');
assert.strictEqual(compressed[1], 0x8b, 'Second gzip magic byte should be 0x8b');
const gunzip = new Gunzip();
gunzip.end(compressed);
const decompressed = gunzip.read();
assert.ok(Buffer.isBuffer(decompressed), 'Gunzip output should be a Buffer');
assert.strictEqual(decompressed.toString('utf8'), input.toString('utf8'), 'Decompressed content must match original input');
}
// 2. Deflate and Inflate perform standard zlib compression and decompression
{
const input = Buffer.from('Testing Deflate and Inflate with structured text payload 1234567890');
const deflate = new Deflate();
deflate.end(input);
const compressed = deflate.read();
assert.ok(Buffer.isBuffer(compressed), 'Deflate output should be a Buffer');
const inflate = new Inflate();
inflate.end(compressed);
const decompressed = inflate.read();
assert.strictEqual(decompressed.toString('utf8'), input.toString('utf8'), 'Inflate output must match deflate input');
}
// 3. DeflateRaw and InflateRaw handle raw deflate streams without zlib headers
{
const input = Buffer.from('Testing DeflateRaw and InflateRaw without headers');
const rawDeflate = new DeflateRaw();
rawDeflate.end(input);
const rawCompressed = rawDeflate.read();
assert.ok(Buffer.isBuffer(rawCompressed), 'DeflateRaw output should be a Buffer');
const rawInflate = new InflateRaw();
rawInflate.end(rawCompressed);
const decompressed = rawInflate.read();
assert.strictEqual(decompressed.toString('utf8'), input.toString('utf8'), 'InflateRaw output must match raw deflate input');
}
// 4. BrotliCompress compresses payload and BrotliDecompress restores original content
{
const input = Buffer.from('Testing BrotliCompress and BrotliDecompress in minizlib');
const brotliCompress = new BrotliCompress();
brotliCompress.end(input);
const compressed = brotliCompress.read();
assert.ok(Buffer.isBuffer(compressed), 'BrotliCompress output should be a Buffer');
const brotliDecompress = new BrotliDecompress();
brotliDecompress.end(compressed);
const decompressed = brotliDecompress.read();
assert.strictEqual(decompressed.toString('utf8'), input.toString('utf8'), 'BrotliDecompress must match original content');
}
// 5. Gunzip emits error event on malformed compressed payload
{
const gunzip = new Gunzip();
let errorCaught = null;
gunzip.on('error', (err) => {
errorCaught = err;
});
gunzip.end(Buffer.from('not valid gzip compressed data'));
assert.ok(errorCaught !== null, 'Gunzip should emit error on corrupt payload');
assert.strictEqual(errorCaught.code, 'Z_DATA_ERROR', 'Error code should be Z_DATA_ERROR');
}
// 6. Gzip respects compression level options from constants
{
const input = Buffer.from('Repeated payload '.repeat(100));
const fastZip = new Gzip({ level: constants.Z_BEST_SPEED });
fastZip.end(input);
const fastOut = fastZip.read();
const bestZip = new Gzip({ level: constants.Z_BEST_COMPRESSION });
bestZip.end(input);
const bestOut = bestZip.read();
const noCompZip = new Gzip({ level: constants.Z_NO_COMPRESSION });
noCompZip.end(input);
const noCompOut = noCompZip.read();
assert.ok(fastOut.length < noCompOut.length, 'Best speed compression should be smaller than no compression');
assert.ok(bestOut.length <= fastOut.length, 'Best compression should be smaller or equal to best speed');
}
console.log('All minizlib contract assertions passed.');
Seeder de origen
anónimo