feat: add electron.safeStorage
encryption API (#30020)
* feat: add SafeStorage api; first commit * chore: rename files to fit semantically * chore: add linkedBindings * chore: fix function signatures * chore: refactor eisCookieEncryptionEnabled() fuse * chore: create test file * chore: add tests and documentation * chore: add copyright and lint * chore: add additional tests * chore: fix constructor * chore: commit for pair programming * wip: commit for keeley pairing * chore: docs change and code cleanup * chore: add linux import * chore: add description to documentation * chore: fixing tests * chore: modify behaviour to not allow unencrypted strings as decyption input * fix add patch for enabling default v11 encryption on Linux * chore: remove file after each test * chore: fix patch * chore: remove chromium patch * chore: add linux specific tests * chore: fix path * chore: add checker for linuux file deletion * chore: add dcheck back * chore: remove reference to headless mode * chore: remove tests for linux * chore: edit commit message * chore: refactor safeStorage to not be a class * chore: remove static variable from header * chore: spec file remove settimeout Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
This commit is contained in:
parent
ec6cd0053e
commit
bc508c6113
17 changed files with 393 additions and 46 deletions
13
spec-main/fixtures/api/safe-storage/decrypt-app/main.js
Normal file
13
spec-main/fixtures/api/safe-storage/decrypt-app/main.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
const { app, safeStorage, ipcMain } = require('electron');
|
||||
const { promises: fs } = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const pathToEncryptedString = path.resolve(__dirname, '..', 'encrypted.txt');
|
||||
const readFile = fs.readFile;
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
const encryptedString = await readFile(pathToEncryptedString);
|
||||
const decrypted = safeStorage.decryptString(encryptedString);
|
||||
console.log(decrypted);
|
||||
app.quit();
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "electron-safe-storage",
|
||||
"main": "main.js"
|
||||
}
|
12
spec-main/fixtures/api/safe-storage/encrypt-app/main.js
Normal file
12
spec-main/fixtures/api/safe-storage/encrypt-app/main.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
const { app, safeStorage, ipcMain } = require('electron');
|
||||
const { promises: fs } = require('fs');
|
||||
const path = require('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();
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "electron-safe-storage",
|
||||
"main": "main.js"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue