]> Repos - mime-chat/commitdiff
Refine notatize.js and update README.md
authorAndrew Gundersen <gundersena@xavier.edu>
Thu, 10 Mar 2022 13:16:42 +0000 (07:16 -0600)
committerAndrew Gundersen <gundersena@xavier.edu>
Thu, 10 Mar 2022 13:16:42 +0000 (07:16 -0600)
README.md
entitlements.plist
notarize.js
src/config.js

index d5220b215d6b153838f998a00a00644aeb8d6006..ea78a49e74e85fad5ff52100f58cea98e983a83f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -29,4 +29,36 @@ yarn lint
 See [Configuration Reference](https://cli.vuejs.org/config/).
 
 ## Sign and Notarize
-Running notarize.js will sign and notarize the app. Further information is in that file.
+
+Prerequisites:
+*  Apple Developer Account ($99)
+*  Valid Apple Developer ID Application Certificate on keychain
+
+Clear debris from app before signing:
+
+    xattr -cr Electron.app
+
+Sign and Notarize:
+
+    node notarize.js
+
+Debug electron-osx-sign:
+
+    export DEBUG=electron-osx-sign*
+
+### Some things to note:
+
+#### Gatekeeper Assess
+Electron-osx-sign seems to have a bug where the sign will fail if "gatekeeper-assess" is true (default).
+
+#### Entitlements.plist
+Not to be confused with Info.plist, this file specifies entitlements the app can have in hardened runtime (e.g. Can I use the microphone?).  Only including the ones Electron reccommends seems to work (including audio of course and omitting allow-unsigned-executable-memory).
+
+#### The Benifit of Electron OSX Sign
+Without this package, we would have to manually go in and figure out how to sign each level of the app.  While it didn't work out of the box (gatekeeper-assess) it's proven to be good otherwise.  However, there is a bug where it puts multiple runtime flags on each command - not catastrophic though. 
+
+#### Apple Password
+This must be an app specific password, not your normal Apple ID password.
+
+#### --Signiture-Flags OSX Sign
+Not exactly sure what this does or why its important, but Electron includes it.
index 06bbc8da3b79cac64dccc886bf8b8c2ae529f54d..0555172f52d5125a1fe28f386af932c44c2573c9 100644 (file)
@@ -6,11 +6,9 @@
     <true/>
     <key>com.apple.security.cs.debugger</key>
     <true/>
-    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
-    <true/>
     <key>com.apple.security.device.audio-input</key>
     <true/>
-    <key>com.apple.security.cs.disable-library-validation</key>
-    <true/>
   </dict>
 </plist>
+<!--<key>com.apple.security.cs.disable-library-validation</key>
+    <true/>-->
index 9b409173599f9d032d111dbdfaa87440e634131d..8f87192a6bf5863ca4aaa046640f3efb5bf2d7fe 100644 (file)
@@ -1,36 +1,41 @@
+const exec = require('child_process').exec;
 const sign = require("electron-osx-sign").signAsync;
 const notarize = require("electron-notarize").notarize;
 
-const path = __dirname + "/Electron.app/Contents/Resources/app/node_modules";
+const app = "Electron.app";
 
-const addons = [
-    `${path}/@crimata/nodeaudio/build/Release/libportaudio.dylib`,
-    `${path}/@crimata/nodeaudio/build/Release/nodeAudio.node`
-];
+const runShellCommand = (cmd) => (new Promise((resolve, reject) => {
+    exec(cmd, (error, stdout, stderr) => {
+        error ? reject(stderr) : resolve(stdout);
+    });
+}));
 
 const signConfig = {
-    "app": "Electron.app",
-    "platform": "darwin",
-    "binaries": addons,
+    "app": app,
     "hardened-runtime": true,
+    "gatekeeper-assess": false,
+    "signature-flags": "library",
     "entitlements": "entitlements.plist",
     "entitlements-inherit": "entitlements.plist",
-    "signature-flags": "library",
-    "gatekeeper-assess": false
 };
 
 const notarizeConfig = {
-    appBundleId: "com.github.Electron",
-    appPath: "Electron.app",
+    appPath: app,
     appleId: "gundersena@crimata.com",
-    appleIdPassword: "wdeb-cbcq-rujb-ldgo"
+    appBundleId: "com.github.Electron",
+    appleIdPassword: process.env["AC_PASSWORD"]
 };
 
 (async function () {
 
     try 
     {
+        console.log("Cleaning App...");
+        await runShellCommand(`xattr -cr ${app}`);
+
+        console.log("Signing...");
         await sign(signConfig);
+
         console.log("Notarizing...");
         await notarize(notarizeConfig);
     }
@@ -40,15 +45,3 @@ const notarizeConfig = {
     }
 
 })();
-
-/* Clear debris from .app before running or it will complain:
- *     xattr -cr Electron.app 
- *
- * Paste this in terminal to debug electron-osx-sign:
- *     export DEBUG=electron-osx-sign*
- *
- * Some important things to note:
- *     - In order to notarize, you need a valid Apple Developer ID Application *       Certificate.
- *     - All flags in current signing config are required for notarization (to 
- *       my knowledge).
- */
\ No newline at end of file
index 61dfdfd1502a6cb3f5c9c3fdc9baafa84d38e6cf..b3b11049ec668d8cbc3b6322d175fa9351615d9c 100644 (file)
@@ -5,8 +5,6 @@ const DOMAIN = "crimata.com";
 const prod = !process.defaultApp;
 
 module.exports = {
-
-PLATFORM: prod ? `http://app.${DOMAIN}` : `http://localhost:8760`,
-API: prod ? `https://${DOMAIN}/api` : `http://localhost:8761`
-
+    PLATFORM: prod ? `http://app.${DOMAIN}` : `http://localhost:8760`,
+    API: prod ? `https://${DOMAIN}/api` : `http://localhost:8761`
 }