Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,18 @@ async function init() {

ora.text = 'Code signing DMG';
let identity;
const {stdout} = await execa('/usr/bin/security', ['find-identity', '-v', '-p', 'codesigning']);
if (cli.flags.identity && stdout.includes(`"${cli.flags.identity}"`)) {
if (cli.flags.identity) {
// We skip identity validation to support both named and SHA-1 formats; let system validate.
identity = cli.flags.identity;
} else if (!cli.flags.identity && stdout.includes('Developer ID Application:')) {
identity = 'Developer ID Application';
} else if (!cli.flags.identity && stdout.includes('Mac Developer:')) {
identity = 'Mac Developer';
} else if (!cli.flags.identity && stdout.includes('Apple Development:')) {
identity = 'Apple Development';
} else {
const {stdout} = await execa('/usr/bin/security', ['find-identity', '-v', '-p', 'codesigning']);
if (!cli.flags.identity && stdout.includes('Developer ID Application:')) {
identity = 'Developer ID Application';
} else if (!cli.flags.identity && stdout.includes('Mac Developer:')) {
identity = 'Mac Developer';
} else if (!cli.flags.identity && stdout.includes('Apple Development:')) {
identity = 'Apple Development';
}
}

if (!identity) {
Expand Down
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test('main', async t => {
await execa(path.join(__dirname, 'cli.js'), ['--identity=0', path.join(__dirname, 'fixtures/Fixture.app')], {cwd});
} catch (error) {
// Silence code signing failure
if (!error.message.includes('No suitable code signing')) {
if (!error.message.includes('The specified item could not be found in the keychain')) {
throw error;
}
}
Expand All @@ -29,7 +29,7 @@ test('binary plist', async t => {
await execa(path.join(__dirname, 'cli.js'), ['--identity=0', path.join(__dirname, 'fixtures/Fixture-with-binary-plist.app')], {cwd});
} catch (error) {
// Silence code signing failure
if (!error.message.includes('No suitable code signing')) {
if (!error.message.includes('The specified item could not be found in the keychain')) {
throw error;
}
}
Expand All @@ -44,7 +44,7 @@ test('app without icon', async t => {
await execa(path.join(__dirname, 'cli.js'), ['--identity=0', path.join(__dirname, 'fixtures/Fixture-no-icon.app')], {cwd});
} catch (error) {
// Silence code signing failure
if (!error.message.includes('No suitable code signing')) {
if (!error.message.includes('The specified item could not be found in the keychain')) {
throw error;
}
}
Expand Down
Loading