Skip to content

emailjs/emailjs-pgp-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

emailjs-pgp-builder

DEPRECATION NOTICE

This project is not actively maintained. If you're sending emails on a node.js-esque platform, please use Andris Reinman's nodemailer. It is actively supported, widely used and maintained, and many possibilities for sending via SMTP.

If you still feel this project has merit and you would like to be a maintainer, please reach out to Felix.

Greenkeeper badge

Builds PGP/MIME, no magic/encryption included.

Usage

const PGPBuilder = require('emailjs-pgp-builder');
const builder = new PGPBuilder();

This is the expected data format...

let message = {
     subject: 'foo',
     date: new Date(),
     from: [{
         name: 'Fred Foo',
         address: '[email protected]'
     }],
     to: [{
         name: 'Bla Foo',
         address: '[email protected]'
     }],
     cc: [{
         name: 'Bli Foo',
         address: '[email protected]'
     }],
     bcc: [{
         name: 'Blu Foo',
         address: '[email protected]'
     }],
     id: '[email protected]',
     inReplyTo: '[email protected]',
     text: 'asd',
     html: '<html><head></head><body>asd</body></html>',
     attachments: []
 };
API
  • #buildEncrypted
  • #buildSigned
  • #buildPlaintext
Build a signed MIME structure
let mimeRoot = builder.buildPlaintext(message);

// Crypto not included
let signature = pgpsign(mimeRoot.build());

builder.buildSigned(message, mimeRoot, signature);

// Find the results of the operation here:
console.log(message.raw)
console.log(message.smtpEnvelope)

NB! pgpsign is whatever you use to PGP-sign the content.

Build a encrypted MIME structure
let mimeRoot = builder.buildPlaintext(message);

// Crypto not included
let ciphertext = pgpencrypt(mimeRoot.build());

builder.buildEncrypted(message, ciphertext);

// Find the results of the operation here:
console.log(message.raw)
console.log(message.smtpEnvelope)

NB! pgpencrypt is whatever you use to PGP-encrypt the content.

You might want to try openpgpjs for example.

License

MIT

About

Builds PGP/MIME, no magic/encryption/unicorns included.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •