Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
dkim-signer
Advanced tools
The dkim-signer npm package is used to sign email messages with DomainKeys Identified Mail (DKIM). This helps in verifying the authenticity of the email and ensuring that it has not been tampered with during transit.
Sign Email
This feature allows you to sign an email message using DKIM. The `sign` function takes the email content and options including the domain name, key selector, and private key, and returns the signed email.
const dkim = require('dkim-signer');
const email = 'From: sender@example.com\r\nTo: receiver@example.com\r\nSubject: Test\r\n\r\nThis is a test email.';
const options = {
domainName: 'example.com',
keySelector: 'default',
privateKey: '-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\n-----END PRIVATE KEY-----'
};
const signedEmail = dkim.sign(email, options);
console.log(signedEmail);
Nodemailer is a module for Node.js applications to allow easy email sending. It supports various transport methods, including SMTP, and can be extended with plugins for additional functionality like DKIM signing. Compared to dkim-signer, Nodemailer is more comprehensive and can handle the entire email sending process, not just DKIM signing.
EmailJS is a library for sending emails from JavaScript applications. It supports SMTP and can be configured to use DKIM for signing emails. While it provides a broader range of email functionalities, it is not as specialized in DKIM signing as dkim-signer.
Mailcomposer is a Node.js module for generating email messages, including support for attachments and DKIM signing. It is more focused on email composition and can be used in conjunction with other modules for sending emails. Compared to dkim-signer, it offers more features for email creation but requires additional setup for sending emails.
Sign RFC822 messages with DKIM. This module is extracted from mailcomposer.
// 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);
MIT
FAQs
DKIM signing code extracted from mailcomposer
The npm package dkim-signer receives a total of 144,706 weekly downloads. As such, dkim-signer popularity was classified as popular.
We found that dkim-signer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.