diff --git a/package.json b/package.json index e20934f60..c8e23b260 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "node-cache": "^5.1.2", "node-schedule": "^2.0.0", "nodemailer": "^6.6.0", - "openpgp": "^5.0.0-1", + "openpgp": "^5.0.0-2", "plex-api": "^5.3.1", "pug": "^3.0.2", "react": "17.0.2", diff --git a/server/lib/email/openpgpEncrypt.ts b/server/lib/email/openpgpEncrypt.ts index 146dc73e8..607173f79 100644 --- a/server/lib/email/openpgpEncrypt.ts +++ b/server/lib/email/openpgpEncrypt.ts @@ -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, }); diff --git a/yarn.lock b/yarn.lock index f3bda59c0..838a14879 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10114,10 +10114,10 @@ opener@^1.5.1: resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598" integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A== -openpgp@^5.0.0-1: - version "5.0.0-1" - resolved "https://registry.yarnpkg.com/openpgp/-/openpgp-5.0.0-1.tgz#28456d930895483770f099e373045e3ce9dbf9f9" - integrity sha512-yfmRStdmOQPZbNbvwyQrqjLOTGW4QO0/aok/Vt08Zhf4UB9w0tGA5c6zBxDefxq+SmXlqEsmdNu+AtYx5G8D6A== +openpgp@^5.0.0-2: + version "5.0.0-2" + resolved "https://registry.yarnpkg.com/openpgp/-/openpgp-5.0.0-2.tgz#da54385eb9298c259bc6aa76ab556532298897d4" + integrity sha512-es+5A50Y+4JbtV+eugLPW9v/UkUIOufeOUyTcjbG8SMILNaLY9nEwUSJKDjQOadY+16w7Uqt0FDQ3Z1Vq7/F9g== dependencies: asn1.js "^5.0.0"