electron-osx-sign
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -17,3 +17,3 @@ declare module "electron-osx-sign" { | ||
'identity-validation'?: boolean; | ||
ignore?: string; | ||
ignore?: string | ((file: string) => boolean); | ||
'pre-auto-entitlements'?: boolean; | ||
@@ -23,5 +23,7 @@ 'pre-embed-provisioning-profile'?: boolean; | ||
'requirements'?: string; | ||
'signature-flags'?: string | ((file: string) => string[]); | ||
'signature-size'?: number; | ||
'type'?: string; | ||
version?: string; | ||
entitlementsForFile?: (file: string, codeSignArgs: string[]) => string | null; | ||
} | ||
@@ -28,0 +30,0 @@ |
{ | ||
"name": "electron-osx-sign", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Codesign Electron macOS apps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
73
sign.js
@@ -169,33 +169,2 @@ /** | ||
let optionsArguments = [] | ||
if (opts['signature-flags']) { | ||
if (Array.isArray(opts['signature-flags'])) { | ||
optionsArguments = [...opts['signature-flags']] | ||
} else { | ||
const flags = opts['signature-flags'].split(',').map(function (flag) { return flag.trim() }) | ||
optionsArguments = [...flags] | ||
} | ||
} | ||
if (opts.hardenedRuntime || opts['hardened-runtime'] || 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(function (element, index) { return element !== 'runtime' }) | ||
} | ||
} | ||
if (opts['restrict']) { | ||
optionsArguments.push('restrict') | ||
debugwarn('This flag is to be deprecated, consider using --signature-flags=restrict instead') | ||
} | ||
if (optionsArguments.length) { | ||
args.push('--options', [...new Set(optionsArguments)].join(',')) | ||
} | ||
var promise | ||
@@ -221,2 +190,36 @@ /** | ||
let optionsArguments = [] | ||
if (opts['signature-flags']) { | ||
if (Array.isArray(opts['signature-flags'])) { | ||
optionsArguments = [...opts['signature-flags']] | ||
} else if (typeof opts['signature-flags'] === 'function') { | ||
const flags = opts['signature-flags'](filePath) | ||
optionsArguments = [...flags] | ||
} else { | ||
const flags = opts['signature-flags'].split(',').map(function (flag) { return flag.trim() }) | ||
optionsArguments = [...flags] | ||
} | ||
} | ||
if (opts.hardenedRuntime || opts['hardened-runtime'] || 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(function (element, index) { return element !== 'runtime' }) | ||
} | ||
} | ||
if (opts['restrict']) { | ||
optionsArguments.push('restrict') | ||
debugwarn('This flag is to be deprecated, consider using --signature-flags=restrict instead') | ||
} | ||
if (optionsArguments.length) { | ||
args.push('--options', [...new Set(optionsArguments)].join(',')) | ||
} | ||
let entitlementsFile = opts['entitlements-inherit'] | ||
@@ -227,3 +230,3 @@ if (filePath.includes('Library/LoginItems')) { | ||
const clonedArgs = args.concat([]); | ||
const clonedArgs = args.concat([]) | ||
if (opts.entitlementsForFile) { | ||
@@ -238,9 +241,9 @@ entitlementsFile = opts.entitlementsForFile(filePath, clonedArgs) || entitlementsFile | ||
const clonedArgs = args.concat([]); | ||
const clonedArgs = args.concat([]) | ||
let entitlementsFile = opts.entitlements | ||
if (opts.entitlementsForFile) { | ||
entitlementsFile = opts.entitlementsForFile(opts.app, clonedArgs) || entitlementsFile; | ||
entitlementsFile = opts.entitlementsForFile(opts.app, clonedArgs) || entitlementsFile | ||
} | ||
return execFileAsync('codesign', clonedArgs.concat('--entitlements', opts.entitlements, opts.app)) | ||
return execFileAsync('codesign', clonedArgs.concat('--entitlements', entitlementsFile, opts.app)) | ||
}) | ||
@@ -247,0 +250,0 @@ } else { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73836
1257