aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-02-10 09:31:44 +0800
committerFrankie <frankie.diamond@gmail.com>2017-02-10 09:32:49 +0800
commitde6455151e3861a36134ab7f92180f571d55f7dc (patch)
treee5dfdd224605b5289ea2064d3f3beaeec4098603 /app/scripts
parentbd34d53c84b450a48074175214720c886a4ee118 (diff)
downloadtangerine-wallet-browser-de6455151e3861a36134ab7f92180f571d55f7dc.tar
tangerine-wallet-browser-de6455151e3861a36134ab7f92180f571d55f7dc.tar.gz
tangerine-wallet-browser-de6455151e3861a36134ab7f92180f571d55f7dc.tar.bz2
tangerine-wallet-browser-de6455151e3861a36134ab7f92180f571d55f7dc.tar.lz
tangerine-wallet-browser-de6455151e3861a36134ab7f92180f571d55f7dc.tar.xz
tangerine-wallet-browser-de6455151e3861a36134ab7f92180f571d55f7dc.tar.zst
tangerine-wallet-browser-de6455151e3861a36134ab7f92180f571d55f7dc.zip
Revert old style message sighing
Diffstat (limited to 'app/scripts')
-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)