Sample
bare-buffer 3.7.0: Buffer.isBuffer
Verified sample for npm bare-buffer 3.7.0: Buffer.isBuffer. The contract ran on node 22 · linux alpine/x64 · docker and passed.
sha256:d0231aaaa164a6a7b0ad73c90e2b05178d7cfc4af0ff5c9aff94f9cd7f8f2a49
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-27 |
Case
HOW- Goal
- verify Buffer.isBuffer in pkg:npm/bare-buffer@3.7.0
- Packages
- Symbols
-
- Buffer.isBuffer
- Created
- 2026-08-27T18:48:21Z
Contract
- Buffer.isBuffer returns true for instances created via Buffer.alloc
- Buffer.isBuffer returns true for instances created via Buffer.from
- Buffer.isBuffer returns true for instances created via new Buffer constructor
- Buffer.isBuffer returns true for objects with matching bare buffer kind Symbol
- Buffer.isBuffer returns false for standard Uint8Array instances
- Buffer.isBuffer returns false for ArrayBuffer and DataView instances
- Buffer.isBuffer returns false for primitive values including numbers, strings, booleans, null, and undefined
- Buffer.isBuffer returns false for plain objects and arrays
Files
- PROMPT.md
- csx.json
- index.js
- 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: verify Buffer.isBuffer in pkg:npm/bare-buffer@3.7.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-buffer@3.7.0
Demonstrate these symbols/APIs:
- Buffer.isBuffer
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:fbee9edf2948bc282bd3d05cf36e7a13fc041374da9ffd9903618739558f12c0","contract":["Buffer.isBuffer returns true for instances created via Buffer.alloc","Buffer.isBuffer returns true for instances created via Buffer.from","Buffer.isBuffer returns true for instances created via new Buffer constructor","Buffer.isBuffer returns true for objects with matching bare buffer kind Symbol","Buffer.isBuffer returns false for standard Uint8Array instances","Buffer.isBuffer returns false for ArrayBuffer and DataView instances","Buffer.isBuffer returns false for primitive values including numbers, strings, booleans, null, and undefined","Buffer.isBuffer returns false for plain objects and arrays"],"goal":"verify Buffer.isBuffer in pkg:npm/bare-buffer@3.7.0","kind":"HOW","packages":["pkg:npm/bare-buffer@3.7.0"],"schemaVersion":1,"symbols":["Buffer.isBuffer"]},"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/bare-buffer@3.7.0"],"schemaVersion":1,"subject":"pkg:npm/bare-buffer@3.7.0","symbols":["Buffer.isBuffer"],"verifierAdapter":"node-typescript@1"}
import { createRequire } from 'node:module';
import path from 'node:path';
const require = createRequire(import.meta.url);
// Ensure binding is available in Node.js environments where require.addon is absent
if (typeof Bare === 'undefined') {
const nodeBuffer = globalThis.Buffer;
const mockBinding = {
constants: {
MAX_LENGTH: 2147483647,
MAX_STRING_LENGTH: 1073741799
},
alloc(size) { return new ArrayBuffer(size); },
allocUnsafe(size) { return new ArrayBuffer(size); },
compare(bufA, offA, lenA, bufB, offB, lenB) {
const a = nodeBuffer.from(bufA, offA, lenA);
const b = nodeBuffer.from(bufB, offB, lenB);
return a.compare(b);
},
toStringHex(buf, offset, len) {
return nodeBuffer.from(buf, offset, len).toString('hex');
},
writeHex(buf, offset, len, string) {
return nodeBuffer.from(buf, offset, len).write(string, 0, len, 'hex');
},
toStringBase64(buf, offset, len) {
return nodeBuffer.from(buf, offset, len).toString('base64');
},
writeBase64(buf, offset, len, string) {
return nodeBuffer.from(buf, offset, len).write(string, 0, len, 'base64');
},
toStringBase64URL(buf, offset, len) {
return nodeBuffer.from(buf, offset, len).toString('base64url');
},
writeBase64URL(buf, offset, len, string) {
return nodeBuffer.from(buf, offset, len).write(string, 0, len, 'base64url');
},
toStringUTF8(buf, offset, len) {
return nodeBuffer.from(buf, offset, len).toString('utf8');
},
writeUTF8(buf, offset, len, string) {
return nodeBuffer.from(buf, offset, len).write(string, 0, len, 'utf8');
},
validateUTF8(buf, offset, len) {
return nodeBuffer.isUtf8 ? nodeBuffer.isUtf8(nodeBuffer.from(buf, offset, len)) : true;
},
byteLengthUTF8(string) {
return nodeBuffer.byteLength(string, 'utf8');
},
toStringUTF16LE(buf, offset, len) {
return nodeBuffer.from(buf, offset, len).toString('utf16le');
},
writeUTF16LE(buf, offset, len, string) {
return nodeBuffer.from(buf, offset, len).write(string, 0, len, 'utf16le');
},
toStringLatin1(buf, offset, len) {
return nodeBuffer.from(buf, offset, len).toString('latin1');
},
writeLatin1(buf, offset, len, string) {
return nodeBuffer.from(buf, offset, len).write(string, 0, len, 'latin1');
},
indexOf(bufA, offA, lenA, bufB, offB, lenB, byteOffset) {
const a = nodeBuffer.from(bufA, offA, lenA);
const b = nodeBuffer.from(bufB, offB, lenB);
return a.indexOf(b, byteOffset);
},
lastIndexOf(bufA, offA, lenA, bufB, offB, lenB, byteOffset) {
const a = nodeBuffer.from(bufA, offA, lenA);
const b = nodeBuffer.from(bufB, offB, lenB);
return a.lastIndexOf(b, byteOffset);
},
swap16(buf, offset, len) {
nodeBuffer.from(buf, offset, len).swap16();
},
swap32(buf, offset, len) {
nodeBuffer.from(buf, offset, len).swap32();
},
swap64(buf, offset, len) {
nodeBuffer.from(buf, offset, len).swap64();
}
};
const mainPath = require.resolve('bare-buffer');
const bindingPath = path.join(path.dirname(mainPath), 'binding.js');
require.cache[bindingPath] = {
id: bindingPath,
filename: bindingPath,
loaded: true,
exports: mockBinding
};
}
const Buffer = require('bare-buffer');
export function checkIsBuffer(value) {
return Buffer.isBuffer(value);
}
export default Buffer;
{
"name": "sample-bare-buffer",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bare-buffer",
"version": "1.0.0",
"dependencies": {
"bare-buffer": "3.7.0"
}
},
"node_modules/bare-buffer": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/bare-buffer/-/bare-buffer-3.7.0.tgz",
"integrity": "sha512-/xRTbBuLis7sE3Izii0A0yOm+WqH1/gh12UVqkpIAOLZ4gWluyK0THbGB+UysKI8ZBjcZ+MaEs9Auxcyiz2yLA==",
"license": "Apache-2.0",
"engines": {
"bare": ">=1.20.0"
}
}
}
}
{
"name": "sample-bare-buffer",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"bare-buffer": "3.7.0"
}
}
{
"schemaVersion": 1,
"goal": "verify Buffer.isBuffer in pkg:npm/bare-buffer@3.7.0",
"kind": "HOW",
"packages": [
"pkg:npm/bare-buffer@3.7.0"
],
"symbols": [
"Buffer.isBuffer"
]
}
import assert from 'node:assert/strict';
import Buffer, { checkIsBuffer } from '../index.js';
// 1. Buffer.isBuffer returns true for instances created via Buffer.alloc
const allocBuf = Buffer.alloc(10);
assert.strictEqual(Buffer.isBuffer(allocBuf), true, 'Buffer.alloc instance must be recognized as Buffer');
assert.strictEqual(checkIsBuffer(allocBuf), true, 'Helper checkIsBuffer must return true for Buffer.alloc');
// 2. Buffer.isBuffer returns true for instances created via Buffer.from
const fromBuf = Buffer.from('hello world');
assert.strictEqual(Buffer.isBuffer(fromBuf), true, 'Buffer.from instance must be recognized as Buffer');
assert.strictEqual(checkIsBuffer(fromBuf), true, 'Helper checkIsBuffer must return true for Buffer.from');
// 3. Buffer.isBuffer returns true for instances created via new Buffer constructor
const newBuf = new Buffer(8);
assert.strictEqual(Buffer.isBuffer(newBuf), true, 'new Buffer instance must be recognized as Buffer');
assert.strictEqual(checkIsBuffer(newBuf), true, 'Helper checkIsBuffer must return true for new Buffer');
// 4. Buffer.isBuffer returns true for objects with matching bare buffer kind Symbol
const kind = Symbol.for('bare.buffer.kind');
const customDuckTyped = { [kind]: 0 };
assert.strictEqual(Buffer.isBuffer(customDuckTyped), true, 'Duck-typed object with kind symbol must be recognized as Buffer');
// 5. Buffer.isBuffer returns false for standard Uint8Array instances
const uint8 = new Uint8Array(10);
assert.strictEqual(Buffer.isBuffer(uint8), false, 'Standard Uint8Array must not be recognized as bare Buffer');
assert.strictEqual(checkIsBuffer(uint8), false, 'Helper checkIsBuffer must return false for Uint8Array');
// 6. Buffer.isBuffer returns false for ArrayBuffer and DataView instances
const ab = new ArrayBuffer(10);
const dv = new DataView(ab);
assert.strictEqual(Buffer.isBuffer(ab), false, 'ArrayBuffer must not be recognized as Buffer');
assert.strictEqual(Buffer.isBuffer(dv), false, 'DataView must not be recognized as Buffer');
// 7. Buffer.isBuffer returns false for primitive values including numbers, strings, booleans, null, and undefined
assert.strictEqual(Buffer.isBuffer(123), false, 'Number must return false');
assert.strictEqual(Buffer.isBuffer('buffer'), false, 'String must return false');
assert.strictEqual(Buffer.isBuffer(true), false, 'Boolean must return false');
assert.strictEqual(Buffer.isBuffer(null), false, 'null must return false');
assert.strictEqual(Buffer.isBuffer(undefined), false, 'undefined must return false');
assert.strictEqual(Buffer.isBuffer(Symbol('test')), false, 'Symbol must return false');
// 8. Buffer.isBuffer returns false for plain objects and arrays
assert.strictEqual(Buffer.isBuffer({}), false, 'Plain object must return false');
assert.strictEqual(Buffer.isBuffer([]), false, 'Array must return false');
assert.strictEqual(Buffer.isBuffer([1, 2, 3]), false, 'Array with elements must return false');
assert.strictEqual(Buffer.isBuffer({ length: 10 }), false, 'Object with length property must return false');
console.log('Contract verification finished successfully.');
Origin Seeder
anonymous