aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-01-17 03:54:59 +0800
committerkumavis <aaron@kumavis.me>2017-01-17 03:54:59 +0800
commit82012cbbce47c691d322b290ad9e77723b289f0b (patch)
tree0d68109c274d9707e855d8a39d4e79e44c16c7ab /app
parente7cf0f4bdd537b69d27afa3c788f67b758d02c05 (diff)
downloadtangerine-wallet-browser-82012cbbce47c691d322b290ad9e77723b289f0b.tar
tangerine-wallet-browser-82012cbbce47c691d322b290ad9e77723b289f0b.tar.gz
tangerine-wallet-browser-82012cbbce47c691d322b290ad9e77723b289f0b.tar.bz2
tangerine-wallet-browser-82012cbbce47c691d322b290ad9e77723b289f0b.tar.lz
tangerine-wallet-browser-82012cbbce47c691d322b290ad9e77723b289f0b.tar.xz
tangerine-wallet-browser-82012cbbce47c691d322b290ad9e77723b289f0b.tar.zst
tangerine-wallet-browser-82012cbbce47c691d322b290ad9e77723b289f0b.zip
keyring - simple - throw error if wallet not found for address
Diffstat (limited to 'app')
-rw-r--r--app/scripts/keyrings/simple.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/scripts/keyrings/simple.js b/app/scripts/keyrings/simple.js
index 6f4512b70..6b16137ae 100644
--- a/app/scripts/keyrings/simple.js
+++ b/app/scripts/keyrings/simple.js
@@ -54,6 +54,7 @@ class SimpleKeyring extends EventEmitter {
// For eth_sign, we need to sign transactions:
signMessage (withAccount, data) {
const wallet = this._getWalletForAccount(withAccount)
+
const message = ethUtil.removeHexPrefix(data)
var privKey = wallet.getPrivateKey()
var msgSig = ethUtil.ecsign(new Buffer(message, 'hex'), privKey)
@@ -70,7 +71,9 @@ class SimpleKeyring extends EventEmitter {
/* PRIVATE METHODS */
_getWalletForAccount (account) {
- return this.wallets.find(w => ethUtil.bufferToHex(w.getAddress()) === account)
+ let wallet = this.wallets.find(w => ethUtil.bufferToHex(w.getAddress()) === account)
+ if (!wallet) throw new Error('Simple Keyring - Unable to find matching address.')
+ return wallet
}
}