@@ -13,6 +13,9 @@ public struct PassBuilder: Sendable {
13
13
14
14
private let encoder = JSONEncoder ( )
15
15
16
+ private static let manifestFileName = " manifest.json "
17
+ private static let signatureFileName = " signature "
18
+
16
19
/// Creates a new ``PassBuilder``.
17
20
///
18
21
/// - Parameters:
@@ -100,7 +103,7 @@ public struct PassBuilder: Sendable {
100
103
try FileManager . default. createDirectory ( at: dir, withIntermediateDirectories: true )
101
104
defer { try ? FileManager . default. removeItem ( at: dir) }
102
105
103
- try manifest. write ( to: dir. appendingPathComponent ( " manifest.json " ) )
106
+ try manifest. write ( to: dir. appendingPathComponent ( Self . manifestFileName ) )
104
107
try self . pemWWDRCertificate. write ( to: dir. appendingPathComponent ( " wwdr.pem " ) , atomically: true , encoding: . utf8)
105
108
try self . pemCertificate. write ( to: dir. appendingPathComponent ( " certificate.pem " ) , atomically: true , encoding: . utf8)
106
109
try self . pemPrivateKey. write ( to: dir. appendingPathComponent ( " private.pem " ) , atomically: true , encoding: . utf8)
@@ -113,15 +116,15 @@ public struct PassBuilder: Sendable {
113
116
" -certfile " , dir. appendingPathComponent ( " wwdr.pem " ) . path,
114
117
" -signer " , dir. appendingPathComponent ( " certificate.pem " ) . path,
115
118
" -inkey " , dir. appendingPathComponent ( " private.pem " ) . path,
116
- " -in " , dir. appendingPathComponent ( " manifest.json " ) . path,
117
- " -out " , dir. appendingPathComponent ( " signature " ) . path,
119
+ " -in " , dir. appendingPathComponent ( Self . manifestFileName ) . path,
120
+ " -out " , dir. appendingPathComponent ( Self . signatureFileName ) . path,
118
121
" -outform " , " DER " ,
119
122
" -passin " , " pass: \( pemPrivateKeyPassword) " ,
120
123
]
121
124
try process. run ( )
122
125
process. waitUntilExit ( )
123
126
124
- return try Data ( contentsOf: dir. appendingPathComponent ( " signature " ) )
127
+ return try Data ( contentsOf: dir. appendingPathComponent ( Self . signatureFileName ) )
125
128
} else {
126
129
let signature = try CMS . sign (
127
130
manifest,
@@ -177,8 +180,8 @@ public struct PassBuilder: Sendable {
177
180
let sourceFiles = try Self . sourceFiles ( in: tempDir, isPersonalized: personalization != nil )
178
181
179
182
let manifest = try self . manifest ( for: sourceFiles)
180
- archiveFiles. append ( ArchiveFile ( filename: " manifest.json " , data: manifest) )
181
- try archiveFiles. append ( ArchiveFile ( filename: " signature " , data: self . signature ( for: manifest) ) )
183
+ archiveFiles. append ( ArchiveFile ( filename: Self . manifestFileName , data: manifest) )
184
+ try archiveFiles. append ( ArchiveFile ( filename: Self . signatureFileName , data: self . signature ( for: manifest) ) )
182
185
183
186
for file in sourceFiles {
184
187
archiveFiles. append ( ArchiveFile ( filename: file. key, data: file. value) )
0 commit comments