Skip to content

Instantly share code, notes, and snippets.

@abhishekY495
Created November 11, 2022 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhishekY495/8299a6bc296d5705f62fc7c3b08e9052 to your computer and use it in GitHub Desktop.
Save abhishekY495/8299a6bc296d5705f62fc7c3b08e9052 to your computer and use it in GitHub Desktop.
Preload Script
const { contextBridge } = require("electron");
const { encryptFile } = require("../backend/encryptFile.js");
const { decryptFile } = require("../backend/decryptFile.js");
const fs = require("fs");
contextBridge.exposeInMainWorld("encryptFile", encryptFile);
contextBridge.exposeInMainWorld("decryptFile", decryptFile);
contextBridge.exposeInMainWorld("unlinkSync", {
unlinkSync: (path) => fs.unlinkSync(path),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment