diff --git a/src/message.js b/src/message.js index 9582dec..56a4324 100644 --- a/src/message.js +++ b/src/message.js @@ -42,12 +42,12 @@ function sign(key, message) { sig = [i].concat(rBa, sBa) - return convert.bytesToHex(sig) + return sig } function verify(address, sig, message) { address = new Address(address) - sig = ecdsa.parseSigCompact(convert.hexToBytes(sig)) + sig = ecdsa.parseSigCompact(sig) var isCompressed = !!(sig.i & 4) var hash = magicHash(message) diff --git a/test/message.js b/test/message.js index ef60c9c..81c1bbe 100644 --- a/test/message.js +++ b/test/message.js @@ -10,14 +10,14 @@ describe('Message', function() { describe('verify', function(){ it('works for mainnet address, messaged signed with uncompressed key', function() { var addr = '16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM'; - var sig = '1bc25ac0fb503abc9bad23f558742740fafaec1f52deaaf106b9759a5ce84c93921c4a669c5ec3dfeb7e2d7d177a2f49db407900874f6de2f701a4c16783776d8d' + var sig = convert.hexToBytes('1bc25ac0fb503abc9bad23f558742740fafaec1f52deaaf106b9759a5ce84c93921c4a669c5ec3dfeb7e2d7d177a2f49db407900874f6de2f701a4c16783776d8d') assert.ok(Message.verify(addr, sig, msg)); verifyNegativeCases(addr, sig, msg) }) it('works for testnet address, message signed with compressed key', function() { var addr = 'mgdnNWji2bXYSi7E9c1DQBSp64kCemaS7V' - var sig = '1feece860e952253ddf465cd1c5aea76ab16287aee093be6f67d196c39f5075436f0407a4e50694e6956c06108fab8608debf9554d75e57c110f7c512a6eb15d0a' + var sig = convert.hexToBytes('1feece860e952253ddf465cd1c5aea76ab16287aee093be6f67d196c39f5075436f0407a4e50694e6956c06108fab8608debf9554d75e57c110f7c512a6eb15d0a') assert(Message.verify(addr, sig, msg)) verifyNegativeCases(addr, sig, msg)