MCPcopy Index your code
hub / github.com/darkreader/darkreader / signature

Function signature

tasks/bundle-signature.js:171–198  ·  view source on GitHub ↗

* 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})

Source from the content-addressed store, hash-verified

169 * and trivial parallelism of the task.
170 */
171async 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
200const signatureTask = createTask(
201 'signature',

Callers

nothing calls this directly

Calls 4

readJSONFunction · 0.90
getDestDirFunction · 0.90
copyFileFunction · 0.90
createHashesFunction · 0.85

Tested by

no test coverage detected