nodemailer-openpgp

2.2.0 • Public • Published

OpenPGP module for Nodemailer

This module allows you to send PGP encrypted and/or signed messages using Nodemailer. Generated messages are in PGP/MIME format.

Build Status

Install

Install from npm

npm install nodemailer-openpgp --save

Usage

Load the openpgpEncrypt function

var openpgpEncrypt = require('nodemailer-openpgp').openpgpEncrypt;

Attach it as a 'stream' handler for a nodemailer transport object

transporter.use('stream', openpgpEncrypt(options));

Where

  • options includes the following optional options for signing messages
    • signingKey is an optional PGP private key for signing the (encrypted) message. If this value is not given then messages are not signed
    • passphrase is the optional passphrase for the signing key in case it is encrypted

To encrypt outgoing messages add encryptionKeys array that holds the public keys used to encrypt the message. To not sign an outgoing message set shouldSign to false.

Example

var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport();
var openpgpEncrypt = require('nodemailer-openpgp').openpgpEncrypt;
transporter.use('stream', openpgpEncrypt());
transporter.sendMail({
    from: 'sender@address',
    to: 'receiver@address',
    subject: 'hello',
    text: 'hello world!',
    encryptionKeys: ['-----BEGIN PGP PUBLIC KEY BLOCK-----…'],
    shouldSign: true
}, function(err, response) {
    console.log(err || response);
});

License

LGPL-3.0

Readme

Keywords

Package Sidebar

Install

npm i nodemailer-openpgp

Weekly Downloads

488

Version

2.2.0

License

LGPL-3.0

Unpacked Size

18.3 kB

Total Files

7

Last publish

Collaborators

  • andris