Cleanup API for key.decrypt and align unit tests
This commit is contained in:
parent
1007637f39
commit
a5fdc36062
|
@ -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");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user