I am using electron forge for building and packaging my electron app.
How can I code sign my app (using electron forge) for windows and mac?
Electrong-forge: https://github.com/electron-userland/electron-forge
I am using electron forge for building and packaging my electron app.
How can I code sign my app (using electron forge) for windows and mac?
Electrong-forge: https://github.com/electron-userland/electron-forge
EDIT: see https://mcmap.net/q/877374/-how-to-sign-electron-app-using-electron-forge bellow. electronPackagerConfig is now packagerConfig
packagerConfig
key in your package.json
.Electron Forge uses Electron Packager under the hood and allows you to set the Electron Packager configuration in your package.json
.
Here's an extract of what mine looks like in order to sign our packaged application file:
package.json
{
"config": {
"forge": {
"packagerConfig": {
"osxSign": {
"identity": "Developer ID Application: Joshua Pinter (<your_key_code>)"
}
}
}
}
}
You can see that all the Electron Packager configurations can be put under the packagerConfig
key.
NOTE: In older versions of Electron Forge, this was called electronPackagerConfig
instead of packagerConfig
.
security unlock-keychain
before you run yarn make
, as it will give you a very cryptic error: WARNING: code sign failed; please retry manually.... but not explain that it is simply the keychain being locked. You can of course run it in the Terminal.app and it will prompt you to unlock it, but OSX can't or won't prompt you remotely. –
Alluvial electronPackagerConfig
is now packagerConfig
, e.g.:
{
"config": {
"forge": {
"packagerConfig": {
"osxSign": {
"identity": "Developer ID Application: Company (id)"
}
}
}
}
}
Only signing the electron app won't let the app work in production, as GateKeeper will not allow the app to open. You need to sign the application and then perform notarization. Here is how you can do that with electron forge.
"packagerConfig": {
"icon": "./resources/icon",
"osxSign": {
"identity": "Developer ID Application: Kiran Maniya (R8A8NS532)"
},
"osxNotarize": {
"tool": "notarytool",
"appleApiKey": "./signing/AuthKey_R8A8NS532.p8",
"appleApiKeyId": "R8A8NS532",
"appleApiIssuer": "30651f9c-0046-4d6a-aba3-db72ff6c32ef"
}
},
You can retrieve the identity name by running the command given below. Remember, The Developer ID Installer certificate is for apps distributed to the Mac App Store and Developer ID Application certificate is for apps distributed outside the Mac App Store.
security find-identity -p codesigning -v
© 2022 - 2024 — McMap. All rights reserved.