From c1b099f5dabe73272f18e16b6ff184d71cfcd4dd Mon Sep 17 00:00:00 2001 From: Hinton Date: Fri, 23 Oct 2020 14:40:50 +0200 Subject: [PATCH] Handle invalidatedEncrytption message --- src/_locales/en/messages.json | 8 +++++++- src/background/nativeMessaging.background.ts | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index a2f748cae72..028715b0542 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -1389,5 +1389,11 @@ }, "errorEnableBiometricDesc": { "message": "Action was canceld by the desktop applicaiton." - } + }, + "nativeMessagingInvalidEncryptionDesc": { + "message": "Desktop application invalidated the secure communication channel. Please retry this operation" + }, + "nativeMessagingInvalidEncryptionTitle": { + "message": "Desktop communication interupted" + } } diff --git a/src/background/nativeMessaging.background.ts b/src/background/nativeMessaging.background.ts index 562fd21b31a..92cb691bdb7 100644 --- a/src/background/nativeMessaging.background.ts +++ b/src/background/nativeMessaging.background.ts @@ -62,6 +62,17 @@ export class NativeMessagingBackground { this.sharedSecret = new SymmetricCryptoKey(decrypted); this.secureSetupResolve(); break; + case 'invalidateEncryption': + this.sharedSecret = null; + this.privateKey = null; + this.connected = false; + + this.messagingService.send('showDialog', { + text: this.i18nService.t('nativeMessagingInvalidEncryptionDesc'), + title: this.i18nService.t('nativeMessagingInvalidEncryptionTitle'), + confirmText: this.i18nService.t('ok'), + type: 'error', + }); default: this.onMessage(message); } @@ -83,6 +94,8 @@ export class NativeMessagingBackground { type: 'error', }); } + this.sharedSecret = null; + this.privateKey = null; this.connected = false; reject(); });