mailauth 6.0.0 → 7.1.0

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.
Files changed (47) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +25 -0
  3. package/README.md +113 -39
  4. package/bin/mailauth.js +15 -6
  5. package/cli.md +9 -3
  6. package/docs/arc.md +126 -43
  7. package/docs/bimi.md +54 -37
  8. package/docs/dkim.md +79 -40
  9. package/docs/dmarc.md +80 -33
  10. package/docs/mta-sts.md +140 -42
  11. package/docs/spf.md +69 -4
  12. package/index.d.ts +508 -43
  13. package/lib/arc/index.d.ts +10 -8
  14. package/lib/arc/index.js +505 -124
  15. package/lib/bimi/index.js +162 -81
  16. package/lib/commands/report.js +3 -1
  17. package/lib/commands/seal.js +35 -5
  18. package/lib/commands/sign.js +8 -1
  19. package/lib/commands/spf.js +8 -0
  20. package/lib/dkim/body/relaxed.js +6 -5
  21. package/lib/dkim/body/simple.js +1 -3
  22. package/lib/dkim/dkim-signer.js +219 -33
  23. package/lib/dkim/dkim-verifier.js +577 -231
  24. package/lib/dkim/header/relaxed.js +6 -43
  25. package/lib/dkim/header/signature-opts.js +87 -0
  26. package/lib/dkim/header/simple.js +6 -43
  27. package/lib/dkim/message-parser.js +18 -4
  28. package/lib/dkim/sign.d.ts +13 -7
  29. package/lib/dkim/sign.js +18 -2
  30. package/lib/dkim/syntax.js +31 -0
  31. package/lib/dkim/verify.js +1 -0
  32. package/lib/dmarc/author-domain.js +181 -0
  33. package/lib/dmarc/get-dmarc-record.js +154 -47
  34. package/lib/dmarc/index.d.ts +29 -2
  35. package/lib/dmarc/verify.js +120 -44
  36. package/lib/mailauth.js +77 -36
  37. package/lib/mta-sts.d.ts +77 -11
  38. package/lib/mta-sts.js +497 -182
  39. package/lib/parse-dkim-headers.js +376 -191
  40. package/lib/parse-received.js +104 -32
  41. package/lib/spf/index.d.ts +37 -1
  42. package/lib/spf/index.js +260 -28
  43. package/lib/spf/macro.js +50 -13
  44. package/lib/spf/spf-verify.js +440 -204
  45. package/lib/spf/syntax.js +366 -0
  46. package/lib/tools.js +522 -116
  47. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  // Type definitions for mailauth/lib/arc
2
2
 
3
- import { MessageInput, ARCData, ARCOptions, ARCResult, ARCSealOptions, ARCChainEntry } from '../../index';
3
+ import { MessageInput, ARCData, ARCOptions, ARCResult, ARCSealOptions, ARCChainEntry, ARCCreateSealData, ARCSealError } from '../../index';
4
4
 
5
5
  /**
6
6
  * Verifies ARC chain in a message
@@ -16,26 +16,28 @@ export function arc(data: ARCData, opts?: ARCOptions): Promise<ARCResult>;
16
16
  *
17
17
  * @param input - RFC822 formatted message (stream, buffer, or string)
18
18
  * @param seal - ARC sealing options
19
- * @returns ARC headers to prepend
19
+ * @returns ARC headers to prepend, empty if no set was created (use createSeal() to see why)
20
20
  */
21
21
  export function sealMessage(input: MessageInput, seal: ARCSealOptions): Promise<Buffer>;
22
22
 
23
23
  /**
24
- * Gets ARC chain from parsed headers
24
+ * Gets ARC chain from parsed headers and validates its structure. Throws for a chain that is not valid
25
25
  *
26
26
  * @param headers - Parsed message headers
27
+ * @param opts - `strict` applies the RFC 8617 syntax rules, lenient acceptances are added to `warnings`
27
28
  * @returns ARC chain or false if no chain found
28
29
  */
29
- export function getARChain(headers: any): ARCChainEntry[] | false;
30
+ export function getARChain(headers: any, opts?: { strict?: boolean; warnings?: string[] }): ARCChainEntry[] | false;
30
31
 
31
32
  /**
32
- * Verifies ARC seal chain
33
+ * Verifies ARC seal chain. Throws if any seal of the chain is not valid, including a chain whose
34
+ * newest seal has cv=fail
33
35
  *
34
36
  * @param data - ARC chain data
35
37
  * @param opts - ARC verification options
36
- * @returns true if chain is valid
38
+ * @returns true if chain is valid, false if there is no chain
37
39
  */
38
- export function verifyASChain(data: ARCData, opts: ARCOptions): Promise<boolean>;
40
+ export function verifyASChain(data: ARCData, opts: ARCOptions & { warnings?: string[] }): Promise<boolean>;
39
41
 
40
42
  /**
41
43
  * Creates ARC seal headers
@@ -44,4 +46,4 @@ export function verifyASChain(data: ARCData, opts: ARCOptions): Promise<boolean>
44
46
  * @param data - Seal creation data
45
47
  * @returns Seal headers, empty if the ARC-Message-Signature could not be signed, and any errors
46
48
  */
47
- export function createSeal(input: MessageInput | false, data: any): Promise<{ headers: string[]; errors: Error[] }>;
49
+ export function createSeal(input: MessageInput | false, data: ARCCreateSealData): Promise<{ headers: string[]; errors: ARCSealError[]; warnings: string[] }>;