New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mailauth

Package Overview
Dependencies
Maintainers
0
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailauth - npm Package Compare versions

Comparing version 4.7.0 to 4.7.1

7

CHANGELOG.md
# Changelog
## [4.7.1](https://github.com/postalsys/mailauth/compare/v4.7.0...v4.7.1) (2024-10-02)
### Bug Fixes
* **dkim:** New class BodyHashStream ([88d2fad](https://github.com/postalsys/mailauth/commit/88d2fad329a9a6fc8ebc1da4efc1c4844ae49507))
## [4.7.0](https://github.com/postalsys/mailauth/compare/v4.6.9...v4.7.0) (2024-10-02)

@@ -4,0 +11,0 @@

76

lib/dkim/body/index.js
'use strict';
let { SimpleHash } = require('./simple');
let { RelaxedHash } = require('./relaxed');
const { SimpleHash } = require('./simple');
const { RelaxedHash } = require('./relaxed');
const { Transform } = require('node:stream');
const { MessageParser } = require('../message-parser');

@@ -21,2 +23,70 @@ const dkimBody = (canonicalization, ...options) => {

module.exports = { dkimBody };
class MessageHasher extends MessageParser {
constructor(canonicalization, ...options) {
super();
this.hasher = dkimBody(canonicalization, ...options);
this.bodyHash = null;
}
async nextChunk(chunk) {
this.hasher.update(chunk);
}
async finalChunk() {
this.bodyHash = this.hasher.digest('base64');
}
}
class BodyHashStream extends Transform {
constructor(canonicalization, ...options) {
super();
this.finished = false;
this.finishCb = null;
this.messageHasher = new MessageHasher(canonicalization, ...options);
this.bodyHash = null;
this.messageHasher.once('finish', () => this.finishHashing());
this.messageHasher.once('end', () => this.finishHashing());
this.messageHasher.once('error', err => this.destroy(err));
}
finishHashing() {
if (this.finished || !this.finishCb) {
return;
}
this.finished = true;
let done = this.finishCb;
this.finishCb = null;
this.bodyHash = this.messageHasher.bodyHash;
this.emit('hash', this.bodyHash);
done();
}
_transform(chunk, encoding, done) {
if (!chunk || !chunk.length) {
return done();
}
if (typeof chunk === 'string') {
chunk = Buffer.from(chunk, encoding);
}
if (this.messageHasher.write(chunk) === false) {
// wait for drain
return this.messageHasher.once('drain', done);
}
this.push(chunk);
done();
}
_flush(done) {
this.finishCb = done;
this.messageHasher.end();
}
}
module.exports = { dkimBody, BodyHashStream };

2

package.json
{
"name": "mailauth",
"version": "4.7.0",
"version": "4.7.1",
"description": "Email authentication library for Node.js",

@@ -5,0 +5,0 @@ "main": "lib/mailauth.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc