mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-13 10:24:20 +01:00
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
|
import { app, ipcMain } from 'electron';
|
||
|
// import { getPassword, setPassword, deletePassword } from 'keytar';
|
||
|
|
||
|
const KeytarService = 'bitwarden';
|
||
|
|
||
|
export class MessagingMain {
|
||
|
init() {
|
||
|
ipcMain.on('messagingService', async (event: any, message: any) => {
|
||
|
switch (message.command) {
|
||
|
case 'loggedIn':
|
||
|
break;
|
||
|
case 'logout':
|
||
|
break;
|
||
|
case 'syncCompleted':
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
/*
|
||
|
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;
|
||
|
}
|
||
|
});
|
||
|
*/
|
||
|
}
|
||
|
}
|