Show error message if gpg failed

This commit is contained in:
Girish Ramakrishnan
2020-04-11 14:52:09 -07:00
parent 1ab23d2902
commit 531d314e25

View File

@@ -64,13 +64,16 @@ function gpgVerify(file, sig, callback) {
debug(`gpgVerify: ${cmd}`);
child_process.exec(cmd, { encoding: 'utf8' }, function (error, stdout, stderr) {
if (error) return callback(new BoxError(BoxError.NOT_SIGNED, `The signature in ${path.basename(sig)} could not verified`));
if (error) {
debug(`gpgVerify: command failed. error: ${error}\n stdout: ${stdout}\n stderr: ${stderr}`);
return callback(new BoxError(BoxError.NOT_SIGNED, `The signature in ${path.basename(sig)} could not verified (command failed)`));
}
if (stdout.indexOf('[GNUPG:] VALIDSIG 0EADB19CDDA23CD0FE71E3470A372F8703C493CC') !== -1) return callback();
debug(`gpgVerify: verification of ${sig} failed: ${stdout}\n${stderr}`);
return callback(new BoxError(BoxError.NOT_SIGNED, `The signature in ${path.basename(sig)} could not verified`));
return callback(new BoxError(BoxError.NOT_SIGNED, `The signature in ${path.basename(sig)} could not verified (bad sig)`));
});
}