Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: electron/notarize
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.5.0
Choose a base ref
...
head repository: electron/notarize
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.0
Choose a head ref
  • 11 commits
  • 23 files changed
  • 6 contributors

Commits on Sep 17, 2024

  1. docs: mark custom notarytoolPath as unsupported (#212)

    felixrieseberg authored Sep 17, 2024
    Copy the full SHA
    1f91f89 View commit details

Commits on Oct 3, 2024

  1. chore: bump continuousauth/npm in .circleci/config.yml to 2.1.1 (#214)

    Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
    electron-roller[bot] authored Oct 3, 2024
    Copy the full SHA
    efd416f View commit details

Commits on Oct 26, 2024

  1. chore: bump electronjs/node in .circleci/config.yml to 2.3.1 (#215)

    Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
    electron-roller[bot] authored Oct 26, 2024
    Copy the full SHA
    669f1c2 View commit details

Commits on Nov 1, 2024

  1. build(deps): bump dsanders11/project-actions from 1.3.0 to 1.4.0 (#216)

    Bumps [dsanders11/project-actions](https://github.com/dsanders11/project-actions) from 1.3.0 to 1.4.0.
    - [Release notes](https://github.com/dsanders11/project-actions/releases)
    - [Changelog](https://github.com/dsanders11/project-actions/blob/main/.releaserc.json)
    - [Commits](dsanders11/project-actions@eb760c4...438b25e)
    
    ---
    updated-dependencies:
    - dependency-name: dsanders11/project-actions
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 1, 2024
    Copy the full SHA
    031072f View commit details

Commits on Nov 22, 2024

  1. build(deps): bump cross-spawn from 7.0.3 to 7.0.6 (#218)

    Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
    - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
    - [Commits](moxystudio/node-cross-spawn@v7.0.3...v7.0.6)
    
    ---
    updated-dependencies:
    - dependency-name: cross-spawn
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 22, 2024
    Copy the full SHA
    76fc907 View commit details

Commits on Dec 3, 2024

  1. ci: switch to GHA (#220)

    dsanders11 authored Dec 3, 2024
    Copy the full SHA
    13af290 View commit details

Commits on Dec 7, 2024

  1. build: publish API documentation (#217)

    Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
    erickzhao and dsanders11 authored Dec 7, 2024
    Copy the full SHA
    45230c6 View commit details

Commits on Dec 12, 2024

  1. build: update prettier to 3.4.2 (#221)

    dsanders11 authored Dec 12, 2024
    Copy the full SHA
    6db692b View commit details

Commits on Feb 1, 2025

  1. build(deps): bump dsanders11/project-actions from 1.4.0 to 1.5.1 (#224)

    Bumps [dsanders11/project-actions](https://github.com/dsanders11/project-actions) from 1.4.0 to 1.5.1.
    - [Release notes](https://github.com/dsanders11/project-actions/releases)
    - [Changelog](https://github.com/dsanders11/project-actions/blob/main/.releaserc.json)
    - [Commits](dsanders11/project-actions@438b25e...9c80cd3)
    
    ---
    updated-dependencies:
    - dependency-name: dsanders11/project-actions
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 1, 2025
    Copy the full SHA
    69092df View commit details
  2. build(deps): bump actions/setup-node from 4.1.0 to 4.2.0 (#223)

    Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.1.0 to 4.2.0.
    - [Release notes](https://github.com/actions/setup-node/releases)
    - [Commits](actions/setup-node@39370e3...1d0ff46)
    
    ---
    updated-dependencies:
    - dependency-name: actions/setup-node
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 1, 2025
    Copy the full SHA
    d6da0ac View commit details

Commits on Mar 14, 2025

  1. feat!: bump engines requirement to Node 22.12 (#222)

    BREAKING CHANGE: Requires Node.js v22.12.0 LTS or higher. ESM-only.
    
    Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
    Co-authored-by: Erik Moura <erikian@erikian.dev>
    3 people authored Mar 14, 2025
    Copy the full SHA
    d914d04 View commit details
Showing with 735 additions and 2,666 deletions.
  1. +0 −42 .circleci/config.yml
  2. +1 −1 .github/workflows/add-to-project.yml
  3. +33 −0 .github/workflows/docs.yml
  4. +35 −0 .github/workflows/release.yml
  5. +35 −0 .github/workflows/test.yml
  6. +1 −0 .nvmrc
  7. +7 −8 README.md
  8. +0 −4 jest.config.js
  9. +18 −13 package.json
  10. +2 −2 src/check-signature.ts
  11. +12 −10 src/helpers.ts
  12. +7 −22 src/index.ts
  13. +0 −18 src/legacy.ts
  14. +8 −8 src/notarytool.ts
  15. +7 −5 src/spawn.ts
  16. +2 −2 src/staple.ts
  17. +1 −84 src/types.ts
  18. +1 −58 src/validate-args.ts
  19. +1 −0 test/helpers.test.ts
  20. +0 −73 test/validate-args.test.ts
  21. +8 −19 tsconfig.json
  22. +0 −1 typedoc.json
  23. +556 −2,296 yarn.lock
42 changes: 0 additions & 42 deletions .circleci/config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/add-to-project.yml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ jobs:
creds: ${{ secrets.ECOSYSTEM_ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron
- name: Add to Project
uses: dsanders11/project-actions/add-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
uses: dsanders11/project-actions/add-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1
with:
field: Opened
field-value: ${{ github.event.pull_request.created_at || github.event.issue.created_at }}
33 changes: 33 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish API documentation

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+*

permissions: {}

jobs:
docs:
runs-on: ubuntu-24
environment:
name: publish-docs
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag: v4.2.2
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # tag: v4.2.0
with:
node-version: '22.12.x'
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Build API documentation
run: yarn build:docs
- name: Upload to Azure Blob Storage
uses: azure/cli@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # tag: v2.1.0
with:
azcliversion: latest
inlineScript: |
az storage blob upload-batch --account-name $ACCOUNT_NAME -d '$web/notarize/${{ github.ref_name }}' -s ./docs --overwrite --sas-token "$SAS_TOKEN"
env:
SAS_TOKEN: ${{ secrets.SAS_TOKEN }}
ACCOUNT_NAME: ${{ secrets.ACCOUNT_NAME }}
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
branches:
- main

jobs:
test:
uses: ./.github/workflows/test.yml

release:
name: Release
runs-on: ubuntu-latest
needs: test
environment: npm
permissions:
id-token: write # for CFA and npm provenance
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: '22.12.x'
cache: 'yarn'
- name: Install
run: yarn install --frozen-lockfile
- uses: continuousauth/action@4e8a2573eeb706f6d7300d6a9f3ca6322740b72d # v1.0.5
with:
project-id: ${{ secrets.CFA_PROJECT_ID }}
secret: ${{ secrets.CFA_SECRET }}
npm-token: ${{ secrets.NPM_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test

on:
pull_request:
branches:
- main
schedule:
- cron: '0 22 * * 3'
workflow_call:

permissions:
contents: read

jobs:
test:
name: Test
strategy:
matrix:
node-version:
- '22.12.x'
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node.js
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: "${{ matrix.node-version }}"
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint
run: yarn lint
- name: Test
run: yarn test
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.12
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ Electron Notarize

> Notarize your Electron apps seamlessly for macOS
[![CircleCI status](https://circleci.com/gh/electron/notarize.svg?style=shield)](https://circleci.com/gh/electron/notarize)
[![Test](https://github.com/electron/notarize/actions/workflows/test.yml/badge.svg)](https://github.com/electron/notarize/actions/workflows/test.yml)
[![NPM package](https://img.shields.io/npm/v/@electron/notarize)](https://npm.im/@electron/notarize)

## Installation
@@ -40,18 +40,12 @@ For notarization, you need the following things:
> If you are using Electron 11 or below, you must add the `com.apple.security.cs.allow-unsigned-executable-memory` entitlement too.
> When using version 12+, this entitlement should not be applied as it increases your app's attack surface.
### Notarization on older macOS versions

Xcode 13 is available from macOS 11.3, but notarization can be performed on systems down to macOS 10.15
(see [TN3147](https://developer.apple.com/documentation/technotes/tn3147-migrating-to-the-latest-notarization-tool#Enable-notarization-on-an-older-version-of-macOS) for more information).

To achieve this, you can copy notarytool binary from a newer macOS version and provide its path as `notarytoolPath` option.

## API

`@electron/notarize` exposes a single `notarize` function that accepts the following parameters:
* `appPath` — the absolute path to your codesigned and packaged Electron application.
* `notarytoolPath` - String (optional) - Path of the notarytool binary ([more details](#notarization-on-older-macos-versions))
* `notarytoolPath` - String (optional) - Path to a custom notarytool binary ([more details](#custom-notarytool))
* additional options required for authenticating your Apple ID (see below)

The method returns a void Promise once app notarization is complete. Please note that notarization may take
@@ -155,6 +149,11 @@ await notarize({
keychainProfile,
});
```

### Custom notarytool

You can provide a path to a custom `notarytool`. This module allows this option to enable unique edge cases - but this use case is _explicitly unsupported_.

## Troubleshooting

### Debug logging
4 changes: 0 additions & 4 deletions jest.config.js

This file was deleted.

31 changes: 18 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@
"name": "@electron/notarize",
"version": "0.0.0-development",
"description": "Notarize your Electron app",
"main": "lib/index.js",
"type": "module",
"exports": "./lib/index.js",
"typings": "lib/index.d.ts",
"author": "Samuel Attard",
"license": "MIT",
@@ -16,32 +17,36 @@
},
"scripts": {
"build": "tsc",
"build:docs": "npx typedoc",
"lint": "prettier --check \"src/**/*.ts\"",
"prettier:write": "prettier --write \"src/**/*.ts\"",
"prepare": "yarn build",
"test": "jest"
"test": "vitest run"
},
"files": [
"lib"
],
"engines": {
"node": ">= 10.0.0"
"node": ">= 22.12.0"
},
"publishConfig": {
"provenance": true
},
"devDependencies": {
"@types/debug": "^4.1.5",
"@types/fs-extra": "^9.0.1",
"@types/jest": "^29.0.0",
"@types/node": "^13.7.7",
"@tsconfig/node22": "^22.0.0",
"@types/debug": "^4.1.12",
"@types/graceful-fs": "^4.1.9",
"@types/node": "~22.10.7",
"@types/promise-retry": "^1.1.3",
"jest": "^29.0.0",
"prettier": "^1.18.2",
"ts-jest": "^29.0.0",
"prettier": "^3.4.2",
"typedoc": "~0.25.13",
"typedoc-plugin-missing-exports": "^2.2.0",
"typescript": "4.9.3"
"typescript": "~5.4.5",
"vitest": "^3.0.8"
},
"dependencies": {
"debug": "^4.1.1",
"fs-extra": "^9.0.1",
"debug": "^4.4.0",
"graceful-fs": "^4.2.11",
"promise-retry": "^2.0.1"
}
}
4 changes: 2 additions & 2 deletions src/check-signature.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path';

import { spawn } from './spawn';
import { NotaryToolNotarizeAppOptions } from './types';
import { spawn } from './spawn.js';
import { NotaryToolNotarizeAppOptions } from './types.js';
import debug from 'debug';
const d = debug('electron-notarize');

22 changes: 12 additions & 10 deletions src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import debug from 'debug';
import * as fs from 'fs-extra';
import * as os from 'os';
import * as path from 'path';
import * as fs from 'graceful-fs';

import * as os from 'node:os';
import * as path from 'node:path';
import * as util from 'node:util';

const d = debug('electron-notarize:helpers');

export async function withTempDir<T>(fn: (dir: string) => Promise<T>) {
const dir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-notarize-'));
const dir = await util.promisify(fs.mkdtemp)(path.resolve(os.tmpdir(), 'electron-notarize-'));
d('doing work inside temp dir:', dir);
let result: T;
try {
result = await fn(dir);
} catch (err) {
d('work failed');
await fs.remove(dir);
await util.promisify(fs.rm)(dir, { recursive: true, force: true });
throw err;
}
d('work succeeded');
await fs.remove(dir);
await util.promisify(fs.rm)(dir, { recursive: true, force: true });
return result;
}

@@ -33,7 +35,7 @@ class Secret {
}

export function makeSecret(s: string) {
return (new Secret(s) as any) as string;
return new Secret(s) as any as string;
}

export function isSecret(s: string) {
@@ -63,10 +65,10 @@ export function parseNotarizationInfo(info: string): NotarizationInfo {
}
};
matchToProperty('uuid', /\n *RequestUUID: (.+?)\n/);
matchToProperty('date', /\n *Date: (.+?)\n/, d => new Date(d));
matchToProperty('date', /\n *Date: (.+?)\n/, (d) => new Date(d));
matchToProperty('status', /\n *Status: (.+?)\n/);
matchToProperty('logFileUrl', /\n *LogFileURL: (.+?)\n/);
matchToProperty('statusCode', /\n *Status Code: (.+?)\n/, n => parseInt(n, 10) as any);
matchToProperty('statusCode', /\n *Status Code: (.+?)\n/, (n) => parseInt(n, 10) as any);
matchToProperty('statusMessage', /\n *Status Message: (.+?)\n/);

if (out.logFileUrl === '(null)') {
@@ -77,5 +79,5 @@ export function parseNotarizationInfo(info: string): NotarizationInfo {
}

export function delay(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms));
return new Promise((resolve) => setTimeout(resolve, ms));
}
29 changes: 7 additions & 22 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import debug from 'debug';
import retry from 'promise-retry';

import { checkSignatures } from './check-signature';
import { isNotaryToolAvailable, notarizeAndWaitForNotaryTool } from './notarytool';
import { stapleApp } from './staple';
import {
NotarizeOptions,
NotaryToolStartOptions,
NotarizeOptionsLegacy,
NotarizeOptionsNotaryTool,
} from './types';
import { checkSignatures } from './check-signature.js';
import { isNotaryToolAvailable, notarizeAndWaitForNotaryTool } from './notarytool.js';
import { stapleApp } from './staple.js';
import { NotarizeOptions } from './types.js';

const d = debug('electron-notarize');

export { NotarizeOptions };

export { validateNotaryToolAuthorizationArgs as validateAuthorizationArgs } from './validate-args';
export { validateNotaryToolAuthorizationArgs as validateAuthorizationArgs } from './validate-args.js';

/**
* Sends your app to Apple for notarization with `notarytool` and staples a successful
@@ -28,19 +23,9 @@ export { validateNotaryToolAuthorizationArgs as validateAuthorizationArgs } from
* @param args Options for notarization
* @returns The Promise resolves once notarization is complete. Note that this may take a few minutes.
*/
async function notarize(args: NotarizeOptionsNotaryTool): Promise<void>;
/**
* @deprecated
*/
async function notarize(args: NotarizeOptionsLegacy): Promise<void>;
async function notarize(args: NotarizeOptions): Promise<void>;

async function notarize({ appPath, ...otherOptions }: NotarizeOptions) {
if (otherOptions.tool === 'legacy') {
throw new Error(
'Notarization with the legacy altool system was decommisioned as of November 2023',
);
}

await checkSignatures({ appPath });

d('notarizing using notarytool');
@@ -53,7 +38,7 @@ async function notarize({ appPath, ...otherOptions }: NotarizeOptions) {
await notarizeAndWaitForNotaryTool({
appPath,
...otherOptions,
} as NotaryToolStartOptions);
} as NotarizeOptions);

await retry(() => stapleApp({ appPath }), {
retries: 3,
Loading