aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/keyrings/hd.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/keyrings/hd.js')
-rw-r--r--app/scripts/keyrings/hd.js13
1 files changed, 12 insertions, 1 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)