Skip to content

Commit 3d0c137

Browse files
mrmacetetrufae
authored andcommitted
Preserve original identifier when pseudo-signing
1 parent a521c58 commit 3d0c137

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/tools.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,25 @@ async function pseudoSign (entitlement, file) {
135135
} else {
136136
args.push('-S');
137137
}
138+
const identifier = await getIdentifier(file);
139+
if (identifier !== undefined) {
140+
args.push('-I' + identifier);
141+
}
138142
args.push(file);
139143
return execProgram(getTool('ldid2'), args, null);
140144
}
141145

146+
async function getIdentifier (file) {
147+
const res = await execProgram(getTool('codesign'), ['-dv', file], null);
148+
const lines = res.stderr.split('\n');
149+
for (const line of lines) {
150+
const splt = line.split('Identifier=');
151+
if (splt.length === 2) {
152+
return splt[1];
153+
}
154+
}
155+
}
156+
142157
async function verifyCodesign (file, keychain, cb) {
143158
const args = ['-v', '--no-strict'];
144159
if (typeof keychain === 'string') {

0 commit comments

Comments
 (0)