Message signing does not work with compressed keys. ref #61

This commit is contained in:
Andreas Brekken 2014-03-11 18:25:36 +01:00
parent 3bed73da65
commit 29ad6b692e

View file

@ -30,5 +30,21 @@ describe('Message', function() {
var sig = Message.signMessage(key, msg);
assert.ok(!Message.verifyMessage(addr, sig, msg));
})
it('handles compressed keys', function() {
var key = new ECKey(hexToBytes(priv));
key.compressed = true
var addr = key.getBitcoinAddress().toString()
var sig = Message.signMessage(key, msg);
assert.ok(Message.verifyMessage(addr, sig, msg));
// wrong message
assert.ok(!Message.verifyMessage(addr, sig, 'not foobar'));
// wrong address
assert.ok(!Message.verifyMessage('1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a', sig, msg));
})
})
})