npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dkimpy

v3.0.1

Published

Node.js wrapper around the Python pip package dkimpy exposing DKIM and ARC signing and verification functions

Downloads

56

Readme

dkimpy

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

Node.js wrapper around the Python pip package dkimpy exposing DKIM and ARC signing and verification functions

Table of Contents

Requirements

  1. Ensure that you have a Python version of >= 3.5 installed per dkimpy requirements (note that Python v3 is required because of a bug with DNS recursive CNAME lookups on v2.7):

    python3 --version
  2. Install the package dkimpy and authres (authres is optional and used for ARC):

    pip3 install dkimpy authres

Install

npm:

npm install dkimpy

yarn:

yarn add dkimpy

Usage

dkimVerify

const fs = require('fs');

const { dkimVerify } = require('dkimpy');

const message = fs.readFileSync('/path/to/example.eml');

// then/catch usage
dkimVerify(message)
  .then(console.log)
  .catch(console.error);

// async/await usage
(async () => {
  try {
    const result = await dkimVerify(message)
    console.log(result);
  } catch (err) {
    console.error(err);
  }
})();

The value of result is a Boolean which indicates if DKIM verification was successful for the first DKIM-Signature header found on the email.

You can pass a second argument of index (defaults to 0, which means it looks for the first DKIM-Signature found).

arcVerify

const fs = require('fs');

const { arcVerify } = require('dkimpy');

const message = fs.readFileSync('/path/to/example.eml');

// then/catch usage
arcVerify(message)
  .then(console.log)
  .catch(console.error);

// async/await usage
(async () => {
  try {
    const result = await arcVerify(message)
    console.log(result);
  } catch (err) {
    console.error(err);
  }
})();

The value of result is an enumerable String which is one of:

  • "none" indicates it does not have an ARC signature
  • "pass" indicates its ARC signature was verified successfully
  • "fail" indicates it had an ARC signature and it failed verification

arcSign

const fs = require('fs');

const { arcSign } = require('dkimpy');

const message = fs.readFileSync('/path/to/example.eml');
const selector = 'default'; // default._domainkey
const domain = 'example.com';
const srvId = 'mx.example.com';
const privateKeyFile = '/path/to/private.key';

// then/catch usage
arcSign(message, selector, domain, privateKeyFile, srvId)
  .then(console.log)
  .catch(console.error);

// async/await usage
(async () => {
  try {
    const result = await arcSign(message, selector, domain, privateKeyFile, srvId)
    console.log(result);
  } catch (err) {
    console.error(err);
  }
})();

The value of result is a String with the new ARC headers to add to the top of the message (if any).

Contributors

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

License

MIT © Nick Baugh