Merge pull request #1105 from MetaMask/rollbackEthSighn

Rollback eth sign
feature/default_network_editable
kumavis 8 years ago committed by GitHub
commit 81a289cc5f
  1. 1
      CHANGELOG.md
  2. 13
      app/scripts/keyrings/hd.js
  3. 13
      app/scripts/keyrings/simple.js
  4. 2
      test/unit/id-management-test.js
  5. 2
      test/unit/keyrings/simple-test.js
  6. 9
      ui/app/components/pending-msg.js

@ -4,6 +4,7 @@
## 3.2.1 2017-2-8
- Revert back to old style message signing.
- Fixed some build errors that were causing a variety of bugs.
## 3.2.0 2017-2-8

@ -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)

@ -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)

@ -16,7 +16,7 @@ describe('IdManagement', function() {
})
describe('#signMsg', function () {
it.skip('passes the dennis test', function() {
it('passes the dennis test', function() {
const address = '0x9858e7d8b79fc3e6d989636721584498926da38a'
const message = '0x879a053d4800c6354e76c7985a865d2922c82fb5b3f4577b2fe08b998954f2e0'
const privateKey = '0x7dd98753d7b4394095de7d176c58128e2ed6ee600abe97c9f6d9fd65015d9b18'

@ -55,7 +55,7 @@ describe('simple-keyring', function() {
const privateKey = '0x7dd98753d7b4394095de7d176c58128e2ed6ee600abe97c9f6d9fd65015d9b18'
const expectedResult = '0x28fcb6768e5110144a55b2e6ce9d1ea5a58103033632d272d2b5cf506906f7941a00b539383fd872109633d8c71c404e13dba87bc84166ee31b0e36061a69e161c'
it.skip('passes the dennis test', function(done) {
it('passes the dennis test', function(done) {
keyring.deserialize([ privateKey ])
.then(() => {
return keyring.signMessage(address, message)

@ -28,6 +28,15 @@ PendingMsg.prototype.render = function () {
},
}, 'Sign Message'),
h('.error', {
style: {
margin: '10px',
},
}, `Signing this message can have
dangerous side effects. Only sign messages from
sites you fully trust with your entire account.
This will be fixed in a future version.`),
// message details
h(PendingTxDetails, state),

Loading…
Cancel
Save