electron/spec/fixtures/api/safe-storage/encrypt-app/main.js
Milan Burda d78f37ec8f
refactor: use node scheme imports in spec (#38487)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-06-15 10:42:27 -04:00

12 lines
441 B
JavaScript

const { app, safeStorage, ipcMain } = require('electron');
const { promises: fs } = require('node:fs');
const path = require('node:path');
const pathToEncryptedString = path.resolve(__dirname, '..', 'encrypted.txt');
const writeFile = fs.writeFile;
app.whenReady().then(async () => {
const encrypted = safeStorage.encryptString('plaintext');
const encryptedString = await writeFile(pathToEncryptedString, encrypted);
app.quit();
});