Cleanup _pgpEncrypt

Signed-off-by: Georg Pfuetzenreuter <georg.pfuetzenreuter@suse.com>
This commit is contained in:
Georg Pfuetzenreuter 2022-07-05 15:35:22 +02:00
parent f49a3ac1ff
commit 4c8f31ffb0
No known key found for this signature in database
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -81,12 +81,11 @@ class Email {
* @return {string} the encrypted PGP message block
*/
async _pgpEncrypt(plaintext, publicKeyArmored) {
//const {keys: [key], err} =
let key;
try {
key = await openpgp.readKey({armoredKey: publicKeyArmored});
} catch (err) {
log.error('email', 'Reading armored key failed.', err, publicKeyArmored);
let key;
try {
key = await openpgp.readKey({armoredKey: publicKeyArmored});
} catch (err) {
log.error('email', 'Reading armored key failed.', err, publicKeyArmored);
}
const now = new Date();
// set message creation date if key has been created with future creation date