# authheaders

> Node.js wrapper around the Python pip package authheaders

Latest version **2.0.2** (published 2020-08-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install authheaders
pnpm add authheaders
yarn add authheaders
bun add authheaders
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2020-08-13 |
| First published | 2020-08-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 3 |
| Unpacked size | 25 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Nick Baugh |
| Maintainers | niftylettuce |
| Keywords | arc, arc, authenticated, chain, dkim, authheaders, domain, domainkeys, email, header, headers, keys, mail, message, messages, parse, parser, pip, python, received, sign, signature, signatures, smtp, validate, validation, validator, validators, verification, verify |

## Links

- npm: https://www.npmjs.com/package/authheaders
- Repository: https://github.com/forwardemail/authheaders
- Issues: https://github.com/forwardemail/authheaders/issues
- npm.io page: https://npm.io/package/authheaders

## Dependencies (3)

- [ms](https://npm.io/package/ms.md) ^2.1.2
- [debug](https://npm.io/package/debug.md) ^4.1.1
- [semver](https://npm.io/package/semver.md) ^7.3.2

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2020-08-13
- 2.0.1 — 2020-08-06
- 2.0.0 — 2020-08-06
- 1.0.1 — 2020-08-06
- 1.0.0 — 2020-08-06
- 0.0.2 — 2020-08-05
- 0.0.1 — 2020-08-05

## README

# authheaders

[![build status](https://img.shields.io/travis/com/forwardemail/authheaders.svg)](https://travis-ci.com/forwardemail/authheaders)
[![code coverage](https://img.shields.io/codecov/c/github/forwardemail/authheaders.svg)](https://codecov.io/gh/forwardemail/authheaders)
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)
[![license](https://img.shields.io/github/license/forwardemail/authheaders.svg)](LICENSE)
[![npm downloads](https://img.shields.io/npm/dt/authheaders.svg)](https://npm.im/authheaders)

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


## Table of Contents

* [Requirements](#requirements)
* [Install](#install)
* [Usage](#usage)
  * [authenticateMessage](#authenticatemessage)
* [Contributors](#contributors)
* [License](#license)


## Requirements

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

   ```sh
   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):

   ```sh
   pip3 install git+https://github.com/forwardemail/authentication-headers.git
   ```

3. Install [dnspython](https://github.com/rthalley/dnspython) v1.16.0:

   ```sh
   pip3 install dnspython==1.16.0
   ```

4. Install [pyspf](https://pypi.org/project/pyspf/):

   ```sh
   pip3 install pyspf
   ```


## Install

[npm][]:

```sh
npm install authheaders
```

[yarn][]:

```sh
yarn add authheaders
```


## Usage

### authenticateMessage

```js
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:

```js
{
  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

| Name           | Website                    |
| -------------- | -------------------------- |
| **Nick Baugh** | <http://niftylettuce.com/> |


## License

[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)


## 

[npm]: https://www.npmjs.com/

[yarn]: https://yarnpkg.com/

[authheaders]: https://pypi.org/project/authheaders/

---
_Source: https://npm.io/package/authheaders · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
