1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-26 07:39:04 +02:00
This commit is contained in:
antelle 2016-07-21 23:15:22 +03:00
parent 7819af0e0e
commit 94ad11b835
4 changed files with 31 additions and 6 deletions

View File

@ -475,12 +475,14 @@ module.exports = function(grunt) {
'sign-exe': { 'sign-exe': {
'win-installer': { 'win-installer': {
options: { options: {
file: 'tmp/desktop/win-ia32/KeeWeb Setup ' + pkg.version + '-ia32.exe', file: 'dist/desktop/KeeWeb.win.x64.exe',
spc: 'keys/code-sign-win32.spc', spc: 'keys/code-sign-win32.spc',
pvk: 'keys/code-sign-win32.pvk', pvk: 'keys/code-sign-win32.pvk',
algo: 'sha1', algo: 'sha1',
name: 'KeeWeb Setup', name: 'KeeWeb Setup',
url: pkg.homepage url: pkg.homepage,
keytarPasswordService: 'code-sign-win32-keeweb',
keytarPasswordAccount: 'code-sign-win32-keeweb'
} }
} }
}, },

View File

@ -4,9 +4,14 @@
module.exports = function (grunt) { module.exports = function (grunt) {
grunt.registerMultiTask('sign-exe', 'Signs exe file with authenticode certificate', function () { grunt.registerMultiTask('sign-exe', 'Signs exe file with authenticode certificate', function () {
const keytar = require('keytar');
const opt = this.options(); const opt = this.options();
const done = this.async(); const done = this.async();
grunt.util.spawn({ const password = keytar.getPassword(opt.keytarPasswordService, opt.keytarPasswordAccount);
if (!password) {
return grunt.warn('Code sign password not found');
}
let spawned = grunt.util.spawn({
cmd: 'signcode', cmd: 'signcode',
args: [ args: [
'-spc', opt.spc, '-spc', opt.spc,
@ -18,13 +23,18 @@ module.exports = function (grunt) {
'-t', 'http://timestamp.verisign.com/scripts/timstamp.dll', '-t', 'http://timestamp.verisign.com/scripts/timstamp.dll',
'-tr', 10, '-tr', 10,
opt.file opt.file
], ]
opts: { stdio: 'inherit' }
}, (error, result, code) => { }, (error, result, code) => {
if (error || code) { if (error || code) {
return grunt.log.warn(`signtool error ${code}: ${error}`); spawned.kill();
return grunt.warn(`signtool error ${code}: ${error}`);
} }
done(); done();
}); });
spawned.stdout.pipe(process.stdout);
spawned.stderr.pipe(process.stderr);
spawned.stdin.setEncoding('utf-8');
spawned.stdin.write(password);
spawned.stdin.write('\n');
}); });
}; };

12
npm-shrinkwrap.json generated
View File

@ -3378,6 +3378,18 @@
"from": "jsprim@>=1.2.2 <2.0.0", "from": "jsprim@>=1.2.2 <2.0.0",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.3.0.tgz" "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.3.0.tgz"
}, },
"keytar": {
"version": "3.0.2",
"from": "keytar@latest",
"resolved": "https://registry.npmjs.org/keytar/-/keytar-3.0.2.tgz",
"dependencies": {
"nan": {
"version": "2.3.2",
"from": "nan@2.3.2",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.3.2.tgz"
}
}
},
"kind-of": { "kind-of": {
"version": "3.0.3", "version": "3.0.3",
"from": "kind-of@>=3.0.2 <4.0.0", "from": "kind-of@>=3.0.2 <4.0.0",

View File

@ -42,6 +42,7 @@
"handlebars": "4.0.5", "handlebars": "4.0.5",
"handlebars-loader": "1.3.0", "handlebars-loader": "1.3.0",
"html-minifier": "3.0.1", "html-minifier": "3.0.1",
"keytar": "3.0.2",
"load-grunt-tasks": "3.5.0", "load-grunt-tasks": "3.5.0",
"node-sass": "3.8.0", "node-sass": "3.8.0",
"raw-loader": "0.5.1", "raw-loader": "0.5.1",