11'use strict' ;
2- const fs = require ( 'fs' ) ;
3- const crypto = require ( 'crypto' ) ;
42const path = require ( 'path' ) ;
53const debug = require ( 'debug' ) ( 'hadron-build:target' ) ;
64const { sign : _garasign } = require ( '@mongodb-js/signing-utils' ) ;
@@ -53,20 +51,6 @@ function getSigningMethod(src) {
5351 }
5452}
5553
56- function hashFile ( filename ) {
57- return new Promise ( ( resolve , reject ) => {
58- const hash = crypto . createHash ( 'sha256' ) ;
59- const fh = fs . createReadStream ( filename ) ;
60-
61- fh . on ( 'data' , d => hash . update ( d ) ) ;
62- fh . on ( 'end' , ( ) => {
63- const digest = hash . digest ( 'hex' ) ;
64- resolve ( digest ) ;
65- } ) ;
66- fh . on ( 'error' , reject ) ;
67- } ) ;
68- }
69-
7054/**
7155 * We are signing the file using `gpg` or `jsign` depending on the
7256 * file extension. If the extension is `.exe` or `.msi`, we use `jsign`
@@ -92,9 +76,7 @@ async function sign(src, garasign = _garasign) {
9276 signingMethod : getSigningMethod ( src ) ,
9377 } ;
9478
95- debug ( `checksum of ${ src } before signing: ${ await hashFile ( src ) } ` ) ;
9679 await garasign ( src , clientOptions ) ;
97- debug ( `checksum of ${ src } after signing: ${ await hashFile ( src ) } ` ) ;
9880}
9981
10082module . exports = { sign, signArchive, getSignedFilename } ;
0 commit comments