Browse Source

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

hk-custom-address
Andreas Brekken 11 years ago
parent
commit
29ad6b692e
  1. 16
      test/message.js

16
test/message.js

@ -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));
})
})
})

Loading…
Cancel
Save