Skip to content

Commit

Permalink
feat: use notarytool by default (#141)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: users who do not specify tool will not use notarytool by default
  • Loading branch information
MarshallOfSound authored Jun 25, 2023
1 parent 6f5116c commit bf23272
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,9 @@ For notarization, you need the following things:
### Method: `notarize(opts): Promise<void>`

* `options` Object
* `tool` String - The notarization tool to use, default is `legacy`. Can be `legacy` or `notarytool`. `notarytool` is substantially (10x) faster.
* `tool` String - The notarization tool to use, default is `notarytool`. Can be `legacy` or `notarytool`. `notarytool` is substantially (10x) faster and `legacy` is deprecated and will **stop working** on November 1st 2023.
* `appPath` String - The absolute path to your `.app` file
* There are different options for each tool: Legacy
* `appBundleId` String - The app bundle identifier your Electron app is using. E.g. `com.github.electron`
* `ascProvider` String (optional) - Your [Team Short Name](#notes-on-your-team-short-name).
* There are two authentication methods available: user name with password:
* `appleId` String - The username of your apple developer account
* `appleIdPassword` String - The [app-specific password](https://support.apple.com/HT204397) (not your Apple ID password).
* ... 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.
* ... or Notary Tool
* There are different options for each tool: Notarytool
* There are three authentication methods available: user name with password:
* `appleId` String - The username of your apple developer account
* `appleIdPassword` String - The [app-specific password](https://support.apple.com/HT204397) (not your Apple ID password).
Expand All @@ -67,6 +58,15 @@ For notarization, you need the following things:
* ... or keychain with keychainProfile:
* `keychain` String - The name of the keychain or path to the keychain you stored notarization credentials in.
* `keychainProfile` String - The name of the profile you provided when storing notarization credentials.
* ... or Legacy
* `appBundleId` String - The app bundle identifier your Electron app is using. E.g. `com.github.electron`
* `ascProvider` String (optional) - Your [Team Short Name](#notes-on-your-team-short-name).
* There are two authentication methods available: user name with password:
* `appleId` String - The username of your apple developer account
* `appleIdPassword` String - The [app-specific password](https://support.apple.com/HT204397) (not your Apple ID password).
* ... 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.

## Safety when using `appleIdPassword`

Expand Down
24 changes: 12 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { delay } from './helpers';
import { startLegacyNotarize, waitForLegacyNotarize } from './legacy';
import { isNotaryToolAvailable, notarizeAndWaitForNotaryTool } from './notarytool';
import { stapleApp } from './staple';
import { NotarizeOptions } from './types';
import { NotarizeOptions, NotaryToolStartOptions } from './types';

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

Expand All @@ -12,17 +12,7 @@ export { NotarizeOptions };
export { validateLegacyAuthorizationArgs as validateAuthorizationArgs } from './validate-args';

export async function notarize({ appPath, ...otherOptions }: NotarizeOptions) {
if (otherOptions.tool === 'notarytool') {
d('notarizing using the new notarytool system');
if (!(await isNotaryToolAvailable())) {
throw new Error('notarytool is not available, you must be on at least Xcode 13');
}

await notarizeAndWaitForNotaryTool({
appPath,
...otherOptions,
});
} else {
if (otherOptions.tool === 'legacy') {
console.warn(
'Notarizing using the legacy altool system. The altool system will be disabled on November 1 2023. Please switch to the notarytool system before then.',
);
Expand All @@ -46,6 +36,16 @@ export async function notarize({ appPath, ...otherOptions }: NotarizeOptions) {
await delay(10000);
d('starting to poll for notarization status');
await waitForLegacyNotarize({ uuid, ...otherOptions });
} else {
d('notarizing using the new notarytool system');
if (!(await isNotaryToolAvailable())) {
throw new Error('notarytool is not available, you must be on at least Xcode 13');
}

await notarizeAndWaitForNotaryTool({
appPath,
...otherOptions,
} as NotaryToolStartOptions);
}

await stapleApp({ appPath });
Expand Down

0 comments on commit bf23272

Please sign in to comment.