Beispiel
ip-address 10.5.0
Verifiziertes Beispiel für npm ip-address 10.5.0. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: Address4 parses IPv4 address…
sha256:40c7d1a9f9a6ac1767eba903a679f4f75e98c68124251bb0dd1555cd3be74ff2
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-23 |
Fall
HOW- Ziel
- verify pkg:npm/ip-address@10.5.0
- Pakete
- Erstellt
- 2026-08-23T07:50:57Z
Contract
- Address4 parses IPv4 address, validates CIDR subnet, and calculates network and broadcast boundaries
- Address4 checks RFC 1918 private and loopback address properties and subnet membership
- Address6 canonicalizes IPv6 representations, validates documentation and loopback addresses, and checks ULA properties
Dateien
- PROMPT.md
- csx.json
- index.mjs
- 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 pkg:npm/ip-address@10.5.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/ip-address@10.5.0
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:c3486611860e041c93739760643d85f4d4bb1abc2a2c6ca51a870eb75899b068","contract":["Address4 parses IPv4 address, validates CIDR subnet, and calculates network and broadcast boundaries","Address4 checks RFC 1918 private and loopback address properties and subnet membership","Address6 canonicalizes IPv6 representations, validates documentation and loopback addresses, and checks ULA properties"],"goal":"verify pkg:npm/ip-address@10.5.0","kind":"HOW","packages":["pkg:npm/ip-address@10.5.0"],"schemaVersion":1},"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/ip-address@10.5.0"],"schemaVersion":1,"subject":"pkg:npm/ip-address@10.5.0","verifierAdapter":"node-typescript@1"}
import { Address4, Address6 } from 'ip-address';
export function parseIPv4(addressString) {
const addr = new Address4(addressString);
return {
address: addr.correctForm(),
subnetMask: addr.subnetMask,
networkForm: addr.networkForm(),
startAddress: addr.startAddress().correctForm(),
endAddress: addr.endAddress().correctForm(),
isPrivate: addr.isPrivate(),
isLoopback: addr.isLoopback()
};
}
export function parseIPv6(addressString) {
const addr = new Address6(addressString);
return {
correctForm: addr.correctForm(),
canonicalForm: addr.canonicalForm(),
subnetMask: addr.subnetMask,
isLoopback: addr.isLoopback(),
isULA: addr.isULA(),
isDocumentation: addr.isDocumentation()
};
}
export function isIPv4InSubnet(ip, subnetCidr) {
const target = new Address4(ip);
const subnet = new Address4(subnetCidr);
return target.isInSubnet(subnet);
}
export function isValidIPv4(addressString) {
return Address4.isValid(addressString);
}
export function isValidIPv6(addressString) {
return Address6.isValid(addressString);
}
{
"name": "ip-address-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ip-address-sample",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"ip-address": "10.5.0"
}
},
"node_modules/ip-address": {
"version": "10.5.0",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.5.0.tgz",
"integrity": "sha512-R5SnVLJmgYYvf2F2ZgwSBnelz5G4q5AxIC277GDfUaNbrZKNANcBC7RHqYYePlszf4kBolVkJauG0ZjHHFh55g==",
"license": "MIT",
"engines": {
"node": ">= 12"
}
}
}
}
{
"name": "ip-address-sample",
"version": "1.0.0",
"type": "module",
"license": "MIT-0",
"dependencies": {
"ip-address": "10.5.0"
},
"scripts": {
"test": "node test/contract.mjs"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/ip-address@10.5.0",
"kind": "HOW",
"packages": [
"pkg:npm/ip-address@10.5.0"
]
}
import assert from 'node:assert/strict';
import { Address4, Address6 } from 'ip-address';
import { parseIPv4, parseIPv6, isIPv4InSubnet, isValidIPv4, isValidIPv6 } from '../index.mjs';
// Contract 1: Address4 parses IPv4 address, validates CIDR subnet, and calculates network and broadcast boundaries
{
const v4 = new Address4('192.168.1.100/24');
assert.equal(v4.correctForm(), '192.168.1.100');
assert.equal(v4.subnetMask, 24);
assert.equal(v4.networkForm(), '192.168.1.0/24');
assert.equal(v4.startAddress().correctForm(), '192.168.1.0');
assert.equal(v4.endAddress().correctForm(), '192.168.1.255');
const parsed = parseIPv4('10.0.5.20/16');
assert.equal(parsed.address, '10.0.5.20');
assert.equal(parsed.subnetMask, 16);
assert.equal(parsed.networkForm, '10.0.0.0/16');
assert.equal(parsed.startAddress, '10.0.0.0');
assert.equal(parsed.endAddress, '10.0.255.255');
assert.equal(parsed.isPrivate, true);
assert.equal(parsed.isLoopback, false);
}
// Contract 2: Address4 checks RFC 1918 private and loopback address properties and subnet membership
{
assert.equal(isValidIPv4('192.168.1.1'), true);
assert.equal(isValidIPv4('256.0.0.1'), false);
assert.equal(isValidIPv4('invalid-ip'), false);
const loopback = new Address4('127.0.0.1');
assert.equal(loopback.isLoopback(), true);
assert.equal(loopback.isPrivate(), false);
assert.equal(isIPv4InSubnet('192.168.1.50', '192.168.1.0/24'), true);
assert.equal(isIPv4InSubnet('192.168.2.50', '192.168.1.0/24'), false);
}
// Contract 3: Address6 canonicalizes IPv6 representations, validates documentation and loopback addresses, and checks ULA properties
{
const v6 = new Address6('2001:0db8:0000:0000:0000:0000:0000:0001');
assert.equal(v6.correctForm(), '2001:db8::1');
assert.equal(v6.canonicalForm(), '2001:0db8:0000:0000:0000:0000:0000:0001');
assert.equal(v6.isDocumentation(), true);
const parsedV6 = parseIPv6('fc00::1/64');
assert.equal(parsedV6.correctForm, 'fc00::1');
assert.equal(parsedV6.subnetMask, 64);
assert.equal(parsedV6.isULA, true);
assert.equal(parsedV6.isLoopback, false);
const loopback6 = parseIPv6('::1');
assert.equal(loopback6.isLoopback, true);
assert.equal(isValidIPv6('::1'), true);
assert.equal(isValidIPv6('2001:db8::1'), true);
assert.equal(isValidIPv6('not-an-ipv6-address'), false);
}
console.log('Contract tests passed successfully.');
Ursprungs-Seeder
anonym