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

[PM-3687] Remove ipcRenderer from native-messaging (#6893)

This commit is contained in:
Daniel García
2023-11-21 16:40:43 +01:00
committed by GitHub
parent f6c2e0b6c0
commit 1ecf019397
2 changed files with 37 additions and 11 deletions

View File

@@ -1,8 +1,14 @@
import { ipcRenderer } from "electron";
import { DeviceType, ThemeType, KeySuffixOptions } from "@bitwarden/common/enums";
import { EncString } from "@bitwarden/common/platform/models/domain/enc-string";
import { EncryptedMessageResponse, UnencryptedMessageResponse } from "../models/native-messaging";
import {
EncryptedMessageResponse,
LegacyMessageWrapper,
Message,
UnencryptedMessageResponse,
} from "../models/native-messaging";
import { BiometricMessage, BiometricAction } from "../types/biometric-message";
import { isDev, isWindowsStore } from "../utils";
@@ -56,6 +62,17 @@ const nativeMessaging = {
sendReply: (message: EncryptedMessageResponse | UnencryptedMessageResponse) => {
ipcRenderer.send("nativeMessagingReply", message);
},
sendMessage: (message: {
appId: string;
command?: string;
sharedSecret?: string;
message?: EncString;
}) => {
ipcRenderer.send("nativeMessagingReply", message);
},
onMessage: (callback: (message: LegacyMessageWrapper | Message) => void) => {
ipcRenderer.on("nativeMessaging", (_event, message) => callback(message));
},
};
export default {