From 0304096e46ee5c33e83f522713cd6ed22c6eccbf Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 6 Mar 2020 16:42:24 +0000 Subject: [PATCH] lint --- scripts/electron_winSign.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/scripts/electron_winSign.js b/scripts/electron_winSign.js index 9fd1616..8d46d0d 100644 --- a/scripts/electron_winSign.js +++ b/scripts/electron_winSign.js @@ -1,15 +1,19 @@ const { execFile } = require('child_process'); -const path = require('path'); // Loosely based on computeSignToolArgs from app-builder-lib/src/codeSign/windowsCodeSign.ts function computeSignToolArgs(options, keyContainer) { const args = []; if (process.env.ELECTRON_BUILDER_OFFLINE !== "true") { - const timestampingServiceUrl = options.options.timeStampServer || "http://timestamp.digicert.com"; - args.push(options.isNest || options.hash === "sha256" ? "/tr" : "/t", options.isNest || options.hash === "sha256" ? (options.options.rfc3161TimeStampServer || "http://timestamp.comodoca.com/rfc3161") : timestampingServiceUrl); + const timestampingServiceUrl = options.options.timeStampServer || "http://timestamp.digicert.com"; + args.push( + options.isNest || options.hash === "sha256" ? "/tr" : "/t", + options.isNest || options.hash === "sha256" ? ( + options.options.rfc3161TimeStampServer || "http://timestamp.comodoca.com/rfc3161" + ) : timestampingServiceUrl, + ); } - + args.push('/kc', keyContainer); // To use the hardware token (this should probably be less hardcoded) args.push('/csp', 'eToken Base Cryptographic Provider'); @@ -23,21 +27,21 @@ function computeSignToolArgs(options, keyContainer) { args.push('/f', 'riot.im\\New_Vector_Ltd.pem'); if (options.hash !== "sha1") { - args.push("/fd", options.hash) + args.push("/fd", options.hash); if (process.env.ELECTRON_BUILDER_OFFLINE !== "true") { - args.push("/td", "sha256") + args.push("/td", "sha256"); } } - + // msi does not support dual-signing if (options.isNest) { - args.push("/as") + args.push("/as"); } - + // https://github.com/electron-userland/electron-builder/issues/2875#issuecomment-387233610 - args.push("/debug") + args.push("/debug"); // must be last argument - args.push(options.path) + args.push(options.path); return args; } @@ -54,12 +58,9 @@ exports.default = async function(options) { return; } - const inPath = options.path; - const appOutDir = path.dirname(inPath); - return new Promise((resolve, reject) => { const args = ['sign'].concat(computeSignToolArgs(options, keyContainer)); - + execFile('signtool', args, {}, (error, stdout) => { if (error) { console.error("signtool failed with code " + error);