Merge pull request #266 from dcousens/mesb64
Message: allow base64 strings as input
This commit is contained in:
commit
43d135c4b3
4 changed files with 15 additions and 14 deletions
src
|
@ -35,14 +35,19 @@ function sign(privKey, message, network) {
|
|||
}
|
||||
|
||||
// TODO: network could be implied from address
|
||||
function verify(address, signatureBuffer, message, network) {
|
||||
function verify(address, signature, message, network) {
|
||||
if (!Buffer.isBuffer(signature)) {
|
||||
signature = new Buffer(signature, 'base64')
|
||||
}
|
||||
|
||||
if (address instanceof Address) {
|
||||
address = address.toString()
|
||||
}
|
||||
|
||||
network = network || networks.bitcoin
|
||||
|
||||
var hash = magicHash(message, network)
|
||||
var parsed = ECSignature.parseCompact(signatureBuffer)
|
||||
var parsed = ECSignature.parseCompact(signature)
|
||||
var e = BigInteger.fromBuffer(hash)
|
||||
var Q = ecdsa.recoverPubKey(ecparams, e, parsed.signature, parsed.i)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue