Sample
json-buffer 3.0.1: serialize and deserialize Buffer objects with JSON using json-buffer
Verified sample for npm json-buffer 3.0.1: serialize and deserialize Buffer objects with JSON using json-buffer. The contract ran on node 22 · linux…
sha256:441b61e50fa3fc504caaedc3fd2188513fd4fa8dbe4a7ef9794dcc083d866438
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
linux 24 · ubuntu · glibc 2.39 x64 npm
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-28 |
Case
HOW- Goal
- serialize and deserialize Buffer objects with JSON using json-buffer
- Packages
- Symbols
-
- parse
- stringify
- Created
- 2026-08-28T03:19:07Z
Contract
- stringify encodes Buffer as base64 string prefixed with colon
- parse decodes colon base64 prefixed string back to Buffer
- stringify and parse round-trip nested objects containing Buffer instances
- stringify and parse round-trip arrays containing Buffer instances
- stringify escapes strings starting with colon by prepending an extra colon
- stringify returns undefined for undefined input and omits undefined object properties
- stringify serializes undefined elements in arrays as null
- parse throws SyntaxError on invalid JSON input
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
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: serialize and deserialize Buffer objects with JSON using json-buffer
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/json-buffer@3.0.1
Demonstrate these symbols/APIs:
- parse
- stringify
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:65bc682cfd3a132b0f0bc5522f7a41c9492fbef768383b77dc5b3b077727c199","contract":["stringify encodes Buffer as base64 string prefixed with colon","parse decodes colon base64 prefixed string back to Buffer","stringify and parse round-trip nested objects containing Buffer instances","stringify and parse round-trip arrays containing Buffer instances","stringify escapes strings starting with colon by prepending an extra colon","stringify returns undefined for undefined input and omits undefined object properties","stringify serializes undefined elements in arrays as null","parse throws SyntaxError on invalid JSON input"],"goal":"serialize and deserialize Buffer objects with JSON using json-buffer","kind":"HOW","packages":["pkg:npm/json-buffer@3.0.1"],"schemaVersion":1,"symbols":["parse","stringify"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/json-buffer@3.0.1"],"schemaVersion":1,"subject":"pkg:npm/json-buffer@3.0.1","symbols":["parse","stringify"],"verifierAdapter":"node-typescript@1"}
{
"name": "json-buffer-verification",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "json-buffer-verification",
"version": "1.0.0",
"dependencies": {
"json-buffer": "3.0.1"
}
},
"node_modules/json-buffer": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
"integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
"license": "MIT"
}
}
}
{
"name": "json-buffer-verification",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for json-buffer",
"dependencies": {
"json-buffer": "3.0.1"
}
}
{
"schemaVersion": 1,
"goal": "serialize and deserialize Buffer objects with JSON using json-buffer",
"kind": "HOW",
"packages": [
"pkg:npm/json-buffer@3.0.1"
],
"symbols": [
"parse",
"stringify"
]
}
import assert from 'node:assert';
import { parse, stringify } from 'json-buffer';
// 1. stringify encodes Buffer as base64 string prefixed with colon
const buf = Buffer.from('hello', 'utf8');
const json = stringify(buf);
assert.strictEqual(json, JSON.stringify(':base64:' + buf.toString('base64')));
// 2. parse decodes colon base64 prefixed string back to Buffer
const parsed = parse(json);
assert.ok(Buffer.isBuffer(parsed));
assert.strictEqual(parsed.toString('utf8'), 'hello');
// 3. stringify and parse round-trip nested objects containing Buffer instances
const obj = { id: 42, buf: Buffer.from([0xde, 0xad, 0xbe, 0xef]), text: 'sample' };
const encoded = stringify(obj);
const decoded = parse(encoded);
assert.strictEqual(decoded.id, 42);
assert.strictEqual(decoded.text, 'sample');
assert.ok(Buffer.isBuffer(decoded.buf));
assert.deepStrictEqual(Array.from(decoded.buf), [0xde, 0xad, 0xbe, 0xef]);
// 4. stringify and parse round-trip arrays containing Buffer instances
const arr = [Buffer.from('first'), 123, Buffer.from('second')];
const encodedArr = stringify(arr);
const decodedArr = parse(encodedArr);
assert.strictEqual(decodedArr.length, 3);
assert.ok(Buffer.isBuffer(decodedArr[0]));
assert.strictEqual(decodedArr[0].toString('utf8'), 'first');
assert.strictEqual(decodedArr[1], 123);
assert.ok(Buffer.isBuffer(decodedArr[2]));
assert.strictEqual(decodedArr[2].toString('utf8'), 'second');
// 5. stringify escapes strings starting with colon by prepending an extra colon
const colonStr = ':my-colon-string';
const encodedStr = stringify(colonStr);
assert.strictEqual(encodedStr, JSON.stringify('::my-colon-string'));
assert.strictEqual(parse(encodedStr), colonStr);
// 6. stringify returns undefined for undefined input and omits undefined object properties
assert.strictEqual(stringify(undefined), undefined);
const objWithUndef = { keep: 1, remove: undefined };
assert.strictEqual(stringify(objWithUndef), '{"keep":1}');
// 7. stringify serializes undefined elements in arrays as null
const arrWithUndef = [1, undefined, 3];
const encUndef = stringify(arrWithUndef);
assert.strictEqual(encUndef, '[1,null,3]');
assert.deepStrictEqual(parse(encUndef), [1, null, 3]);
// 8. parse throws SyntaxError on invalid JSON input
assert.throws(
() => parse('{ malformed json }'),
{ name: 'SyntaxError' }
);
console.log('Contract passed');
Origin Seeder
anonymous