mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Revert old style message sighing
This commit is contained in:
parent
bd34d53c84
commit
de6455151e
@ -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…
Reference in New Issue
Block a user