galusben
galusben

Reputation: 6372

How to sign electron app using 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

Upvotes: 13

Views: 5938

Answers (3)

Kiran Maniya
Kiran Maniya

Reputation: 8979

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

Upvotes: 0

Joshua Pinter
Joshua Pinter

Reputation: 47471

EDIT: see https://stackoverflow.com/a/58665415/2165342 bellow. electronPackagerConfig is now packagerConfig

Use 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.

Upvotes: 9

Ed McManus
Ed McManus

Reputation: 7076

electronPackagerConfig is now packagerConfig, e.g.:

{ 
  "config": {
    "forge": {
      "packagerConfig": {
        "osxSign": {
          "identity": "Developer ID Application: Company (id)"
        }
      }
    }
  }
}

Upvotes: 2

Related Questions