Socket
Socket
Sign inDemoInstall

@electron/notarize

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electron/notarize - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

1

lib/helpers.js

@@ -11,2 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.delay = exports.parseNotarizationInfo = exports.isSecret = exports.makeSecret = exports.withTempDir = void 0;
const debug = require("debug");

@@ -13,0 +14,0 @@ const fs = require("fs-extra");

17

lib/index.js

@@ -22,2 +22,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.notarize = exports.validateAuthorizationArgs = void 0;
const debug = require("debug");

@@ -30,3 +31,3 @@ const helpers_1 = require("./helpers");

var validate_args_1 = require("./validate-args");
exports.validateAuthorizationArgs = validate_args_1.validateLegacyAuthorizationArgs;
Object.defineProperty(exports, "validateAuthorizationArgs", { enumerable: true, get: function () { return validate_args_1.validateLegacyAuthorizationArgs; } });
function notarize(_a) {

@@ -37,10 +38,12 @@ var { appPath } = _a, otherOptions = __rest(_a, ["appPath"]);

d('notarizing using the new notarytool system');
if (!(yield notarytool_1.isNotaryToolAvailable())) {
if (!(yield (0, notarytool_1.isNotaryToolAvailable)())) {
throw new Error('notarytool is not available, you must be on at least Xcode 13');
}
yield notarytool_1.notarizeAndWaitForNotaryTool(Object.assign({ appPath }, otherOptions));
yield (0, notarytool_1.notarizeAndWaitForNotaryTool)(Object.assign({ appPath }, otherOptions));
}
else {
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.');
console.warn('You can do this by setting "tool: notarytool" in your "@electron/notarize" options. Please note that the credentials options may be slightly different between tools.');
d('notarizing using the legacy notarization system, this will be slow');
const { uuid } = yield legacy_1.startLegacyNotarize(Object.assign({ appPath }, otherOptions));
const { uuid } = yield (0, legacy_1.startLegacyNotarize)(Object.assign({ appPath }, otherOptions));
/**

@@ -55,7 +58,7 @@ * Wait for Apples API to initialize the status UUID

d('notarization started, waiting for 10 seconds before pinging Apple for status');
yield helpers_1.delay(10000);
yield (0, helpers_1.delay)(10000);
d('starting to poll for notarization status');
yield legacy_1.waitForLegacyNotarize(Object.assign({ uuid }, otherOptions));
yield (0, legacy_1.waitForLegacyNotarize)(Object.assign({ uuid }, otherOptions));
}
yield staple_1.stapleApp({ appPath });
yield (0, staple_1.stapleApp)({ appPath });
});

@@ -62,0 +65,0 @@ }

@@ -11,2 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.waitForLegacyNotarize = exports.startLegacyNotarize = void 0;
const debug = require("debug");

@@ -19,5 +20,5 @@ const path = require("path");

function authorizationArgs(rawOpts) {
const opts = validate_args_1.validateLegacyAuthorizationArgs(rawOpts);
if (validate_args_1.isLegacyPasswordCredentials(opts)) {
return ['-u', helpers_1.makeSecret(opts.appleId), '-p', helpers_1.makeSecret(opts.appleIdPassword)];
const opts = (0, validate_args_1.validateLegacyAuthorizationArgs)(rawOpts);
if ((0, validate_args_1.isLegacyPasswordCredentials)(opts)) {
return ['-u', (0, helpers_1.makeSecret)(opts.appleId), '-p', (0, helpers_1.makeSecret)(opts.appleIdPassword)];
}

@@ -27,5 +28,5 @@ else {

'--apiKey',
helpers_1.makeSecret(opts.appleApiKey),
(0, helpers_1.makeSecret)(opts.appleApiKey),
'--apiIssuer',
helpers_1.makeSecret(opts.appleApiIssuer),
(0, helpers_1.makeSecret)(opts.appleApiIssuer),
];

@@ -37,6 +38,6 @@ }

d('starting notarize process for app:', opts.appPath);
return yield helpers_1.withTempDir((dir) => __awaiter(this, void 0, void 0, function* () {
return yield (0, helpers_1.withTempDir)((dir) => __awaiter(this, void 0, void 0, function* () {
const zipPath = path.resolve(dir, `${path.basename(opts.appPath, '.app')}.zip`);
d('zipping application to:', zipPath);
const zipResult = yield spawn_1.spawn('ditto', ['-c', '-k', '--sequesterRsrc', '--keepParent', path.basename(opts.appPath), zipPath], {
const zipResult = yield (0, spawn_1.spawn)('ditto', ['-c', '-k', '--sequesterRsrc', '--keepParent', path.basename(opts.appPath), zipPath], {
cwd: path.dirname(opts.appPath),

@@ -60,3 +61,3 @@ });

}
const result = yield spawn_1.spawn('xcrun', notarizeArgs);
const result = yield (0, spawn_1.spawn)('xcrun', notarizeArgs);
if (result.code !== 0) {

@@ -81,3 +82,3 @@ throw new Error(`Failed to upload app to Apple's notarization servers\n\n${result.output}`);

d('checking notarization status:', opts.uuid);
const result = yield spawn_1.spawn('xcrun', [
const result = yield (0, spawn_1.spawn)('xcrun', [
'altool',

@@ -95,9 +96,9 @@ '--notarization-info',

d(`Failed to check status of notarization request, retrying in 30 seconds: ${opts.uuid}\n\n${result.output}`);
yield helpers_1.delay(30000);
yield (0, helpers_1.delay)(30000);
return waitForLegacyNotarize(opts);
}
const notarizationInfo = helpers_1.parseNotarizationInfo(result.output);
const notarizationInfo = (0, helpers_1.parseNotarizationInfo)(result.output);
if (notarizationInfo.status === 'in progress') {
d('still in progress, waiting 30 seconds');
yield helpers_1.delay(30000);
yield (0, helpers_1.delay)(30000);
return waitForLegacyNotarize(opts);

@@ -104,0 +105,0 @@ }

@@ -11,2 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.notarizeAndWaitForNotaryTool = exports.isNotaryToolAvailable = void 0;
const debug = require("debug");

@@ -19,21 +20,21 @@ const path = require("path");

function authorizationArgs(rawOpts) {
const opts = validate_args_1.validateNotaryToolAuthorizationArgs(rawOpts);
if (validate_args_1.isNotaryToolPasswordCredentials(opts)) {
const opts = (0, validate_args_1.validateNotaryToolAuthorizationArgs)(rawOpts);
if ((0, validate_args_1.isNotaryToolPasswordCredentials)(opts)) {
return [
'--apple-id',
helpers_1.makeSecret(opts.appleId),
(0, helpers_1.makeSecret)(opts.appleId),
'--password',
helpers_1.makeSecret(opts.appleIdPassword),
(0, helpers_1.makeSecret)(opts.appleIdPassword),
'--team-id',
helpers_1.makeSecret(opts.teamId),
(0, helpers_1.makeSecret)(opts.teamId),
];
}
else if (validate_args_1.isNotaryToolApiKeyCredentials(opts)) {
else if ((0, validate_args_1.isNotaryToolApiKeyCredentials)(opts)) {
return [
'--key',
helpers_1.makeSecret(opts.appleApiKey),
(0, helpers_1.makeSecret)(opts.appleApiKey),
'--key-id',
helpers_1.makeSecret(opts.appleApiKeyId),
(0, helpers_1.makeSecret)(opts.appleApiKeyId),
'--issuer',
helpers_1.makeSecret(opts.appleApiIssuer),
(0, helpers_1.makeSecret)(opts.appleApiIssuer),
];

@@ -51,3 +52,3 @@ }

return __awaiter(this, void 0, void 0, function* () {
const result = yield spawn_1.spawn('xcrun', ['--find', 'notarytool']);
const result = yield (0, spawn_1.spawn)('xcrun', ['--find', 'notarytool']);
return result.code === 0;

@@ -60,6 +61,6 @@ });

d('starting notarize process for app:', opts.appPath);
return yield helpers_1.withTempDir((dir) => __awaiter(this, void 0, void 0, function* () {
return yield (0, helpers_1.withTempDir)((dir) => __awaiter(this, void 0, void 0, function* () {
const zipPath = path.resolve(dir, `${path.parse(opts.appPath).name}.zip`);
d('zipping application to:', zipPath);
const zipResult = yield spawn_1.spawn('ditto', ['-c', '-k', '--sequesterRsrc', '--keepParent', path.basename(opts.appPath), zipPath], {
const zipResult = yield (0, spawn_1.spawn)('ditto', ['-c', '-k', '--sequesterRsrc', '--keepParent', path.basename(opts.appPath), zipPath], {
cwd: path.dirname(opts.appPath),

@@ -80,3 +81,3 @@ });

];
const result = yield spawn_1.spawn('xcrun', notarizeArgs);
const result = yield (0, spawn_1.spawn)('xcrun', notarizeArgs);
if (result.code !== 0) {

@@ -86,3 +87,3 @@ try {

if (parsed && parsed.id) {
const logResult = yield spawn_1.spawn('xcrun', [
const logResult = yield (0, spawn_1.spawn)('xcrun', [
'notarytool',

@@ -89,0 +90,0 @@ 'log',

@@ -1,2 +0,1 @@

/// <reference types="node" />
import { SpawnOptions } from 'child_process';

@@ -3,0 +2,0 @@ export interface SpawnResult {

Object.defineProperty(exports, "__esModule", { value: true });
exports.spawn = void 0;
const child_process_1 = require("child_process");

@@ -6,5 +7,5 @@ const debug = require("debug");

const d = debug('electron-notarize:spawn');
exports.spawn = (cmd, args = [], opts = {}) => {
d('spawning cmd:', cmd, 'args:', args.map(arg => (helpers_1.isSecret(arg) ? '*********' : arg)), 'opts:', opts);
const child = child_process_1.spawn(cmd, args, opts);
const spawn = (cmd, args = [], opts = {}) => {
d('spawning cmd:', cmd, 'args:', args.map(arg => ((0, helpers_1.isSecret)(arg) ? '*********' : arg)), 'opts:', opts);
const child = (0, child_process_1.spawn)(cmd, args, opts);
const out = [];

@@ -27,2 +28,3 @@ const dataHandler = (data) => out.push(data.toString());

};
exports.spawn = spawn;
//# sourceMappingURL=spawn.js.map

@@ -11,2 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.stapleApp = void 0;
const debug = require("debug");

@@ -19,3 +20,3 @@ const path = require("path");

d('attempting to staple app:', opts.appPath);
const result = yield spawn_1.spawn('xcrun', ['stapler', 'staple', '-v', path.basename(opts.appPath)], {
const result = yield (0, spawn_1.spawn)('xcrun', ['stapler', 'staple', '-v', path.basename(opts.appPath)], {
cwd: path.dirname(opts.appPath),

@@ -22,0 +23,0 @@ });

@@ -23,5 +23,5 @@ export interface LegacyNotarizePasswordCredentials {

}
export declare type LegacyNotarizeCredentials = LegacyNotarizePasswordCredentials | LegacyNotarizeApiKeyCredentials;
export declare type NotaryToolCredentials = NotaryToolPasswordCredentials | NotaryToolApiKeyCredentials | NotaryToolKeychainCredentials;
export declare type NotarizeCredentials = LegacyNotarizeCredentials | NotaryToolCredentials;
export type LegacyNotarizeCredentials = LegacyNotarizePasswordCredentials | LegacyNotarizeApiKeyCredentials;
export type NotaryToolCredentials = NotaryToolPasswordCredentials | NotaryToolApiKeyCredentials | NotaryToolKeychainCredentials;
export type NotarizeCredentials = LegacyNotarizeCredentials | NotaryToolCredentials;
export interface LegacyNotarizeAppOptions {

@@ -40,7 +40,7 @@ appPath: string;

}
export declare type LegacyNotarizeStartOptions = LegacyNotarizeAppOptions & LegacyNotarizeCredentials & TransporterOptions;
export declare type NotaryToolStartOptions = NotaryToolNotarizeAppOptions & NotaryToolCredentials;
export declare type LegacyNotarizeWaitOptions = NotarizeResult & LegacyNotarizeCredentials;
export declare type NotarizeStapleOptions = Pick<LegacyNotarizeAppOptions, 'appPath'>;
export declare type NotarizeOptions = ({
export type LegacyNotarizeStartOptions = LegacyNotarizeAppOptions & LegacyNotarizeCredentials & TransporterOptions;
export type NotaryToolStartOptions = NotaryToolNotarizeAppOptions & NotaryToolCredentials;
export type LegacyNotarizeWaitOptions = NotarizeResult & LegacyNotarizeCredentials;
export type NotarizeStapleOptions = Pick<LegacyNotarizeAppOptions, 'appPath'>;
export type NotarizeOptions = ({
tool?: 'legacy';

@@ -47,0 +47,0 @@ } & LegacyNotarizeStartOptions) | ({

Object.defineProperty(exports, "__esModule", { value: true });
exports.validateNotaryToolAuthorizationArgs = exports.isNotaryToolKeychainCredentials = exports.isNotaryToolApiKeyCredentials = exports.isNotaryToolPasswordCredentials = exports.validateLegacyAuthorizationArgs = exports.isLegacyApiKeyCredentials = exports.isLegacyPasswordCredentials = void 0;
function isLegacyPasswordCredentials(opts) {

@@ -3,0 +4,0 @@ const creds = opts;

{
"name": "@electron/notarize",
"version": "1.2.3",
"version": "1.2.4",
"description": "Notarize your Electron app",

@@ -30,11 +30,11 @@ "main": "lib/index.js",

"devDependencies": {
"@continuous-auth/semantic-release-npm": "^2.0.0",
"@continuous-auth/semantic-release-npm": "^3.0.0",
"@types/debug": "^4.1.5",
"@types/fs-extra": "^9.0.1",
"@types/jest": "^25.1.4",
"@types/jest": "^29.0.0",
"@types/node": "^13.7.7",
"jest": "^25.1.0",
"jest": "^29.0.0",
"prettier": "^1.18.2",
"ts-jest": "^25.2.1",
"typescript": "^3.6.4"
"ts-jest": "^29.0.0",
"typescript": "^4.8.4"
},

@@ -41,0 +41,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc