diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-03-08 03:43:59 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-03-08 03:43:59 +0800 |
commit | fba7a50e1bad007a94badf990e5ad661d4049409 (patch) | |
tree | 6df7eca08b4a706b7c81f0e2876b31f3f5af1a5f | |
parent | 6253885e286a554736e2e51736a742d39a377727 (diff) | |
download | tangerine-wallet-browser-fba7a50e1bad007a94badf990e5ad661d4049409.tar tangerine-wallet-browser-fba7a50e1bad007a94badf990e5ad661d4049409.tar.gz tangerine-wallet-browser-fba7a50e1bad007a94badf990e5ad661d4049409.tar.bz2 tangerine-wallet-browser-fba7a50e1bad007a94badf990e5ad661d4049409.tar.lz tangerine-wallet-browser-fba7a50e1bad007a94badf990e5ad661d4049409.tar.xz tangerine-wallet-browser-fba7a50e1bad007a94badf990e5ad661d4049409.tar.zst tangerine-wallet-browser-fba7a50e1bad007a94badf990e5ad661d4049409.zip |
Fixed encoding
-rw-r--r-- | app/scripts/lib/personal-message-manager.js | 15 | ||||
-rw-r--r-- | test/unit/personal-message-manager-test.js | 2 |
2 files changed, 2 insertions, 15 deletions
diff --git a/app/scripts/lib/personal-message-manager.js b/app/scripts/lib/personal-message-manager.js index ddc3ee39c..bbc978446 100644 --- a/app/scripts/lib/personal-message-manager.js +++ b/app/scripts/lib/personal-message-manager.js @@ -118,21 +118,8 @@ module.exports = class PersonalMessageManager extends EventEmitter{ log.debug(`Message was not hex encoded, interpreting as utf8.`) } - return this.hexEncode(data) - } - - hexEncode(text){ - var hex, i - - var result = '' - for (i = 0; i < text.length; i++) { - hex = text.charCodeAt(i).toString(16) - result += ('000' + hex).slice(-4) - } - return '0x' + result + return ethUtil.bufferToHex(new Buffer(data, 'utf8')) } } - - diff --git a/test/unit/personal-message-manager-test.js b/test/unit/personal-message-manager-test.js index 41ac3db87..f2c01392c 100644 --- a/test/unit/personal-message-manager-test.js +++ b/test/unit/personal-message-manager-test.js @@ -91,7 +91,7 @@ describe('Personal Message Manager', function() { it('converts text to a utf8 hex string', function() { var input = 'hello' var output = messageManager.normalizeMsgData(input) - assert.equal(output, '0x00680065006c006c006f', 'predictably hex encoded') + assert.equal(output, '0x68656c6c6f', 'predictably hex encoded') }) it('tolerates a hex prefix', function() { |