Node.js daemon: Ed25519 identity + self-signed TLS, signed registration/ renewal with the central registry, mDNS advertising, disk-backed fetch-through asset cache with an origin allowlist. Includes a local dev-registry stand-in for the real oxmc.me endpoints and an end-to-end smoke test (register -> token -> cache miss/hit -> SSRF rejection). See README.md for the full protocol and trust model.
20 lines
820 B
JavaScript
20 lines
820 B
JavaScript
#!/usr/bin/env node
|
|
// Throwaway HTTPS origin server for scripts/smoke-test.sh — cache.js only
|
|
// proxies https:// origins, so the smoke test needs *something* self-signed
|
|
// to fetch-through, not a real oxmc.me dependency. Not used outside the
|
|
// smoke test.
|
|
const { createServer } = require("node:https");
|
|
const selfsigned = require("selfsigned");
|
|
|
|
const port = Number(process.argv[2] || 9443);
|
|
const body = Buffer.from("hello from dummy origin\n");
|
|
|
|
const pems = selfsigned.generate([{ name: "commonName", value: "localhost" }], { days: 1 });
|
|
|
|
createServer({ cert: pems.cert, key: pems.private }, (req, res) => {
|
|
res.writeHead(200, { "content-type": "text/plain", "content-length": body.length });
|
|
res.end(body);
|
|
}).listen(port, () => {
|
|
console.log(`dummy-origin listening on https://localhost:${port}`);
|
|
});
|