arn-rawmime 0.0.7 → 0.0.8
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 +10 -15
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}
|
|
104
|
+
return dkim + signature.replace(/(^.{73}|.{75})/g, "$&\r\n\t").trimEnd();
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/**
|
|
@@ -119,8 +119,7 @@ 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)
|
|
123
|
-
dkim;
|
|
122
|
+
canonicalizedHeaderData = DKIMCanonicalizer.relaxedHeaders(headers, headerFieldNames);
|
|
124
123
|
|
|
125
124
|
if (hasUTFChars(domainName)) {
|
|
126
125
|
try {
|
|
@@ -131,18 +130,14 @@ function generateDKIMHeader(domainName, keySelector, headerFieldNames, headers,
|
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
"a=rsa-sha256"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
|
|
142
|
-
"h=" + canonicalizedHeaderData.fieldNames,
|
|
143
|
-
].join("; ");
|
|
144
|
-
|
|
145
|
-
return foldLines("DKIM-Signature: " + dkim, 76) + ";\r\n b=";
|
|
133
|
+
// Format each tag on its own continuation line (Google-style)
|
|
134
|
+
return (
|
|
135
|
+
"DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r\n" +
|
|
136
|
+
"\td=" + domainName + "; s=" + keySelector + "; q=dns/txt;\r\n" +
|
|
137
|
+
"\tbh=" + canonicalizedBodyHash + ";\r\n" +
|
|
138
|
+
"\th=" + canonicalizedHeaderData.fieldNames + ";\r\n" +
|
|
139
|
+
"\tb="
|
|
140
|
+
);
|
|
146
141
|
}
|
|
147
142
|
|
|
148
143
|
/**
|