From 85a29ce3ae9495f2a2d6772f9f71289a0ddb8448 Mon Sep 17 00:00:00 2001 From: jhl-alameda Date: Mon, 26 Apr 2021 21:37:59 +0800 Subject: [PATCH] clear background mnemonic on logout --- src/utils/wallet-seed.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/utils/wallet-seed.js b/src/utils/wallet-seed.js index 0efde67..54602dc 100644 --- a/src/utils/wallet-seed.js +++ b/src/utils/wallet-seed.js @@ -136,11 +136,17 @@ export async function storeMnemonicAndSeed( }), ); localStorage.removeItem('unlocked'); - sessionStorage.removeItem('unlocked'); } else { localStorage.setItem('unlocked', plaintext); localStorage.removeItem('locked'); - sessionStorage.removeItem('unlocked'); + } + sessionStorage.removeItem('unlocked'); + if (isExtension) { + chrome.runtime.sendMessage({ + channel: 'sollet_extension_mnemonic_channel', + method: 'set', + data: '', + }); } const importsEncryptionKey = deriveImportsEncryptionKey(seed); setUnlockedMnemonicAndSeed( @@ -217,6 +223,13 @@ function deriveImportsEncryptionKey(seed) { export function forgetWallet() { localStorage.clear(); sessionStorage.removeItem('unlocked'); + if (isExtension) { + chrome.runtime.sendMessage({ + channel: 'sollet_extension_mnemonic_channel', + method: 'set', + data: '', + }); + } unlockedMnemonicAndSeed = { mnemonic: null, seed: null,