element-web/scripts/electron_afterSign.js
David Baker 070d5fc6e8 Sign all of the Windows executable files
We can actually just supply a custom signing module here to do our
signing rather than manually signing things in the afterSign hook.
This means all 4 executable files get signed (the main exe, the
stub exe, Update.exe and the installer).
2019-11-26 12:08:29 -07:00

24 lines
948 B
JavaScript

const { notarize } = require('electron-notarize');
exports.default = async function(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName === 'darwin') {
const appName = context.packager.appInfo.productFilename;
// We get the password from keychain. The keychain stores
// user IDs too, but apparently altool can't get the user ID
// from the keychain, so we need to get it from the environment.
const userId = process.env.NOTARIZE_APPLE_ID;
if (userId === undefined) {
throw new Error("User ID not found. Set NOTARIZE_APPLE_ID.");
}
console.log("Notarising macOS app. This may be some time.");
return await notarize({
appBundleId: 'im.riot.app',
appPath: `${appOutDir}/${appName}.app`,
appleId: userId,
appleIdPassword: '@keychain:NOTARIZE_CREDS',
});
}
};