Skip to content

Commit b5f0691

Browse files
author
Erika Perugachi
authored
Merge pull request #1198 from erikaperugachi/notarize
Add electron-notarize
2 parents dd31b97 + 112aa60 commit b5f0691

File tree

4 files changed

+262
-195
lines changed

4 files changed

+262
-195
lines changed

electron_app/build/entitlements.mac.plist

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
<true/>
1515
<key>com.apple.security.print</key>
1616
<true/>
17-
<key>NSRequiresAquaSystemAppearance</key>
18-
<false />
17+
<key>com.apple.security.cs.allow-jit</key>
18+
<true/>
19+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
20+
<true/>
21+
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
22+
<true/>
1923
</dict>
2024
</plist>

electron_app/notarize.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
require('dotenv').config();
2+
const fs = require('fs');
3+
const path = require('path');
4+
var electron_notarize = require('electron-notarize');
5+
const { build } = require('./package.json');
6+
7+
module.exports = async function (params) {
8+
// Only notarize the app on Mac OS only.
9+
if (process.platform !== 'darwin') return;
10+
console.log('afterSign hook triggered', params);
11+
12+
// Same appId in electron-builder.
13+
let appId = build.appId
14+
15+
let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);
16+
if (!fs.existsSync(appPath)) {
17+
throw new Error(`Cannot find application at: ${appPath}`);
18+
}
19+
20+
console.log(`Notarizing ${appId} found at ${appPath}`);
21+
const password = `@keychain:AC_PASSWORD`;
22+
try {
23+
await electron_notarize.notarize({
24+
appBundleId: appId,
25+
appPath: appPath,
26+
appleId: process.env.APPLEID,
27+
appleIdPassword: password,
28+
});
29+
} catch (error) {
30+
console.error(error);
31+
}
32+
33+
console.log(`Done notarizing ${appId}`);
34+
};

electron_app/package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
"url": "https://github.com/Criptext/Criptext-Email-React-Client.git"
1717
},
1818
"scripts": {
19+
"build": "electron-builder",
1920
"electron": "electron .",
2021
"start": "npm run electron .",
2122
"start:dev": "npm run electron . --allow-file-access-from-file",
22-
"postinstall": "install-app-deps",
23+
"postinstall": "electron-builder install-app-deps",
2324
"test": "criptext-js-tools test",
2425
"integration": "NODE_ENV=test criptext-js-tools integration",
2526
"lint": "criptext-js-tools lint",
@@ -31,8 +32,11 @@
3132
"nucleusId": "0.0.0",
3233
"build": {
3334
"appId": "com.criptext.criptextmail",
35+
"afterSign": "notarize.js",
3436
"buildVersion": "1",
3537
"mac": {
38+
"hardenedRuntime": true,
39+
"gatekeeperAssess": false,
3640
"target": [
3741
"mas",
3842
"dmg",
@@ -132,7 +136,8 @@
132136
"devDependencies": {
133137
"criptext-js-tools": "0.5.0",
134138
"electron": "3.1.10",
135-
"electron-builder": "^20.37.0"
139+
"electron-builder": "21.2.0",
140+
"electron-notarize": "^0.1.1"
136141
},
137142
"dependencies": {
138143
"@criptext/api": "^0.15.22",

0 commit comments

Comments
 (0)