diff options
Diffstat (limited to 'desktop/node_modules/@electron/osx-sign/dist/esm')
24 files changed, 1059 insertions, 0 deletions
diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/flat.d.ts b/desktop/node_modules/@electron/osx-sign/dist/esm/flat.d.ts new file mode 100644 index 0000000..4d63f07 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/flat.d.ts @@ -0,0 +1,11 @@ +import { FlatOptions } from './types'; +/** + * This function is exported and returns a promise flattening the application. + */ +export declare function buildPkg(_opts: FlatOptions): Promise<void>; +/** + * This function is exported with normal callback implementation. + * + * @deprecated Please use the promise based "buildPkg" method + */ +export declare const flat: (opts: FlatOptions, cb?: ((error?: Error) => void) | undefined) => void; diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/flat.js b/desktop/node_modules/@electron/osx-sign/dist/esm/flat.js new file mode 100644 index 0000000..3b72803 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/flat.js @@ -0,0 +1,125 @@ +import * as path from 'path'; +import { debugLog, debugWarn, execFileAsync, validateOptsApp, validateOptsPlatform } from './util'; +import { findIdentities } from './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 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 { + 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 { + debugWarn('No `install` passed in arguments, will fallback to default `/Applications`.'); + install = '/Applications'; + } + return Object.assign(Object.assign({}, opts), { pkg, + install, platform: await validateOptsPlatform(opts) }); +} +/** + * This function returns a promise flattening the application. + * @function + * @param {Object} opts - Options. + * @returns {Promise} Promise. + */ +async function buildApplicationPkg(opts, identity) { + const args = ['--component', opts.app, opts.install, '--sign', identity.name, opts.pkg]; + if (opts.keychain) { + args.unshift('--keychain', opts.keychain); + } + if (opts.scripts) { + args.unshift('--scripts', opts.scripts); + } + debugLog('Flattening... ' + opts.app); + await execFileAsync('productbuild', args); +} +/** + * This function is exported and returns a promise flattening the application. + */ +export async function buildPkg(_opts) { + debugLog('@electron/osx-sign@%s', pkgVersion); + const validatedOptions = await validateFlatOpts(_opts); + let identities = []; + let identityInUse = null; + if (validatedOptions.identity) { + debugLog('`identity` passed in arguments.'); + if (validatedOptions.identityValidation === false) { + // Do nothing + } + else { + identities = await findIdentities(validatedOptions.keychain || null, validatedOptions.identity); + } + } + else { + debugWarn('No `identity` passed in arguments...'); + if (validatedOptions.platform === 'mas') { + debugLog('Finding `3rd Party Mac Developer Installer` certificate for flattening app distribution in the Mac App Store...'); + identities = await findIdentities(validatedOptions.keychain || null, '3rd Party Mac Developer Installer:'); + } + else { + debugLog('Finding `Developer ID Application` certificate for distribution outside the Mac App Store...'); + identities = await findIdentities(validatedOptions.keychain || null, 'Developer ID Installer:'); + } + } + if (identities.length > 0) { + // Provisioning profile(s) found + if (identities.length > 1) { + debugWarn('Multiple identities found, will use the first discovered.'); + } + else { + debugLog('Found 1 identity.'); + } + identityInUse = identities[0]; + } + else { + // No identity found + throw new Error('No identity found for signing.'); + } + 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); + debugLog('Application flattened.'); +} +/** + * This function is exported with normal callback implementation. + * + * @deprecated Please use the promise based "buildPkg" method + */ +export const flat = (opts, cb) => { + buildPkg(opts) + .then(() => { + debugLog('Application flattened, saved to: ' + opts.app); + if (cb) + cb(); + }) + .catch((err) => { + debugLog('Flat failed:'); + if (err.message) + debugLog(err.message); + else if (err.stack) + debugLog(err.stack); + else + debugLog(err); + if (cb) + cb(err); + }); +}; +//# sourceMappingURL=flat.js.map
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/flat.js.map b/desktop/node_modules/@electron/osx-sign/dist/esm/flat.js.map new file mode 100644 index 0000000..2337fb6 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/flat.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flat.js","sourceRoot":"","sources":["../../src/flat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAEnG,OAAO,EAAY,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAI7D,MAAM,UAAU,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAiB,CAAC;AAEnE;;;;;GAKG;AACH,KAAK,UAAU,gBAAgB,CAAE,IAAiB;IAChD,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACnB,IAAI,GAAG,EAAE;QACP,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACxE,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;SAChE;KACF;SAAM;QACL,SAAS,CACP,6FAA6F,CAC9F,CAAC;QACF,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAA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OAAO,EACxB,IAAI,EACJ,aAAa,EACb,gBAAgB,CAAC,QAAQ,EACzB,IAAI,EACJ,YAAY,EACZ,gBAAgB,CAAC,OAAO,CACzB,CAAC;IACF,MAAM,mBAAmB,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;IAE3D,QAAQ,CAAC,wBAAwB,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAiB,EAAE,EAA4B,EAAE,EAAE;IACtE,QAAQ,CAAC,IAAI,CAAC;SACX,IAAI,CAAC,GAAG,EAAE;QACT,QAAQ,CAAC,mCAAmC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QACzD,IAAI,EAAE;YAAE,EAAE,EAAE,CAAC;IACf,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,QAAQ,CAAC,cAAc,CAAC,CAAC;QACzB,IAAI,GAAG,CAAC,OAAO;YAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;aAClC,IAAI,GAAG,CAAC,KAAK;YAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;;YACnC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACnB,IAAI,EAAE;YAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/index.d.ts b/desktop/node_modules/@electron/osx-sign/dist/esm/index.d.ts new file mode 100644 index 0000000..deb3ca0 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/index.d.ts @@ -0,0 +1,4 @@ +import { sign, signApp } from './sign'; +import { flat, buildPkg } from './flat'; +export { sign, flat, signApp as signAsync, signApp, buildPkg as flatAsync, buildPkg }; +export * from './types'; diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/index.js b/desktop/node_modules/@electron/osx-sign/dist/esm/index.js new file mode 100644 index 0000000..de8bd18 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/index.js @@ -0,0 +1,14 @@ +import { sign, signApp } from './sign'; +import { flat, buildPkg } from './flat'; +// 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; +module.exports.sign = sign; +module.exports.signAsync = signApp; +module.exports.signApp = signApp; +module.exports.flat = flat; +module.exports.flatAsync = buildPkg; +module.exports.buildPkg = buildPkg; +export { sign, flat, signApp as signAsync, signApp, buildPkg as flatAsync, buildPkg }; +export * from './types'; +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/index.js.map b/desktop/node_modules/@electron/osx-sign/dist/esm/index.js.map new file mode 100644 index 0000000..616e01e --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAExC,wFAAwF;AACxF,yCAAyC;AACzC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;AACtB,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AAC3B,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC;AACnC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;AACjC,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AAC3B,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,QAAQ,CAAC;AACpC,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,IAAI,SAAS,EAAE,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,QAAQ,EAAE,CAAC;AACtF,cAAc,SAAS,CAAC"}
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/sign.d.ts b/desktop/node_modules/@electron/osx-sign/dist/esm/sign.d.ts new file mode 100644 index 0000000..14eda7e --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/sign.d.ts @@ -0,0 +1,11 @@ +import { SignOptions } from './types'; +/** + * This function returns a promise signing the application. + */ +export declare function signApp(_opts: SignOptions): Promise<void>; +/** + * This function is a legacy callback implementation. + * + * @deprecated Please use the promise based "signApp" method + */ +export declare const sign: (opts: SignOptions, cb?: ((error?: Error) => void) | undefined) => void; diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/sign.js b/desktop/node_modules/@electron/osx-sign/dist/esm/sign.js new file mode 100644 index 0000000..856aab4 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/sign.js @@ -0,0 +1,332 @@ +import * as fs from 'fs-extra'; +import * as os from 'os'; +import * as path from 'path'; +import * as plist from 'plist'; +import compareVersion from 'compare-version'; +import { debugLog, debugWarn, getAppContentsPath, execFileAsync, validateOptsApp, validateOptsPlatform, walkAsync } from './util'; +import { Identity, findIdentities } from './util-identities'; +import { preEmbedProvisioningProfile, getProvisioningProfile } from './util-provisioning-profiles'; +import { preAutoEntitlements } from './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 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 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 + debugLog('Verifying application bundle with codesign...'); + await execFileAsync('codesign', ['--verify', '--deep'].concat(opts.strictVerify !== false && compareVersion(osRelease, '15.0.0') >= 0 // Strict flag since darwin 15.0.0 --> OS X 10.11.0 El Capitan + ? [ + '--strict' + + (opts.strictVerify + ? '=' + opts.strictVerify // Array should be converted to a comma separated string + : '') + ] + : [], ['--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 + }; +} +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; + } + 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 walkAsync(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)) { + 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) { + debugWarn('Pre-sign operation disabled for entitlements automation.'); + } + else { + 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 || compareVersion(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 preAutoEntitlements(opts, perFileOptions, { + identity, + provisioningProfile: opts.provisioningProfile + ? await 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; + } + } + } + } + debugLog('Signing... ' + filePath); + const perFileArgs = [...args]; + if (perFileOptions.requirements) { + 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 (compareVersion(osRelease, '17.7.0') >= 0) { + optionsArguments.push('runtime'); + } + else { + // Remove runtime if passed in with --signature-flags + 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(',')); + } + await execFileAsync('codesign', perFileArgs.concat('--entitlements', perFileOptions.entitlements, filePath)); + } + // Verify code sign + debugLog('Verifying...'); + await verifySignApplication(opts); + debugLog('Verified.'); + // Check entitlements if applicable + debugLog('Displaying entitlements...'); + const result = await execFileAsync('codesign', [ + '--display', + '--entitlements', + ':-', + opts.app + ]); + debugLog('Entitlements:', '\n', result); +} +/** + * This function returns a promise signing the application. + */ +export async function signApp(_opts) { + debugLog('electron-osx-sign@%s', pkgVersion); + const validatedOpts = await validateSignOpts(_opts); + let identities = []; + let identityInUse = null; + // Determine identity for signing + if (validatedOpts.identity) { + debugLog('`identity` passed in arguments.'); + if (validatedOpts.identityValidation === false) { + identityInUse = new Identity(validatedOpts.identity); + } + else { + identities = await findIdentities(validatedOpts.keychain || null, validatedOpts.identity); + } + } + else { + debugWarn('No `identity` passed in arguments...'); + if (validatedOpts.platform === 'mas') { + if (validatedOpts.type === 'distribution') { + debugLog('Finding `3rd Party Mac Developer Application` certificate for signing app distribution in the Mac App Store...'); + identities = await findIdentities(validatedOpts.keychain || null, '3rd Party Mac Developer Application:'); + } + else { + debugLog('Finding `Mac Developer` certificate for signing app in development for the Mac App Store signing...'); + identities = await findIdentities(validatedOpts.keychain || null, 'Mac Developer:'); + } + } + else { + debugLog('Finding `Developer ID Application` certificate for distribution outside the Mac App Store...'); + identities = await findIdentities(validatedOpts.keychain || null, 'Developer ID Application:'); + } + } + if (!identityInUse) { + if (identities.length > 0) { + // Identity(/ies) found + if (identities.length > 1) { + debugWarn('Multiple identities found, will use the first discovered.'); + } + else { + 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) { + debugWarn('Pre-sign operation disabled for provisioning profile embedding:', '\n', '* Enable by setting `pre-embed-provisioning-profile` to `true`.'); + } + else { + debugLog('Pre-sign operation enabled for provisioning profile:', '\n', '* Disable by setting `pre-embed-provisioning-profile` to `false`.'); + await preEmbedProvisioningProfile(validatedOpts, validatedOpts.provisioningProfile + ? await getProvisioningProfile(validatedOpts.provisioningProfile, validatedOpts.keychain) + : null); + } + 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 + debugLog('Application signed.'); +} +/** + * This function is a legacy callback implementation. + * + * @deprecated Please use the promise based "signApp" method + */ +export const sign = (opts, cb) => { + signApp(opts) + .then(() => { + debugLog('Application signed: ' + opts.app); + if (cb) + cb(); + }) + .catch((err) => { + if (err.message) + debugLog(err.message); + else if (err.stack) + debugLog(err.stack); + else + debugLog(err); + if (cb) + cb(err); + }); +}; +//# sourceMappingURL=sign.js.map
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/sign.js.map b/desktop/node_modules/@electron/osx-sign/dist/esm/sign.js.map new file mode 100644 index 0000000..fd6f022 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/sign.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/sign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EACL,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,aAAa,EACb,eAAe,EAC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,EACtB,IAAI,EACJ,aAAa,EACb,aAAa,CAAC,QAAQ,CACvB,CAAC;IACF,MAAM,eAAe,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IAEpD,uBAAuB;IACvB,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAiB,EAAE,EAA4B,EAAE,EAAE;IACtE,OAAO,CAAC,IAAI,CAAC;SACV,IAAI,CAAC,GAAG,EAAE;QACT,QAAQ,CAAC,sBAAsB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,EAAE;YAAE,EAAE,EAAE,CAAC;IACf,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,IAAI,GAAG,CAAC,OAAO;YAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;aAClC,IAAI,GAAG,CAAC,KAAK;YAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;;YACnC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACnB,IAAI,EAAE;YAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/types.d.ts b/desktop/node_modules/@electron/osx-sign/dist/esm/types.d.ts new file mode 100644 index 0000000..c2ba609 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/types.d.ts @@ -0,0 +1,73 @@ +export type ElectronMacPlatform = 'darwin' | 'mas'; +type SigningDistributionType = 'development' | 'distribution'; +export type BaseSignOptions = Readonly<{ + app: string; + identity?: string; + platform?: ElectronMacPlatform; + keychain?: string; +}>; +type OnlyValidatedBaseSignOptions = { + platform: ElectronMacPlatform; +}; +/** + * Any missing options will use the default values, providing a partial + * structure will shallow merge with the default values. + */ +export type PerFileSignOptions = { + /** + * The entitlements file to use when signing this file + */ + entitlements?: string | string[]; + /** + * Whether to enable hardened runtime for this file. Enabled by default. + */ + hardenedRuntime?: boolean; + /** + * The designated requirements to embed when signing this file + */ + requirements?: string; + /** + * See --options of the "codesign" command. + * + * https://www.manpagez.com/man/1/codesign + */ + signatureFlags?: string | string[]; + /** + * The timestamp server to use when signing, by default uses the Apple provided + * timestamp server. + */ + timestamp?: string; +}; +type OnlySignOptions = { + binaries?: string[]; + optionsForFile?: (filePath: string) => PerFileSignOptions; + identityValidation?: boolean; + ignore?: string | string[] | ((file: string) => boolean); + preAutoEntitlements?: boolean; + preEmbedProvisioningProfile?: boolean; + provisioningProfile?: string; + strictVerify?: boolean; + type?: SigningDistributionType; + version?: string; +}; +type OnlyValidatedSignOptions = { + ignore?: (string | ((file: string) => boolean))[]; + type: SigningDistributionType; +}; +type OnlyFlatOptions = { + identityValidation?: boolean; + install?: string; + pkg?: string; + scripts?: string; +}; +type OnlyValidatedFlatOptions = { + install: string; + pkg: string; +}; +type ValidatedForm<UnValidated, Validated> = Omit<UnValidated, keyof Validated> & Validated; +export type ValidatedBaseSignOptions = Readonly<ValidatedForm<BaseSignOptions, OnlyValidatedBaseSignOptions>>; +export type SignOptions = Readonly<OnlySignOptions & BaseSignOptions>; +export type ValidatedSignOptions = Readonly<ValidatedForm<OnlySignOptions, OnlyValidatedSignOptions> & ValidatedBaseSignOptions>; +export type FlatOptions = Readonly<OnlyFlatOptions & BaseSignOptions>; +export type ValidatedFlatOptions = Readonly<ValidatedForm<OnlyFlatOptions, OnlyValidatedFlatOptions> & ValidatedBaseSignOptions>; +export {}; diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/types.js b/desktop/node_modules/@electron/osx-sign/dist/esm/types.js new file mode 100644 index 0000000..718fd38 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/types.js.map b/desktop/node_modules/@electron/osx-sign/dist/esm/types.js.map new file mode 100644 index 0000000..7b5fff8 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util-entitlements.d.ts b/desktop/node_modules/@electron/osx-sign/dist/esm/util-entitlements.d.ts new file mode 100644 index 0000000..0c4ff73 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util-entitlements.d.ts @@ -0,0 +1,17 @@ +import { PerFileSignOptions, ValidatedSignOptions } from './types'; +import { Identity } from './util-identities'; +import { ProvisioningProfile } from './util-provisioning-profiles'; +type ComputedOptions = { + identity: Identity; + provisioningProfile?: ProvisioningProfile; +}; +/** + * This function returns a promise completing the entitlements automation: The + * process includes checking in `Info.plist` for `ElectronTeamID` or setting + * parsed value from identity, and checking in entitlements file for + * `com.apple.security.application-groups` or inserting new into array. A + * temporary entitlements file may be created to replace the input for any + * changes introduced. + */ +export declare function preAutoEntitlements(opts: ValidatedSignOptions, perFileOpts: PerFileSignOptions, computed: ComputedOptions): Promise<void | string>; +export {}; diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util-entitlements.js b/desktop/node_modules/@electron/osx-sign/dist/esm/util-entitlements.js new file mode 100644 index 0000000..8d4455b --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util-entitlements.js @@ -0,0 +1,106 @@ +import * as fs from 'fs-extra'; +import * as os from 'os'; +import * as path from 'path'; +import * as plist from 'plist'; +import { debugLog, getAppContentsPath } from './util'; +const preAuthMemo = new Map(); +/** + * This function returns a promise completing the entitlements automation: The + * process includes checking in `Info.plist` for `ElectronTeamID` or setting + * parsed value from identity, and checking in entitlements file for + * `com.apple.security.application-groups` or inserting new into array. A + * temporary entitlements file may be created to replace the input for any + * changes introduced. + */ +export async function preAutoEntitlements(opts, perFileOpts, computed) { + var _a; + if (!perFileOpts.entitlements) + return; + const memoKey = [opts.app, perFileOpts.entitlements].join('---'); + if (preAuthMemo.has(memoKey)) + return preAuthMemo.get(memoKey); + // If entitlements file not provided, default will be used. Fixes #41 + const appInfoPath = path.join(getAppContentsPath(opts), 'Info.plist'); + debugLog('Automating entitlement app group...', '\n', '> Info.plist:', appInfoPath, '\n'); + let entitlements; + if (typeof perFileOpts.entitlements === 'string') { + const entitlementsContents = await fs.readFile(perFileOpts.entitlements, 'utf8'); + entitlements = plist.parse(entitlementsContents); + } + else { + entitlements = perFileOpts.entitlements.reduce((dict, entitlementKey) => (Object.assign(Object.assign({}, dict), { [entitlementKey]: true })), {}); + } + if (!entitlements['com.apple.security.app-sandbox']) { + // Only automate when app sandbox enabled by user + return; + } + const appInfoContents = await fs.readFile(appInfoPath, 'utf8'); + const appInfo = plist.parse(appInfoContents); + // Use ElectronTeamID in Info.plist if already specified + if (appInfo.ElectronTeamID) { + debugLog('`ElectronTeamID` found in `Info.plist`: ' + appInfo.ElectronTeamID); + } + else { + // The team identifier in signing identity should not be trusted + if (computed.provisioningProfile) { + appInfo.ElectronTeamID = + computed.provisioningProfile.message.Entitlements['com.apple.developer.team-identifier']; + debugLog('`ElectronTeamID` not found in `Info.plist`, use parsed from provisioning profile: ' + + appInfo.ElectronTeamID); + } + else { + const teamID = (_a = /^.+\((.+?)\)$/g.exec(computed.identity.name)) === null || _a === void 0 ? void 0 : _a[1]; + if (!teamID) { + throw new Error(`Could not automatically determine ElectronTeamID from identity: ${computed.identity.name}`); + } + appInfo.ElectronTeamID = teamID; + debugLog('`ElectronTeamID` not found in `Info.plist`, use parsed from signing identity: ' + + appInfo.ElectronTeamID); + } + await fs.writeFile(appInfoPath, plist.build(appInfo), 'utf8'); + debugLog('`Info.plist` updated:', '\n', '> Info.plist:', appInfoPath); + } + const appIdentifier = appInfo.ElectronTeamID + '.' + appInfo.CFBundleIdentifier; + // Insert application identifier if not exists + if (entitlements['com.apple.application-identifier']) { + debugLog('`com.apple.application-identifier` found in entitlements file: ' + + entitlements['com.apple.application-identifier']); + } + else { + debugLog('`com.apple.application-identifier` not found in entitlements file, new inserted: ' + + appIdentifier); + entitlements['com.apple.application-identifier'] = appIdentifier; + } + // Insert developer team identifier if not exists + if (entitlements['com.apple.developer.team-identifier']) { + debugLog('`com.apple.developer.team-identifier` found in entitlements file: ' + + entitlements['com.apple.developer.team-identifier']); + } + else { + debugLog('`com.apple.developer.team-identifier` not found in entitlements file, new inserted: ' + + appInfo.ElectronTeamID); + entitlements['com.apple.developer.team-identifier'] = appInfo.ElectronTeamID; + } + // Init entitlements app group key to array if not exists + if (!entitlements['com.apple.security.application-groups']) { + entitlements['com.apple.security.application-groups'] = []; + } + // Insert app group if not exists + if (Array.isArray(entitlements['com.apple.security.application-groups']) && + entitlements['com.apple.security.application-groups'].indexOf(appIdentifier) === -1) { + debugLog('`com.apple.security.application-groups` not found in entitlements file, new inserted: ' + + appIdentifier); + entitlements['com.apple.security.application-groups'].push(appIdentifier); + } + else { + debugLog('`com.apple.security.application-groups` found in entitlements file: ' + appIdentifier); + } + // Create temporary entitlements file + 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'); + debugLog('Entitlements file updated:', '\n', '> Entitlements:', entitlementsPath); + preAuthMemo.set(memoKey, entitlementsPath); + return entitlementsPath; +} +//# sourceMappingURL=util-entitlements.js.map
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util-entitlements.js.map b/desktop/node_modules/@electron/osx-sign/dist/esm/util-entitlements.js.map new file mode 100644 index 0000000..0b50559 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util-entitlements.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util-entitlements.js","sourceRoot":"","sources":["../../src/util-entitlements.ts"],"names":[],"mappings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AAI,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IAC9D,MAAM,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;IACxE,QAAQ,CAAC,4BAA4B,EAAE,IAAI,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IAElF,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAC3C,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util-identities.d.ts b/desktop/node_modules/@electron/osx-sign/dist/esm/util-identities.d.ts new file mode 100644 index 0000000..fe56cdb --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util-identities.d.ts @@ -0,0 +1,6 @@ +export declare class Identity { + name: string; + hash?: string | undefined; + constructor(name: string, hash?: string | undefined); +} +export declare function findIdentities(keychain: string | null, identity: string): Promise<Identity[]>; diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util-identities.js b/desktop/node_modules/@electron/osx-sign/dist/esm/util-identities.js new file mode 100644 index 0000000..4fb273d --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util-identities.js @@ -0,0 +1,30 @@ +import { debugLog, compactFlattenedList, execFileAsync } from './util'; +export class Identity { + constructor(name, hash) { + this.name = name; + this.hash = hash; + } +} +export async function findIdentities(keychain, identity) { + // Only to look for valid identities, excluding those flagged with + // CSSMERR_TP_CERT_EXPIRED or CSSMERR_TP_NOT_TRUSTED. Fixes #9 + const args = [ + 'find-identity', + '-v' + ]; + if (keychain) { + args.push(keychain); + } + const result = await execFileAsync('security', args); + const identities = result.split('\n').map(function (line) { + if (line.indexOf(identity) >= 0) { + const identityFound = line.substring(line.indexOf('"') + 1, line.lastIndexOf('"')); + const identityHashFound = line.substring(line.indexOf(')') + 2, line.indexOf('"') - 1); + debugLog('Identity:', '\n', '> Name:', identityFound, '\n', '> Hash:', identityHashFound); + return new Identity(identityFound, identityHashFound); + } + return null; + }); + return compactFlattenedList(identities); +} +//# sourceMappingURL=util-identities.js.map
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util-identities.js.map b/desktop/node_modules/@electron/osx-sign/dist/esm/util-identities.js.map new file mode 100644 index 0000000..18e3c43 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util-identities.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util-identities.js","sourceRoot":"","sources":["../../src/util-identities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvE,MAAM,OAAO,QAAQ;IACnB,YAAoB,IAAY,EAAS,IAAa;QAAlC,SAAI,GAAJ,IAAI,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAS;IAAG,CAAC;CAC3D;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAE,QAAuB,EAAE,QAAgB;IAC7E,kEAAkE;IAClE,8DAA8D;IAE9D,MAAM,IAAI,GAAG;QACX,eAAe;QACf,IAAI;KACL,CAAC;IACF,IAAI,QAAQ,EAAE;QACZ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACrB;IAED,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,IAAI;QACtD,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAC/B,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;YACnF,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACvF,QAAQ,CAAC,WAAW,EAAE,IAAI,EACxB,SAAS,EAAE,aAAa,EAAE,IAAI,EAC9B,SAAS,EAAE,iBAAiB,CAAC,CAAC;YAChC,OAAO,IAAI,QAAQ,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;SACvD;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,OAAO,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAC1C,CAAC"}
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util-provisioning-profiles.d.ts b/desktop/node_modules/@electron/osx-sign/dist/esm/util-provisioning-profiles.d.ts new file mode 100644 index 0000000..7c9d9c3 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util-provisioning-profiles.d.ts @@ -0,0 +1,25 @@ +import { ElectronMacPlatform, ValidatedSignOptions } from './types'; +export declare class ProvisioningProfile { + filePath: string; + message: any; + constructor(filePath: string, message: any); + get name(): string; + get platforms(): ElectronMacPlatform[]; + get type(): "development" | "distribution"; +} +/** + * Returns a promise resolving to a ProvisioningProfile instance based on file. + * @function + * @param {string} filePath - Path to provisioning profile. + * @param {string} keychain - Keychain to use when unlocking provisioning profile. + * @returns {Promise} Promise. + */ +export declare function getProvisioningProfile(filePath: string, keychain?: string | null): Promise<ProvisioningProfile>; +/** + * Returns a promise resolving to a list of suitable provisioning profile within the current working directory. + */ +export declare function findProvisioningProfiles(opts: ValidatedSignOptions): Promise<ProvisioningProfile[]>; +/** + * Returns a promise embedding the provisioning profile in the app Contents folder. + */ +export declare function preEmbedProvisioningProfile(opts: ValidatedSignOptions, profile: ProvisioningProfile | null): Promise<void>; diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util-provisioning-profiles.js b/desktop/node_modules/@electron/osx-sign/dist/esm/util-provisioning-profiles.js new file mode 100644 index 0000000..62d0fea --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util-provisioning-profiles.js @@ -0,0 +1,115 @@ +import * as fs from 'fs-extra'; +import * as path from 'path'; +import plist from 'plist'; +import { debugLog, debugWarn, getAppContentsPath, compactFlattenedList, execFileAsync } from './util'; +export class ProvisioningProfile { + constructor(filePath, message) { + this.filePath = filePath; + this.message = message; + } + get name() { + return this.message.Name; + } + get platforms() { + if ('ProvisionsAllDevices' in this.message) + return ['darwin']; + // Developer ID + else if (this.type === 'distribution') + return ['mas']; + // Mac App Store + else + return ['darwin', 'mas']; // Mac App Development + } + get type() { + if ('ProvisionedDevices' in this.message) + return 'development'; + // Mac App Development + else + return 'distribution'; // Developer ID or Mac App Store + } +} +/** + * Returns a promise resolving to a ProvisioningProfile instance based on file. + * @function + * @param {string} filePath - Path to provisioning profile. + * @param {string} keychain - Keychain to use when unlocking provisioning profile. + * @returns {Promise} Promise. + */ +export async function getProvisioningProfile(filePath, keychain = null) { + const securityArgs = [ + 'cms', + '-D', + '-i', + filePath // Use infile as source of data + ]; + if (keychain) { + securityArgs.push('-k', keychain); + } + const result = await execFileAsync('security', securityArgs); + const provisioningProfile = new ProvisioningProfile(filePath, plist.parse(result)); + debugLog('Provisioning profile:', '\n', '> Name:', provisioningProfile.name, '\n', '> Platforms:', provisioningProfile.platforms, '\n', '> Type:', provisioningProfile.type, '\n', '> Path:', provisioningProfile.filePath, '\n', '> Message:', provisioningProfile.message); + return provisioningProfile; +} +/** + * Returns a promise resolving to a list of suitable provisioning profile within the current working directory. + */ +export async function findProvisioningProfiles(opts) { + const cwd = process.cwd(); + const children = await fs.readdir(cwd); + const foundProfiles = compactFlattenedList(await Promise.all(children.map(async (child) => { + const filePath = path.resolve(cwd, child); + const stat = await fs.stat(filePath); + if (stat.isFile() && path.extname(filePath) === '.provisionprofile') { + return filePath; + } + return null; + }))); + return compactFlattenedList(await Promise.all(foundProfiles.map(async (filePath) => { + const profile = await getProvisioningProfile(filePath); + if (profile.platforms.indexOf(opts.platform) >= 0 && profile.type === opts.type) { + return profile; + } + debugWarn('Provisioning profile above ignored, not for ' + opts.platform + ' ' + opts.type + '.'); + return null; + }))); +} +/** + * Returns a promise embedding the provisioning profile in the app Contents folder. + */ +export async function preEmbedProvisioningProfile(opts, profile) { + async function embedProvisioningProfile(profile) { + debugLog('Looking for existing provisioning profile...'); + const embeddedFilePath = path.join(getAppContentsPath(opts), 'embedded.provisionprofile'); + if (await fs.pathExists(embeddedFilePath)) { + debugLog('Found embedded provisioning profile:', '\n', '* Please manually remove the existing file if not wanted.', '\n', '* Current file at:', embeddedFilePath); + } + else { + debugLog('Embedding provisioning profile...'); + await fs.copy(profile.filePath, embeddedFilePath); + } + } + if (profile) { + // User input provisioning profile + return await embedProvisioningProfile(profile); + } + else { + // Discover provisioning profile + debugLog('No `provisioning-profile` passed in arguments, will find in current working directory and in user library...'); + const profiles = await findProvisioningProfiles(opts); + if (profiles.length > 0) { + // Provisioning profile(s) found + if (profiles.length > 1) { + debugLog('Multiple provisioning profiles found, will use the first discovered.'); + } + else { + debugLog('Found 1 provisioning profile.'); + } + await embedProvisioningProfile(profiles[0]); + } + else { + // No provisioning profile found + debugLog('No provisioning profile found, will not embed profile in app contents.'); + } + } +} +//# sourceMappingURL=util-provisioning-profiles.js.map
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util-provisioning-profiles.js.map b/desktop/node_modules/@electron/osx-sign/dist/esm/util-provisioning-profiles.js.map new file mode 100644 index 0000000..6beb366 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util-provisioning-profiles.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util-provisioning-profiles.js","sourceRoot":"","sources":["../../src/util-provisioning-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MA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,sEAAsE,CAAC,CAAC;aAClF;iBAAM;gBACL,QAAQ,CAAC,+BAA+B,CAAC,CAAC;aAC3C;YACD,MAAM,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;SAC7C;aAAM;YACL,gCAAgC;YAChC,QAAQ,CAAC,wEAAwE,CAAC,CAAC;SACpF;KACF;AACH,CAAC"}
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util.d.ts b/desktop/node_modules/@electron/osx-sign/dist/esm/util.d.ts new file mode 100644 index 0000000..d420151 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util.d.ts @@ -0,0 +1,35 @@ +/// <reference types="node" /> +import * as child from 'child_process'; +import debug from 'debug'; +import { BaseSignOptions, ElectronMacPlatform } from './types'; +export declare const debugLog: debug.Debugger; +export declare const debugWarn: debug.Debugger; +export declare function execFileAsync(file: string, args: string[], options?: child.ExecFileOptions): Promise<string>; +type DeepListItem<T> = null | T | DeepListItem<T>[]; +type DeepList<T> = DeepListItem<T>[]; +export declare function compactFlattenedList<T>(list: DeepList<T>): T[]; +/** + * Returns the path to the "Contents" folder inside the application bundle + */ +export declare function getAppContentsPath(opts: BaseSignOptions): string; +/** + * Returns the path to app "Frameworks" within contents. + */ +export declare function getAppFrameworksPath(opts: BaseSignOptions): string; +export declare function detectElectronPlatform(opts: BaseSignOptions): Promise<ElectronMacPlatform>; +/** + * This function returns a promise validating opts.app, the application to be signed or flattened. + */ +export declare function validateOptsApp(opts: BaseSignOptions): Promise<void>; +/** + * This function returns a promise validating opts.platform, the platform of Electron build. It allows auto-discovery if no opts.platform is specified. + */ +export declare function validateOptsPlatform(opts: BaseSignOptions): Promise<ElectronMacPlatform>; +/** + * This function returns a promise resolving all child paths within the directory specified. + * @function + * @param {string} dirPath - Path to directory. + * @returns {Promise} Promise resolving child paths needing signing in order. + */ +export declare function walkAsync(dirPath: string): Promise<string[]>; +export {}; diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util.js b/desktop/node_modules/@electron/osx-sign/dist/esm/util.js new file mode 100644 index 0000000..76eef43 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util.js @@ -0,0 +1,145 @@ +import * as child from 'child_process'; +import * as fs from 'fs-extra'; +import { isBinaryFile } from 'isbinaryfile'; +import * as path from 'path'; +import debug from 'debug'; +export const debugLog = debug('electron-osx-sign'); +debugLog.log = console.log.bind(console); +export const debugWarn = debug('electron-osx-sign:warn'); +debugWarn.log = console.warn.bind(console); +const removePassword = function (input) { + return input.replace(/(-P |pass:|\/p|-pass )([^ ]+)/, function (_, p1) { + return `${p1}***`; + }); +}; +export async function execFileAsync(file, args, options = {}) { + if (debugLog.enabled) { + debugLog('Executing...', file, args && Array.isArray(args) ? removePassword(args.join(' ')) : ''); + } + return new Promise(function (resolve, reject) { + child.execFile(file, args, options, function (err, stdout, stderr) { + if (err) { + debugLog('Error executing file:', '\n', '> Stdout:', stdout, '\n', '> Stderr:', stderr); + reject(err); + return; + } + resolve(stdout); + }); + }); +} +export function compactFlattenedList(list) { + const result = []; + function populateResult(list) { + if (!Array.isArray(list)) { + if (list) + result.push(list); + } + else if (list.length > 0) { + for (const item of list) + if (item) + populateResult(item); + } + } + populateResult(list); + return result; +} +/** + * Returns the path to the "Contents" folder inside the application bundle + */ +export function getAppContentsPath(opts) { + return path.join(opts.app, 'Contents'); +} +/** + * Returns the path to app "Frameworks" within contents. + */ +export function getAppFrameworksPath(opts) { + return path.join(getAppContentsPath(opts), 'Frameworks'); +} +export async function detectElectronPlatform(opts) { + const appFrameworksPath = getAppFrameworksPath(opts); + if (await fs.pathExists(path.resolve(appFrameworksPath, 'Squirrel.framework'))) { + return 'darwin'; + } + else { + return 'mas'; + } +} +/** + * This function returns a promise resolving the file path if file binary. + */ +async function getFilePathIfBinary(filePath) { + if (await isBinaryFile(filePath)) { + return filePath; + } + return null; +} +/** + * This function returns a promise validating opts.app, the application to be signed or flattened. + */ +export async function validateOptsApp(opts) { + if (!opts.app) { + throw new Error('Path to application must be specified.'); + } + if (path.extname(opts.app) !== '.app') { + throw new Error('Extension of application must be `.app`.'); + } + if (!(await fs.pathExists(opts.app))) { + throw new Error(`Application at path "${opts.app}" could not be found`); + } +} +/** + * This function returns a promise validating opts.platform, the platform of Electron build. It allows auto-discovery if no opts.platform is specified. + */ +export async function validateOptsPlatform(opts) { + if (opts.platform) { + if (opts.platform === 'mas' || opts.platform === 'darwin') { + return opts.platform; + } + else { + debugWarn('`platform` passed in arguments not supported, checking Electron platform...'); + } + } + else { + debugWarn('No `platform` passed in arguments, checking Electron platform...'); + } + return await detectElectronPlatform(opts); +} +/** + * This function returns a promise resolving all child paths within the directory specified. + * @function + * @param {string} dirPath - Path to directory. + * @returns {Promise} Promise resolving child paths needing signing in order. + */ +export async function walkAsync(dirPath) { + debugLog('Walking... ' + dirPath); + async function _walkAsync(dirPath) { + const children = await fs.readdir(dirPath); + return await Promise.all(children.map(async (child) => { + const filePath = path.resolve(dirPath, child); + const stat = await fs.stat(filePath); + if (stat.isFile()) { + switch (path.extname(filePath)) { + case '.cstemp': // Temporary file generated from past codesign + debugLog('Removing... ' + filePath); + await fs.remove(filePath); + return null; + default: + return await getFilePathIfBinary(filePath); + } + } + else if (stat.isDirectory() && !stat.isSymbolicLink()) { + const walkResult = await _walkAsync(filePath); + switch (path.extname(filePath)) { + case '.app': // Application + case '.framework': // Framework + walkResult.push(filePath); + } + return walkResult; + } + return null; + })); + } + const allPaths = await _walkAsync(dirPath); + return compactFlattenedList(allPaths); +} +//# sourceMappingURL=util.js.map
\ No newline at end of file diff --git a/desktop/node_modules/@electron/osx-sign/dist/esm/util.js.map b/desktop/node_modules/@electron/osx-sign/dist/esm/util.js.map new file mode 100644 index 0000000..ecc2617 --- /dev/null +++ b/desktop/node_modules/@electron/osx-sign/dist/esm/util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KA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