mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 23:03:32 +00:00
Handle special serialization case for native messaging. (#3442)
It would be nice to fix this by processing the encString properly in Desktop, but that wouldn't be backwards compatible with existing installs.
This commit is contained in:
@@ -238,7 +238,18 @@ export class NativeMessagingBackground {
|
|||||||
private postMessage(message: OuterMessage) {
|
private postMessage(message: OuterMessage) {
|
||||||
// Wrap in try-catch to when the port disconnected without triggering `onDisconnect`.
|
// Wrap in try-catch to when the port disconnected without triggering `onDisconnect`.
|
||||||
try {
|
try {
|
||||||
this.port.postMessage(message);
|
const msg: any = message;
|
||||||
|
if (message.message instanceof EncString) {
|
||||||
|
// Alternative, backwards-compatible serialization of EncString
|
||||||
|
msg.message = {
|
||||||
|
encryptedString: message.message.encryptedString,
|
||||||
|
encryptionType: message.message.encryptionType,
|
||||||
|
data: message.message.data,
|
||||||
|
iv: message.message.iv,
|
||||||
|
mac: message.message.mac,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
this.port.postMessage(msg);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error("NativeMessaging port disconnected, disconnecting.");
|
this.logService.error("NativeMessaging port disconnected, disconnecting.");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user