Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including dkim-signer with all npm packages installed. Try it out:

var dkimSigner = require("dkim-signer")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

dkim-signer v0.2.2

DKIM signing code extracted from mailcomposer

DKIM Signer

Sign RFC822 messages with DKIM. This module is extracted from mailcomposer.

Usage

// require signer function
var DKIMSign = require("dkim-signer").DKIMSign;

// generate a RFC822 message
var rfc822message = "Subject: test\r\n\r\nHello world";

// setup DKIM options
var dkimOptions = {
    domainName: "müriaad-polüteism.info",
    keySelector: "dkim",
    privateKey: require("fs").readFileSync("./test_private.pem")
};

// generate signature header field
var signature = DKIMSign(rfc822message, dkimOptions);

// join signature header field with the message
console.log(signature + "\r\n" + rfc822message);

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free