Logout (#31)
* Logout ability * Logout for private key imports Co-authored-by: armaniferrante <armaniferrante@gmail.com>
This commit is contained in:
parent
086f6e2763
commit
acfe5a7faa
|
@ -9,9 +9,11 @@ import Menu from '@material-ui/core/Menu';
|
||||||
import MenuItem from '@material-ui/core/MenuItem';
|
import MenuItem from '@material-ui/core/MenuItem';
|
||||||
import { clusterApiUrl } from '@solana/web3.js';
|
import { clusterApiUrl } from '@solana/web3.js';
|
||||||
import { useWalletSelector } from '../utils/wallet';
|
import { useWalletSelector } from '../utils/wallet';
|
||||||
|
import { forgetWallet } from '../utils/wallet-seed';
|
||||||
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
||||||
import CheckIcon from '@material-ui/icons/Check';
|
import CheckIcon from '@material-ui/icons/Check';
|
||||||
import AddIcon from '@material-ui/icons/Add';
|
import AddIcon from '@material-ui/icons/Add';
|
||||||
|
import ExitToApp from '@material-ui/icons/ExitToApp';
|
||||||
import AccountIcon from '@material-ui/icons/AccountCircle';
|
import AccountIcon from '@material-ui/icons/AccountCircle';
|
||||||
import Divider from '@material-ui/core/Divider';
|
import Divider from '@material-ui/core/Divider';
|
||||||
import Hidden from '@material-ui/core/Hidden';
|
import Hidden from '@material-ui/core/Hidden';
|
||||||
|
@ -210,6 +212,12 @@ function WalletSelector() {
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
Add Account
|
Add Account
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem onClick={forgetWallet}>
|
||||||
|
<ListItemIcon className={classes.menuItemIcon}>
|
||||||
|
<ExitToApp fontSize="small" />
|
||||||
|
</ListItemIcon>
|
||||||
|
Logout
|
||||||
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
@ -130,3 +130,14 @@ function deriveImportsEncryptionKey(seed) {
|
||||||
return bip32.fromSeed(Buffer.from(seed, 'hex')).derivePath("m/10016'/0")
|
return bip32.fromSeed(Buffer.from(seed, 'hex')).derivePath("m/10016'/0")
|
||||||
.privateKey;
|
.privateKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function forgetWallet() {
|
||||||
|
localStorage.removeItem('walletIndex');
|
||||||
|
localStorage.removeItem('walletCount');
|
||||||
|
localStorage.removeItem('walletPrivateKeyImports');
|
||||||
|
localStorage.removeItem('locked');
|
||||||
|
localStorage.removeItem('unlocked');
|
||||||
|
sessionStorage.removeItem('unlocked');
|
||||||
|
unlockedMnemonicAndSeed = { mnemonic: null, seed: null, importsEncryptionKey: null };
|
||||||
|
walletSeedChanged.emit('change', unlockedMnemonicAndSeed);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue