Codesign Electron macOS apps
Перейти к файлу
sethlu b864c6b9b8 Release 0.3.1 2016-05-01 21:32:09 +08:00
bin Document opts.ignore in electron-osx-sign 2016-05-01 21:05:31 +08:00
test Remove verbose flag from readme docs (#32) 2016-05-01 21:01:31 +08:00
.gitattributes Change from .plist to .entitlements 2016-02-23 17:25:34 +08:00
.gitignore Ignore test/work from git 2016-01-22 20:51:10 +09:00
.travis.yml Travis: only run standard, not tape 2016-03-04 22:35:27 -08:00
LICENSE Transfer to org electron-userland 2016-02-29 17:46:58 +08:00
README.md Release 0.3.1 2016-05-01 21:32:09 +08:00
default.darwin.entitlements Signing darwin with entitlements 2016-03-03 11:49:56 +08:00
default.darwin.inherit.entitlements Signing darwin with entitlements 2016-03-03 11:49:56 +08:00
default.mas.entitlements Signing darwin with entitlements 2016-03-03 11:49:56 +08:00
default.mas.inherit.entitlements Signing darwin with entitlements 2016-03-03 11:49:56 +08:00
index.d.ts 🎨 2016-05-01 20:09:13 +08:00
index.js opts.ignore to filter out undesired file paths for signing 2016-05-01 21:03:55 +08:00
package.json Release 0.3.1 2016-05-01 21:32:09 +08:00

README.md

electron-osx-sign npm Build Status

Code-signing for packaged Electron OS X apps.

Please visit our Wiki hosted here on GitHub for walk-throughs and notes from past projects shipped with electron-packager and electron-osx-sign.

Note: The signing procedure implemented in this package is based on what described in Mac App Store Submission Guide.

An OPEN Open Source Project

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

Installation

# For use in npm scripts
npm install electron-osx-sign --save
# For use from CLI
npm install electron-osx-sign -g

Note: electron-osx-sign is a dependency of electron-packager as of 6.0.0 for signing apps on OS X. However, please install this package globally for more customization beyond specifying identity and entitlements.

Usage

electron-osx-sign

From the Command Line

electron-osx-sign <app> [additional-binaries...] [--options...]

Example:

electron-osx-sign path/to/my.app

For details on the optional flags, run electron-osx-sign --help or see electron-osx-sign-usage.txt.

From the API

var sign = require('electron-osx-sign')
sign(opts[, function done (err) {}])

Example:

sign(opts, callback)
var sign = require('electron-osx-sign')
sign({
  app: 'path/to/my.app'
}, function done (err) {
  if (err) {
    // Handle the error
    return;
  }
  // Regular callback
})
opts

Required

app - String

Path to the application package. Needs file extension .app.

Optional

binaries - Array

Path to additional binaries that will be signed along with built-ins of Electron. Default to null.

entitlements - String

Path to entitlements file for signing the app. See default.mas.entitlements or default.darwin.entitlements for default.

entitlements-inherit - String

Path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. This option only applies when signing with entitlements provided, or for a mas platform version. See default.mas.inherit.entitlements or default.darwin.inherit.entitlements for default.

identity - String

Name of certificate to use when signing. Default to retrieve from opts.keychain (see below) or system default keychain.

Signing platform mas will look for 3rd Party Mac Developer Application: * (*), and platform darwin will look for Developer ID Application: * (*) by default.

keychain - String

The keychain name. Default to system default keychain (login.keychain).

ignore - String

Regex or function that signals ignoring a file before signing. Default to undefined.

platform - String

Build platform of Electron. Allowed values: darwin, mas. Default to auto detect from presence of Squirrel.framework within the application package.

callback

err - Error

electron-osx-flat

From the Command Line

electron-osx-flat <app> [--options...]

Example:

electron-osx-flat path/to/my.app

For details on the optional flags, run electron-osx-flat --help or see electron-osx-flat-usage.txt.

From the API

flat(opts, callback)
var flat = require('electron-osx-sign').flat
flat(opts[, function done (err) {}])

Example:

var flat = require('electron-osx-sign').flat
flat({
  app: 'path/to/my.app'
}, function done (err) {
  if (err) {
    // Handle the error
    return;
  }
  // Regular callback
})
opts

Required

app - String

Path to the application package. Needs file extension .app.

Optional

identity - String

Name of certificate to use when flattening. Default to retrieve from opts.keychain(see below) or system default keychain.

Flattening platform mas will look for 3rd Party Mac Developer Installer: * (*), and platform darwin will look for Developer ID Installer: * (*) by default.

install - String

Path to install for the bundle. Default to /Applications.

keychain - String

The keychain name. Default to login.keychain.

platform - String

Build platform of Electron. Allowed values: darwin, mas. Default to auto detect from application.

pkg - String

Path to the output flattened package. Needs file extension .pkg.

callback

err - Error

Debug

As of release v0.3.1, external module debug is used to display logs and messages; remember to export DEBUG=electron-osx-sign* when necessary.

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.

A successful testing should look something like:

$ npm test

> electron-osx-sign@0.3.1 pretest electron-osx-sign
> rimraf test/work

> electron-osx-sign@0.3.1 test electron-osx-sign
> standard && tape test

Calling electron-download before running tests...
Running tests...
TAP version 13
# setup
# defaults-test:v0.24.0-darwin-x64
ok 1 app signed
ok 2 app flattened
# defaults-test:v0.25.0-darwin-x64
ok 3 app signed
ok 4 app flattened
# defaults-test:v0.26.0-darwin-x64
ok 5 app signed
ok 6 app flattened
# defaults-test:v0.27.0-darwin-x64
ok 7 app signed
ok 8 app flattened
# defaults-test:v0.28.0-darwin-x64
ok 9 app signed
ok 10 app flattened
# defaults-test:v0.29.0-darwin-x64
ok 11 app signed
ok 12 app flattened
# defaults-test:v0.30.0-darwin-x64
ok 13 app signed
ok 14 app flattened
# defaults-test:v0.31.0-darwin-x64
ok 15 app signed
ok 16 app flattened
# defaults-test:v0.32.0-darwin-x64
ok 17 app signed
ok 18 app flattened
# defaults-test:v0.33.0-darwin-x64
ok 19 app signed
ok 20 app flattened
# defaults-test:v0.34.0-darwin-x64
ok 21 app signed
ok 22 app flattened
# defaults-test:v0.34.0-mas-x64
ok 23 app signed
ok 24 app flattened
# defaults-test:v0.35.0-darwin-x64
ok 25 app signed
ok 26 app flattened
# defaults-test:v0.35.0-mas-x64
ok 27 app signed
ok 28 app flattened
# defaults-test:v0.36.0-darwin-x64
ok 29 app signed
ok 30 app flattened
# defaults-test:v0.36.0-mas-x64
ok 31 app signed
ok 32 app flattened
# teardown

1..32
# tests 32
# pass  32

# ok

Collaborators

Thanks to seanchas116, and jasonhinkle for improving the usability of this project implementation.

  • electron-packager - package your electron app in OS executables (.app, .exe, etc) via JS or CLI