mailauth 2.3.2 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ *.js text eol=lf
package/README.md CHANGED
@@ -261,7 +261,7 @@ process.stdout.write(message);
261
261
  If you want to modify the message before sealing, you have to authenticate the message first and then use authentication results as input for the sealing step.
262
262
 
263
263
  ```js
264
- const { authenticate, sealMessage } = require('@postalsys/mailauth');
264
+ const { authenticate, sealMessage } = require('mailauth');
265
265
 
266
266
  // 1. authenticate the message
267
267
  const { arc, headers } = await authenticate(
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const { getSigningHeaderLines, getPublicKey, parseDkimHeaders, formatAuthHeaderRow, getAligment } = require('../../lib/tools');
3
+ const { getSigningHeaderLines, getPublicKey, parseDkimHeaders, formatAuthHeaderRow, getAlignment } = require('../../lib/tools');
4
4
  const { MessageParser } = require('./message-parser');
5
5
  const { dkimBody } = require('./body');
6
6
  const { generateCanonicalizedHeader } = require('./header');
@@ -195,7 +195,7 @@ class DkimVerifier extends MessageParser {
195
195
  };
196
196
 
197
197
  if (signatureHeader.type === 'DKIM' && this.headerFrom?.length) {
198
- status.aligned = this.headerFrom?.length ? getAligment(this.headerFrom[0].split('@').pop(), [signatureHeader.signingDomain]) : false;
198
+ status.aligned = this.headerFrom?.length ? getAlignment(this.headerFrom[0].split('@').pop(), [signatureHeader.signingDomain]) : false;
199
199
  }
200
200
 
201
201
  let bodyHash = this.bodyHashes.get(signatureHeader.bodyHashKey)?.hash;
@@ -3,7 +3,7 @@
3
3
  const dns = require('dns').promises;
4
4
  const punycode = require('punycode/');
5
5
  const psl = require('psl');
6
- const { formatAuthHeaderRow, getAligment } = require('../tools');
6
+ const { formatAuthHeaderRow, getAlignment } = require('../tools');
7
7
 
8
8
  const resolveTxt = async (domain, resolver) => {
9
9
  try {
@@ -146,8 +146,8 @@ const verifyDmarc = async opts => {
146
146
  // use "sp" if this is a subdomain of an org domain and "sp" is set, otherwise use "p"
147
147
  const policy = dmarcRecord.isOrgRecord && dmarcRecord.sp ? dmarcRecord.sp : dmarcRecord.p;
148
148
 
149
- const dkimAlignment = getAligment(domain, dkimDomains, { strict: dmarcRecord.adkim === 's' });
150
- const spfAlignment = getAligment(domain, spfDomains, { strict: dmarcRecord.aspf === 's' });
149
+ const dkimAlignment = getAlignment(domain, dkimDomains, { strict: dmarcRecord.adkim === 's' });
150
+ const spfAlignment = getAlignment(domain, spfDomains, { strict: dmarcRecord.aspf === 's' });
151
151
 
152
152
  if (dkimAlignment || spfAlignment) {
153
153
  // pass
@@ -164,7 +164,12 @@ const verifyDmarc = async opts => {
164
164
  p: dmarcRecord.p,
165
165
  sp: dmarcRecord.sp || dmarcRecord.p,
166
166
  pct: dmarcRecord.pct,
167
- rr: dmarcRecord.rr
167
+ rr: dmarcRecord.rr,
168
+
169
+ alignment: {
170
+ spf: { result: spfAlignment, strict: dmarcRecord.aspf === 's' },
171
+ dkim: { result: dkimAlignment, strict: dmarcRecord.adkim === 's' }
172
+ }
168
173
  });
169
174
  };
170
175
 
package/lib/mailauth.js CHANGED
@@ -6,6 +6,7 @@ const { dmarc } = require('./dmarc');
6
6
  const { arc, createSeal } = require('./arc');
7
7
  const { bimi } = require('./bimi');
8
8
  const { parseReceived } = require('./parse-received');
9
+ const { sealMessage } = require('./arc');
9
10
  const libmime = require('libmime');
10
11
  const os = require('os');
11
12
  const { isIP } = require('net');
@@ -179,4 +180,4 @@ const authenticate = async (input, opts) => {
179
180
  };
180
181
  };
181
182
 
182
- module.exports = { authenticate };
183
+ module.exports = { authenticate, sealMessage };
package/lib/tools.js CHANGED
@@ -429,7 +429,7 @@ const formatDomain = domain => {
429
429
  return domain;
430
430
  };
431
431
 
432
- const getAligment = (fromDomain, domainList, strict) => {
432
+ const getAlignment = (fromDomain, domainList, strict) => {
433
433
  domainList = [].concat(domainList || []);
434
434
  if (strict) {
435
435
  fromDomain = formatDomain(fromDomain);
@@ -530,7 +530,7 @@ module.exports = {
530
530
 
531
531
  validateAlgorithm,
532
532
 
533
- getAligment,
533
+ getAlignment,
534
534
 
535
535
  formatRelaxedLine,
536
536
 
package/licenses.txt ADDED
@@ -0,0 +1,11 @@
1
+ name license type link installed version author
2
+ ---- ------------ ---- ----------------- ------
3
+ @fidm/x509 MIT git+ssh://git@github.com/fidm/x509.git 1.2.1
4
+ ipaddr.js MIT git://github.com/whitequark/ipaddr.js.git 2.0.1 whitequark whitequark@whitequark.org
5
+ joi BSD-3-Clause git://github.com/sideway/joi.git 17.6.0
6
+ libmime MIT git://github.com/andris9/libmime.git 5.0.0 Andris Reinman andris@kreata.ee
7
+ node-forge (BSD-3-Clause OR GPL-2.0) git+https://github.com/digitalbazaar/forge.git 1.3.1 Digital Bazaar, Inc. support@digitalbazaar.com http://digitalbazaar.com/
8
+ nodemailer MIT git+https://github.com/nodemailer/nodemailer.git 6.7.3 Andris Reinman
9
+ psl MIT git+ssh://git@github.com/lupomontero/psl.git 1.8.0 Lupo Montero lupomontero@gmail.com https://lupomontero.com/
10
+ punycode MIT git+https://github.com/bestiejs/punycode.js.git 2.1.1 Mathias Bynens https://mathiasbynens.be/
11
+ yargs MIT git+https://github.com/yargs/yargs.git 17.4.1
package/man/mailauth.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH "MAILAUTH" "1" "April 2022" "v2.3.1" "Mailauth Help"
1
+ .TH "MAILAUTH" "1" "May 2022" "v2.3.2" "Mailauth Help"
2
2
  .SH "NAME"
3
3
  \fBmailauth\fR
4
4
  .QP
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "mailauth",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "description": "Email authentication library for Node.js",
5
5
  "main": "lib/mailauth.js",
6
6
  "scripts": {
7
7
  "test": "eslint \"lib/**/*.js\" \"test/**/*.js\" && mocha --recursive \"./test/**/*.js\" --reporter spec",
8
8
  "prepublish": "npm run man || true",
9
9
  "man": "cd man && marked-man --version `node -e \"console.log('v'+require('../package.json').version)\"` --manual 'Mailauth Help' --section 1 man.md > mailauth.1",
10
- "build-dist": "npm run man && npm run licenses && pkg --compress Brotli package.json",
10
+ "build-source": "rm -rf node_modules package-lock.json && npm install && npm run man && npm run licenses && rm -rf node_modules package-lock.json && npm install --production && rm -rf package-lock.json",
11
+ "build-dist": "npx pkg --compress Brotli package.json && rm -rf package-lock.json && npm install",
11
12
  "licenses": "license-report --only=prod --output=table --config license-report-config.json > licenses.txt"
12
13
  },
13
14
  "repository": {
@@ -32,7 +33,7 @@
32
33
  "homepage": "https://github.com/postalsys/mailauth",
33
34
  "devDependencies": {
34
35
  "chai": "4.3.6",
35
- "eslint": "8.14.0",
36
+ "eslint": "8.15.0",
36
37
  "eslint-config-nodemailer": "1.2.0",
37
38
  "eslint-config-prettier": "8.5.0",
38
39
  "js-yaml": "4.1.0",
@@ -40,19 +41,19 @@
40
41
  "marked": "0.7.0",
41
42
  "marked-man": "0.7.0",
42
43
  "mbox-reader": "1.1.5",
43
- "mocha": "9.2.2",
44
+ "mocha": "10.0.0",
44
45
  "pkg": "5.6.0"
45
46
  },
46
47
  "dependencies": {
47
48
  "@fidm/x509": "1.2.1",
48
49
  "ipaddr.js": "2.0.1",
49
50
  "joi": "17.6.0",
50
- "libmime": "5.0.0",
51
+ "libmime": "5.1.0",
51
52
  "node-forge": "1.3.1",
52
- "nodemailer": "6.7.3",
53
+ "nodemailer": "6.7.5",
53
54
  "psl": "1.8.0",
54
55
  "punycode": "2.1.1",
55
- "yargs": "17.4.1"
56
+ "yargs": "17.5.0"
56
57
  },
57
58
  "engines": {
58
59
  "node": ">=14.0.0"
@@ -64,16 +65,15 @@
64
65
  "man/mailauth.1"
65
66
  ],
66
67
  "pkg": {
67
- "scripts": [
68
- "workers/**/*.js"
69
- ],
70
68
  "assets": [
71
69
  "man/**/*",
72
70
  "licenses.txt",
73
71
  "LICENSE.txt"
74
72
  ],
75
- "_targets": [
76
- "node16-macos-x64"
73
+ "targets": [
74
+ "node16-linux-x64",
75
+ "node16-macos-x64",
76
+ "node16-win-x64"
77
77
  ],
78
78
  "outputPath": "ee-dist"
79
79
  }