File tree 6 files changed +36
-4
lines changed
6 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 4
4
5
5
## 3.2.1 2017-2-8
6
6
7
+ - Revert back to old style message signing.
7
8
- Fixed some build errors that were causing a variety of bugs.
8
9
9
10
## 3.2.0 2017-2-8
Original file line number Diff line number Diff line change @@ -74,7 +74,18 @@ class HdKeyring extends EventEmitter {
74
74
}
75
75
76
76
// For eth_sign, we need to sign transactions:
77
- signMessage ( withAccount , msgHex ) {
77
+ // hd
78
+ signMessage ( withAccount , data ) {
79
+ const wallet = this . _getWalletForAccount ( withAccount )
80
+ const message = ethUtil . stripHexPrefix ( data )
81
+ var privKey = wallet . getPrivateKey ( )
82
+ var msgSig = ethUtil . ecsign ( new Buffer ( message , 'hex' ) , privKey )
83
+ var rawMsgSig = ethUtil . bufferToHex ( sigUtil . concatSig ( msgSig . v , msgSig . r , msgSig . s ) )
84
+ return Promise . resolve ( rawMsgSig )
85
+ }
86
+
87
+ // For eth_sign, we need to sign transactions:
88
+ newGethSignMessage ( withAccount , msgHex ) {
78
89
const wallet = this . _getWalletForAccount ( withAccount )
79
90
const privKey = wallet . getPrivateKey ( )
80
91
const msgBuffer = ethUtil . toBuffer ( msgHex )
Original file line number Diff line number Diff line change @@ -58,7 +58,18 @@ class SimpleKeyring extends EventEmitter {
58
58
}
59
59
60
60
// For eth_sign, we need to sign transactions:
61
- signMessage ( withAccount , msgHex ) {
61
+ signMessage ( withAccount , data ) {
62
+ const wallet = this . _getWalletForAccount ( withAccount )
63
+ const message = ethUtil . stripHexPrefix ( data )
64
+ var privKey = wallet . getPrivateKey ( )
65
+ var msgSig = ethUtil . ecsign ( new Buffer ( message , 'hex' ) , privKey )
66
+ var rawMsgSig = ethUtil . bufferToHex ( sigUtil . concatSig ( msgSig . v , msgSig . r , msgSig . s ) )
67
+ return Promise . resolve ( rawMsgSig )
68
+ }
69
+
70
+ // For eth_sign, we need to sign transactions:
71
+
72
+ newGethSignMessage ( withAccount , msgHex ) {
62
73
const wallet = this . _getWalletForAccount ( withAccount )
63
74
const privKey = wallet . getPrivateKey ( )
64
75
const msgBuffer = ethUtil . toBuffer ( msgHex )
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ describe('IdManagement', function() {
16
16
} )
17
17
18
18
describe ( '#signMsg' , function ( ) {
19
- it . skip ( 'passes the dennis test' , function ( ) {
19
+ it ( 'passes the dennis test' , function ( ) {
20
20
const address = '0x9858e7d8b79fc3e6d989636721584498926da38a'
21
21
const message = '0x879a053d4800c6354e76c7985a865d2922c82fb5b3f4577b2fe08b998954f2e0'
22
22
const privateKey = '0x7dd98753d7b4394095de7d176c58128e2ed6ee600abe97c9f6d9fd65015d9b18'
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ describe('simple-keyring', function() {
55
55
const privateKey = '0x7dd98753d7b4394095de7d176c58128e2ed6ee600abe97c9f6d9fd65015d9b18'
56
56
const expectedResult = '0x28fcb6768e5110144a55b2e6ce9d1ea5a58103033632d272d2b5cf506906f7941a00b539383fd872109633d8c71c404e13dba87bc84166ee31b0e36061a69e161c'
57
57
58
- it . skip ( 'passes the dennis test' , function ( done ) {
58
+ it ( 'passes the dennis test' , function ( done ) {
59
59
keyring . deserialize ( [ privateKey ] )
60
60
. then ( ( ) => {
61
61
return keyring . signMessage ( address , message )
Original file line number Diff line number Diff line change @@ -28,6 +28,15 @@ PendingMsg.prototype.render = function () {
28
28
} ,
29
29
} , 'Sign Message' ) ,
30
30
31
+ h ( '.error' , {
32
+ style : {
33
+ margin : '10px' ,
34
+ } ,
35
+ } , `Signing this message can have
36
+ dangerous side effects. Only sign messages from
37
+ sites you fully trust with your entire account.
38
+ This will be fixed in a future version.` ) ,
39
+
31
40
// message details
32
41
h ( PendingTxDetails , state ) ,
33
42
You can’t perform that action at this time.
0 commit comments