Upload via GUI (7543 Dateien)
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
import { FlatOptions } from './types';
|
||||
/**
|
||||
* Generates a flat `.pkg` installer for a packaged Electron `.app` bundle.
|
||||
* @returns A void Promise once the flattening operation is complete.
|
||||
*
|
||||
* @category Flat
|
||||
*/
|
||||
export declare function buildPkg(_opts: FlatOptions): Promise<void>;
|
||||
/**
|
||||
* This function is exported with normal callback implementation.
|
||||
*
|
||||
* @deprecated Please use the Promise-based {@link flatAsync} method instead.
|
||||
* @category Flat
|
||||
*/
|
||||
export declare const flat: (opts: FlatOptions, cb?: ((error?: Error) => void) | undefined) => void;
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.flat = exports.buildPkg = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const util_1 = require("./util");
|
||||
const util_identities_1 = require("./util-identities");
|
||||
const pkgVersion = require('../../package.json').version;
|
||||
/**
|
||||
* This function returns a promise validating all options passed in opts.
|
||||
* @function
|
||||
* @param {Object} opts - Options.
|
||||
* @returns {Promise} Promise.
|
||||
*/
|
||||
async function validateFlatOpts(opts) {
|
||||
await (0, util_1.validateOptsApp)(opts);
|
||||
let pkg = opts.pkg;
|
||||
if (pkg) {
|
||||
if (typeof pkg !== 'string')
|
||||
throw new Error('`pkg` must be a string.');
|
||||
if (path.extname(pkg) !== '.pkg') {
|
||||
throw new Error('Extension of output package must be `.pkg`.');
|
||||
}
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugWarn)('No `pkg` passed in arguments, will fallback to default inferred from the given application.');
|
||||
pkg = path.join(path.dirname(opts.app), path.basename(opts.app, '.app') + '.pkg');
|
||||
}
|
||||
let install = opts.install;
|
||||
if (install) {
|
||||
if (typeof install !== 'string') {
|
||||
return Promise.reject(new Error('`install` must be a string.'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugWarn)('No `install` passed in arguments, will fallback to default `/Applications`.');
|
||||
install = '/Applications';
|
||||
}
|
||||
if (typeof opts.scripts === 'string' && opts.platform === 'mas') {
|
||||
(0, util_1.debugWarn)('Mac App Store packages cannot have `scripts`, ignoring option.');
|
||||
}
|
||||
return Object.assign(Object.assign({}, opts), { pkg,
|
||||
install, platform: await (0, util_1.validateOptsPlatform)(opts) });
|
||||
}
|
||||
/**
|
||||
* This function returns a promise flattening the application.
|
||||
* @param opts - Options for building the .pkg archive
|
||||
*/
|
||||
async function buildApplicationPkg(opts, identity) {
|
||||
if (opts.platform === 'mas') {
|
||||
const args = ['--component', opts.app, opts.install, '--sign', identity.name, opts.pkg];
|
||||
if (opts.keychain) {
|
||||
args.unshift('--keychain', opts.keychain);
|
||||
}
|
||||
(0, util_1.debugLog)('Flattening Mac App Store package... ' + opts.app);
|
||||
await (0, util_1.execFileAsync)('productbuild', args);
|
||||
}
|
||||
else {
|
||||
const componentPkgPath = path.join(path.dirname(opts.app), path.basename(opts.app, '.app') + '-component.pkg');
|
||||
const pkgbuildArgs = [
|
||||
'--install-location',
|
||||
opts.install,
|
||||
'--component',
|
||||
opts.app,
|
||||
componentPkgPath
|
||||
];
|
||||
if (opts.scripts) {
|
||||
pkgbuildArgs.unshift('--scripts', opts.scripts);
|
||||
}
|
||||
(0, util_1.debugLog)('Building component package... ' + opts.app);
|
||||
await (0, util_1.execFileAsync)('pkgbuild', pkgbuildArgs);
|
||||
const args = ['--package', componentPkgPath, opts.install, '--sign', identity.name, opts.pkg];
|
||||
if (opts.keychain) {
|
||||
args.unshift('--keychain', opts.keychain);
|
||||
}
|
||||
(0, util_1.debugLog)('Flattening OS X Installer package... ' + opts.app);
|
||||
await (0, util_1.execFileAsync)('productbuild', args);
|
||||
await (0, util_1.execFileAsync)('rm', [componentPkgPath]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Generates a flat `.pkg` installer for a packaged Electron `.app` bundle.
|
||||
* @returns A void Promise once the flattening operation is complete.
|
||||
*
|
||||
* @category Flat
|
||||
*/
|
||||
async function buildPkg(_opts) {
|
||||
(0, util_1.debugLog)('@electron/osx-sign@%s', pkgVersion);
|
||||
const validatedOptions = await validateFlatOpts(_opts);
|
||||
let identities = [];
|
||||
let identityInUse = null;
|
||||
if (validatedOptions.identity) {
|
||||
(0, util_1.debugLog)('`identity` passed in arguments.');
|
||||
if (validatedOptions.identityValidation === false) {
|
||||
// Do nothing
|
||||
}
|
||||
else {
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOptions.keychain || null, validatedOptions.identity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugWarn)('No `identity` passed in arguments...');
|
||||
if (validatedOptions.platform === 'mas') {
|
||||
(0, util_1.debugLog)('Finding `3rd Party Mac Developer Installer` certificate for flattening app distribution in the Mac App Store...');
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOptions.keychain || null, '3rd Party Mac Developer Installer:');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Finding `Developer ID Application` certificate for distribution outside the Mac App Store...');
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOptions.keychain || null, 'Developer ID Installer:');
|
||||
}
|
||||
}
|
||||
if (identities.length > 0) {
|
||||
// Provisioning profile(s) found
|
||||
if (identities.length > 1) {
|
||||
(0, util_1.debugWarn)('Multiple identities found, will use the first discovered.');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Found 1 identity.');
|
||||
}
|
||||
identityInUse = identities[0];
|
||||
}
|
||||
else {
|
||||
// No identity found
|
||||
throw new Error('No identity found for signing.');
|
||||
}
|
||||
(0, util_1.debugLog)('Flattening application...', '\n', '> Application:', validatedOptions.app, '\n', '> Package output:', validatedOptions.pkg, '\n', '> Install path:', validatedOptions.install, '\n', '> Identity:', validatedOptions.identity, '\n', '> Scripts:', validatedOptions.scripts);
|
||||
await buildApplicationPkg(validatedOptions, identityInUse);
|
||||
(0, util_1.debugLog)('Application flattened.');
|
||||
}
|
||||
exports.buildPkg = buildPkg;
|
||||
/**
|
||||
* This function is exported with normal callback implementation.
|
||||
*
|
||||
* @deprecated Please use the Promise-based {@link flatAsync} method instead.
|
||||
* @category Flat
|
||||
*/
|
||||
const flat = (opts, cb) => {
|
||||
buildPkg(opts)
|
||||
.then(() => {
|
||||
(0, util_1.debugLog)('Application flattened, saved to: ' + opts.app);
|
||||
if (cb)
|
||||
cb();
|
||||
})
|
||||
.catch((err) => {
|
||||
(0, util_1.debugLog)('Flat failed:');
|
||||
if (err.message)
|
||||
(0, util_1.debugLog)(err.message);
|
||||
else if (err.stack)
|
||||
(0, util_1.debugLog)(err.stack);
|
||||
else
|
||||
(0, util_1.debugLog)(err);
|
||||
if (cb)
|
||||
cb(err);
|
||||
});
|
||||
};
|
||||
exports.flat = flat;
|
||||
//# sourceMappingURL=flat.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"flat.js","sourceRoot":"","sources":["../../src/flat.ts"],"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,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,IAAA,eAAQ,EAAC,cAAc,CAAC,CAAC;QACzB,IAAI,GAAG,CAAC,OAAO;YAAE,IAAA,eAAQ,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC;aAClC,IAAI,GAAG,CAAC,KAAK;YAAE,IAAA,eAAQ,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC;;YACnC,IAAA,eAAQ,EAAC,GAAG,CAAC,CAAC;QACnB,IAAI,EAAE;YAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAbW,QAAA,IAAI,QAaf"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { sign, signApp } from './sign';
|
||||
import { flat, buildPkg } from './flat';
|
||||
import { walkAsync } from './util';
|
||||
export { sign, flat, signApp as signAsync, signApp, buildPkg as flatAsync, buildPkg, walkAsync };
|
||||
export * from './types';
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.walkAsync = exports.buildPkg = exports.flatAsync = exports.signApp = exports.signAsync = exports.flat = exports.sign = void 0;
|
||||
const sign_1 = require("./sign");
|
||||
Object.defineProperty(exports, "sign", { enumerable: true, get: function () { return sign_1.sign; } });
|
||||
Object.defineProperty(exports, "signAsync", { enumerable: true, get: function () { return sign_1.signApp; } });
|
||||
Object.defineProperty(exports, "signApp", { enumerable: true, get: function () { return sign_1.signApp; } });
|
||||
const flat_1 = require("./flat");
|
||||
Object.defineProperty(exports, "flat", { enumerable: true, get: function () { return flat_1.flat; } });
|
||||
Object.defineProperty(exports, "flatAsync", { enumerable: true, get: function () { return flat_1.buildPkg; } });
|
||||
Object.defineProperty(exports, "buildPkg", { enumerable: true, get: function () { return flat_1.buildPkg; } });
|
||||
const util_1 = require("./util");
|
||||
Object.defineProperty(exports, "walkAsync", { enumerable: true, get: function () { return util_1.walkAsync; } });
|
||||
// TODO: Remove and leave only proper named exports, but for non-breaking change reasons
|
||||
// we need to keep this weirdness for now
|
||||
module.exports = sign_1.sign;
|
||||
module.exports.sign = sign_1.sign;
|
||||
module.exports.signAsync = sign_1.signApp;
|
||||
module.exports.signApp = sign_1.signApp;
|
||||
module.exports.flat = flat_1.flat;
|
||||
module.exports.flatAsync = flat_1.buildPkg;
|
||||
module.exports.buildPkg = flat_1.buildPkg;
|
||||
module.exports.walkAsync = util_1.walkAsync;
|
||||
__exportStar(require("./types"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iCAAuC;AAe9B,qFAfA,WAAI,OAeA;AAAmB,0FAfjB,cAAO,OAemB;AAAE,wFAf5B,cAAO,OAe4B;AAdlD,iCAAwC;AAczB,qFAdN,WAAI,OAcM;AAA6C,0FAdjD,eAAQ,OAckD;AAAE,yFAd5D,eAAQ,OAc4D;AAbnF,iCAAmC;AAakD,0FAb5E,gBAAS,OAa4E;AAX9F,wFAAwF;AACxF,yCAAyC;AACzC,MAAM,CAAC,OAAO,GAAG,WAAI,CAAC;AACtB,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC;AAC3B,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,cAAO,CAAC;AACnC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,cAAO,CAAC;AACjC,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC;AAC3B,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,eAAQ,CAAC;AACpC,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,eAAQ,CAAC;AACnC,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,gBAAS,CAAC;AAGrC,0CAAwB"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import { SignOptions } from './types';
|
||||
/**
|
||||
* Signs a macOS application.
|
||||
* @returns A void Promise once the signing operation is complete.
|
||||
*
|
||||
* @category Codesign
|
||||
*/
|
||||
export declare function signApp(_opts: SignOptions): Promise<void>;
|
||||
/**
|
||||
* This function is a legacy callback implementation.
|
||||
*
|
||||
* @deprecated Please use the Promise-based {@link signAsync} method instead.
|
||||
* @category Codesign
|
||||
*/
|
||||
export declare const sign: (opts: SignOptions, cb?: ((error?: Error) => void) | undefined) => void;
|
||||
+377
@@ -0,0 +1,377 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sign = exports.signApp = void 0;
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const plist = __importStar(require("plist"));
|
||||
const compare_version_1 = __importDefault(require("compare-version"));
|
||||
const util_1 = require("./util");
|
||||
const util_identities_1 = require("./util-identities");
|
||||
const util_provisioning_profiles_1 = require("./util-provisioning-profiles");
|
||||
const util_entitlements_1 = require("./util-entitlements");
|
||||
const pkgVersion = require('../../package.json').version;
|
||||
const osRelease = os.release();
|
||||
/**
|
||||
* This function returns a promise validating opts.binaries, the additional binaries to be signed along with the discovered enclosed components.
|
||||
*/
|
||||
async function validateOptsBinaries(opts) {
|
||||
if (opts.binaries) {
|
||||
if (!Array.isArray(opts.binaries)) {
|
||||
throw new Error('Additional binaries should be an Array.');
|
||||
}
|
||||
// TODO: Presence check for binary files, reject if any does not exist
|
||||
}
|
||||
}
|
||||
function validateOptsIgnore(ignore) {
|
||||
if (ignore && !(ignore instanceof Array)) {
|
||||
return [ignore];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This function returns a promise validating all options passed in opts.
|
||||
*/
|
||||
async function validateSignOpts(opts) {
|
||||
await validateOptsBinaries(opts);
|
||||
await (0, util_1.validateOptsApp)(opts);
|
||||
if (opts.provisioningProfile && typeof opts.provisioningProfile !== 'string') {
|
||||
throw new Error('Path to provisioning profile should be a string.');
|
||||
}
|
||||
if (opts.type && opts.type !== 'development' && opts.type !== 'distribution') {
|
||||
throw new Error('Type must be either `development` or `distribution`.');
|
||||
}
|
||||
const platform = await (0, util_1.validateOptsPlatform)(opts);
|
||||
const cloned = Object.assign(Object.assign({}, opts), { ignore: validateOptsIgnore(opts.ignore), type: opts.type || 'distribution', platform });
|
||||
return cloned;
|
||||
}
|
||||
/**
|
||||
* This function returns a promise verifying the code sign of application bundle.
|
||||
*/
|
||||
async function verifySignApplication(opts) {
|
||||
// Verify with codesign
|
||||
(0, util_1.debugLog)('Verifying application bundle with codesign...');
|
||||
const strictVerify = opts.strictVerify !== undefined ? opts.strictVerify : true;
|
||||
await (0, util_1.execFileAsync)('codesign', ['--verify', '--deep'].concat(strictVerify !== false && (0, compare_version_1.default)(osRelease, '15.0.0') >= 0 // Strict flag since darwin 15.0.0 --> OS X 10.11.0 El Capitan
|
||||
? [
|
||||
'--strict' +
|
||||
(strictVerify !== true ? '=' + strictVerify : '')
|
||||
]
|
||||
: [], ['--verbose=2', opts.app]));
|
||||
}
|
||||
function defaultOptionsForFile(filePath, platform) {
|
||||
const entitlementsFolder = path.resolve(__dirname, '..', '..', 'entitlements');
|
||||
let entitlementsFile;
|
||||
if (platform === 'darwin') {
|
||||
// Default Entitlements
|
||||
// c.f. https://source.chromium.org/chromium/chromium/src/+/main:chrome/app/app-entitlements.plist
|
||||
// Also include JIT for main process V8
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.darwin.plist');
|
||||
// Plugin helper
|
||||
// c.f. https://source.chromium.org/chromium/chromium/src/+/main:chrome/app/helper-plugin-entitlements.plist
|
||||
if (filePath.includes('(Plugin).app')) {
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.darwin.plugin.plist');
|
||||
// GPU Helper
|
||||
// c.f. https://source.chromium.org/chromium/chromium/src/+/main:chrome/app/helper-gpu-entitlements.plist
|
||||
}
|
||||
else if (filePath.includes('(GPU).app')) {
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.darwin.gpu.plist');
|
||||
// Renderer Helper
|
||||
// c.f. https://source.chromium.org/chromium/chromium/src/+/main:chrome/app/helper-renderer-entitlements.plist
|
||||
}
|
||||
else if (filePath.includes('(Renderer).app')) {
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.darwin.renderer.plist');
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Default entitlements
|
||||
// TODO: Can these be more scoped like the non-mas variant?
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.mas.plist');
|
||||
// If it is not the top level app bundle, we sign with inherit
|
||||
if (filePath.includes('.app/')) {
|
||||
entitlementsFile = path.resolve(entitlementsFolder, 'default.mas.child.plist');
|
||||
}
|
||||
}
|
||||
return {
|
||||
entitlements: entitlementsFile,
|
||||
hardenedRuntime: true,
|
||||
requirements: undefined,
|
||||
signatureFlags: undefined,
|
||||
timestamp: undefined,
|
||||
additionalArguments: []
|
||||
};
|
||||
}
|
||||
async function mergeOptionsForFile(opts, defaults) {
|
||||
const mergedPerFileOptions = Object.assign({}, defaults);
|
||||
if (opts) {
|
||||
if (opts.entitlements !== undefined) {
|
||||
if (Array.isArray(opts.entitlements)) {
|
||||
const entitlements = opts.entitlements.reduce((dict, entitlementKey) => (Object.assign(Object.assign({}, dict), { [entitlementKey]: true })), {});
|
||||
const dir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'tmp-entitlements-'));
|
||||
const entitlementsPath = path.join(dir, 'entitlements.plist');
|
||||
await fs.writeFile(entitlementsPath, plist.build(entitlements), 'utf8');
|
||||
opts.entitlements = entitlementsPath;
|
||||
}
|
||||
mergedPerFileOptions.entitlements = opts.entitlements;
|
||||
}
|
||||
if (opts.hardenedRuntime !== undefined) {
|
||||
mergedPerFileOptions.hardenedRuntime = opts.hardenedRuntime;
|
||||
}
|
||||
if (opts.requirements !== undefined)
|
||||
mergedPerFileOptions.requirements = opts.requirements;
|
||||
if (opts.signatureFlags !== undefined) {
|
||||
mergedPerFileOptions.signatureFlags = opts.signatureFlags;
|
||||
}
|
||||
if (opts.timestamp !== undefined)
|
||||
mergedPerFileOptions.timestamp = opts.timestamp;
|
||||
if (opts.additionalArguments !== undefined)
|
||||
mergedPerFileOptions.additionalArguments = opts.additionalArguments;
|
||||
}
|
||||
return mergedPerFileOptions;
|
||||
}
|
||||
/**
|
||||
* This function returns a promise codesigning only.
|
||||
*/
|
||||
async function signApplication(opts, identity) {
|
||||
function shouldIgnoreFilePath(filePath) {
|
||||
if (opts.ignore) {
|
||||
return opts.ignore.some(function (ignore) {
|
||||
if (typeof ignore === 'function') {
|
||||
return ignore(filePath);
|
||||
}
|
||||
return filePath.match(ignore);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const children = await (0, util_1.walkAsync)((0, util_1.getAppContentsPath)(opts));
|
||||
if (opts.binaries)
|
||||
children.push(...opts.binaries);
|
||||
const args = ['--sign', identity.hash || identity.name, '--force'];
|
||||
if (opts.keychain) {
|
||||
args.push('--keychain', opts.keychain);
|
||||
}
|
||||
/**
|
||||
* Sort the child paths by how deep they are in the file tree. Some arcane apple
|
||||
* logic expects the deeper files to be signed first otherwise strange errors get
|
||||
* thrown our way
|
||||
*/
|
||||
children.sort((a, b) => {
|
||||
const aDepth = a.split(path.sep).length;
|
||||
const bDepth = b.split(path.sep).length;
|
||||
return bDepth - aDepth;
|
||||
});
|
||||
for (const filePath of [...children, opts.app]) {
|
||||
if (shouldIgnoreFilePath(filePath)) {
|
||||
(0, util_1.debugLog)('Skipped... ' + filePath);
|
||||
continue;
|
||||
}
|
||||
const perFileOptions = await mergeOptionsForFile(opts.optionsForFile ? opts.optionsForFile(filePath) : null, defaultOptionsForFile(filePath, opts.platform));
|
||||
// preAutoEntitlements should only be applied to the top level app bundle.
|
||||
// Applying it other files will cause the app to crash and be rejected by Apple.
|
||||
if (!filePath.includes('.app/')) {
|
||||
if (opts.preAutoEntitlements === false) {
|
||||
(0, util_1.debugWarn)('Pre-sign operation disabled for entitlements automation.');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Pre-sign operation enabled for entitlements automation with versions >= `1.1.1`:', '\n', '* Disable by setting `pre-auto-entitlements` to `false`.');
|
||||
if (!opts.version || (0, compare_version_1.default)(opts.version, '1.1.1') >= 0) {
|
||||
// Enable Mac App Store sandboxing without using temporary-exception, introduced in Electron v1.1.1. Relates to electron#5601
|
||||
const newEntitlements = await (0, util_entitlements_1.preAutoEntitlements)(opts, perFileOptions, {
|
||||
identity,
|
||||
provisioningProfile: opts.provisioningProfile
|
||||
? await (0, util_provisioning_profiles_1.getProvisioningProfile)(opts.provisioningProfile, opts.keychain)
|
||||
: undefined
|
||||
});
|
||||
// preAutoEntitlements may provide us new entitlements, if so we update our options
|
||||
// and ensure that entitlements-loginhelper has a correct default value
|
||||
if (newEntitlements) {
|
||||
perFileOptions.entitlements = newEntitlements;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(0, util_1.debugLog)('Signing... ' + filePath);
|
||||
const perFileArgs = [...args];
|
||||
if (perFileOptions.requirements) {
|
||||
if (perFileOptions.requirements.charAt(0) === '=') {
|
||||
perFileArgs.push(`-r${perFileOptions.requirements}`);
|
||||
}
|
||||
else {
|
||||
perFileArgs.push('--requirements', perFileOptions.requirements);
|
||||
}
|
||||
}
|
||||
if (perFileOptions.timestamp) {
|
||||
perFileArgs.push('--timestamp=' + perFileOptions.timestamp);
|
||||
}
|
||||
else {
|
||||
perFileArgs.push('--timestamp');
|
||||
}
|
||||
let optionsArguments = [];
|
||||
if (perFileOptions.signatureFlags) {
|
||||
if (Array.isArray(perFileOptions.signatureFlags)) {
|
||||
optionsArguments.push(...perFileOptions.signatureFlags);
|
||||
}
|
||||
else {
|
||||
const flags = perFileOptions.signatureFlags.split(',').map(function (flag) {
|
||||
return flag.trim();
|
||||
});
|
||||
optionsArguments.push(...flags);
|
||||
}
|
||||
}
|
||||
if (perFileOptions.hardenedRuntime || optionsArguments.includes('runtime')) {
|
||||
// Hardened runtime since darwin 17.7.0 --> macOS 10.13.6
|
||||
if ((0, compare_version_1.default)(osRelease, '17.7.0') >= 0) {
|
||||
optionsArguments.push('runtime');
|
||||
}
|
||||
else {
|
||||
// Remove runtime if passed in with --signature-flags
|
||||
(0, util_1.debugLog)('Not enabling hardened runtime, current macOS version too low, requires 10.13.6 and higher');
|
||||
optionsArguments = optionsArguments.filter((arg) => {
|
||||
return arg !== 'runtime';
|
||||
});
|
||||
}
|
||||
}
|
||||
if (optionsArguments.length) {
|
||||
perFileArgs.push('--options', [...new Set(optionsArguments)].join(','));
|
||||
}
|
||||
if (perFileOptions.additionalArguments) {
|
||||
perFileArgs.push(...perFileOptions.additionalArguments);
|
||||
}
|
||||
await (0, util_1.execFileAsync)('codesign', perFileArgs.concat('--entitlements', perFileOptions.entitlements, filePath));
|
||||
}
|
||||
// Verify code sign
|
||||
(0, util_1.debugLog)('Verifying...');
|
||||
await verifySignApplication(opts);
|
||||
(0, util_1.debugLog)('Verified.');
|
||||
// Check entitlements if applicable
|
||||
(0, util_1.debugLog)('Displaying entitlements...');
|
||||
const result = await (0, util_1.execFileAsync)('codesign', [
|
||||
'--display',
|
||||
'--entitlements',
|
||||
':-',
|
||||
opts.app
|
||||
]);
|
||||
(0, util_1.debugLog)('Entitlements:', '\n', result);
|
||||
}
|
||||
/**
|
||||
* Signs a macOS application.
|
||||
* @returns A void Promise once the signing operation is complete.
|
||||
*
|
||||
* @category Codesign
|
||||
*/
|
||||
async function signApp(_opts) {
|
||||
(0, util_1.debugLog)('electron-osx-sign@%s', pkgVersion);
|
||||
const validatedOpts = await validateSignOpts(_opts);
|
||||
let identities = [];
|
||||
let identityInUse = null;
|
||||
// Determine identity for signing
|
||||
if (validatedOpts.identity) {
|
||||
(0, util_1.debugLog)('`identity` passed in arguments.');
|
||||
if (validatedOpts.identityValidation === false) {
|
||||
identityInUse = new util_identities_1.Identity(validatedOpts.identity);
|
||||
}
|
||||
else {
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOpts.keychain || null, validatedOpts.identity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugWarn)('No `identity` passed in arguments...');
|
||||
if (validatedOpts.platform === 'mas') {
|
||||
if (validatedOpts.type === 'distribution') {
|
||||
(0, util_1.debugLog)('Finding `3rd Party Mac Developer Application` certificate for signing app distribution in the Mac App Store...');
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOpts.keychain || null, '3rd Party Mac Developer Application:');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Finding `Mac Developer` certificate for signing app in development for the Mac App Store signing...');
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOpts.keychain || null, 'Mac Developer:');
|
||||
}
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Finding `Developer ID Application` certificate for distribution outside the Mac App Store...');
|
||||
identities = await (0, util_identities_1.findIdentities)(validatedOpts.keychain || null, 'Developer ID Application:');
|
||||
}
|
||||
}
|
||||
if (!identityInUse) {
|
||||
if (identities.length > 0) {
|
||||
// Identity(/ies) found
|
||||
if (identities.length > 1) {
|
||||
(0, util_1.debugWarn)('Multiple identities found, will use the first discovered.');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Found 1 identity.');
|
||||
}
|
||||
identityInUse = identities[0];
|
||||
}
|
||||
else {
|
||||
// No identity found
|
||||
throw new Error('No identity found for signing.');
|
||||
}
|
||||
}
|
||||
// Pre-sign operations
|
||||
if (validatedOpts.preEmbedProvisioningProfile === false) {
|
||||
(0, util_1.debugWarn)('Pre-sign operation disabled for provisioning profile embedding:', '\n', '* Enable by setting `pre-embed-provisioning-profile` to `true`.');
|
||||
}
|
||||
else {
|
||||
(0, util_1.debugLog)('Pre-sign operation enabled for provisioning profile:', '\n', '* Disable by setting `pre-embed-provisioning-profile` to `false`.');
|
||||
await (0, util_provisioning_profiles_1.preEmbedProvisioningProfile)(validatedOpts, validatedOpts.provisioningProfile
|
||||
? await (0, util_provisioning_profiles_1.getProvisioningProfile)(validatedOpts.provisioningProfile, validatedOpts.keychain)
|
||||
: null);
|
||||
}
|
||||
(0, util_1.debugLog)('Signing application...', '\n', '> Application:', validatedOpts.app, '\n', '> Platform:', validatedOpts.platform, '\n', '> Additional binaries:', validatedOpts.binaries, '\n', '> Identity:', validatedOpts.identity);
|
||||
await signApplication(validatedOpts, identityInUse);
|
||||
// Post-sign operations
|
||||
(0, util_1.debugLog)('Application signed.');
|
||||
}
|
||||
exports.signApp = signApp;
|
||||
/**
|
||||
* This function is a legacy callback implementation.
|
||||
*
|
||||
* @deprecated Please use the Promise-based {@link signAsync} method instead.
|
||||
* @category Codesign
|
||||
*/
|
||||
const sign = (opts, cb) => {
|
||||
signApp(opts)
|
||||
.then(() => {
|
||||
(0, util_1.debugLog)('Application signed: ' + opts.app);
|
||||
if (cb)
|
||||
cb();
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.message)
|
||||
(0, util_1.debugLog)(err.message);
|
||||
else if (err.stack)
|
||||
(0, util_1.debugLog)(err.stack);
|
||||
else
|
||||
(0, util_1.debugLog)(err);
|
||||
if (cb)
|
||||
cb(err);
|
||||
});
|
||||
};
|
||||
exports.sign = sign;
|
||||
//# sourceMappingURL=sign.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+258
@@ -0,0 +1,258 @@
|
||||
/**
|
||||
* macOS applications can be distributed via the Mac App Store (MAS) or directly
|
||||
* downloaded from the developer's website. @electron/osx-sign distinguishes between
|
||||
* MAS apps (`mas`) or non-MAS apps (`darwin`).
|
||||
* @category Utility
|
||||
*/
|
||||
export type ElectronMacPlatform = 'darwin' | 'mas';
|
||||
/**
|
||||
* MAS apps can be signed using Development or Distribution certificates.
|
||||
|
||||
* See [Apple Documentation](https://developer.apple.com/help/account/create-certificates/certificates-overview/) for more info.
|
||||
* @category Utility
|
||||
*/
|
||||
export type SigningDistributionType = 'development' | 'distribution';
|
||||
/**
|
||||
* @interface
|
||||
* @internal
|
||||
*/
|
||||
export type BaseSignOptions = Readonly<{
|
||||
/**
|
||||
* Path to the application package.
|
||||
* Needs to end with the file extension `.app`.
|
||||
*/
|
||||
app: string;
|
||||
/**
|
||||
* The keychain name.
|
||||
*
|
||||
* @defaultValue `login`
|
||||
*/
|
||||
keychain?: string;
|
||||
/**
|
||||
* Build platform of your Electron app.
|
||||
* Allowed values: `darwin` (Direct Download App), `mas` (Mac App Store).
|
||||
*
|
||||
* @defaultValue Determined by presence of `Squirrel.framework` within the application bundle,
|
||||
* which is used for non-MAS apps.
|
||||
*/
|
||||
platform?: ElectronMacPlatform;
|
||||
/**
|
||||
* Name of the certificate to use when signing.
|
||||
*
|
||||
* @defaultValue Selected with respect to {@link SignOptions.provisioningProfile | provisioningProfile}
|
||||
* and {@link SignOptions.platform | platform} from the selected {@link SignOptions.keychain | keychain}.
|
||||
* * `mas` will look for `3rd Party Mac Developer Application: * (*)`
|
||||
* * `darwin` will look for `Developer ID Application: * (*)` by default.
|
||||
*/
|
||||
identity?: string;
|
||||
}>;
|
||||
type OnlyValidatedBaseSignOptions = {
|
||||
platform: ElectronMacPlatform;
|
||||
};
|
||||
/**
|
||||
* A set of signing options that can be overriden on a per-file basis.
|
||||
* Any missing options will use the default values, and providing a partial structure
|
||||
* will shallow merge with the default values.
|
||||
* @interface
|
||||
* @category Codesign
|
||||
*/
|
||||
export type PerFileSignOptions = {
|
||||
/**
|
||||
* String specifying the path to an `entitlements.plist` file.
|
||||
* Can also be an array of entitlement keys that osx-sign will write to an entitlements file for you.
|
||||
*
|
||||
* @defaultValue `@electron/osx-sign`'s built-in entitlements files.
|
||||
*/
|
||||
entitlements?: string | string[];
|
||||
/**
|
||||
* Whether to enable [Hardened Runtime](https://developer.apple.com/documentation/security/hardened_runtime)
|
||||
* for this file.
|
||||
*
|
||||
* Note: Hardened Runtime is a pre-requisite for notarization, which is mandatory for apps running on macOS 10.15 and above.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
hardenedRuntime?: boolean;
|
||||
/**
|
||||
* Either a string beginning with `=` which specifies in plain text the
|
||||
* [signing requirements](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html)
|
||||
* that you recommend to be used to evaluate the code signature, or a string specifying a path to a text or
|
||||
* properly encoded `.rqset` file which contains those requirements.
|
||||
*/
|
||||
requirements?: string;
|
||||
/**
|
||||
* When signing, a set of option flags can be specified to change the behavior of the system when using the signed code.
|
||||
* Accepts an array of strings or a comma-separated string.
|
||||
*
|
||||
* See --options of the `codesign` command.
|
||||
*
|
||||
* https://keith.github.io/xcode-man-pages/codesign.1.html#OPTION_FLAGS
|
||||
*/
|
||||
signatureFlags?: string | string[];
|
||||
/**
|
||||
* String specifying the URL of the timestamp authority server.
|
||||
* Please note that this default server may not support signatures not furnished by Apple.
|
||||
* Disable the timestamp service with `none`.
|
||||
*
|
||||
* @defaultValue Uses the Apple-provided timestamp server.
|
||||
*/
|
||||
timestamp?: string;
|
||||
/**
|
||||
* Additional raw arguments to pass to the `codesign` command.
|
||||
*
|
||||
* These can be things like `--deep` for instance when code signing specific resources that may
|
||||
* require such arguments.
|
||||
*
|
||||
* https://keith.github.io/xcode-man-pages/codesign.1.html#OPTIONS
|
||||
*/
|
||||
additionalArguments?: string[];
|
||||
};
|
||||
/**
|
||||
* @interface
|
||||
* @internal
|
||||
*/
|
||||
export type OnlySignOptions = {
|
||||
/**
|
||||
* Array of paths to additional binaries that will be signed along with built-ins of Electron.
|
||||
*
|
||||
* @defaultValue `undefined`
|
||||
*/
|
||||
binaries?: string[];
|
||||
/**
|
||||
* Function that receives the path to a file and can return the entitlements to use for that file to override the default behavior. The
|
||||
* object this function returns can include any of the following optional keys. Any properties that are returned **override** the default
|
||||
* values that `@electron/osx-sign` generates. Any properties not returned use the default value.
|
||||
*
|
||||
* @param filePath Path to file
|
||||
* @returns Override signing options
|
||||
*/
|
||||
optionsForFile?: (filePath: string) => PerFileSignOptions;
|
||||
/**
|
||||
* Flag to enable/disable validation for the signing identity.
|
||||
* If enabled, the {@link SignOptions.identity | identity} provided
|
||||
* will be validated in the {@link BaseSignOptions.keychain | keychain} specified.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
identityValidation?: boolean;
|
||||
/**
|
||||
* Defines files that will be skipped during the code signing process.
|
||||
* This property accepts a regex, function or an array of regexes and functions.
|
||||
* Elements of other types are treated as `RegExp`.
|
||||
*
|
||||
* File paths matching a regex or returning a `true` value from a function will be ignored.
|
||||
*
|
||||
* @defaultValue `undefined`
|
||||
*/
|
||||
ignore?: string | string[] | ((file: string) => boolean);
|
||||
/**
|
||||
* Flag to enable/disable entitlements automation tasks necessary for code signing most Electron apps.
|
||||
* * Adds [`com.apple.security.application-groups`](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_application-groups) to the entitlements file
|
||||
* * Fills in the `ElectronTeamID` property in `Info.plist` with the provisioning profile's Team Identifier or by parsing the identity name.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
preAutoEntitlements?: boolean;
|
||||
/**
|
||||
* Flag to enable/disable the embedding of a provisioning profile into the app's `Contents` folder.
|
||||
* Will use the profile from {@link OnlySignOptions.provisioningProfile} if provided. Otherwise, it
|
||||
* searches for a `.provisionprofile` file in the current working directory.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
preEmbedProvisioningProfile?: boolean;
|
||||
/**
|
||||
* Path to a provisioning profile, which can be used to grant restricted entitlements to your app.
|
||||
*
|
||||
* See [Apple Documentation](https://developer.apple.com/documentation/technotes/tn3125-inside-code-signing-provisioning-profiles) for more details.
|
||||
*/
|
||||
provisioningProfile?: string;
|
||||
/**
|
||||
* Flag to enable/disable the `--strict` flag when verifying the signed application bundle.
|
||||
* Also supports string values to specify which strict restrictions to use, see codesign man page for supported values.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
strictVerify?: boolean | string;
|
||||
/**
|
||||
* Type of certificate to use when signing a MAS app.
|
||||
* @defaultValue `"distribution"`
|
||||
*/
|
||||
type?: SigningDistributionType;
|
||||
/**
|
||||
* Build version of Electron. Values may be like: `1.1.1`, `1.2.0`. For use for signing legacy versions
|
||||
* of Electron to ensure backwards compatibility.
|
||||
*/
|
||||
version?: string;
|
||||
};
|
||||
type OnlyValidatedSignOptions = {
|
||||
ignore?: (string | ((file: string) => boolean))[];
|
||||
type: SigningDistributionType;
|
||||
};
|
||||
type OnlyFlatOptions = {
|
||||
/**
|
||||
* Flag to enable/disable validation for the signing identity.
|
||||
* If enabled, the {@link BaseSignOptions.identity | identity} provided
|
||||
* will be validated in the {@link BaseSignOptions.keychain | keychain} specified.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
identityValidation?: boolean;
|
||||
/**
|
||||
* Path to install the bundle.
|
||||
* @defaultValue `"/Applications"`
|
||||
*/
|
||||
install?: string;
|
||||
/**
|
||||
* Output path for the flattened installer package.
|
||||
* Needs file extension `.pkg`.
|
||||
*
|
||||
* @defaultValue Inferred from the app name passed into `opts.app`.
|
||||
*/
|
||||
pkg?: string;
|
||||
/**
|
||||
* Path to a directory containing `preinstall.sh` or `postinstall.sh` scripts.
|
||||
* These must be executable and will run on pre/postinstall depending on the file
|
||||
* name.
|
||||
*
|
||||
* This option is only valid if {@link FlatOptions.platform} is set to `darwin`.
|
||||
*/
|
||||
scripts?: string;
|
||||
};
|
||||
type OnlyValidatedFlatOptions = {
|
||||
install: string;
|
||||
pkg: string;
|
||||
};
|
||||
/**
|
||||
* Utility type that represents an `UnValidated` type after validation,
|
||||
* replacing any properties in the unvalidated type that also exist in the
|
||||
* `Validated` type with the validated versions.
|
||||
*
|
||||
* @template UnValidated - The type representing the unvalidated form.
|
||||
* @template Validated - The type representing the validated form.
|
||||
*/
|
||||
type ValidatedForm<UnValidated, Validated> = Omit<UnValidated, keyof Validated> & Validated;
|
||||
type ValidatedBaseSignOptions = Readonly<ValidatedForm<BaseSignOptions, OnlyValidatedBaseSignOptions>>;
|
||||
type _SignOptions = Readonly<OnlySignOptions & BaseSignOptions>;
|
||||
/**
|
||||
* Options for codesigning a packaged `.app` bundle.
|
||||
* @category Codesign
|
||||
*/
|
||||
export interface SignOptions extends _SignOptions {
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type ValidatedSignOptions = Readonly<ValidatedForm<OnlySignOptions, OnlyValidatedSignOptions> & ValidatedBaseSignOptions>;
|
||||
type _FlatOptions = Readonly<OnlyFlatOptions & BaseSignOptions>;
|
||||
/**
|
||||
* Options for creating a flat `.pkg` installer.
|
||||
* @category Flat
|
||||
*/
|
||||
export interface FlatOptions extends _FlatOptions {
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type ValidatedFlatOptions = Readonly<ValidatedForm<OnlyFlatOptions, OnlyValidatedFlatOptions> & ValidatedBaseSignOptions>;
|
||||
export {};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
||||
Reference in New Issue
Block a user