1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-02 00:23:35 +00:00
Files
browser/electron/src/services/electronRendererStorage.service.ts
Matt Gibson 5ba1416679 Authenticate with secure storage service (#402)
* Split secure key into use case

Allows us to push authentication for key access as late as possible.

* Do not reload if biometric locked

* Linter fixes

* Fix key upgrade scenario

* Fix boolean value message parsing

* Handle systems which don't support biometrics

* Do not fail key retrieval on secret upgrade

* Ensure old key is removed regardless of upgrade success

* Log errors
2021-06-09 15:53:54 -05:00

35 lines
872 B
TypeScript

import { ipcRenderer } from 'electron';
import { StorageService } from 'jslib-common/abstractions/storage.service';
export class ElectronRendererStorageService implements StorageService {
get<T>(key: string): Promise<T> {
return ipcRenderer.invoke('storageService', {
action: 'get',
key: key,
});
}
has(key: string): Promise<boolean> {
return ipcRenderer.invoke('storageService', {
action: 'has',
key: key,
});
}
save(key: string, obj: any): Promise<any> {
return ipcRenderer.invoke('storageService', {
action: 'save',
key: key,
obj: obj,
});
}
remove(key: string): Promise<any> {
return ipcRenderer.invoke('storageService', {
action: 'remove',
key: key,
});
}
}