arn-rawmime 0.0.8 → 0.0.9
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/package.json +1 -1
- package/src/dkim-signer.js +15 -10
package/package.json
CHANGED
package/src/dkim-signer.js
CHANGED
|
@@ -101,7 +101,7 @@ function DKIMSign(email, options) {
|
|
|
101
101
|
signer.update(canonicalizedHeaderData.headers);
|
|
102
102
|
signature = signer.sign(options.privateKey, "base64");
|
|
103
103
|
|
|
104
|
-
return dkim + signature.replace(/(^.{73}|.{75})/g, "$&\r\n
|
|
104
|
+
return dkim + signature.replace(/(^.{73}|.{75}(?!\r?\n|\r))/g, "$&\r\n ").trim();
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/**
|
|
@@ -119,7 +119,8 @@ function DKIMSign(email, options) {
|
|
|
119
119
|
function generateDKIMHeader(domainName, keySelector, headerFieldNames, headers, body) {
|
|
120
120
|
let canonicalizedBody = DKIMCanonicalizer.relaxedBody(body),
|
|
121
121
|
canonicalizedBodyHash = sha256(canonicalizedBody, "base64"),
|
|
122
|
-
canonicalizedHeaderData = DKIMCanonicalizer.relaxedHeaders(headers, headerFieldNames)
|
|
122
|
+
canonicalizedHeaderData = DKIMCanonicalizer.relaxedHeaders(headers, headerFieldNames),
|
|
123
|
+
dkim;
|
|
123
124
|
|
|
124
125
|
if (hasUTFChars(domainName)) {
|
|
125
126
|
try {
|
|
@@ -130,14 +131,18 @@ function generateDKIMHeader(domainName, keySelector, headerFieldNames, headers,
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
|
|
134
|
+
dkim = [
|
|
135
|
+
"v=1",
|
|
136
|
+
"a=rsa-sha256",
|
|
137
|
+
"c=relaxed/relaxed",
|
|
138
|
+
"d=" + domainName,
|
|
139
|
+
"q=dns/txt",
|
|
140
|
+
"s=" + keySelector,
|
|
141
|
+
"bh=" + canonicalizedBodyHash,
|
|
142
|
+
"h=" + canonicalizedHeaderData.fieldNames,
|
|
143
|
+
].join("; ");
|
|
144
|
+
|
|
145
|
+
return foldLines("DKIM-Signature: " + dkim, 76) + ";\r\n b=";
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
/**
|