1
0
mirror of https://github.com/bitwarden/desktop synced 2025-12-21 02:33:15 +00:00

move to base menu and keytar storage from jslib

This commit is contained in:
Kyle Spearrin
2018-04-25 15:43:26 -04:00
parent b87f648eeb
commit 8239c0cc53
4 changed files with 23 additions and 269 deletions

View File

@@ -1,17 +1,7 @@
import {
app,
ipcMain,
} from 'electron';
import {
deletePassword,
getPassword,
setPassword,
} from 'keytar';
import { ipcMain } from 'electron';
import { Main } from '../main';
const KeytarService = 'Bitwarden';
const SyncInterval = 5 * 60 * 1000; // 5 minutes
export class MessagingMain {
@@ -22,25 +12,6 @@ export class MessagingMain {
init() {
this.scheduleNextSync();
ipcMain.on('messagingService', async (event: any, message: any) => this.onMessage(message));
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;
}
});
}
onMessage(message: any) {