import { createHash } from "node:crypto"; import { readFile } from "node:fs/promises"; import { supplyChainDigest } from "./supply-chain.ts"; export async function digestReleaseInputFiles( files: readonly string[], readBytes: (file: string) => Promise = readFile, ): Promise { const rows = await Promise.all( [...files].sort().map(async (file) => ({ path: file, sha256: createHash("sha256") .update(await readBytes(file)) .digest("hex"), })), ); return supplyChainDigest(rows); }