mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-19 02:51:14 +02:00
secure storage with keytar
This commit is contained in:
parent
1ef0d7a9a9
commit
fa39ba2d2d
@ -9,7 +9,7 @@ import { ToasterModule } from 'angular2-toaster';
|
|||||||
|
|
||||||
import { DesktopPlatformUtilsService } from '../../services/desktopPlatformUtils.service';
|
import { DesktopPlatformUtilsService } from '../../services/desktopPlatformUtils.service';
|
||||||
import { DesktopRendererMessagingService } from '../../services/desktopRendererMessaging.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 { DesktopStorageService } from '../../services/desktopStorage.service';
|
||||||
import { I18nService } from '../../services/i18n.service';
|
import { I18nService } from '../../services/i18n.service';
|
||||||
|
|
||||||
@ -71,9 +71,9 @@ const platformUtilsService = new DesktopPlatformUtilsService(i18nService);
|
|||||||
const broadcasterService = new BroadcasterService();
|
const broadcasterService = new BroadcasterService();
|
||||||
const messagingService = new DesktopRendererMessagingService(broadcasterService);
|
const messagingService = new DesktopRendererMessagingService(broadcasterService);
|
||||||
const storageService: StorageServiceAbstraction = new DesktopStorageService();
|
const storageService: StorageServiceAbstraction = new DesktopStorageService();
|
||||||
const secureStorageService: StorageServiceAbstraction = new DesktopSecureStorageService();
|
const secureStorageService: StorageServiceAbstraction = new DesktopRendererSecureStorageService();
|
||||||
const constantsService = new ConstantsService({}, 0);
|
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 tokenService = new TokenService(storageService);
|
||||||
const appIdService = new AppIdService(storageService);
|
const appIdService = new AppIdService(storageService);
|
||||||
const apiService = new ApiService(tokenService, platformUtilsService,
|
const apiService = new ApiService(tokenService, platformUtilsService,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { app, ipcMain } from 'electron';
|
import { app, ipcMain } from 'electron';
|
||||||
// import { getPassword, setPassword, deletePassword } from 'keytar';
|
import { getPassword, setPassword, deletePassword } from 'keytar';
|
||||||
|
|
||||||
import { WindowMain } from './window.main';
|
import { WindowMain } from './window.main';
|
||||||
|
|
||||||
@ -15,7 +15,6 @@ export class MessagingMain {
|
|||||||
this.scheduleNextSync();
|
this.scheduleNextSync();
|
||||||
ipcMain.on('messagingService', async (event: any, message: any) => this.onMessage(message));
|
ipcMain.on('messagingService', async (event: any, message: any) => this.onMessage(message));
|
||||||
|
|
||||||
/*
|
|
||||||
ipcMain.on('keytar', async (event: any, message: any) => {
|
ipcMain.on('keytar', async (event: any, message: any) => {
|
||||||
try {
|
try {
|
||||||
let val: string = null;
|
let val: string = null;
|
||||||
@ -35,7 +34,6 @@ export class MessagingMain {
|
|||||||
event.returnValue = null;
|
event.returnValue = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMessage(message: any) {
|
onMessage(message: any) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||||
|
|
||||||
export class DesktopSecureStorageService implements StorageService {
|
export class DesktopRendererSecureStorageService implements StorageService {
|
||||||
async get<T>(key: string): Promise<T> {
|
async get<T>(key: string): Promise<T> {
|
||||||
const val = ipcRenderer.sendSync('keytar', {
|
const val = ipcRenderer.sendSync('keytar', {
|
||||||
action: 'getPassword',
|
action: 'getPassword',
|
Loading…
Reference in New Issue
Block a user