Beispiel
base64-js 1.5.1: toByteArray
Verifiziertes Beispiel für npm base64-js 1.5.1: toByteArray. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.
sha256:a7030d7ff094896ed803b25ae855d0bc47c55066f08034477e687f90c5eac07f
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 npm
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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-26 |
Fall
HOW- Ziel
- verify toByteArray in pkg:npm/base64-js@1.5.1
- Pakete
- Symbole
-
- toByteArray
- Erstellt
- 2026-08-26T11:24:52Z
Contract
- toByteArray decodes standard base64 string into Uint8Array
- toByteArray decodes base64 string with double padding into Uint8Array
- toByteArray decodes base64 string with single padding into Uint8Array
- toByteArray decodes url-safe base64 string containing dash and underscore
- toByteArray returns empty Uint8Array for empty string
- toByteArray throws Error when base64 string length is not a multiple of 4
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Quelltext
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 toByteArray in pkg:npm/base64-js@1.5.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/base64-js@1.5.1
Demonstrate these symbols/APIs:
- toByteArray
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:a76a7b735cffb1498525dc32c4ec7f165cee9615783f7a08cffeb2b6c045cf4c","contract":["toByteArray decodes standard base64 string into Uint8Array","toByteArray decodes base64 string with double padding into Uint8Array","toByteArray decodes base64 string with single padding into Uint8Array","toByteArray decodes url-safe base64 string containing dash and underscore","toByteArray returns empty Uint8Array for empty string","toByteArray throws Error when base64 string length is not a multiple of 4"],"goal":"verify toByteArray in pkg:npm/base64-js@1.5.1","kind":"HOW","packages":["pkg:npm/base64-js@1.5.1"],"schemaVersion":1,"symbols":["toByteArray"]},"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/base64-js@1.5.1"],"schemaVersion":1,"subject":"pkg:npm/base64-js@1.5.1","symbols":["toByteArray"],"verifierAdapter":"node-typescript@1"}
{
"name": "base64-js-verification",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "base64-js-verification",
"version": "1.0.0",
"dependencies": {
"base64-js": "1.5.1"
}
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
}
}
}
{
"name": "base64-js-verification",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for base64-js toByteArray",
"dependencies": {
"base64-js": "1.5.1"
}
}
{
"schemaVersion": 1,
"goal": "verify toByteArray in pkg:npm/base64-js@1.5.1",
"kind": "HOW",
"packages": [
"pkg:npm/base64-js@1.5.1"
],
"symbols": [
"toByteArray"
]
}
import assert from 'node:assert';
import base64 from 'base64-js';
const { toByteArray } = base64;
// 1. toByteArray decodes standard base64 string into Uint8Array
const standardBytes = toByteArray('Zm9vYmFy');
assert.ok(standardBytes instanceof Uint8Array);
assert.strictEqual(standardBytes.length, 6);
assert.deepStrictEqual(Array.from(standardBytes), [102, 111, 111, 98, 97, 114]);
// 2. toByteArray decodes base64 string with double padding into Uint8Array
const doublePadded = toByteArray('AQ==');
assert.ok(doublePadded instanceof Uint8Array);
assert.strictEqual(doublePadded.length, 1);
assert.deepStrictEqual(Array.from(doublePadded), [1]);
// 3. toByteArray decodes base64 string with single padding into Uint8Array
const singlePadded = toByteArray('AQI=');
assert.ok(singlePadded instanceof Uint8Array);
assert.strictEqual(singlePadded.length, 2);
assert.deepStrictEqual(Array.from(singlePadded), [1, 2]);
// 4. toByteArray decodes url-safe base64 string containing dash and underscore
const urlSafeBytes = toByteArray('-_8=');
assert.ok(urlSafeBytes instanceof Uint8Array);
assert.strictEqual(urlSafeBytes.length, 2);
assert.deepStrictEqual(Array.from(urlSafeBytes), [0xFB, 0xFF]);
// 5. toByteArray returns empty Uint8Array for empty string
const emptyBytes = toByteArray('');
assert.ok(emptyBytes instanceof Uint8Array);
assert.strictEqual(emptyBytes.length, 0);
// 6. toByteArray throws Error when base64 string length is not a multiple of 4
assert.throws(
() => toByteArray('abc'),
{
name: 'Error',
message: 'Invalid string. Length must be a multiple of 4'
}
);
Ursprungs-Seeder
anonym