electron/spec/fixtures/api/safe-storage/decrypt-app/main.js
Robo 34e7c3696a
feat: expose safestorage backend information on linux (#38873)
* feat: expose safestorage backend information on linux

* Remove gnome-keyring

Refs https://chromium-review.googlesource.com/c/chromium/src/+/4609704
2023-07-13 11:14:33 +02:00

16 lines
539 B
JavaScript

const { app, safeStorage } = require('electron');
const { promises: fs } = require('node:fs');
const path = require('node:path');
const pathToEncryptedString = path.resolve(__dirname, '..', 'encrypted.txt');
const readFile = fs.readFile;
app.whenReady().then(async () => {
if (process.platform === 'linux') {
safeStorage.setUsePlainTextEncryption(true);
}
const encryptedString = await readFile(pathToEncryptedString);
const decrypted = safeStorage.decryptString(encryptedString);
console.log(decrypted);
app.quit();
});