Skip to content

isabella232/nodemailer-openpgp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenPGP module for Nodemailer

This module allows you to send PGP encrypted messages using Nodemailer. Generated messages are in PGP/MIME format and currently it is only possible to encrypt or encrypt+sign but not just sign messages.

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 encryptionKeys
    • signingKey is an optional PGP private key for signing the encrypted message. If this value is not given then messages are encrypted but 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.

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-----…']
}, function(err, response) {
    console.log(err || response);
});

License

LGPL-3.0

About

Encrypt Nodemailer messages with PGP

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%