[feature] Enable cookie encryption

This commit is contained in:
MathieuG-P
2023-09-28 17:29:05 +02:00
parent da3b2b13a8
commit bd7d6b2f2e
4 changed files with 97 additions and 15 deletions
+5
View File
@@ -0,0 +1,5 @@
const { fuseElectron } = require("./fuse-electron")
exports.afterPack = async function afterPack(context) {
await fuseElectron(context);
}
+36
View File
@@ -0,0 +1,36 @@
/// const { AfterPackContext } = require("electron-builder");
const { flipFuses, FuseVersion, FuseV1Options } = require('@electron/fuses');
const path = require("path");
exports.fuseElectron = async function fuseElectron({
appOutDir,
packager,
electronPlatformName,
}){
const { productFilename } = packager.appInfo;
const target = (() => {
switch (electronPlatformName) {
case "darwin":
return `${productFilename}.app`;
case "win32":
return `${productFilename}.exe`;
case "linux":
// Sadly, `LinuxPackager` type is not exported by electron-builder so we have to improvise
return packager.executableName;
default:
throw new Error(`Unsupported platform: ${electronPlatformName}`);
}
})();
const electron = path.join(appOutDir, target);
console.log(`Fusing electron at ${electron}`);
return flipFuses(electron, {
version: FuseVersion.V1,
[FuseV1Options.EnableCookieEncryption]: true,
});
}