@@ -6,7 +6,7 @@ import { signAsync, SignOptions } from "electron-osx-sign"
6
6
import { ensureDir } from "fs-extra-p"
7
7
import * as path from "path"
8
8
import { AppInfo } from "./appInfo"
9
- import { appleCertificatePrefixes , CodeSigningInfo , createKeychain , findIdentity } from "./codeSign"
9
+ import { appleCertificatePrefixes , CodeSigningInfo , createKeychain , findIdentity , Identity } from "./codeSign"
10
10
import { Arch , DIR_TARGET , Platform , Target } from "./core"
11
11
import { MacOptions , MasBuildOptions } from "./options/macOptions"
12
12
import { BuildInfo } from "./packagerApi"
@@ -158,19 +158,19 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
158
158
const explicitType = masOptions == null ? macOptions . type : masOptions . type
159
159
const type = explicitType || "distribution"
160
160
const isDevelopment = type === "development"
161
- let name = await findIdentity ( isDevelopment ? "Mac Developer" : ( isMas ? "3rd Party Mac Developer Application" : "Developer ID Application" ) , isMas ? masQualifier : qualifier , keychainName )
162
- if ( name == null ) {
161
+ let identity = await findIdentity ( isDevelopment ? "Mac Developer" : ( isMas ? "3rd Party Mac Developer Application" : "Developer ID Application" ) , isMas ? masQualifier : qualifier , keychainName )
162
+ if ( identity == null ) {
163
163
if ( ! isMas && ! isDevelopment && explicitType !== "distribution" ) {
164
- name = await findIdentity ( "Mac Developer" , qualifier , keychainName )
165
- if ( name != null ) {
164
+ identity = await findIdentity ( "Mac Developer" , qualifier , keychainName )
165
+ if ( identity != null ) {
166
166
warn ( "Mac Developer is used to sign app — it is only for development and testing, not for production" )
167
167
}
168
168
else if ( qualifier != null ) {
169
169
throw new Error ( `Identity name "${ qualifier } " is specified, but no valid identity with this name in the keychain` )
170
170
}
171
171
}
172
172
173
- if ( name == null ) {
173
+ if ( identity == null ) {
174
174
const message = process . env . CSC_IDENTITY_AUTO_DISCOVERY === "false" ?
175
175
`App is not signed: env CSC_IDENTITY_AUTO_DISCOVERY is set to false` :
176
176
`App is not signed: cannot find valid ${ isMas ? '"3rd Party Mac Developer Application" identity' : `"Developer ID Application" identity or custom non-Apple code signing certificate` } , see https://github.com/electron-userland/electron-builder/wiki/Code-Signing`
@@ -186,15 +186,15 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
186
186
187
187
const signOptions : any = {
188
188
"identity-validation" : false ,
189
- identity : name ! ,
189
+ identity : identity ! ,
190
190
type : type ,
191
191
platform : isMas ? "mas" : "darwin" ,
192
192
version : this . info . electronVersion ,
193
193
app : appPath ,
194
194
keychain : keychainName || undefined ,
195
195
binaries : ( isMas && masOptions != null ? masOptions . binaries : macOptions . binaries ) || undefined ,
196
196
requirements : isMas || macOptions . requirements == null ? undefined : await this . getResource ( macOptions . requirements ) ,
197
- "gatekeeper-assess" : appleCertificatePrefixes . find ( it => name ! . startsWith ( it ) ) != null
197
+ "gatekeeper-assess" : appleCertificatePrefixes . find ( it => identity ! . name . startsWith ( it ) ) != null
198
198
}
199
199
200
200
const resourceList = await this . resourceList
@@ -226,7 +226,7 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
226
226
signOptions [ "entitlements-inherit" ] = customSignOptions . entitlementsInherit
227
227
}
228
228
229
- await task ( `Signing app (identity: ${ name } )` , this . doSign ( signOptions ) )
229
+ await task ( `Signing app (identity: ${ identity . hash } ${ identity . name } )` , this . doSign ( signOptions ) )
230
230
231
231
if ( masOptions != null ) {
232
232
const certType = "3rd Party Mac Developer Installer"
@@ -247,7 +247,7 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
247
247
}
248
248
249
249
//noinspection JSMethodCanBeStatic
250
- protected async doFlat ( appPath : string , outFile : string , identity : string , keychain : string | n ) : Promise < any > {
250
+ protected async doFlat ( appPath : string , outFile : string , identity : Identity , keychain : string | n ) : Promise < any > {
251
251
// productbuild doesn't created directory for out file
252
252
await ensureDir ( path . dirname ( outFile ) )
253
253
0 commit comments