build(deps): bump openpgp from 5.0.0-1 to 5.0.0-2 (#1565)

This commit is contained in:
TheCatLady
2021-05-04 05:23:20 -04:00
committed by GitHub
parent 26580eaa21
commit f8b2c3c1b1
3 changed files with 13 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
import crypto from 'crypto';
import * as openpgp from 'openpgp';
import { Transform, TransformCallback } from 'stream';
import crypto from 'crypto';
interface EncryptorOptions {
signingKey?: string;
@@ -54,7 +54,8 @@ class PGPEncryptor extends Transform {
privateKey = await openpgp.readKey({
armoredKey: this._signingKey,
});
await privateKey.decrypt(this._password);
await openpgp.decryptKey({ privateKey, passphrase: this._password });
}
const emailPartDelimiter = '\r\n\r\n';
@@ -128,11 +129,12 @@ class PGPEncryptor extends Transform {
.join('\r\n');
const encryptedMessage = await openpgp.encrypt({
message: openpgp.Message.fromText(
contentHeadersRaw +
message: await openpgp.createMessage({
text:
contentHeadersRaw +
emailPartDelimiter +
messageParts.join(emailPartDelimiter)
),
messageParts.join(emailPartDelimiter),
}),
publicKeys: validPublicKeys,
privateKeys: privateKey,
});