Skip to content

Commit 1b04111

Browse files
committed
chore: delete code for deprecated altool strategy
1 parent 99d0cbe commit 1b04111

7 files changed

+7
-254
lines changed

src/index.ts

+3-18
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import retry from 'promise-retry';
44
import { checkSignatures } from './check-signature';
55
import { isNotaryToolAvailable, notarizeAndWaitForNotaryTool } from './notarytool';
66
import { stapleApp } from './staple';
7-
import {
8-
NotarizeOptions,
9-
NotaryToolStartOptions,
10-
NotarizeOptionsLegacy,
11-
NotarizeOptionsNotaryTool,
12-
} from './types';
7+
import { NotarizeOptions } from './types';
138

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

@@ -28,19 +23,9 @@ export { validateNotaryToolAuthorizationArgs as validateAuthorizationArgs } from
2823
* @param args Options for notarization
2924
* @returns The Promise resolves once notarization is complete. Note that this may take a few minutes.
3025
*/
31-
async function notarize(args: NotarizeOptionsNotaryTool): Promise<void>;
32-
/**
33-
* @deprecated
34-
*/
35-
async function notarize(args: NotarizeOptionsLegacy): Promise<void>;
26+
async function notarize(args: NotarizeOptions): Promise<void>;
3627

3728
async function notarize({ appPath, ...otherOptions }: NotarizeOptions) {
38-
if (otherOptions.tool === 'legacy') {
39-
throw new Error(
40-
'Notarization with the legacy altool system was decommisioned as of November 2023',
41-
);
42-
}
43-
4429
await checkSignatures({ appPath });
4530

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

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

src/legacy.ts

-18
This file was deleted.

src/notarytool.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
isNotaryToolPasswordCredentials,
99
isNotaryToolApiKeyCredentials,
1010
} from './validate-args';
11-
import { NotaryToolCredentials, NotaryToolStartOptions } from './types';
11+
import { NotarizeOptions, NotaryToolCredentials } from './types';
1212

1313
const d = debug('electron-notarize:notarytool');
1414

@@ -47,7 +47,7 @@ function authorizationArgs(rawOpts: NotaryToolCredentials): string[] {
4747
}
4848
}
4949

50-
async function getNotarizationLogs(opts: NotaryToolStartOptions, id: string) {
50+
async function getNotarizationLogs(opts: NotarizeOptions, id: string) {
5151
try {
5252
const logResult = await runNotaryTool(
5353
['log', id, ...authorizationArgs(opts)],
@@ -70,7 +70,7 @@ export async function isNotaryToolAvailable(notarytoolPath?: string) {
7070
}
7171
}
7272

73-
export async function notarizeAndWaitForNotaryTool(opts: NotaryToolStartOptions) {
73+
export async function notarizeAndWaitForNotaryTool(opts: NotarizeOptions) {
7474
d('starting notarize process for app:', opts.appPath);
7575
return await withTempDir(async (dir) => {
7676
const fileExt = path.extname(opts.appPath);

src/types.ts

+1-84
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
/**
2-
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
3-
* @category Legacy
4-
*/
5-
export interface LegacyNotarizePasswordCredentials {
6-
appleId: string;
7-
appleIdPassword: string;
8-
}
9-
101
/**
112
* You can generate an [app-specific password](https://support.apple.com/en-us/102654) for your Apple ID
123
* to notarize your Electron applications.
@@ -36,15 +27,6 @@ export interface NotaryToolPasswordCredentials {
3627
teamId: string;
3728
}
3829

39-
/**
40-
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
41-
* @category Legacy
42-
*/
43-
export interface LegacyNotarizeApiKeyCredentials {
44-
appleApiKey: string;
45-
appleApiIssuer: string;
46-
}
47-
4830
/**
4931
* Credentials required for JSON Web Token (JWT) notarization using App Store Connect API keys.
5032
*
@@ -90,14 +72,6 @@ export interface NotaryToolKeychainCredentials {
9072
keychain?: string;
9173
}
9274

93-
/**
94-
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
95-
* @category Legacy
96-
*/
97-
export type LegacyNotarizeCredentials =
98-
| LegacyNotarizePasswordCredentials
99-
| LegacyNotarizeApiKeyCredentials;
100-
10175
/**
10276
* Credential options for authenticating `notarytool`. There are three valid stategies available:
10377
*
@@ -111,15 +85,6 @@ export type NotaryToolCredentials =
11185
| NotaryToolApiKeyCredentials
11286
| NotaryToolKeychainCredentials;
11387

114-
/**
115-
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
116-
* @category Legacy
117-
*/
118-
export interface LegacyNotarizeAppOptions {
119-
appPath: string;
120-
appBundleId: string;
121-
}
122-
12388
/**
12489
* Non-credential options for notarizing your application with `notarytool`.
12590
* @category Core
@@ -132,56 +97,8 @@ export interface NotaryToolNotarizeAppOptions {
13297
notarytoolPath?: string;
13398
}
13499

135-
/**
136-
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
137-
* @category Legacy
138-
*/
139-
interface TransporterOptions {
140-
ascProvider?: string;
141-
}
142-
143-
/**
144-
* @deprecated This interface was used for Apple's `altool`, which was sunset in 2023 and no longer works.
145-
* @category Legacy
146-
*/
147-
interface NotarizeResult {
148-
uuid: string;
149-
}
150-
151-
/**
152-
* @deprecated This type was used for Apple's `altool`, which was sunset in 2023 and no longer works.
153-
* @category Legacy
154-
*/
155-
export type LegacyNotarizeStartOptions = LegacyNotarizeAppOptions &
156-
LegacyNotarizeCredentials &
157-
TransporterOptions;
158-
159-
/**
160-
* @deprecated This type was used for Apple's `altool`, which was sunset in 2023 and no longer works.
161-
* @category Legacy
162-
*/
163-
export type LegacyNotarizeWaitOptions = NotarizeResult & LegacyNotarizeCredentials;
164-
165-
/**
166-
* @deprecated This type was used for Apple's `altool`, which was sunset in 2023 and no longer works.
167-
* @category Legacy
168-
*/
169-
export type NotarizeOptionsLegacy = { tool: 'legacy' } & LegacyNotarizeStartOptions;
170-
171100
/**
172101
* Options for notarizing your Electron app with `notarytool`.
173102
* @category Core
174103
*/
175-
export type NotaryToolStartOptions = NotaryToolNotarizeAppOptions & NotaryToolCredentials;
176-
177-
/**
178-
* Helper type that specifies that `@electron/notarize` is using the `notarytool` strategy.
179-
* @category Utility Types
180-
*/
181-
export type NotarizeOptionsNotaryTool = { tool?: 'notarytool' } & NotaryToolStartOptions;
182-
183-
/**
184-
* Options accepted by the `notarize` method.
185-
* @internal
186-
*/
187-
export type NotarizeOptions = NotarizeOptionsLegacy | NotarizeOptionsNotaryTool;
104+
export type NotarizeOptions = NotaryToolNotarizeAppOptions & NotaryToolCredentials;

src/validate-args.ts

-57
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,10 @@
11
import {
2-
LegacyNotarizeApiKeyCredentials,
3-
LegacyNotarizeCredentials,
4-
LegacyNotarizePasswordCredentials,
52
NotaryToolApiKeyCredentials,
63
NotaryToolCredentials,
74
NotaryToolKeychainCredentials,
85
NotaryToolPasswordCredentials,
96
} from './types';
107

11-
/** @deprecated */
12-
export function isLegacyPasswordCredentials(
13-
opts: LegacyNotarizeCredentials,
14-
): opts is LegacyNotarizePasswordCredentials {
15-
const creds = opts as LegacyNotarizePasswordCredentials;
16-
return creds.appleId !== undefined || creds.appleIdPassword !== undefined;
17-
}
18-
19-
/** @deprecated */
20-
export function isLegacyApiKeyCredentials(
21-
opts: LegacyNotarizeCredentials,
22-
): opts is LegacyNotarizeApiKeyCredentials {
23-
const creds = opts as LegacyNotarizeApiKeyCredentials;
24-
return creds.appleApiKey !== undefined || creds.appleApiIssuer !== undefined;
25-
}
26-
27-
/** @deprecated */
28-
export function validateLegacyAuthorizationArgs(
29-
opts: LegacyNotarizeCredentials,
30-
): LegacyNotarizeCredentials {
31-
const isPassword = isLegacyPasswordCredentials(opts);
32-
const isApiKey = isLegacyApiKeyCredentials(opts);
33-
if (isPassword && isApiKey) {
34-
throw new Error('Cannot use both password credentials and API key credentials at once');
35-
}
36-
if (isPassword) {
37-
const passwordCreds = opts as LegacyNotarizePasswordCredentials;
38-
if (!passwordCreds.appleId) {
39-
throw new Error(
40-
'The appleId property is required when using notarization with appleIdPassword',
41-
);
42-
} else if (!passwordCreds.appleIdPassword) {
43-
throw new Error(
44-
'The appleIdPassword property is required when using notarization with appleId',
45-
);
46-
}
47-
return passwordCreds;
48-
}
49-
if (isApiKey) {
50-
const apiKeyCreds = opts as LegacyNotarizeApiKeyCredentials;
51-
if (!apiKeyCreds.appleApiKey) {
52-
throw new Error(
53-
'The appleApiKey property is required when using notarization with appleApiIssuer',
54-
);
55-
} else if (!apiKeyCreds.appleApiIssuer) {
56-
throw new Error(
57-
'The appleApiIssuer property is required when using notarization with appleApiKey',
58-
);
59-
}
60-
return apiKeyCreds;
61-
}
62-
throw new Error('No authentication properties provided (e.g. appleId, appleApiKey)');
63-
}
64-
658
export function isNotaryToolPasswordCredentials(
669
opts: NotaryToolCredentials,
6710
): opts is NotaryToolPasswordCredentials {

test/validate-args.test.ts

-73
This file was deleted.

typedoc.json

-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@
1212
"Core",
1313
"Credential Strategies",
1414
"Utility Types",
15-
"Legacy"
1615
]
1716
}

0 commit comments

Comments
 (0)