Sample
@peculiar/utils 2.0.3
Verified sample for npm @peculiar/utils 2.0.3. The contract ran on node 22 · linux alpine/x64 · docker and passed: assert bytes provides stateless byte…
sha256:99946f294654a7ad6be6d3fd27ce89f1d2b2ff3bc9d1e52a3faef46a07f0296a
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@1 |
2026-08-21 |
Case
HOW- Goal
- verify pkg:npm/%40peculiar/utils@2.0.3
- Packages
- Created
- 2026-08-21T07:10:40Z
Contract
- assert bytes provides stateless byte sequence comparison, equality check, prefix/suffix inspection, search, and slicing operations
- assert hex provides encoding and decoding with preset formats and style-preserving parse and format operations
- assert base64, base64url, and utf8 encode and decode binary and text representations bidirectionally
- assert pem encodes and decodes labeled PEM containers and searches multiple blocks
- assert convert facade supports direct transcoding, format detection, and safe decoding
- assert legacy compatibility layer provides Convert and BufferSourceConverter utilities
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: verify pkg:npm/%40peculiar/utils@2.0.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40peculiar/utils@2.0.3
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:baccceaea4951fc96a29dc8d703661ec1e66896233cfeb8f19048ca2e61b96b7","contract":["assert bytes provides stateless byte sequence comparison, equality check, prefix/suffix inspection, search, and slicing operations","assert hex provides encoding and decoding with preset formats and style-preserving parse and format operations","assert base64, base64url, and utf8 encode and decode binary and text representations bidirectionally","assert pem encodes and decodes labeled PEM containers and searches multiple blocks","assert convert facade supports direct transcoding, format detection, and safe decoding","assert legacy compatibility layer provides Convert and BufferSourceConverter utilities"],"goal":"verify pkg:npm/%40peculiar/utils@2.0.3","kind":"HOW","packages":["pkg:npm/%40peculiar/utils@2.0.3"],"schemaVersion":1,"symbols":["BufferSourceConverter.toUint8Array","Convert.FromBase64","Convert.FromHex","Convert.FromString","Convert.ToBase64","Convert.ToHex","Convert.ToString","base64.decode","base64.encode","base64url.decode","base64url.encode","bytes.compare","bytes.concat","bytes.concatToUint8Array","bytes.endsWith","bytes.equal","bytes.indexOf","bytes.lastIndexOf","bytes.startsWith","bytes.tail","convert.detect","convert.transcode","convert.tryDecode","hex.decode","hex.encode","hex.format","hex.parse","isEqual","pem.decode","pem.encode","pem.encodeMany","pem.find","pem.findAll","utf8.decode","utf8.encode"]},"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/%40peculiar/utils@2.0.3"],"schemaVersion":1,"subject":"pkg:npm/%40peculiar/utils@2.0.3","verifierAdapter":"node-typescript@1"}
{
"name": "sample-peculiar-utils",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-peculiar-utils",
"version": "1.0.0",
"dependencies": {
"@peculiar/utils": "2.0.3"
}
},
"node_modules/@peculiar/utils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@peculiar/utils/-/utils-2.0.3.tgz",
"integrity": "sha512-+oL3HPFRIZ1St2K50lWCXiioIgSoxzz7R1J3uF6neO2yl1sgmpgY6XXJH4BdpoDkMWznQTeYF6oWNDZLCdQ4eQ==",
"license": "MIT",
"dependencies": {
"tslib": "^2.8.1"
}
},
"node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
}
}
}
{
"name": "sample-peculiar-utils",
"version": "1.0.0",
"type": "module",
"dependencies": {
"@peculiar/utils": "2.0.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40peculiar/utils@2.0.3",
"kind": "HOW",
"packages": [
"pkg:npm/%40peculiar/utils@2.0.3"
]
}
import assert from "node:assert/strict";
import {
bytes,
hex,
base64,
base64url,
utf8,
pem,
convert,
Convert,
BufferSourceConverter,
isEqual,
} from "@peculiar/utils";
// Contract 1: bytes provides stateless byte sequence comparison, equality check, prefix/suffix inspection, search, and slicing operations
const u1 = new Uint8Array([1, 2, 3]);
const u2 = new Uint8Array([1, 2, 3]);
const u3 = new Uint8Array([1, 2, 4]);
assert.equal(bytes.equal(u1, u2), true);
assert.equal(bytes.equal(u1, u3), false);
assert.equal(bytes.compare(u1, u2), 0);
assert.ok(bytes.compare(u1, u3) < 0);
const joinedBuffer = bytes.concat(u1, new Uint8Array([4, 5]));
assert.deepEqual(Array.from(new Uint8Array(joinedBuffer)), [1, 2, 3, 4, 5]);
const joinedTyped = bytes.concatToUint8Array([u1, new Uint8Array([4, 5])]);
assert.deepEqual(Array.from(joinedTyped), [1, 2, 3, 4, 5]);
const textBuf = utf8.encode("Hello, World!");
assert.equal(bytes.indexOf(textBuf, "World", { encoding: "utf8" }), 7);
assert.equal(bytes.lastIndexOf(textBuf, "o", { encoding: "utf8" }), 8);
assert.equal(bytes.startsWith(textBuf, "Hello", { encoding: "utf8" }), true);
assert.equal(bytes.endsWith(textBuf, "World!", { encoding: "utf8" }), true);
const tailed = bytes.tail(textBuf, 6);
assert.equal(utf8.decode(tailed), "World!");
// Contract 2: hex provides encoding and decoding with preset formats and style-preserving parse and format operations
const raw = new Uint8Array([0xde, 0xad, 0xbe, 0xef]);
assert.equal(hex.encode(raw), "deadbeef");
assert.equal(hex.encode(raw, hex.formats.upper), "DEADBEEF");
assert.equal(hex.encode(raw, hex.formats.colonUpper), "DE:AD:BE:EF");
assert.deepEqual(hex.decode("DE:AD:BE:EF"), raw);
const parsedHex = hex.parse("01:02:03:04");
assert.deepEqual(parsedHex.bytes, new Uint8Array([1, 2, 3, 4]));
const formattedHex = hex.format(new Uint8Array([0xaa, 0xbb, 0xcc, 0xdd]), parsedHex.format);
assert.equal(formattedHex, "aa:bb:cc:dd");
// Contract 3: base64, base64url, and utf8 encode and decode binary and text representations bidirectionally
const b64 = base64.encode(raw);
assert.equal(b64, "3q2+7w==");
assert.deepEqual(base64.decode(b64), raw);
const b64url = base64url.encode(raw);
assert.equal(b64url, "3q2-7w");
assert.deepEqual(base64url.decode(b64url), raw);
const sampleText = "Sample Payload 123";
const encodedUtf8 = utf8.encode(sampleText);
assert.equal(utf8.decode(encodedUtf8), sampleText);
// Contract 4: pem encodes and decodes labeled PEM containers and searches multiple blocks
const pemText = pem.encode("CERTIFICATE", raw);
assert.ok(pemText.includes("-----BEGIN CERTIFICATE-----"));
assert.ok(pemText.includes("-----END CERTIFICATE-----"));
const blocks = pem.decode(pemText);
assert.equal(blocks.length, 1);
assert.equal(blocks[0].label, "CERTIFICATE");
assert.deepEqual(blocks[0].data, raw);
const found = pem.find(pemText, "CERTIFICATE");
assert.ok(found);
assert.deepEqual(found.data, raw);
const multiPem = pem.encodeMany([
{ label: "CERTIFICATE", data: raw },
{ label: "PUBLIC KEY", data: new Uint8Array([1, 2, 3]) },
]);
const allCerts = pem.findAll(multiPem, "CERTIFICATE");
assert.equal(allCerts.length, 1);
assert.deepEqual(allCerts[0].data, raw);
// Contract 5: convert facade supports direct transcoding, format detection, and safe decoding
const transcoded = convert.transcode("AQIDBA==", {
from: "base64",
to: "hex",
toOptions: { case: "upper" },
});
assert.equal(transcoded, "01020304");
const tryDecSuccess = convert.tryDecode("hex", "01020304");
assert.equal(tryDecSuccess.ok, true);
assert.deepEqual(tryDecSuccess.bytes, new Uint8Array([1, 2, 3, 4]));
const tryDecFail = convert.tryDecode("hex", "invalid-hex-data");
assert.equal(tryDecFail.ok, false);
const detected = convert.detect(pemText);
assert.ok(detected.some((d) => d.format === "pem"));
// Contract 6: legacy compatibility layer provides Convert and BufferSourceConverter utilities
assert.equal(Convert.ToHex(raw), "deadbeef");
assert.deepEqual(new Uint8Array(Convert.FromHex("deadbeef")), raw);
assert.equal(Convert.ToBase64(raw), "3q2+7w==");
assert.deepEqual(new Uint8Array(Convert.FromBase64("3q2+7w==")), raw);
assert.equal(Convert.ToString(textBuf, "utf8"), "Hello, World!");
assert.deepEqual(new Uint8Array(Convert.FromString("Hello, World!", "utf8")), textBuf);
assert.equal(isEqual(u1, u2), true);
assert.equal(isEqual(u1, u3), false);
const convertedUint8 = BufferSourceConverter.toUint8Array(raw.buffer);
assert.deepEqual(convertedUint8, raw);
console.log("Contract verified: all assertions passed.");
Origin Seeder
anonymous