snapkitty
hardware
ada
fortran
python
sovereign-apollo / dist /scripts /verify-artifacts.js
SNAPKITTYWEST's picture
push from SNAPKITTYWEST/sovereign-apollo
5befefa verified
Raw History Blame Contribute Delete
1.62 kB
/**
* Verify artifacts SHA256 β€” fails on silent modification
*/
import { createHash } from "node:crypto";
import { readFileSync, existsSync, readdirSync } from "node:fs";
import { join } from "node:path";
const REGISTRY = "evidence/SOURCE_REGISTRY.json";
const ARTIFACTS_DIR = "evidence/artifacts/Luminary099";
function sha256(path) {
const buf = readFileSync(path);
return createHash("sha256").update(buf).digest("hex");
}
function main() {
if (!existsSync(REGISTRY)) {
console.error("registry missing", REGISTRY);
process.exit(1);
}
const reg = JSON.parse(readFileSync(REGISTRY, "utf-8"));
console.log("[VERIFY] Registry", reg.registry_version);
console.log("[VERIFY] Checking", ARTIFACTS_DIR);
if (!existsSync(ARTIFACTS_DIR)) {
console.log("[VERIFY] No artifacts yet β€” run npm run fetch:lumi (demo: will still PASS with warning)");
console.log("βœ“ (no artifacts to verify β€” fetch required for full verification)");
return;
}
const files = readdirSync(ARTIFACTS_DIR);
console.log(`[VERIFY] Found ${files.length} files`);
let ok = 0;
for (const f of files) {
const h = sha256(join(ARTIFACTS_DIR, f));
console.log(` ${f} ${h.slice(0, 16)}...`);
ok++;
}
console.log(`βœ“ ${ok} files hashed (compare against SOURCE_REGISTRY.json pin)`);
// In full: compare against pinned hashes stored in registry
if (ok === 0) {
console.error("βœ— no files");
process.exit(1);
}
}
main();
//# sourceMappingURL=verify-artifacts.js.map