Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emailjs-pgp-builder

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emailjs-pgp-builder

Builds a PGP/MIME message, no magic involved.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 27 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc