|
|
@ -24,13 +24,13 @@ describe('Message', function() { |
|
|
|
fixtures.valid.verify.forEach(function(f) { |
|
|
|
var network = networks[f.network] |
|
|
|
|
|
|
|
var s1 = new Buffer(f.signature, 'base64') |
|
|
|
assert.ok(Message.verify(f.address, s1, f.message, network)) |
|
|
|
var signature = new Buffer(f.signature, 'base64') |
|
|
|
assert.ok(Message.verify(f.address, signature, f.message, network)) |
|
|
|
|
|
|
|
if (f.compressed) { |
|
|
|
var s2 = new Buffer(f.compressed.signature, 'base64') |
|
|
|
var compressedSignature = new Buffer(f.compressed.signature, 'base64') |
|
|
|
|
|
|
|
assert.ok(Message.verify(f.compressed.address, s2, f.message, network)) |
|
|
|
assert.ok(Message.verify(f.compressed.address, compressedSignature, f.message, network)) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -48,15 +48,15 @@ describe('Message', function() { |
|
|
|
it(f.description, function() { |
|
|
|
var network = networks[f.network] |
|
|
|
|
|
|
|
var k1 = new ECKey(new BigInteger(f.D), false) |
|
|
|
var s1 = Message.sign(k1, f.message, network) |
|
|
|
assert.equal(s1.toString('base64'), f.signature) |
|
|
|
var privKey = new ECKey(new BigInteger(f.D), false) |
|
|
|
var signature = Message.sign(privKey, f.message, network) |
|
|
|
assert.equal(signature.toString('base64'), f.signature) |
|
|
|
|
|
|
|
if (f.compressed) { |
|
|
|
var k2 = new ECKey(new BigInteger(f.D)) |
|
|
|
var s2 = Message.sign(k2, f.message) |
|
|
|
var compressedPrivKey = new ECKey(new BigInteger(f.D)) |
|
|
|
var compressedSignature = Message.sign(compressedPrivKey, f.message) |
|
|
|
|
|
|
|
assert.equal(s2.toString('base64'), f.compressed.signature) |
|
|
|
assert.equal(compressedSignature.toString('base64'), f.compressed.signature) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|