What is electron-osx-sign?
The electron-osx-sign package is used to sign and verify macOS applications built with Electron. It ensures that your application is properly signed with a valid Apple Developer ID, which is necessary for distribution and to avoid security warnings.
What are electron-osx-sign's main functionalities?
Code Signing
This feature allows you to sign your macOS application with a valid Apple Developer ID. The code sample demonstrates how to use the `sign` function to sign an application located at 'path/to/your/app' with the specified identity.
const sign = require('electron-osx-sign').sign;
sign({
app: 'path/to/your/app',
identity: 'Developer ID Application: Your Name (XXXXXXXXXX)'
}, function done (err) {
if (err) {
console.error('Error during signing:', err);
} else {
console.log('Application signed successfully');
}
});
Verification
This feature allows you to verify that your macOS application has been correctly signed. The code sample demonstrates how to use the `verify` function to check the signature of an application located at 'path/to/your/app'.
const verify = require('electron-osx-sign').verify;
verify({
app: 'path/to/your/app'
}, function done (err, result) {
if (err) {
console.error('Error during verification:', err);
} else {
console.log('Verification result:', result);
}
});
Entitlements
This feature allows you to sign your macOS application with specific entitlements. The code sample demonstrates how to use the `sign` function to sign an application with entitlements specified in 'path/to/entitlements.plist'.
const sign = require('electron-osx-sign').sign;
sign({
app: 'path/to/your/app',
identity: 'Developer ID Application: Your Name (XXXXXXXXXX)',
entitlements: 'path/to/entitlements.plist'
}, function done (err) {
if (err) {
console.error('Error during signing with entitlements:', err);
} else {
console.log('Application signed successfully with entitlements');
}
});
Other packages similar to electron-osx-sign
electron-builder
electron-builder is a complete solution to package and build a ready-for-distribution Electron app for macOS, Windows, and Linux. It includes features for code signing, auto-updates, and more. Compared to electron-osx-sign, electron-builder offers a broader range of functionalities beyond just signing macOS applications.
appdmg
appdmg is a tool for creating DMG images for macOS applications. While it does not handle code signing directly, it is often used in conjunction with tools like electron-osx-sign to package signed applications into DMG files for distribution. It complements electron-osx-sign by focusing on the packaging aspect.
electron-osx-sign
Code signing for Electron-packed OS X apps
Installation
npm install electron-osx-sign --save-dev
npm install electron-osx-sign -g
Usage
From the Command Line
electron-sign <app> [optional flags...]
For details on the optional flags, run electron-sign --help
or see usage.txt.
Programmatic API
var sign = require('electron-osx-sign')
sign(app[, opts[, function done (err) { }]])
sign(app, opts, callback)
app
Path to the application
opts
Optional
entitlements
- String
Path to entitlements file for signing Mac App Store application.
See mas.default.plist for default.
entitlements-inherit
- String
Path to child entitlements file for signing frameworks and bundles of Mac App Store application.
See mas.inherit.default.plist for default.
helper-path
- String
Path to Electron Helper.app
, which may be renamed.
helper-eh-path
- String
Path to Electron Helper EH.app
, which may be renamed.
helper-np-path
- String
Path to Electron Helper NP.app
, which may be renamed.
Note: helper-path
, helper-eh-path
, helper-np-path
needn't provided unless error thrown for not able to find any of them automatically.
identity
- String
Name of certificate to use when signing.
Default to retrieve from login.keychain
.
platform
- String
Build platform of Electron.
Allowed values: darwin, mas
Default: darwin
callback
err
- Error
Test
As developer certificates are required for codesign
in OS X, this module may not be tested via online build services. If you wish to test out this module, enter:
npm test
from the dev directory, and tell us if all tests should pass.
When this command is fun for the first time: electron-download
will download all major releases of Electron available for OS X from 0.24.0, and save to ~/.electron/
, which might take up less than 1GB of disk space.
Related
- electron-packager - package your electron app in OS executables (.app, .exe, etc) via JS or CLI