* This utility function is written with readability in mind * It is a naiive implementation which does not take advantage of data streaming * and trivial parallelism of the task.
({platforms, debug, version})
| 169 | * and trivial parallelism of the task. |
| 170 | */ |
| 171 | async function signature({platforms, debug, version}) { |
| 172 | if (!platforms[PLATFORM.FIREFOX_MV2] || debug) { |
| 173 | throw new Error('Only Firefox builds support signed packages for now.'); |
| 174 | } |
| 175 | |
| 176 | const infoPath = `./integrity/firefox/${version}/info.json`; |
| 177 | const {type, order, manifest} = await readJSON(infoPath); |
| 178 | await createHashes(type, version, order, manifest); |
| 179 | |
| 180 | const destDir = getDestDir({debug, platform: 'firefox'}); |
| 181 | const rsa = `./integrity/firefox/${version}/mozilla.rsa`; |
| 182 | const rsaDest = `${destDir}/META-INF/mozilla.rsa`; |
| 183 | const sig = `./integrity/firefox/${version}/cose.sig`; |
| 184 | const sigDest = `${destDir}/META-INF/cose.sig`; |
| 185 | const recommendation = `./integrity/firefox/${version}/mozilla-recommendation.json`; |
| 186 | const recommendationDest = `${destDir}/mozilla-recommendation.json`; |
| 187 | await copyFile(rsa, rsaDest); |
| 188 | try { |
| 189 | await copyFile(sig, sigDest); |
| 190 | } catch (e) { |
| 191 | // Do nothing |
| 192 | } |
| 193 | try { |
| 194 | await copyFile(recommendation, recommendationDest); |
| 195 | } catch (e) { |
| 196 | // Do nothing |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | const signatureTask = createTask( |
| 201 | 'signature', |
nothing calls this directly
no test coverage detected