From 409cfa32445128daefba3728f4546ae1b65d81af Mon Sep 17 00:00:00 2001 From: JrMasterModelBuilder Date: Thu, 2 May 2024 02:16:23 -0400 Subject: [PATCH] Validate hash --- bin/download-harman-air-runtime.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/download-harman-air-runtime.mjs b/bin/download-harman-air-runtime.mjs index 800a0b57..860cb967 100755 --- a/bin/download-harman-air-runtime.mjs +++ b/bin/download-harman-air-runtime.mjs @@ -29,7 +29,7 @@ async function main() { })); const each = async resource => { - const {name, source, file, mimetype} = resource.info; + const {name, source, file, mimetype, sha256: sha256e} = resource.info; const filedir = pathJoin(outdir, name); const filepath = pathJoin(filedir, file); @@ -69,6 +69,10 @@ async function main() { ['sha256', 'sha1', 'md5'], 'hex' ); + if (sha256 !== sha256e) { + throw new Error(`Hash: ${sha256} != ${sha256e}: ${source}`); + } + resource.hashes = {sha256, sha1, md5}; };