|
|
@ -26,29 +26,25 @@ describe('Message', function() { |
|
|
|
var network = networks[f.network] |
|
|
|
|
|
|
|
var address = Address.fromBase58Check(f.address) |
|
|
|
var signature = new Buffer(f.signature, 'base64') |
|
|
|
assert.ok(Message.verify(address, signature, f.message, network)) |
|
|
|
assert(Message.verify(address, f.signature, f.message, network)) |
|
|
|
}) |
|
|
|
|
|
|
|
fixtures.valid.verify.forEach(function(f) { |
|
|
|
it('verifies a valid signature for \"' + f.message + '\" (' + f.network + ')', function() { |
|
|
|
var network = networks[f.network] |
|
|
|
|
|
|
|
var signature = new Buffer(f.signature, 'base64') |
|
|
|
assert.ok(Message.verify(f.address, signature, f.message, network)) |
|
|
|
var signature = f.signature |
|
|
|
assert(Message.verify(f.address, f.signature, f.message, network)) |
|
|
|
|
|
|
|
if (f.compressed) { |
|
|
|
var compressedSignature = new Buffer(f.compressed.signature, 'base64') |
|
|
|
|
|
|
|
assert.ok(Message.verify(f.compressed.address, compressedSignature, f.message, network)) |
|
|
|
assert(Message.verify(f.compressed.address, f.compressed.signature, f.message, network)) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
fixtures.invalid.verify.forEach(function(f) { |
|
|
|
it(f.description, function() { |
|
|
|
var signature = new Buffer(f.signature, 'base64') |
|
|
|
assert.ok(!Message.verify(f.address, signature, f.message)) |
|
|
|
assert(!Message.verify(f.address, f.signature, f.message)) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|