Added Signing on Mac.

This commit is contained in:
Mikunj 2019-10-15 15:15:46 +11:00
parent f387cf6093
commit 6309c58ab2
6 changed files with 70 additions and 22 deletions

2
.gitignore vendored
View File

@ -25,3 +25,5 @@ yarn-error.log*
# bin dir
bin/*
!bin/.gitkeep
.env

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
</dict>
</plist>

24
build/notarize.js Normal file
View File

@ -0,0 +1,24 @@
const { notarize } = require("electron-notarize")
/*
Pre-requisites: https://github.com/electron/electron-notarize#prerequisites
1. Generate an app specific password
2. Add ELECTRON_WALLET_APPLE_ID, ELECTRON_WALLET_APP_PASSWORD, ELECTRON_WALLET_TEAM_ID to .env file in the root directory (where quasar.conf.js is located)
*/
exports.default = async function notarizing (context) {
const { electronPlatformName, appOutDir } = context
if (electronPlatformName !== "darwin") {
return
}
const appName = context.packager.appInfo.productFilename
return notarize({
appBundleId: "com.loki-project.electron-wallet",
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.ELECTRON_WALLET_APPLE_ID,
appleIdPassword: process.env.ELECTRON_WALLET_APP_PASSWORD,
ascProvider: process.env.ELECTRON_WALLET_TEAM_ID
})
}

37
package-lock.json generated
View File

@ -5836,13 +5836,13 @@
}
},
"electron-notarize": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-0.0.5.tgz",
"integrity": "sha512-YzrqZ6RDQ7Wt2RWlxzRoQUuxnTeXrfp7laH7XKcmQqrZ6GaAr50DMPvFMpqDKdrZSHSbcgZgB7ktIQbjvITmCQ==",
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-0.1.1.tgz",
"integrity": "sha512-TpKfJcz4LXl5jiGvZTs5fbEx+wUFXV5u8voeG5WCHWfY/cdgdD8lDZIZRqLVOtR3VO+drgJ9aiSHIO9TYn/fKg==",
"dev": true,
"requires": {
"debug": "^4.1.0",
"fs-extra": "^7.0.0"
"debug": "^4.1.1",
"fs-extra": "^8.0.1"
},
"dependencies": {
"debug": {
@ -5854,21 +5854,10 @@
"ms": "^2.1.1"
}
},
"fs-extra": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
"integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
}
}
@ -5953,6 +5942,16 @@
"ms": "^2.1.1"
}
},
"electron-notarize": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-0.0.5.tgz",
"integrity": "sha512-YzrqZ6RDQ7Wt2RWlxzRoQUuxnTeXrfp7laH7XKcmQqrZ6GaAr50DMPvFMpqDKdrZSHSbcgZgB7ktIQbjvITmCQ==",
"dev": true,
"requires": {
"debug": "^4.1.0",
"fs-extra": "^7.0.0"
}
},
"fs-extra": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",

View File

@ -33,10 +33,12 @@
"devDependencies": {
"babel-eslint": "^10.0.1",
"devtron": "^1.4.0",
"dotenv": "^8.1.0",
"electron": "^4.1.1",
"electron-builder": "^21.2.0",
"electron-debug": "^2.1.0",
"electron-devtools-installer": "^2.2.4",
"electron-notarize": "^0.1.1",
"electron-packager": "^13.1.1",
"eslint": "^5.15.3",
"eslint-config-standard": "^12.0.0",

View File

@ -178,6 +178,7 @@ module.exports = function (ctx) {
appId: "com.loki-project.electron-wallet",
productName: "Loki Electron Wallet",
copyright: "Copyright © 2018-2019 Loki Project, 2018 Ryo Currency Project",
afterSign: "build/notarize.js",
// directories: {
// buildResources: "src-electron/build"
@ -190,13 +191,20 @@ module.exports = function (ctx) {
},
mac: {
target: ["zip"],
// Zip seems to corrupt the app after unzipping. Ref: https://github.com/electron-userland/electron-builder/issues/3534
target: ["7z"],
icon: "src-electron/icons/icon.icns",
category: "public.app-category.finance"
category: "public.app-category.finance",
// Notarizing: https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
hardenedRuntime: true,
gatekeeperAssess: false,
entitlements: "build/entitlements.mac.plist",
entitlementsInherit: "build/entitlements.mac.plist"
},
dmg: {
background: "src-electron/build/loki-dmg.tiff"
background: "src-electron/build/loki-dmg.tiff",
sign: false
},
nsis: {
@ -204,6 +212,11 @@ module.exports = function (ctx) {
allowToChangeInstallationDirectory: true
},
files: [
"!build/notarize.js",
"!.env"
],
extraResources: [
"bin"
]