Extend error logging

This commit is contained in:
Thomas Oberndörfer
2019-03-06 09:52:08 +01:00
parent 9db75f4034
commit cee14ba99c
4 changed files with 28 additions and 10 deletions

View File

@@ -82,9 +82,13 @@ class Email {
* @return {string} the encrypted PGP message block
*/
async _pgpEncrypt(plaintext, publicKeyArmored) {
const {keys, err} = await openpgp.key.readArmored(publicKeyArmored);
if (err) {
log.error('email', 'Reading armored key failed.', err, publicKeyArmored);
}
const ciphertext = await openpgp.encrypt({
message: openpgp.message.fromText(plaintext),
publicKeys: (await openpgp.key.readArmored(publicKeyArmored)).keys,
publicKeys: keys,
});
return ciphertext.data;
}