Simplify code-flow of Key.encrypt
This commit is contained in:
parent
a5fdc36062
commit
0d93127186
12
src/key.js
12
src/key.js
|
@ -370,11 +370,13 @@ Key.prototype.getEncryptionKeyPacket = function() {
|
||||||
* @param {String} passphrase
|
* @param {String} passphrase
|
||||||
*/
|
*/
|
||||||
Key.prototype.encrypt = function(passphrase) {
|
Key.prototype.encrypt = function(passphrase) {
|
||||||
if (this.isPrivate()) {
|
if (!this.isPrivate()) {
|
||||||
var keys = this.getAllKeyPackets();
|
throw new Error("Nothing to encrypt in a public key");
|
||||||
for (var i = 0; i < keys.length; i++) {
|
}
|
||||||
keys[i].encrypt(passphrase);
|
|
||||||
}
|
var keys = this.getAllKeyPackets();
|
||||||
|
for (var i = 0; i < keys.length; i++) {
|
||||||
|
keys[i].encrypt(passphrase);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user