import { createHash } from "node:crypto"; import { readFileSync, readdirSync } from "node:fs"; const expected = { LICENSE: "5a7b61a51a5efb789721b3480b502f324094911aeca46937956c561b52638009", "binjgb.js": "a68e5854b5d68339a34c0aa0b6dbeacd615ed316657ee17b63dafa5e00561b09", "binjgb.wasm": "52c165069441a09180b4bd63464318aa7b861b1d36e0d05e8047b48619fd2f0b", }; for (const [name, hash] of Object.entries(expected)) { const actual = createHash("sha256") .update(readFileSync(`reference/public/vendor/binjgb/${name}`)) .digest("hex"); if (actual !== hash) throw new Error(`Vendor integrity mismatch: ${name}`); } for (const path of readdirSync("public", { recursive: true })) { if (/\.(gbc?|rom|sav|zip)$/i.test(path)) throw new Error(`Game data must not be shipped: ${path}`); } console.log("Pinned emulator integrity and public game-file checks passed.");