1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

secure storage with keytar

This commit is contained in:
Kyle Spearrin 2018-02-11 00:36:32 -05:00
parent 1ef0d7a9a9
commit fa39ba2d2d
3 changed files with 5 additions and 7 deletions

View File

@ -9,7 +9,7 @@ import { ToasterModule } from 'angular2-toaster';
import { DesktopPlatformUtilsService } from '../../services/desktopPlatformUtils.service';
import { DesktopRendererMessagingService } from '../../services/desktopRendererMessaging.service';
import { DesktopSecureStorageService } from '../../services/desktopSecureStorage.service';
import { DesktopRendererSecureStorageService } from '../../services/desktopRendererSecureStorage.service';
import { DesktopStorageService } from '../../services/desktopStorage.service';
import { I18nService } from '../../services/i18n.service';
@ -71,9 +71,9 @@ const platformUtilsService = new DesktopPlatformUtilsService(i18nService);
const broadcasterService = new BroadcasterService();
const messagingService = new DesktopRendererMessagingService(broadcasterService);
const storageService: StorageServiceAbstraction = new DesktopStorageService();
const secureStorageService: StorageServiceAbstraction = new DesktopSecureStorageService();
const secureStorageService: StorageServiceAbstraction = new DesktopRendererSecureStorageService();
const constantsService = new ConstantsService({}, 0);
const cryptoService = new CryptoService(storageService, storageService); // TODO: use secure storage
const cryptoService = new CryptoService(storageService, secureStorageService);
const tokenService = new TokenService(storageService);
const appIdService = new AppIdService(storageService);
const apiService = new ApiService(tokenService, platformUtilsService,

View File

@ -1,5 +1,5 @@
import { app, ipcMain } from 'electron';
// import { getPassword, setPassword, deletePassword } from 'keytar';
import { getPassword, setPassword, deletePassword } from 'keytar';
import { WindowMain } from './window.main';
@ -15,7 +15,6 @@ export class MessagingMain {
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;
@ -35,7 +34,6 @@ export class MessagingMain {
event.returnValue = null;
}
});
*/
}
onMessage(message: any) {

View File

@ -1,7 +1,7 @@
import { ipcRenderer } from 'electron';
import { StorageService } from 'jslib/abstractions/storage.service';
export class DesktopSecureStorageService implements StorageService {
export class DesktopRendererSecureStorageService implements StorageService {
async get<T>(key: string): Promise<T> {
const val = ipcRenderer.sendSync('keytar', {
action: 'getPassword',