mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-10-09 09:59:45 +07:00
node_modules: update (#338)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
e1936242ed
commit
a9c5eb6c35
39 files changed
+799
-388
No files matched your search
+17
-1
@@ -1,6 +1,15 @@
|
||||
import * as punycode from '../punycode/index.js';
|
||||
import * as mimeFuncs from '../mime-funcs/index.js';
|
||||
import crypto from 'node:crypto';
|
||||
import * as errors from '../errors.js';
|
||||
/**
|
||||
* Error for a hashAlgo value the crypto module does not know
|
||||
*/
|
||||
function unsupportedHashAlgoError(hashAlgo) {
|
||||
const err = new Error('Unsupported DKIM hash algorithm "' + hashAlgo + '"');
|
||||
err.code = errors.ECONFIG;
|
||||
return err;
|
||||
}
|
||||
/**
|
||||
* Returns DKIM signature header line
|
||||
*
|
||||
@@ -25,7 +34,13 @@ function sign(headers, hashAlgo, bodyHash, options) {
|
||||
const canonicalizedHeaderData = relaxedHeaders(headers, fieldNames, options.skipFields);
|
||||
const dkimHeader = generateDKIMHeader(options.domainName, options.keySelector, canonicalizedHeaderData.fieldNames, hashAlgo, bodyHash);
|
||||
canonicalizedHeaderData.headers += 'dkim-signature:' + relaxedHeaderLine(dkimHeader);
|
||||
const signer = crypto.createSign(('rsa-' + hashAlgo).toUpperCase());
|
||||
let signer;
|
||||
try {
|
||||
signer = crypto.createSign(('rsa-' + hashAlgo).toUpperCase());
|
||||
}
|
||||
catch (_E) {
|
||||
throw unsupportedHashAlgoError(hashAlgo);
|
||||
}
|
||||
// the header lines are 'binary' strings, so this reproduces the original header bytes
|
||||
signer.update(canonicalizedHeaderData.headers, 'latin1');
|
||||
let signature;
|
||||
@@ -38,6 +53,7 @@ function sign(headers, hashAlgo, bodyHash, options) {
|
||||
return dkimHeader + signature.replace(/(^.{73}|.{75}(?!\r?\n|\r))/g, '$&\r\n ').trim();
|
||||
}
|
||||
sign.relaxedHeaders = relaxedHeaders;
|
||||
sign.unsupportedHashAlgoError = unsupportedHashAlgoError;
|
||||
export default sign;
|
||||
function generateDKIMHeader(domainName, keySelector, fieldNames, hashAlgo, bodyHash) {
|
||||
// the caller supplied tag values are interpolated straight into the tag list, and none of
|
||||
|
||||
Reference in new issue
Block a user