This package has been deprecated

Author message:

please use the official electron-notarize package.

@mceachen/electron-notarize
TypeScript icon, indicating that this package has built-in type declarations

0.1.1-20191102 • Public • Published

Electron Notarize

Notarize your Electron apps seamlessly

Installation

# npm
npm i electron-notarize --save-dev

# yarn
yarn add electron-notarize --dev

What is app "notarization"?

From apple's docs, the definition of a "notarized app"

A notarized app is a macOS app that was uploaded to Apple for processing before it was distributed. When you export a notarized app from Xcode, it code signs the app with a Developer ID certificate and staples a ticket from Apple to the app. The ticket confirms that you previously uploaded the app to Apple.

On macOS 10.14 and later, the user can launch notarized apps when Gatekeeper is enabled. When the user first launches a notarized app, Gatekeeper looks for the app’s ticket online. If the user is offline, Gatekeeper looks for the ticket that was stapled to the app.

Basically Apple are going to make this a hard requirement soon, may as well get on the train early.

API

Method: notarize(opts): Promise<void>

  • options Object
    • appBundleId String - The app bundle identifier your Electron app is using. E.g. com.github.electron
    • appPath String - The absolute path to your .app file
    • ascProvider String (optional) - Your Team ID in App Store Connect. This is necessary if you are part of multiple teams
    • There are two methods available: user name with password:
      • appleId String - The username of your apple developer account
      • appleIdPassword String - The password for your apple developer account
    • ... or apiKey with apiIssuer:
      • appleApiKey String - Required for JWT authentication. See Note on JWT authentication below.
      • appleApiIssuer String - Issuer ID. Required if appleApiKey is specified.

Prerequisites

For notarization, you need the following things:

  1. Xcode 10 or later installed on your Mac.
  2. An Apple Developer account.
  3. An app-specific password for your ADC account’s Apple ID.

Safety when using appleIdPassword

  1. Never hard code your password into your packaging scripts, use an environment variable at a minimum.
  2. It is possible to provide a keychain reference instead of your actual password (assuming that you have already logged into the Application Loader from Xcode). For example:
const password = `@keychain:"Application Loader: ${appleId}"`;

Another option is that you can add a new keychain item using either the Keychain Access app or from the command line using the security utility:

security add-generic-password -a "AC_USERNAME" -w <app_specific_password> -s "AC_PASSWORD"

where AC_USERNAME should be replaced with your Apple ID, and then in your code you can use:

const password = `@keychain:AC_PASSWORD`;

Notes on JWT authentication

You can obtain an API key from Appstore Connect. Create a key with App Manager access. Note down the Issuer ID and download the .p8 file. This file is your Api key and comes with the name of AuthKey_<api_key>.p8. This is the string you have to supply when calling notarize.

Based on the ApiKey altool will look in the following places for that file:
./private_keys, ~/private_keys, ~/.private_keys and ~/.appstoreconnect/private_keys.

Example Usage

import { notarize } from 'electron-notarize';

async function packageTask () {
  // Package your app here, and code side with hardened runtime
  await notarize({
    appBundleId,
    appPath,
    appleId,
    appleIdPassword,
    ascProvider, // This parameter is optional
  });
}

Readme

Keywords

none

Package Sidebar

Install

npm i @mceachen/electron-notarize

Weekly Downloads

0

Version

0.1.1-20191102

License

MIT

Unpacked Size

24.2 kB

Total Files

11

Last publish

Collaborators

  • mceachen