I am developing an Electron application for Mac OS X. I am attempting to test its auto-update feature while developing locally, prior to bundling it as a .app
.
I have a built one initial version of my application, Foo.app
, along with a .dmg
and .zip
, using the electron-builder
module, to use as the update. I have hosted these files. I have verified that they install and run correctly. And I have a Squirrel server, running locally, that will return a correct JSON payload pointing to that .zip
.
For developing my application locally, I am using Webpack to transpile my web assets, and using [email protected]
to launch those assets in Electron. In other words, when developing locally, I am not launching the bundled .app
; I am launching a dev server and serving those assets in Electron. The process is similar to running $ electron .
.
The problem occurs when the auto-update hook is called, at this line:
autoUpdater.setFeedURL(feedURL)
This line raises an Electron error that says:
"Could not get code signature for running application."
OK, so I do a search and see that there are a handful of guides that explain how to code sign an application:
But, these indicate that I should code sign the .app
. As I have stated, I am trying to test auto-update before I bundle it as a .app
. I would prefer not to rebuild again and again until I get auto-update working correctly.
So I do another search and see there are several forum questions that are more-or-less the same as what I am asking:
I'm having trouble grokking the solution from digging through these threads. I'm hoping someone can give me a clear solution to signing an Electron app before bundling it.
For an answer, I am hoping to get a clear answer on all of these:
.app
? I.e., the files that I would launch with $ electron .
?Regular Code Signing – both gives secure environment to developers for their software codes. EV code signing keeps the private key secret using hardware token whereas in Regular code signing the private key is not provided in a separate external drive.
Code signing your app assures users that it's from a known source and hasn't been modified since it was last signed. Before your app can integrate app services, be installed on a device, or be submitted to the App Store, it must be signed with a certificate issued by Apple.
Long shot and I have not verified this.
Squirrel.Mac checks the signing of the currently running application[1], this is the AppName.app/Contents/MacOS/AppName
executable when you are running a packaged app. Which basically is a renamed electron executable.
But when you run electron .
it will run the executable from your node/bin
directory. Electron is not signed by default, so if you sign it the auto updater might succeed with the cert check.
So basically:
which electron
codesign -s "Developer ID Application: YourCompanyName" electron
codesign -dvvv electron
Hopefully that should cut it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With