aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/_locales/en/messages.json3
-rw-r--r--app/scripts/metamask-controller.js37
2 files changed, 39 insertions, 1 deletions
diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json
index c4f78d121..8e119d3e4 100644
--- a/app/_locales/en/messages.json
+++ b/app/_locales/en/messages.json
@@ -339,6 +339,9 @@
"followTwitter": {
"message": "Follow us on Twitter"
},
+ "forgetDevice": {
+ "message": "Forget this device"
+ },
"from": {
"message": "From"
},
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.
*