Cleanup API for key.decrypt and align unit tests

This commit is contained in:
evilaliv3 2016-04-27 16:06:52 +02:00
parent 1007637f39
commit a5fdc36062
2 changed files with 1 additions and 4 deletions

View File

@ -368,7 +368,6 @@ Key.prototype.getEncryptionKeyPacket = function() {
/**
* Encrypts all secret key and subkey packets
* @param {String} passphrase
* @return {Boolean} true if all key and subkey packets encrypted successfully
*/
Key.prototype.encrypt = function(passphrase) {
if (this.isPrivate()) {
@ -376,8 +375,6 @@ Key.prototype.encrypt = function(passphrase) {
for (var i = 0; i < keys.length; i++) {
keys[i].encrypt(passphrase);
}
} else {
throw new Error("Nothing to encrypt in a public key");
}
};

View File

@ -717,7 +717,7 @@ var pgp_desktop_priv =
expect(armor1).to.equal(armor2);
expect(key.decrypt('passphrase')).to.be.true;
expect(key.primaryKey.isDecrypted).to.be.true;
expect(key.encrypt('new_passphrase')).to.be.true;
key.encrypt('new_passphrase');
expect(key.primaryKey.isDecrypted).to.be.false;
expect(key.decrypt('passphrase')).to.be.false;
expect(key.primaryKey.isDecrypted).to.be.false;