1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

secure storage via ipc to main

This commit is contained in:
Kyle Spearrin
2018-01-23 15:08:57 -05:00
parent 95e6d0b92d
commit 78b1f5df99
3 changed files with 45 additions and 13 deletions

View File

@@ -1,10 +1,30 @@
import { app, BrowserWindow, screen } from 'electron';
import { app, BrowserWindow, screen, ipcMain } from 'electron';
import * as path from 'path';
import * as url from 'url';
/*
import { getPassword, setPassword, deletePassword } from 'keytar';
//import { DesktopSecureStorageService } from './services/desktopSecureStorage.service';
//const secureStorageService = new DesktopSecureStorageService();
//(global as any).secureStorageService = secureStorageService;
const keytarService = 'bitwarden';
ipcMain.on('keytar', async (event: any, message: any) => {
try {
let val: string = null;
if (message.action && message.key) {
if (message.action === 'getPassword') {
val = await getPassword(keytarService, message.key);
} else if (message.action === 'setPassword' && message.value) {
await setPassword(keytarService, message.key, message.value);
} else if (message.action === 'deletePassword') {
await deletePassword(keytarService, message.key);
}
}
event.returnValue = val;
}
catch {
event.returnValue = null;
}
});
*/
let win: BrowserWindow;
const args = process.argv.slice(1);