Added a test to verify that a previosly encrypted message can be decrypted.
This commit is contained in:
parent
afcd0e1662
commit
f0dedd7ef9
|
@ -35,7 +35,8 @@ describe('bitauth', function() {
|
||||||
var contract = 'keyboard cat';
|
var contract = 'keyboard cat';
|
||||||
var secret = 'o hai, nsa. how i do teh cryptos?';
|
var secret = 'o hai, nsa. how i do teh cryptos?';
|
||||||
var password = 's4705hiru13z!';
|
var password = 's4705hiru13z!';
|
||||||
|
var encryptedSecret = '291Dm9unZMwfxBA7BEHiQsraRxCrMRqwJ2TjCWwEH3Sp5QGMehNFNgZLo62sgF5Khe';
|
||||||
|
|
||||||
// signature from generate keys
|
// signature from generate keys
|
||||||
var signature = null;
|
var signature = null;
|
||||||
var enc = null;
|
var enc = null;
|
||||||
|
@ -177,6 +178,14 @@ describe('bitauth', function() {
|
||||||
it('should decrypt the secret message', function(done) {
|
it('should decrypt the secret message', function(done) {
|
||||||
var dec = bitauth.decrypt(password, enc);
|
var dec = bitauth.decrypt(password, enc);
|
||||||
should.exist(dec);
|
should.exist(dec);
|
||||||
|
dec.should.equal(secret);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should decrypt a previously known message', function(done) {
|
||||||
|
var dec = bitauth.decrypt(password, encryptedSecret);
|
||||||
|
should.exist(dec);
|
||||||
|
dec.should.equal(secret);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue