Sample
xmlhttprequest-ssl 2.1.2
Verified sample for npm xmlhttprequest-ssl 2.1.2. The contract ran on node 22 · linux alpine/x64 · docker and passed: XMLHttpRequest is exported as a…
sha256:8d3891f00e634daf2cc5dcb8290da092704fb9f6810acf734f67dbc50fcccf5f
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
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
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/xmlhttprequest-ssl@2.1.2
- Packages
- Environment
- node 22.23.2
- Created
- 2026-08-21T04:15:14Z
Contract
- XMLHttpRequest is exported as a constructor function
- XMLHttpRequest open, setRequestHeader, and send execute an asynchronous HTTP GET request
- XMLHttpRequest onreadystatechange handler captures readyState 4 and HTTP status 200
- XMLHttpRequest responseText contains the response body from the HTTP server
Files
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.js
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/xmlhttprequest-ssl@2.1.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/xmlhttprequest-ssl@2.1.2
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:554b214c9ee149f88bbcc5e8412b1169b773159ebd5331a4714d52923d540c9b","constraints":{"executionContext":"node"},"contract":["XMLHttpRequest is exported as a constructor function","XMLHttpRequest open, setRequestHeader, and send execute an asynchronous HTTP GET request","XMLHttpRequest onreadystatechange handler captures readyState 4 and HTTP status 200","XMLHttpRequest responseText contains the response body from the HTTP server"],"goal":"verify pkg:npm/xmlhttprequest-ssl@2.1.2","kind":"HOW","packages":["pkg:npm/xmlhttprequest-ssl@2.1.2"],"schemaVersion":1,"symbols":["XMLHttpRequest"]},"contractCommand":["node","test/contract.js"],"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/xmlhttprequest-ssl@2.1.2"],"schemaVersion":1,"subject":"pkg:npm/xmlhttprequest-ssl@2.1.2","verifierAdapter":"node-typescript@1"}
const { XMLHttpRequest } = require('xmlhttprequest-ssl');
function request(options, callback) {
const xhr = new XMLHttpRequest();
const method = options.method || 'GET';
xhr.open(method, options.url, true);
if (options.headers) {
for (const [header, value] of Object.entries(options.headers)) {
xhr.setRequestHeader(header, value);
}
}
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status >= 200 && xhr.status < 300) {
callback(null, {
status: xhr.status,
statusText: xhr.statusText,
body: xhr.responseText,
headers: xhr.getAllResponseHeaders()
});
} else {
callback(new Error(`Request failed with status ${xhr.status}`));
}
}
};
xhr.onerror = function () {
callback(new Error('Request error occurred'));
};
xhr.send(options.body || null);
return xhr;
}
module.exports = {
XMLHttpRequest,
request
};
{
"name": "sample-xmlhttprequest-ssl",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-xmlhttprequest-ssl",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"xmlhttprequest-ssl": "2.1.2"
}
},
"node_modules/xmlhttprequest-ssl": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz",
"integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==",
"engines": {
"node": ">=0.4.0"
}
}
}
}
{
"name": "sample-xmlhttprequest-ssl",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for xmlhttprequest-ssl",
"main": "index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"xmlhttprequest-ssl": "2.1.2"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/xmlhttprequest-ssl@2.1.2",
"kind": "HOW",
"packages": [
"pkg:npm/xmlhttprequest-ssl@2.1.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const http = require('http');
const assert = require('assert');
const { XMLHttpRequest, request } = require('../index.js');
assert.strictEqual(typeof XMLHttpRequest, 'function', 'XMLHttpRequest should be a constructor function');
const server = http.createServer((req, res) => {
if (req.method === 'GET' && req.url === '/hello') {
res.writeHead(200, {
'Content-Type': 'application/json',
'X-Custom-Response': 'xhr-test'
});
res.end(JSON.stringify({ greeting: 'hello world', status: 'ok' }));
} else if (req.method === 'POST' && req.url === '/echo') {
let body = '';
req.on('data', chunk => {
body += chunk;
});
req.on('end', () => {
res.writeHead(201, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ received: JSON.parse(body) }));
});
} else {
res.writeHead(404);
res.end();
}
});
server.listen(0, '127.0.0.1', () => {
const port = server.address().port;
const baseUrl = `http://127.0.0.1:${port}`;
// Test 1: GET request
request({ url: `${baseUrl}/hello` }, (err, result) => {
assert.ifError(err);
assert.strictEqual(result.status, 200);
const parsed = JSON.parse(result.body);
assert.strictEqual(parsed.greeting, 'hello world');
assert.strictEqual(parsed.status, 'ok');
// Test 2: POST request
request({
method: 'POST',
url: `${baseUrl}/echo`,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ ping: 'pong' })
}, (err2, result2) => {
assert.ifError(err2);
assert.strictEqual(result2.status, 201);
const parsed2 = JSON.parse(result2.body);
assert.strictEqual(parsed2.received.ping, 'pong');
// Test 3: Direct XMLHttpRequest usage
const directXhr = new XMLHttpRequest();
directXhr.open('GET', `${baseUrl}/hello`, true);
directXhr.setRequestHeader('X-Client-Test', 'enabled');
directXhr.onreadystatechange = function () {
if (directXhr.readyState === 4) {
assert.strictEqual(directXhr.status, 200);
assert(directXhr.responseText.includes('hello world'));
assert(directXhr.getAllResponseHeaders().includes('xhr-test'));
server.close(() => {
console.log('All contracts passed successfully.');
process.exit(0);
});
}
};
directXhr.send();
});
});
});
Origin Seeder
anonymous