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

dkim-signature

v1.3.0

Published

DomainKey Identified Mail (DKIM) Signature

Downloads

1,903

Readme

DomainKeys Identified Mail (DKIM) Signature

npm npm npm downloads build status

Install via npm

$ npm install dkim-signature

Usage

var DKIMSignature = require( 'dkim-signature' )

Suppose you have the content of the DKIM-Signature email header:

v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20120113;
 h=mime-version:date:message-id:subject:from:to:content-type;
 bh=DrlXO8ocnosZnW5ZN7P4S/fIdR8vwHj0TyzoPISZF2Q=;
 b=gOHBExs2JcJFRrozPDw88Js0dc0AHOo6YTZqrDTedfcK/jM/mxfu5rfVzuUnKAGiS5
 ZvRvXvwYjIW0B9t0DDHDOs5soIukuEXeUw9OV2QD8qc5pmOShuRQWyW5pRftTF87omkj
 gV2Eik5K2f8FpNlyvuLDjMUmyP8RpLaRrii6+kRRsoJzzP41IqALmlLmJfvtnkeu5kM0
 v4XnQ4hBNcaLuCmq3fZfCQFDexofECQOZ8FWE0VfdASG8HOJ6jgxuKwYtNfy11ySUSrI
 wFFlrjTfiNqSD9nzQns3j+xXLtqsvviJQXJgkC8O6mLel3GDwm8LHzBoszzqZ/FiL4rg
 Vdfw==

Parse the signature header:

var signature = DKIMSignature.parse( header )
{
  algorithm: 'rsa-sha256',
  canonical: 'relaxed/relaxed',
  copiedHeaders: [],
  domain: 'gmail.com',
  expires: null,
  hash: <Buffer 0e b9 57 3b ca 1c 9e 8b 19 9d 6e 59 37 b3 ...>,
  headers: [
    'mime-version',
    'date',
    'message-id',
    'subject',
    'from',
    'to',
    'content-type'
  ],
  identity: null,
  length: null,
  query: null,
  selector: '20120113',
  signature: <Buffer 80 e1 c1 13 1b 36 25 c2 45 46 ba 33 3c ...>,
  timestamp: null,
  version: '1'
}

Or create a signature header:

var signature = new DKIMSignature({
  algorithm: 'rsa-sha256',
  canonical: 'simple/relaxed',
  domain: 'into.space',
  headers: [
    'mime-version',
    'date',
    'message-id',
    'subject',
    ...
  ],
  selector: '20120113',
  signature: <Buffer 80 e1 c1 13 1b 36 25 c2 45 46 ba 33 3c ...>,
  version: '1'
})
signature.toString()

API

Constructor:

  • new Signature( options )
  • Signature.create( options )
  • Signature.parse( header )

Methods:

  • signature.parse( header )
  • signature.toString()