[PM-3686] Remove ipcRenderer from native-message-handler (#6839)
This commit is contained in:
parent
91fd4f7411
commit
29be9bff05
|
@ -2,6 +2,7 @@ import { ipcRenderer } from "electron";
|
||||||
|
|
||||||
import { DeviceType, ThemeType, KeySuffixOptions } from "@bitwarden/common/enums";
|
import { DeviceType, ThemeType, KeySuffixOptions } from "@bitwarden/common/enums";
|
||||||
|
|
||||||
|
import { EncryptedMessageResponse, UnencryptedMessageResponse } from "../models/native-messaging";
|
||||||
import { BiometricMessage, BiometricAction } from "../types/biometric-message";
|
import { BiometricMessage, BiometricAction } from "../types/biometric-message";
|
||||||
import { isDev, isWindowsStore } from "../utils";
|
import { isDev, isWindowsStore } from "../utils";
|
||||||
|
|
||||||
|
@ -51,6 +52,12 @@ const clipboard = {
|
||||||
write: (message: ClipboardWriteMessage) => ipcRenderer.invoke("clipboard.write", message),
|
write: (message: ClipboardWriteMessage) => ipcRenderer.invoke("clipboard.write", message),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const nativeMessaging = {
|
||||||
|
sendReply: (message: EncryptedMessageResponse | UnencryptedMessageResponse) => {
|
||||||
|
ipcRenderer.send("nativeMessagingReply", message);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
versions: {
|
versions: {
|
||||||
app: (): Promise<string> => ipcRenderer.invoke("appVersion"),
|
app: (): Promise<string> => ipcRenderer.invoke("appVersion"),
|
||||||
|
@ -93,6 +100,7 @@ export default {
|
||||||
passwords,
|
passwords,
|
||||||
biometric,
|
biometric,
|
||||||
clipboard,
|
clipboard,
|
||||||
|
nativeMessaging,
|
||||||
};
|
};
|
||||||
|
|
||||||
function deviceType(): DeviceType {
|
function deviceType(): DeviceType {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { ipcRenderer } from "electron";
|
|
||||||
import { firstValueFrom } from "rxjs";
|
import { firstValueFrom } from "rxjs";
|
||||||
|
|
||||||
import { NativeMessagingVersion } from "@bitwarden/common/enums";
|
import { NativeMessagingVersion } from "@bitwarden/common/enums";
|
||||||
|
@ -225,7 +224,7 @@ export class NativeMessageHandlerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendResponse(response: EncryptedMessageResponse | UnencryptedMessageResponse) {
|
private sendResponse(response: EncryptedMessageResponse | UnencryptedMessageResponse) {
|
||||||
ipcRenderer.send("nativeMessagingReply", response);
|
ipc.platform.nativeMessaging.sendReply(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trim all null bytes padded at the end of messages. This happens with C encryption libraries.
|
// Trim all null bytes padded at the end of messages. This happens with C encryption libraries.
|
||||||
|
|
Loading…
Reference in New Issue