import { existsSync } from'node:fs';
import { join } from'node:path';
/* Which detached signatures this build will actually serve. * * The importer (scripts/sync-pentest-workflow.py) writes a `signatureHref` * for every download, but the signatures themselves are made afterwards, by * hand, with the publisher's key. Linking them unconditionally told readers * every file was signed when none was. The page asks the filesystem instead: * Astro copies public/ into the release verbatim, so a signature that exists * here is one the site serves. * * `complete` is the only state the page may call "signed": the manifest and * every catalogued file. scripts/verify-downloads.mjs refuses to deploy the * in-between state and checks the signatures themselves. */const DIR = join(process.cwd(), 'public', 'downloads', 'pentest-workflow');
exportfunction publishedSignatures(downloads: { name:string }[]) {
const files =newSet(downloads.filter((d) => existsSync(join(DIR, `${d.name}.sha256.asc`))).map((d) => d.name));
const manifest = existsSync(join(DIR, 'SHA256SUMS.asc'));
return { files, manifest, complete:manifest&& downloads.length >0&& files.size === downloads.length };
}