This package has been deprecated

Author message:

This project is no longer maintained. Please reach out if you want to hop on as a maintainer.

emailjs-pgp-builder

1.0.0 • Public • Published

emailjs-pgp-builder

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: 'fred@foobar.bar'
     }],
     to: [{
         name: 'Bla Foo',
         address: 'bla@foobar.bar'
     }],
     cc: [{
         name: 'Bli Foo',
         address: 'bli@foobar.bar'
     }],
     bcc: [{
         name: 'Blu Foo',
         address: 'Blu@foobar.bar'
     }],
     id: '368357@foobar.bar',
     inReplyTo: '112342356@foobar.bar',
     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.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i emailjs-pgp-builder

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • andris
  • felixhammerl
  • nifgraup