Browse Source

message: remove unnecessary verbosity

hk-custom-address
Daniel Cousens 10 years ago
parent
commit
98bc1685b3
  1. 7
      src/message.js

7
src/message.js

@ -3,7 +3,6 @@ var crypto = require('./crypto')
var ecdsa = require('./ecdsa') var ecdsa = require('./ecdsa')
var networks = require('./networks') var networks = require('./networks')
var Address = require('./address')
var BigInteger = require('bigi') var BigInteger = require('bigi')
var ECPubKey = require('./ecpubkey') var ECPubKey = require('./ecpubkey')
var ECSignature = require('./ecsignature') var ECSignature = require('./ecsignature')
@ -38,10 +37,6 @@ function verify(address, signature, message, network) {
signature = new Buffer(signature, 'base64') signature = new Buffer(signature, 'base64')
} }
if (address instanceof Address) {
address = address.toString()
}
network = network || networks.bitcoin network = network || networks.bitcoin
var hash = magicHash(message, network) var hash = magicHash(message, network)
@ -50,7 +45,7 @@ function verify(address, signature, message, network) {
var Q = ecdsa.recoverPubKey(ecparams, e, parsed.signature, parsed.i) var Q = ecdsa.recoverPubKey(ecparams, e, parsed.signature, parsed.i)
var pubKey = new ECPubKey(Q, parsed.compressed) var pubKey = new ECPubKey(Q, parsed.compressed)
return pubKey.getAddress(network).toString() === address return pubKey.getAddress(network).toString() === address.toString()
} }
module.exports = { module.exports = {

Loading…
Cancel
Save