diff options
author | brunobar79 <brunobar79@gmail.com> | 2018-07-12 09:21:36 +0800 |
---|---|---|
committer | brunobar79 <brunobar79@gmail.com> | 2018-07-12 09:21:36 +0800 |
commit | 80e875308b4447ed38d7e0f677570d73956dd9de (patch) | |
tree | fb2f0bdf95c6358295e3894b8302867bc8a16d51 /app/scripts | |
parent | 89cc48789af2bb6f0925384abe4d4a53179a3956 (diff) | |
download | tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar.gz tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar.bz2 tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar.lz tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar.xz tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar.zst tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.zip |
forget device and autiload account features added
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/metamask-controller.js | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index cd6fdcc37..b8b7c38e4 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -357,8 +357,12 @@ module.exports = class MetamaskController extends EventEmitter { removeAccount: nodeify(this.removeAccount, this), importAccountWithStrategy: nodeify(this.importAccountWithStrategy, this), - // trezor + // hardware wallets connectHardware: nodeify(this.connectHardware, this), + forgetDevice: nodeify(this.forgetDevice, this), + checkHardwareStatus: nodeify(this.checkHardwareStatus, this), + + // TREZOR unlockTrezorAccount: nodeify(this.unlockTrezorAccount, this), // vault management @@ -561,6 +565,37 @@ module.exports = class MetamaskController extends EventEmitter { } } + async checkHardwareStatus (deviceName) { + + switch (deviceName) { + case 'trezor': + const keyringController = this.keyringController + const keyring = await keyringController.getKeyringsByType( + 'Trezor Hardware' + )[0] + if (!keyring) { + return false + } + return keyring.isUnlocked() + } + } + + async forgetDevice (deviceName) { + + switch (deviceName) { + case 'trezor': + const keyringController = this.keyringController + const keyring = await keyringController.getKeyringsByType( + 'Trezor Hardware' + )[0] + if (!keyring) { + return false + } + keyring.forgetDevice() + return true + } + } + /** * Imports an account from a trezor device. * |