1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 02:03:39 +00:00

[PM-3683] Remove ipcRenderer from electron-platform-utils (#6679)

* [PM-3683] Remove ipcRenderer from electron-platform-utils

* FIx review comments

* Formatting

* Use isNullOrWhitespace
This commit is contained in:
Daniel García
2023-11-01 18:34:36 +01:00
committed by GitHub
parent a1729c97df
commit c592bcba80
9 changed files with 112 additions and 46 deletions

View File

@@ -2,8 +2,11 @@ import { ipcRenderer } from "electron";
import { DeviceType, ThemeType } from "@bitwarden/common/enums";
import { BiometricMessage, BiometricAction } from "../types/biometric-message";
import { isDev, isWindowsStore } from "../utils";
import { ClipboardWriteMessage } from "./types/clipboard";
const storage = {
get: <T>(key: string): Promise<T> => ipcRenderer.invoke("storageService", { action: "get", key }),
has: (key: string): Promise<boolean> =>
@@ -25,6 +28,22 @@ const passwords = {
ipcRenderer.invoke("keytar", { action: "deletePassword", key, keySuffix }),
};
const biometric = {
osSupported: (): Promise<boolean> =>
ipcRenderer.invoke("biometric", {
action: BiometricAction.OsSupported,
} satisfies BiometricMessage),
authenticate: (): Promise<boolean> =>
ipcRenderer.invoke("biometric", {
action: BiometricAction.Authenticate,
} satisfies BiometricMessage),
};
const clipboard = {
read: (): Promise<string> => ipcRenderer.invoke("clipboard.read"),
write: (message: ClipboardWriteMessage) => ipcRenderer.invoke("clipboard.write", message),
};
export default {
versions: {
app: (): Promise<string> => ipcRenderer.invoke("appVersion"),
@@ -52,8 +71,12 @@ export default {
});
},
launchUri: (uri: string) => ipcRenderer.invoke("launchUri", uri),
storage,
passwords,
biometric,
clipboard,
};
function deviceType(): DeviceType {