aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-02-10 10:17:14 +0800
committerGitHub <noreply@github.com>2017-02-10 10:17:14 +0800
commit81a289cc5f024ab3aea86e062989fa5ff80af36e (patch)
tree4a2bc0b950351c59e0d2853a0545cdddd9f7a45f /app
parentbd34d53c84b450a48074175214720c886a4ee118 (diff)
parent26cd66cb6264c714ddeb924127921581fa58d558 (diff)
downloadtangerine-wallet-browser-81a289cc5f024ab3aea86e062989fa5ff80af36e.tar
tangerine-wallet-browser-81a289cc5f024ab3aea86e062989fa5ff80af36e.tar.gz
tangerine-wallet-browser-81a289cc5f024ab3aea86e062989fa5ff80af36e.tar.bz2
tangerine-wallet-browser-81a289cc5f024ab3aea86e062989fa5ff80af36e.tar.lz
tangerine-wallet-browser-81a289cc5f024ab3aea86e062989fa5ff80af36e.tar.xz
tangerine-wallet-browser-81a289cc5f024ab3aea86e062989fa5ff80af36e.tar.zst
tangerine-wallet-browser-81a289cc5f024ab3aea86e062989fa5ff80af36e.zip
Merge pull request #1105 from MetaMask/rollbackEthSighn
Rollback eth sign
Diffstat (limited to 'app')
-rw-r--r--app/scripts/keyrings/hd.js13
-rw-r--r--app/scripts/keyrings/simple.js13
2 files changed, 24 insertions, 2 deletions
diff --git a/app/scripts/keyrings/hd.js b/app/scripts/keyrings/hd.js
index 2e3b74192..7b10f925a 100644
--- a/app/scripts/keyrings/hd.js
+++ b/app/scripts/keyrings/hd.js
@@ -74,7 +74,18 @@ class HdKeyring extends EventEmitter {
}
// For eth_sign, we need to sign transactions:
- signMessage (withAccount, msgHex) {
+ // hd
+ signMessage (withAccount, data) {
+ const wallet = this._getWalletForAccount(withAccount)
+ const message = ethUtil.stripHexPrefix(data)
+ var privKey = wallet.getPrivateKey()
+ var msgSig = ethUtil.ecsign(new Buffer(message, 'hex'), privKey)
+ var rawMsgSig = ethUtil.bufferToHex(sigUtil.concatSig(msgSig.v, msgSig.r, msgSig.s))
+ return Promise.resolve(rawMsgSig)
+ }
+
+ // For eth_sign, we need to sign transactions:
+ newGethSignMessage (withAccount, msgHex) {
const wallet = this._getWalletForAccount(withAccount)
const privKey = wallet.getPrivateKey()
const msgBuffer = ethUtil.toBuffer(msgHex)
diff --git a/app/scripts/keyrings/simple.js b/app/scripts/keyrings/simple.js
index fa8e9fd78..b6ffc606e 100644
--- a/app/scripts/keyrings/simple.js
+++ b/app/scripts/keyrings/simple.js
@@ -58,7 +58,18 @@ class SimpleKeyring extends EventEmitter {
}
// For eth_sign, we need to sign transactions:
- signMessage (withAccount, msgHex) {
+ signMessage (withAccount, data) {
+ const wallet = this._getWalletForAccount(withAccount)
+ const message = ethUtil.stripHexPrefix(data)
+ var privKey = wallet.getPrivateKey()
+ var msgSig = ethUtil.ecsign(new Buffer(message, 'hex'), privKey)
+ var rawMsgSig = ethUtil.bufferToHex(sigUtil.concatSig(msgSig.v, msgSig.r, msgSig.s))
+ return Promise.resolve(rawMsgSig)
+ }
+
+ // For eth_sign, we need to sign transactions:
+
+ newGethSignMessage (withAccount, msgHex) {
const wallet = this._getWalletForAccount(withAccount)
const privKey = wallet.getPrivateKey()
const msgBuffer = ethUtil.toBuffer(msgHex)