mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
Merge pull request #12 from vector-im/dbkr/windows_signing
Sign natively on Windows
This commit is contained in:
commit
c43a742df4
@ -79,7 +79,7 @@
|
|||||||
"ia32"
|
"ia32"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"sign": "scripts/electron_winSign"
|
"certificateSubjectName": "New Vector Ltd"
|
||||||
},
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"output": "dist"
|
"output": "dist"
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIF0jCCBLqgAwIBAgIRAISYBqZi3VvCUeSfHXF+cbwwDQYJKoZIhvcNAQELBQAw
|
|
||||||
gZExCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO
|
|
||||||
BgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMTcwNQYD
|
|
||||||
VQQDEy5DT01PRE8gUlNBIEV4dGVuZGVkIFZhbGlkYXRpb24gQ29kZSBTaWduaW5n
|
|
||||||
IENBMB4XDTE3MDgyMzAwMDAwMFoXDTIwMDgyMjIzNTk1OVowgdgxETAPBgNVBAUT
|
|
||||||
CDEwODczNjYxMRMwEQYLKwYBBAGCNzwCAQMTAkdCMR0wGwYDVQQPExRQcml2YXRl
|
|
||||||
IE9yZ2FuaXphdGlvbjELMAkGA1UEBhMCR0IxETAPBgNVBBEMCFdDMVIgNEFHMQ8w
|
|
||||||
DQYDVQQIDAZMb25kb24xDzANBgNVBAcMBkxvbmRvbjEbMBkGA1UECQwSMjYgUmVk
|
|
||||||
IExpb24gU3F1YXJlMRcwFQYDVQQKDA5OZXcgVmVjdG9yIEx0ZDEXMBUGA1UEAwwO
|
|
||||||
TmV3IFZlY3RvciBMdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC7
|
|
||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ZG9jYS5jb20wJgYDVR0RBB8wHaAbBggrBgEFBQcI
|
|
||||||
A6APMA0MC0dCLTEwODczNjYxMA0GCSqGSIb3DQEBCwUAA4IBAQBJ2aH4aixh0aiz
|
|
||||||
4WKlK+LMVLHpQ2POE3FZYNpAW7o1q2YDGEADXdGrygPE9NCGNBXKo0CAemCYNWfX
|
|
||||||
Ov/jdoiMfeqW3vrZ66oEy8OqbvJSwK1xmomWuYw3wYPWcPVG+YbWYD2CGdQu8jTz
|
|
||||||
fzAJCpvAuY3Wji3fQjiecAC7JCSB4fBHa0ALJOmiSqKQUUpkXs5kW7O0lPBnHzNF
|
|
||||||
2tQGltXMSIrq1QfFtcreMyKlwDOxPIh360dv5aHhaeSRDRKxq7uq5ikQF2gjKx4k
|
|
||||||
ieg2HRbAW6fVPpFr4zRS5umpeZV3i06i11VQQPS/mA/OBEXyaqzx4mr6B7U6ptrp
|
|
||||||
jMqiUv2w
|
|
||||||
-----END CERTIFICATE-----
|
|
@ -1,69 +0,0 @@
|
|||||||
const { exec, execFile } = require('child_process');
|
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
const shellescape = require('shell-escape');
|
|
||||||
|
|
||||||
exports.default = async function(options) {
|
|
||||||
const inPath = options.path;
|
|
||||||
const appOutDir = path.dirname(inPath);
|
|
||||||
|
|
||||||
// get the token passphrase from the keychain
|
|
||||||
const tokenPassphrase = await new Promise((resolve, reject) => {
|
|
||||||
execFile(
|
|
||||||
'security',
|
|
||||||
['find-generic-password', '-s', 'riot_signing_token', '-w'],
|
|
||||||
{},
|
|
||||||
(err, stdout) => {
|
|
||||||
if (err) {
|
|
||||||
console.error("Couldn't find signing token in keychain", err);
|
|
||||||
// electron-builder seems to print '[object Object]' on the
|
|
||||||
// console whether you reject with an Error or a string...
|
|
||||||
reject(err);
|
|
||||||
} else {
|
|
||||||
resolve(stdout.trim());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let cmdLine = 'osslsigncode sign ';
|
|
||||||
if (process.env.OSSLSIGNCODE_SIGNARGS) {
|
|
||||||
cmdLine += process.env.OSSLSIGNCODE_SIGNARGS + ' ';
|
|
||||||
}
|
|
||||||
const tmpFile = path.join(
|
|
||||||
appOutDir,
|
|
||||||
'tmp_' + Math.random().toString(36).substring(2, 15) + '.exe',
|
|
||||||
);
|
|
||||||
const args = [
|
|
||||||
'-h', options.hash,
|
|
||||||
'-pass', tokenPassphrase,
|
|
||||||
'-in', inPath,
|
|
||||||
'-out', tmpFile,
|
|
||||||
];
|
|
||||||
if (options.isNest) args.push('-nest');
|
|
||||||
cmdLine += shellescape(args);
|
|
||||||
|
|
||||||
let signStdout;
|
|
||||||
const signproc = exec(cmdLine, {}, (error, stdout) => {
|
|
||||||
signStdout = stdout;
|
|
||||||
});
|
|
||||||
signproc.on('exit', (code) => {
|
|
||||||
if (code !== 0) {
|
|
||||||
console.log("Running", cmdLine);
|
|
||||||
console.log(signStdout);
|
|
||||||
console.error("osslsigncode failed with code " + code);
|
|
||||||
reject("osslsigncode failed with code " + code);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fs.rename(tmpFile, inPath, (err) => {
|
|
||||||
if (err) {
|
|
||||||
console.error("Error renaming file", err);
|
|
||||||
reject(err);
|
|
||||||
} else {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user