// Makes a copy of a Final Wishes file with every secret value erased, sealed under a NEW passphrase, // so it can be kept somewhere less safe (a shared SSD, an online session) for working on the layout. // The input file is only read. The copy carries the newest app code from src/. // // node sanitize.js --in real.html --out /path/copy.html // // Passphrases: FW_PASSPHRASE (current) and FW_NEW_PASSPHRASE (for the copy), else prompted for hidden. // They are never accepted as arguments. Only values flagged `secret` are erased; the summary printed // at the end lists what is still in the copy so you can judge whether it is safe to put where you plan to. import { readFileSync, writeFileSync, mkdirSync, existsSync, realpathSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import { dirname, join, resolve } from 'node:path'; import { assemble } from './src/template.js'; import { encrypt, decrypt, passphraseProblem } from './src/crypto.js'; import { assertValid, isSequence } from './src/model.js'; import { clearSecrets } from './src/ops.js'; import { bundleJs, promptHidden } from './build.js'; const root = dirname(fileURLToPath(import.meta.url)); export function extractPayload(html) { const m = html.match(/