Exemplo
ip-address 10.4.0
Amostra verificada para npm ip-address 10.4.0. O contrato rodou em node 22 · linux alpine/x64 · docker e passou: Address4.isValid validates valid IPv4…
sha256:c8834e372785f303dda61ddedf812c9bfd6dc2f7a8820e8e2974d7a9b63f3fd4
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify pkg:npm/ip-address@10.4.0
- Pacotes
- Ambiente
- node 22.23.2
- Criado
- 2026-08-27T21:52:20Z
Contrato
- Address4.isValid validates valid IPv4 addresses and rejects invalid strings
- Address4 parses IPv4 address and CIDR subnet mask correctly
- Address4 calculates startAddress and endAddress for a given subnet
- Address4.isInSubnet determines whether an address belongs to the subnet
- Address4.fromAddressAndMask parses dotted-decimal subnet masks into CIDR prefix length
- Address4 bigInt and fromBigInt convert IPv4 addresses to and from 32-bit integers
- Address6.isValid validates valid IPv6 addresses and rejects invalid formats
- Address6 formats canonical and correct compressed representations
- Address6 calculates startAddress, endAddress, and subnet membership for IPv6 subnets
- Address6 bigInt and fromBigInt convert IPv6 addresses to and from 128-bit integers
- Address6 identifies special address types including loopback, link-local, and multicast
- Address6.fromAddress4 creates IPv4-mapped IPv6 address and converts back via to4
- Address4 and Address6 throw AddressError on invalid IP input strings
- v6.helpers provides escapeHtml, spanAllZeroes, spanAll, and spanLeadingZeroes helpers
Arquivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
Código-fonte
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.4.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/ip-address@10.4.0
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:696c0a4d240d6f724bd57076a3458759705ba9dd339689eea3ffa53c851aa95b","constraints":{"executionContext":"node"},"contract":["Address4.isValid validates valid IPv4 addresses and rejects invalid strings","Address4 parses IPv4 address and CIDR subnet mask correctly","Address4 calculates startAddress and endAddress for a given subnet","Address4.isInSubnet determines whether an address belongs to the subnet","Address4.fromAddressAndMask parses dotted-decimal subnet masks into CIDR prefix length","Address4 bigInt and fromBigInt convert IPv4 addresses to and from 32-bit integers","Address6.isValid validates valid IPv6 addresses and rejects invalid formats","Address6 formats canonical and correct compressed representations","Address6 calculates startAddress, endAddress, and subnet membership for IPv6 subnets","Address6 bigInt and fromBigInt convert IPv6 addresses to and from 128-bit integers","Address6 identifies special address types including loopback, link-local, and multicast","Address6.fromAddress4 creates IPv4-mapped IPv6 address and converts back via to4","Address4 and Address6 throw AddressError on invalid IP input strings","v6.helpers provides escapeHtml, spanAllZeroes, spanAll, and spanLeadingZeroes helpers"],"goal":"verify pkg:npm/ip-address@10.4.0","kind":"HOW","packages":["pkg:npm/ip-address@10.4.0"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/ip-address@10.4.0"],"schemaVersion":1,"subject":"pkg:npm/ip-address@10.4.0","verifierAdapter":"node-typescript@1"}
{
"name": "ip-address-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ip-address-sample",
"version": "1.0.0",
"dependencies": {
"ip-address": "10.4.0"
}
},
"node_modules/ip-address": {
"version": "10.4.0",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.4.0.tgz",
"integrity": "sha512-oSK96Grm3aP6OrS263xVxbNDGVL7rzBtYdpGqlDG8iQdoenDoTs/nkki+DflYbAEE8Xl6o5YxhxlrKvI3nqKXQ==",
"license": "MIT",
"engines": {
"node": ">= 12"
}
}
}
}
{
"name": "ip-address-sample",
"version": "1.0.0",
"private": true,
"description": "Verification sample for ip-address 10.4.0",
"dependencies": {
"ip-address": "10.4.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/ip-address@10.4.0",
"kind": "HOW",
"packages": [
"pkg:npm/ip-address@10.4.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const assert = require("node:assert/strict");
const { Address4, Address6, AddressError, v6 } = require("ip-address");
// 1. Address4.isValid validates valid IPv4 addresses and rejects invalid strings
assert.equal(Address4.isValid("192.168.1.100"), true);
assert.equal(Address4.isValid("10.0.0.1"), true);
assert.equal(Address4.isValid("999.1.1.1"), false);
assert.equal(Address4.isValid("256.0.0.1"), false);
assert.equal(Address4.isValid("invalid-ip"), false);
// 2. Address4 parses IPv4 address and CIDR subnet mask correctly
const ipv4 = new Address4("192.168.1.100/24");
assert.equal(ipv4.address, "192.168.1.100/24");
assert.equal(ipv4.subnet, "/24");
assert.equal(ipv4.subnetMask, 24);
// 3. Address4 calculates startAddress and endAddress for a given subnet
assert.equal(ipv4.startAddress().correctForm(), "192.168.1.0");
assert.equal(ipv4.endAddress().correctForm(), "192.168.1.255");
// 4. Address4.isInSubnet determines whether an address belongs to the subnet
const member4 = new Address4("192.168.1.50");
const nonMember4 = new Address4("192.168.2.1");
assert.equal(member4.isInSubnet(ipv4), true);
assert.equal(nonMember4.isInSubnet(ipv4), false);
// 5. Address4.fromAddressAndMask parses dotted-decimal subnet masks into CIDR prefix length
const v4FromMask = Address4.fromAddressAndMask("10.0.0.1", "255.255.0.0");
assert.equal(v4FromMask.subnetMask, 16);
assert.equal(v4FromMask.startAddress().correctForm(), "10.0.0.0");
assert.equal(v4FromMask.endAddress().correctForm(), "10.0.255.255");
// 6. Address4 bigInt and fromBigInt convert IPv4 addresses to and from 32-bit integers
const v4BigInt = ipv4.bigInt();
assert.equal(Address4.fromBigInt(v4BigInt).correctForm(), "192.168.1.100");
// 7. Address6.isValid validates valid IPv6 addresses and rejects invalid formats
assert.equal(Address6.isValid("2001:db8:85a3::8a2e:370:7334"), true);
assert.equal(Address6.isValid("::1"), true);
assert.equal(Address6.isValid("fe80:::1"), false);
assert.equal(Address6.isValid("not:valid:ipv6"), false);
// 8. Address6 formats canonical and correct compressed representations
const ipv6 = new Address6("2001:0db8:0000:0000:0000:0000:1428:57ab/64");
assert.equal(ipv6.canonicalForm(), "2001:0db8:0000:0000:0000:0000:1428:57ab");
assert.equal(ipv6.correctForm(), "2001:db8::1428:57ab");
// 9. Address6 calculates startAddress, endAddress, and subnet membership for IPv6 subnets
assert.equal(ipv6.startAddress().correctForm(), "2001:db8::");
assert.equal(ipv6.endAddress().correctForm(), "2001:db8::ffff:ffff:ffff:ffff");
const member6 = new Address6("2001:db8::1");
const nonMember6 = new Address6("2001:db9::1");
assert.equal(member6.isInSubnet(ipv6), true);
assert.equal(nonMember6.isInSubnet(ipv6), false);
// 10. Address6 bigInt and fromBigInt convert IPv6 addresses to and from 128-bit integers
const v6BigInt = ipv6.bigInt();
assert.equal(Address6.fromBigInt(v6BigInt).correctForm(), "2001:db8::1428:57ab");
// 11. Address6 identifies special address types including loopback, link-local, and multicast
assert.equal(new Address6("::1").isLoopback(), true);
assert.equal(new Address6("fe80::1").isLinkLocal(), true);
assert.equal(new Address6("ff02::1").isMulticast(), true);
// 12. Address6.fromAddress4 creates IPv4-mapped IPv6 address and converts back via to4
const v6Mapped = Address6.fromAddress4("192.168.1.1");
assert.equal(v6Mapped.is4(), true);
assert.equal(v6Mapped.to4().correctForm(), "192.168.1.1");
// 13. Address4 and Address6 throw AddressError on invalid IP input strings
assert.throws(() => new Address4("not-an-ip"), (err) => {
return err instanceof AddressError || err.name === "AddressError" || /Invalid/i.test(err.message);
});
assert.throws(() => new Address6("not:a:valid:ipv6:address:::1"), (err) => {
return err instanceof AddressError || err.name === "AddressError" || /Invalid/i.test(err.message);
});
// 14. v6.helpers provides escapeHtml, spanAllZeroes, spanAll, and spanLeadingZeroes helpers
assert.equal(v6.helpers.escapeHtml("<b>test</b>"), "<b>test</b>");
assert.equal(v6.helpers.spanAllZeroes("00ab00"), '<span class="zero">00</span>ab<span class="zero">00</span>');
assert.equal(v6.helpers.spanLeadingZeroes("0042:0001"), '<span class="zero">00</span>42:<span class="zero">000</span>1');
console.log("Contract verified successfully.");
Seeder de origem
anônimo