Skip to main content

Command Palette

Search for a command to run...

Code Sigin

Updated
2 min readView as Markdown

Certificate Required

To sign Electron apps, you may require two separate certificates:

  • The Developer ID Installer certificate is for apps distributed to the Mac App Store.

  • The Developer ID Application certificate is for apps distributed outside the Mac App Store.

Note:- Both these certificates can only be created by the Account Holder.

https://www.electronforge.io/guides/code-signing/code-signing-macos

How to Create Certificate on Apple Developer Account

Keychain Access on your Mac allows you to create a certificate signing request (CSR).

Create a certificate on the system:- https://developer.apple.com/help/account/create-certificates/create-a-certificate-signing-request

After this

  1. Go to the Apple developer account

  2. Go to the Certificates Click on the + icon, Here you will see Developer ID Application And Developer ID Installer if you logged in by owner account.

  3. Select the certificate then click on continue.

  4. Then choose the file that was created from the above link.

  5. Once the certificate is created download it and double-click on the certificate. It will add the certificate to keyChain.

  6. Sometimes you need to right-click on the certificate in key chain access and --> click on info --> make it Always trust

Code sign-in after build (dmg) may be for pkg

  1. first, we will run a command that fixes error that we get if we create a build having a file which does not support for code-signing

     export CSC_IDENTITY_AUTO_DISCOVERY=false
    
  2. Then once dmg is created we run the command for its code-signing


codesign --force --sign "SID" "path_to_app_or_dmg" --deep
  1. To get a valid identity, use security find-identity -p codesigning

  2. The above command return the identies which you can use at place of "SID".
    Recommend to use Developer ID Application

Code sign-in file

//Open terminal at root of project 
codesign -s "Developer ID Application: R...no Inc. (....)"  <path to that file> //ex-  src/file.node


codesign -dv <path to that file> //ex-  src/file

// release is a folder name
codesign --remove-signatur Release/file