Skip to content

Commit

Permalink
Use Array.includes
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobar79 authored Nov 26, 2018
1 parent fb94c1b commit f206643
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const seedPhraseVerifier = require('./lib/seed-phrase-verifier')
const log = require('loglevel')
const TrezorKeyring = require('eth-trezor-keyring')
const LedgerBridgeKeyring = require('eth-ledger-bridge-keyring')
const HW_WALLETS_KEYRINGS = [TrezorKeyring.type, LedgerBridgeKeyring.type]
const EthQuery = require('eth-query')
const ethUtil = require('ethereumjs-util')
const sigUtil = require('eth-sig-util')
Expand Down Expand Up @@ -1021,15 +1022,14 @@ module.exports = class MetamaskController extends EventEmitter {
log.info('MetaMaskController - eth_signTypedData')
const msgId = msgParams.metamaskId
const version = msgParams.version
const HW_WALLETS_KEYRINGS = [TrezorKeyring.type, LedgerBridgeKeyring.type]
try {
const cleanMsgParams = await this.typedMessageManager.approveMessage(msgParams)
const address = sigUtil.normalize(cleanMsgParams.from)
const keyring = await this.keyringController.getKeyringForAccount(address)
let signature
// HW Wallet keyrings don't expose private keys so
// we need to handle it separately
if (HW_WALLETS_KEYRINGS.indexOf(keyring.type) === -1) {
// HW Wallet keyrings don't expose private keys
// so we need to handle it separately
if (!HW_WALLETS_KEYRINGS.includes(keyring.type)) {
const wallet = keyring._getWalletForAccount(address)
const privKey = ethUtil.toBuffer(wallet.getPrivateKey())
switch (version) {
Expand Down

0 comments on commit f206643

Please sign in to comment.