From da0cd3d58835829c19252d69847724d6e16b6b4d Mon Sep 17 00:00:00 2001 From: Hinton Date: Fri, 23 Oct 2020 14:40:31 +0200 Subject: [PATCH] Send error when failing to decrypt message --- src/services/nativeMessaging.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/services/nativeMessaging.service.ts b/src/services/nativeMessaging.service.ts index d5a1ffc23f..d9af63998d 100644 --- a/src/services/nativeMessaging.service.ts +++ b/src/services/nativeMessaging.service.ts @@ -51,6 +51,12 @@ export class NativeMessagingService { const message = JSON.parse(await this.cryptoService.decryptToUtf8(rawMessage, this.sharedSecret)); + // Shared secret is invalidated, force re-authentication + if (message == null) { + ipcRenderer.send('nativeMessagingReply', {command: 'invalidateEncryption'}); + return; + } + if (Math.abs(message.timestamp - Date.now()) > MessageValidTimeout) { this.logService.error('NativeMessage is to old, ignoring.'); return;