Skip to content

Commit

Permalink
Validate hash
Browse files Browse the repository at this point in the history
  • Loading branch information
JrMasterModelBuilder committed May 2, 2024
1 parent 8cf2cb4 commit 409cfa3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/download-harman-air-runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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};
};

Expand Down

0 comments on commit 409cfa3

Please sign in to comment.