Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Commit

Permalink
Merge branch 'mercury' of github.com:kvhnuke/etherwallet into mercury
Browse files Browse the repository at this point in the history
  • Loading branch information
gamalielhere committed Sep 21, 2018
2 parents 7811a11 + 9126fb2 commit fa48c16
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
26 changes: 14 additions & 12 deletions app/scripts/controllers/signMsgCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,21 @@ var signMsgCtrl = function($scope, $sce, walletService) {
var connectApp = new MewConnectEth();
var mewConnect = MewConnect.instance;
connectApp.setMewConnect(mewConnect);
mewConnect.on('signMessage', (data) =>{
$scope.signMsg.signedMsg = JSON.parse(data);
$scope.notifier.success('Successfully Signed Message with ' + $scope.wallet.getAddressString());
})
mewConnect.on('sign', (data) =>{
$scope.signMsg.signedMsg = JSON.parse(data);
mewConnect.on('signMessage', function(data) {
$scope.signMsg.signedMsg = JSON.stringify({
address: $scope.wallet.getAddressString(),
msg: thisMessage,
sig: data.sig,
version: '3',
signer: 'MEW'
}, null, 2);
$scope.notifier.success('Successfully Signed Message with ' + $scope.wallet.getAddressString());
})
//TODO hash message before send. Currently sending as plain text
ethUtil.hashPersonalMessage(ethUtil.toBuffer(thisMessage)).toString('hex')
connectApp.signMessage(thisMessage);
});
var hashedMessage = ethUtil.hashPersonalMessage(ethUtil.toBuffer(thisMessage)).toString('hex');
connectApp.signMessage({
hash: hashedMessage,
text: thisMessage
});

//================= Mew Connect (end)==============================

Expand Down Expand Up @@ -233,9 +237,7 @@ var signMsgCtrl = function($scope, $sce, walletService) {
}

$scope.reOpenDecryptWalletMEWconnect = function () {
if ($scope.globalService.currentTab === 11) {
$scope.wd = false
}
}
globalFuncs.MEWconnectStatus.registerDecryptOpeners($scope.reOpenDecryptWalletMEWconnect.bind(this))

Expand Down
6 changes: 2 additions & 4 deletions app/scripts/staticJS/mewConnectEth.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ class MewConnectEth {
this.comm.sendRtcMessage('signTx', JSON.stringify(sendTxData));
}

signMessage(messageHex) {
var self = this;
var hashToSign = ethUtil.hashPersonalMessage(ethUtil.toBuffer(messageHex));
self.comm.sendRtcMessage('signMessage', hashToSign.toString('hex'));
signMessage(message) {
this.comm.sendRtcMessage('signMessage', message);
}

static getBrowserRTC() {
Expand Down

0 comments on commit fa48c16

Please sign in to comment.