Skip to content

Commit

Permalink
Merge pull request #1835 from webtorrent/osx-notarize
Browse files Browse the repository at this point in the history
Add macOS Notarization
  • Loading branch information
feross authored Jul 16, 2020
2 parents 8e89c09 + 803cce8 commit 5deb0d7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
12 changes: 12 additions & 0 deletions bin/darwin-entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
26 changes: 24 additions & 2 deletions bin/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ function buildDarwin (cb) {

function signApp (cb) {
const sign = require('electron-osx-sign')
const { notarize } = require('electron-notarize')

/*
* Sign the app with Apple Developer ID certificates. We sign the app for 2 reasons:
Expand All @@ -281,16 +282,37 @@ function buildDarwin (cb) {
* - Membership in the Apple Developer Program
*/
const signOpts = {
verbose: true,
app: appPath,
platform: 'darwin',
verbose: true
identity: 'Developer ID Application: WebTorrent, LLC (5MAMC8G3L8)',
hardenedRuntime: true,
entitlements: path.join(config.ROOT_PATH, 'bin', 'darwin-entitlements.plist'),
'entitlements-inherit': path.join(config.ROOT_PATH, 'bin', 'darwin-entitlements.plist'),
'signature-flags': 'library'
}

const notarizeOpts = {
appBundleId: darwin.appBundleId,
appPath,
appleId: '[email protected]',
appleIdPassword: '@keychain:AC_PASSWORD'
}

console.log('Mac: Signing app...')
sign(signOpts, function (err) {
if (err) return cb(err)
console.log('Mac: Signed app.')
cb(null)

console.log('Mac: Notarizing app...')
notarize(notarizeOpts).then(
function () {
console.log('Mac: Notarized app.')
cb(null)
},
function (err) {
cb(err)
})
})
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"cross-zip": "^3.1.0",
"depcheck": "^1.0.0",
"electron": "~10.0.0-beta.11",
"electron-notarize": "^1.0.0",
"electron-osx-sign": "^0.4.17",
"electron-packager": "^15.0.0",
"electron-winstaller": "^4.0.1",
Expand Down

0 comments on commit 5deb0d7

Please sign in to comment.