main.js 431 B

123456789101112
  1. const { app, safeStorage, ipcMain } = require('electron');
  2. const { promises: fs } = require('fs');
  3. const path = require('path');
  4. const pathToEncryptedString = path.resolve(__dirname, '..', 'encrypted.txt');
  5. const writeFile = fs.writeFile;
  6. app.whenReady().then(async () => {
  7. const encrypted = safeStorage.encryptString('plaintext');
  8. const encryptedString = await writeFile(pathToEncryptedString, encrypted);
  9. app.quit();
  10. });