Simplify code-flow of Key.encrypt

This commit is contained in:
evilaliv3 2016-04-28 15:59:55 +02:00
parent a5fdc36062
commit 0d93127186

View File

@ -370,12 +370,14 @@ Key.prototype.getEncryptionKeyPacket = function() {
* @param {String} passphrase
*/
Key.prototype.encrypt = function(passphrase) {
if (this.isPrivate()) {
if (!this.isPrivate()) {
throw new Error("Nothing to encrypt in a public key");
}
var keys = this.getAllKeyPackets();
for (var i = 0; i < keys.length; i++) {
keys[i].encrypt(passphrase);
}
}
};
/**