Skip to content

Commit 2d0f5f1

Browse files
committed
fix: osx code sign regression
Closes #377
1 parent e7cee5e commit 2d0f5f1

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
*.ico filter=lfs diff=lfs merge=lfs -text
33
*.icns filter=lfs diff=lfs merge=lfs -text
44
vendor/**/* filter=lfs diff=lfs merge=lfs -text
5-
*.gif filter=lfs diff=lfs merge=lfs -text
5+
*.gif filter=lfs diff=lfs merge=lfs -text

certs/AppleWWDRCA.cer

1.04 KB
Binary file not shown.

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"main": "out/index.js",
66
"files": [
77
"out",
8-
"templates"
8+
"templates",
9+
"certs"
910
],
1011
"bin": {
1112
"build": "./out/build-cli.js",
@@ -62,7 +63,7 @@
6263
"compare-versions": "^2.0.1",
6364
"debug": "^2.2.0",
6465
"deep-assign": "^2.0.0",
65-
"electron-osx-sign-tf": "~0.5.0-beta.0",
66+
"electron-osx-sign-tf": "0.4.0-beta.0",
6667
"electron-packager-tf": "^7.0.2-beta.0",
6768
"electron-winstaller-fixed": "~2.4.0-beta.1",
6869
"fs-extra-p": "^1.0.1",
@@ -76,8 +77,7 @@
7677
"read-package-json": "^2.0.4",
7778
"signcode-tf": "^0.5.0",
7879
"source-map-support": "^0.4.0",
79-
"tmp": "0.0.28",
80-
"typescript": "^1.9.0-dev.20160503"
80+
"tmp": "0.0.28"
8181
},
8282
"optionalDependencies": {
8383
"appdmg-tf": "^0.3.11"
@@ -106,7 +106,7 @@
106106
"ts-babel": "^0.8.6",
107107
"tsconfig-glob": "^0.4.3",
108108
"tslint": "next",
109-
"typescript": "^1.9.0-dev.20160414",
109+
"typescript": "^1.9.0-dev.20160504",
110110
"whitespace": "^2.0.0"
111111
},
112112
"babel": {
@@ -123,8 +123,5 @@
123123
"test/out/*"
124124
]
125125
},
126-
"typings": "./out/electron-builder.d.ts",
127-
"publishConfig": {
128-
"tag": "next"
129-
}
126+
"typings": "./out/electron-builder.d.ts"
130127
}

src/codeSign.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ export function generateKeychainName(): string {
2626
}
2727

2828
export function createKeychain(keychainName: string, cscLink: string, cscKeyPassword: string, cscILink?: string | null, cscIKeyPassword?: string | null, csaLink?: string | null): Promise<CodeSigningInfo> {
29-
const certLinks = [csaLink || "https://developer.apple.com/certificationauthority/AppleWWDRCA.cer"]
30-
if (csaLink == null) {
31-
certLinks.push("https://startssl.com/certs/sca.code2.crt", "https://startssl.com/certs/sca.code3.crt")
32-
}
33-
29+
const certLinks = csaLink == null ? ["https://startssl.com/certs/sca.code2.crt", "https://startssl.com/certs/sca.code3.crt"] : [csaLink]
3430
certLinks.push(cscLink)
3531
if (cscILink != null) {
3632
certLinks.push(cscILink)
@@ -46,7 +42,7 @@ export function createKeychain(keychainName: string, cscLink: string, cscKeyPass
4642
["set-keychain-settings", "-t", "3600", "-u", keychainName]
4743
], it => exec("security", it))
4844
])
49-
.then(() => importCerts(keychainName, certPaths, [cscKeyPassword, cscIKeyPassword].filter(it => it != null))),
45+
.then(() => importCerts(keychainName, certPaths, [cscKeyPassword, cscIKeyPassword].filter(it => it != null), csaLink == null)),
5046
errorOccurred => {
5147
const tasks = certPaths.map(it => deleteFile(it, true))
5248
if (errorOccurred) {
@@ -56,9 +52,13 @@ export function createKeychain(keychainName: string, cscLink: string, cscKeyPass
5652
})
5753
}
5854

59-
async function importCerts(keychainName: string, paths: Array<string>, keyPasswords: Array<string | null | undefined>): Promise<CodeSigningInfo> {
55+
async function importCerts(keychainName: string, paths: Array<string>, keyPasswords: Array<string | null | undefined>, importAppleCerts: boolean): Promise<CodeSigningInfo> {
6056
for (let f of paths.slice(0, -keyPasswords.length)) {
61-
await exec("security", ["import", f!, "-k", keychainName, "-T", "/usr/bin/codesign"])
57+
await exec("security", ["import", f, "-k", keychainName, "-T", "/usr/bin/codesign"])
58+
}
59+
60+
if (importAppleCerts) {
61+
await exec("security", ["import", path.join(__dirname, "..", "certs", "AppleWWDRCA.cer"), "-k", keychainName, "-T", "/usr/bin/codesign"])
6262
}
6363

6464
const namePromises: Array<Promise<string>> = []

0 commit comments

Comments
 (0)