@@ -26,11 +26,7 @@ export function generateKeychainName(): string {
26
26
}
27
27
28
28
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 ]
34
30
certLinks . push ( cscLink )
35
31
if ( cscILink != null ) {
36
32
certLinks . push ( cscILink )
@@ -46,7 +42,7 @@ export function createKeychain(keychainName: string, cscLink: string, cscKeyPass
46
42
[ "set-keychain-settings" , "-t" , "3600" , "-u" , keychainName ]
47
43
] , it => exec ( "security" , it ) )
48
44
] )
49
- . then ( ( ) => importCerts ( keychainName , certPaths , [ cscKeyPassword , cscIKeyPassword ] . filter ( it => it != null ) ) ) ,
45
+ . then ( ( ) => importCerts ( keychainName , certPaths , [ cscKeyPassword , cscIKeyPassword ] . filter ( it => it != null ) , csaLink == null ) ) ,
50
46
errorOccurred => {
51
47
const tasks = certPaths . map ( it => deleteFile ( it , true ) )
52
48
if ( errorOccurred ) {
@@ -56,9 +52,13 @@ export function createKeychain(keychainName: string, cscLink: string, cscKeyPass
56
52
} )
57
53
}
58
54
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 > {
60
56
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" ] )
62
62
}
63
63
64
64
const namePromises : Array < Promise < string > > = [ ]
0 commit comments