GithubHelp home page GithubHelp logo

isabella232 / nodemailer-openpgp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nodemailer/nodemailer-openpgp

0.0 0.0 0.0 20 KB

Encrypt Nodemailer messages with PGP

License: GNU Lesser General Public License v3.0

JavaScript 100.00%

nodemailer-openpgp's Introduction

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

nodemailer-openpgp's People

Contributors

andris9 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.