|
|
@ -15,37 +15,6 @@ describe('Message', function() { |
|
|
|
should.exist(message); |
|
|
|
}); |
|
|
|
|
|
|
|
describe('#sign', function() { |
|
|
|
var messagebuf = new Buffer('this is my message'); |
|
|
|
var key = Key().fromRandom(); |
|
|
|
|
|
|
|
it('should sign a message', function() { |
|
|
|
var message = new Message(); |
|
|
|
message.messagebuf = messagebuf; |
|
|
|
message.key = key; |
|
|
|
message.sign(); |
|
|
|
var sig = message.sig; |
|
|
|
should.exist(sig); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
describe('#verify', function() { |
|
|
|
var messagebuf = new Buffer('this is my message'); |
|
|
|
var key = Key().fromRandom(); |
|
|
|
|
|
|
|
it('should verify a message that was just signed', function() { |
|
|
|
var message = new Message(); |
|
|
|
message.messagebuf = messagebuf; |
|
|
|
message.key = key; |
|
|
|
message.address = Address().fromPubkey(key.pubkey); |
|
|
|
message.sign(); |
|
|
|
message.verify(); |
|
|
|
message.verified.should.equal(true); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
describe('@sign', function() { |
|
|
|
var messagebuf = new Buffer('this is my message'); |
|
|
|
var key = Key().fromRandom(); |
|
|
@ -95,4 +64,35 @@ describe('Message', function() { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
describe('#sign', function() { |
|
|
|
var messagebuf = new Buffer('this is my message'); |
|
|
|
var key = Key().fromRandom(); |
|
|
|
|
|
|
|
it('should sign a message', function() { |
|
|
|
var message = new Message(); |
|
|
|
message.messagebuf = messagebuf; |
|
|
|
message.key = key; |
|
|
|
message.sign(); |
|
|
|
var sig = message.sig; |
|
|
|
should.exist(sig); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
describe('#verify', function() { |
|
|
|
var messagebuf = new Buffer('this is my message'); |
|
|
|
var key = Key().fromRandom(); |
|
|
|
|
|
|
|
it('should verify a message that was just signed', function() { |
|
|
|
var message = new Message(); |
|
|
|
message.messagebuf = messagebuf; |
|
|
|
message.key = key; |
|
|
|
message.address = Address().fromPubkey(key.pubkey); |
|
|
|
message.sign(); |
|
|
|
message.verify(); |
|
|
|
message.verified.should.equal(true); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|