Skip to content

Commit

Permalink
Preserve original identifier when pseudo-signing
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmacete authored and trufae committed Nov 2, 2023
1 parent a521c58 commit 3d0c137
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,25 @@ async function pseudoSign (entitlement, file) {
} else {
args.push('-S');
}
const identifier = await getIdentifier(file);
if (identifier !== undefined) {
args.push('-I' + identifier);
}
args.push(file);
return execProgram(getTool('ldid2'), args, null);
}

async function getIdentifier (file) {
const res = await execProgram(getTool('codesign'), ['-dv', file], null);
const lines = res.stderr.split('\n');
for (const line of lines) {
const splt = line.split('Identifier=');
if (splt.length === 2) {
return splt[1];
}
}
}

async function verifyCodesign (file, keychain, cb) {
const args = ['-v', '--no-strict'];
if (typeof keychain === 'string') {
Expand Down

0 comments on commit 3d0c137

Please sign in to comment.