Socket
Socket
Sign inDemoInstall

authheaders

Package Overview
Dependencies
5
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    authheaders

Node.js wrapper around the Python pip package authheaders


Version published
Weekly downloads
10
increased by66.67%
Maintainers
1
Install size
195 kB
Created
Weekly downloads
 

Readme

Source

authheaders

build status code coverage code style styled with prettier made with lass license npm downloads

Node.js wrapper around the Python pip package authheaders exposing a function to generate Authentication-Results headers

Table of Contents

Requirements

  1. Ensure that you have a Python version of >= 3.6 installed.

    python3 --version
    
  2. Install the package authheaders from our fork which contains a fix (until https://github.com/ValiMail/authentication-headers/pull/6 is merged and released):

    pip3 install git+https://github.com/forwardemail/authentication-headers.git
    
  3. Install dnspython v1.16.0:

    pip3 install dnspython==1.16.0
    
  4. Install pyspf:

    pip3 install pyspf
    

Install

npm:

npm install authheaders

yarn:

yarn add authheaders

Usage

authenticateMessage

const fs = require('fs');

const { authenticateMessage } = require('authheaders');

const message = fs.readFileSync('/path/to/example.eml');
const authservId = 'mx.example.com';
const ip = '1.2.3.4';
const mailFrom = 'example.net';
const helo = 'domain.of.sender.example.net';

// then/catch usage
authenticateMessage(message, authservId, ip, mailFrom, helo)
  .then(console.log)
  .catch(console.error);

// async/await usage
(async () => {
  try {
    const result = await authenticateMessage(message, authservId, ip, mailFrom, helo);
    console.log(result);
  } catch (err) {
    console.error(err);
  }
})();

The value of result is an Object with properties header (String), and Objects for spf, dkim, arc, and dmarc.

These Objects contain a result (String) and conditionally a reason (String) value.

An example result object is provided below:

{
  header: 'example.com; spf=none smtp.helo=domain.of.sender.net smtp.mailfrom=test.com; dkim=pass header.d=forwardemail.net; arc=pass; dmarc=fail (Used From Domain Record) header.from=gmail.com policy.dmarc=none',
  spf: { result: 'none' },
  dkim: { result: 'pass' },
  arc: { result: 'pass' },
  dmarc: { policy: 'none', result: 'fail', reason: 'Used From Domain Record' }
}

Contributors

NameWebsite
Nick Baughhttp://niftylettuce.com/

License

MIT © Nick Baugh

Keywords

FAQs

Last updated on 13 Aug 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc