1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 11:13:46 +00:00

[PM-3685] Remove ipcRenderer from electron-renderer-storage (#6481)

* [PM-3685] Remove ipcRenderer from renderer-storage

* Break out storage and keytar into separate functions
This commit is contained in:
Daniel García
2023-10-23 12:27:49 +02:00
committed by GitHub
parent c2613af4f6
commit 55bc275f40
3 changed files with 32 additions and 42 deletions

View File

@@ -1,34 +1,19 @@
import { ipcRenderer } from "electron";
import { AbstractStorageService } from "@bitwarden/common/platform/abstractions/storage.service";
export class ElectronRendererStorageService implements AbstractStorageService {
get<T>(key: string): Promise<T> {
return ipcRenderer.invoke("storageService", {
action: "get",
key: key,
});
return ipc.platform.storage.get(key);
}
has(key: string): Promise<boolean> {
return ipcRenderer.invoke("storageService", {
action: "has",
key: key,
});
return ipc.platform.storage.has(key);
}
save(key: string, obj: any): Promise<any> {
return ipcRenderer.invoke("storageService", {
action: "save",
key: key,
obj: obj,
});
return ipc.platform.storage.save(key, obj);
}
remove(key: string): Promise<any> {
return ipcRenderer.invoke("storageService", {
action: "remove",
key: key,
});
return ipc.platform.storage.remove(key);
}
}