@visulima/email 2.1.6 → 2.1.7
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/CHANGELOG.md +7 -0
- package/dist/crypto/index.d.ts +183 -183
- package/dist/crypto/index.js +1 -1
- package/dist/deliverability/dmarc-report.d.ts +43 -43
- package/dist/deliverability/dmarc-report.js +1 -1
- package/dist/deliverability/index.d.ts +201 -201
- package/dist/events/index.d.ts +17 -17
- package/dist/inbound/index.d.ts +180 -180
- package/dist/index.d.ts +35 -46
- package/dist/index.js +1 -1
- package/dist/middleware/index.d.ts +213 -216
- package/dist/middleware/index.js +1 -1
- package/dist/packem_shared/{DkimSigner-CiLBaXrg.js → DkimSigner-sLcIw9bp.js} +6 -6
- package/dist/packem_shared/{DraftMailMessage-CGTVuy2z.js → DraftMailMessage-C3YTXqWo.js} +1 -1
- package/dist/packem_shared/EmailError-CDvYwuqz.js +1 -0
- package/dist/packem_shared/{Mail-CYAwMRnX.js → Mail-CIyxkmxu.js} +1 -1
- package/dist/packem_shared/MailMessage-DuEXJiCg.js +1 -0
- package/dist/packem_shared/{RequiredOptionError-DuNNY_a5.js → RequiredOptionError-DU2lxzk3.js} +1 -1
- package/dist/packem_shared/SmimeEncrypter-CzTbQM-z.js +6 -0
- package/dist/packem_shared/SmimeSigner-DjLShaOw.js +8 -0
- package/dist/packem_shared/{ahaSendProvider-DSuZIzaQ.js → ahaSendProvider-br1yB2un.js} +1 -1
- package/dist/packem_shared/arcMessageSignatureBase-D54jQIWu.js +17 -0
- package/dist/packem_shared/attachment-processor-D1cbAhQi.js +1 -0
- package/dist/packem_shared/{autoSendProvider-DqAoelWR.js → autoSendProvider-BSP8ueOC.js} +1 -1
- package/dist/packem_shared/{awsSesProvider-ClK1FUln.js → awsSesProvider-zRICW1pH.js} +13 -13
- package/dist/packem_shared/azureProvider-DwN4c5dC.js +1 -0
- package/dist/packem_shared/{brevoProvider-CIzuIDlt.js → brevoProvider-C491beE_.js} +1 -1
- package/dist/packem_shared/{build-mime-message-BW5FQ2Bt.js → build-mime-message-DT67qfMp.js} +1 -1
- package/dist/packem_shared/{circuitBreakerMiddleware-D2SA_07f.js → circuitBreakerMiddleware-N0CKF90q.js} +1 -1
- package/dist/packem_shared/{cloudflareEmailProvider-B8mOEl3N.js → cloudflareEmailProvider-8JxzLbpX.js} +1 -1
- package/dist/packem_shared/{createTestEmail-f12yLlWn.js → createTestEmail-D_ksEez3.js} +1 -1
- package/dist/packem_shared/dedupeMiddleware-CYYI_O7S.js +1 -0
- package/dist/packem_shared/{detectMimeType-DFH3kp6K.js → detectMimeType-CmYmWDXE.js} +1 -1
- package/dist/packem_shared/event-bus.d-BNQA-FZE.d.ts +104 -0
- package/dist/packem_shared/{failoverProvider-BgX6zfnY.js → failoverProvider-6qwE_HSJ.js} +1 -1
- package/dist/packem_shared/generate-boundary-0xGe9GqK.js +1 -0
- package/dist/packem_shared/{httpProvider-aBfTXyCT.js → httpProvider-BqrdZhGw.js} +1 -1
- package/dist/packem_shared/index-Gd7m-UQA.js +11 -0
- package/dist/packem_shared/{infobipProvider-DxzsONUX.js → infobipProvider-C2FU6VMP.js} +1 -1
- package/dist/packem_shared/isValidSigningCertUrl-DNxPA0Q-.js +3 -0
- package/dist/packem_shared/{loopsProvider-QBsAH6Ee.js → loopsProvider-Bz63so6m.js} +1 -1
- package/dist/packem_shared/mail.d-xKtvoKMK.d.ts +909 -0
- package/dist/packem_shared/{mailCrabProvider-DRE5snM9.js → mailCrabProvider-bkQy-2a1.js} +1 -1
- package/dist/packem_shared/{mailPaceProvider-DCa-4ghl.js → mailPaceProvider-S1AB-AYq.js} +1 -1
- package/dist/packem_shared/{mailchannelsProvider-GiwkYBdD.js → mailchannelsProvider-B_K6X4VY.js} +1 -1
- package/dist/packem_shared/{mailerSendProvider-RK6IbUrL.js → mailerSendProvider-DPEww2H1.js} +1 -1
- package/dist/packem_shared/mailgunProvider-DKxzVbDW.js +1 -0
- package/dist/packem_shared/mailjetProvider-C2TQcujL.js +1 -0
- package/dist/packem_shared/{mailomatProvider-DPDpVS8r.js → mailomatProvider-B8-5bQsu.js} +1 -1
- package/dist/packem_shared/{mailtrapProvider-DtrS4Q34.js → mailtrapProvider-DW7TLOdG.js} +1 -1
- package/dist/packem_shared/{make-request-B9XjBynA.js → make-request-CylyuRaN.js} +1 -1
- package/dist/packem_shared/{mandrillProvider-B84zH-eV.js → mandrillProvider-S-0lKNGd.js} +1 -1
- package/dist/packem_shared/{mockProvider-Behywbl1.js → mockProvider-BAl292mW.js} +1 -1
- package/dist/packem_shared/{netcoreProvider-D-wtCyJj.js → netcoreProvider-DajMprlo.js} +1 -1
- package/dist/packem_shared/{nodemailerProvider-BFHobXxt.js → nodemailerProvider-DRo0lJ6g.js} +1 -1
- package/dist/packem_shared/{opentelemetryProvider-ByHC01ub.js → opentelemetryProvider-C6spx2CD.js} +1 -1
- package/dist/packem_shared/{outlook365Provider-Btk4Emig.js → outlook365Provider-B0o7UZBW.js} +1 -1
- package/dist/packem_shared/{plunkProvider-Bw8e6460.js → plunkProvider-DJzEUEtU.js} +1 -1
- package/dist/packem_shared/{postalProvider-CT8zr89z.js → postalProvider-DHFjFE3Y.js} +1 -1
- package/dist/packem_shared/{postmarkProvider-CQSqZWDs.js → postmarkProvider-Dt1EGGBA.js} +1 -1
- package/dist/packem_shared/{provider-base-C7PuopYK.js → provider-base-DjPzWncP.js} +1 -1
- package/dist/packem_shared/{provider.d-J-y6iogK.d.ts → provider.d-Cx5YQJdP.d.ts} +9 -9
- package/dist/packem_shared/{resendProvider-drJYlvLP.js → resendProvider-qjI86j_d.js} +1 -1
- package/dist/packem_shared/{retry-ipI5DRJ8.js → retry-CG9iT2wF.js} +1 -1
- package/dist/packem_shared/{roundRobinProvider-D1by5KGW.js → roundRobinProvider-CO5YvhgR.js} +1 -1
- package/dist/packem_shared/{scalewayProvider-DU5gXQrl.js → scalewayProvider-CihQKhw6.js} +1 -1
- package/dist/packem_shared/{sendGridProvider-BuTbEXW8.js → sendGridProvider-Dkc5AKlC.js} +1 -1
- package/dist/packem_shared/{smtpProvider-5MI3-EPh.js → smtpProvider-CIXMxPu-.js} +12 -12
- package/dist/packem_shared/{sparkpostProvider-UAsFYIjP.js → sparkpostProvider-CKxQhpyB.js} +1 -1
- package/dist/packem_shared/{sweegoProvider-SUz0LIcA.js → sweegoProvider-DjmAs6La.js} +1 -1
- package/dist/packem_shared/{tracer.d-MU42G1jG.d.ts → tracer.d-sb5yrt_n.d.ts} +2 -2
- package/dist/packem_shared/types.d-B0t3PQ3t.d.ts +107 -0
- package/dist/packem_shared/{types.d-ejzh-xBP.d.ts → types.d-B9295M4_.d.ts} +82 -82
- package/dist/packem_shared/types.d-BzoHR9nB.d.ts +61 -0
- package/dist/packem_shared/types.d-C5geVKes.d.ts +51 -0
- package/dist/packem_shared/types.d-GKqPNk0I.d.ts +24 -0
- package/dist/packem_shared/types.d-I-KeZ5w2.d.ts +9 -0
- package/dist/packem_shared/types.d-kHO4kX9q.d.ts +69 -0
- package/dist/packem_shared/utils-DjEtR3qT.js +1 -0
- package/dist/packem_shared/verifyMailgunWebhook-DNk080BF.js +1 -0
- package/dist/packem_shared/verifyPostmarkWebhook-B4OIEHQF.js +1 -0
- package/dist/packem_shared/verifyResendWebhook-C7E32LZ1.js +1 -0
- package/dist/packem_shared/verifySendGridWebhook-1l9bqIMw.js +1 -0
- package/dist/packem_shared/withEvents-CytsykaK.js +1 -0
- package/dist/packem_shared/{withSuppression-DBaZDMAr.js → withSuppression-BoaO4Qdz.js} +1 -1
- package/dist/packem_shared/{zeptomailProvider-DXNX9mG_.js → zeptomailProvider-DSTC9pUi.js} +1 -1
- package/dist/providers/ahasend/index.d.ts +18 -18
- package/dist/providers/ahasend/index.js +1 -1
- package/dist/providers/autosend/index.d.ts +30 -30
- package/dist/providers/autosend/index.js +1 -1
- package/dist/providers/aws-ses/index.d.ts +20 -20
- package/dist/providers/aws-ses/index.js +1 -1
- package/dist/providers/azure/index.d.ts +26 -26
- package/dist/providers/azure/index.js +1 -1
- package/dist/providers/brevo/index.d.ts +35 -35
- package/dist/providers/brevo/index.js +1 -1
- package/dist/providers/cloudflare-email/index.d.ts +25 -25
- package/dist/providers/cloudflare-email/index.js +1 -1
- package/dist/providers/failover/index.d.ts +14 -14
- package/dist/providers/failover/index.js +1 -1
- package/dist/providers/http/index.d.ts +15 -15
- package/dist/providers/http/index.js +1 -1
- package/dist/providers/infobip/index.d.ts +28 -28
- package/dist/providers/infobip/index.js +1 -1
- package/dist/providers/loops/index.d.ts +25 -25
- package/dist/providers/loops/index.js +1 -1
- package/dist/providers/mailchannels/index.d.ts +13 -13
- package/dist/providers/mailchannels/index.js +1 -1
- package/dist/providers/mailcrab/index.d.ts +17 -17
- package/dist/providers/mailcrab/index.js +1 -1
- package/dist/providers/mailersend/index.d.ts +24 -24
- package/dist/providers/mailersend/index.js +1 -1
- package/dist/providers/mailgun/index.d.ts +37 -37
- package/dist/providers/mailgun/index.js +1 -1
- package/dist/providers/mailjet/index.d.ts +36 -36
- package/dist/providers/mailjet/index.js +1 -1
- package/dist/providers/mailomat/index.d.ts +20 -20
- package/dist/providers/mailomat/index.js +1 -1
- package/dist/providers/mailpace/index.d.ts +24 -24
- package/dist/providers/mailpace/index.js +1 -1
- package/dist/providers/mailtrap/index.d.ts +22 -22
- package/dist/providers/mailtrap/index.js +1 -1
- package/dist/providers/mandrill/index.d.ts +36 -36
- package/dist/providers/mandrill/index.js +1 -1
- package/dist/providers/mock/index.d.ts +8 -8
- package/dist/providers/mock/index.js +1 -1
- package/dist/providers/netcore/index.d.ts +17 -17
- package/dist/providers/netcore/index.js +1 -1
- package/dist/providers/nodemailer/index.d.ts +22 -22
- package/dist/providers/nodemailer/index.js +1 -1
- package/dist/providers/opentelemetry/index.d.ts +20 -20
- package/dist/providers/opentelemetry/index.js +1 -1
- package/dist/providers/outlook365/index.d.ts +82 -82
- package/dist/providers/outlook365/index.js +1 -1
- package/dist/providers/plunk/index.d.ts +18 -18
- package/dist/providers/plunk/index.js +1 -1
- package/dist/providers/postal/index.d.ts +24 -24
- package/dist/providers/postal/index.js +1 -1
- package/dist/providers/postmark/index.d.ts +30 -30
- package/dist/providers/postmark/index.js +1 -1
- package/dist/providers/resend/index.d.ts +24 -24
- package/dist/providers/resend/index.js +1 -1
- package/dist/providers/roundrobin/index.d.ts +14 -14
- package/dist/providers/roundrobin/index.js +1 -1
- package/dist/providers/scaleway/index.d.ts +22 -22
- package/dist/providers/scaleway/index.js +1 -1
- package/dist/providers/sendgrid/index.d.ts +25 -25
- package/dist/providers/sendgrid/index.js +1 -1
- package/dist/providers/smtp/index.d.ts +11 -11
- package/dist/providers/smtp/index.js +1 -1
- package/dist/providers/sparkpost/index.d.ts +21 -21
- package/dist/providers/sparkpost/index.js +1 -1
- package/dist/providers/sweego/index.d.ts +20 -20
- package/dist/providers/sweego/index.js +1 -1
- package/dist/providers/zeptomail/index.d.ts +17 -17
- package/dist/providers/zeptomail/index.js +1 -1
- package/dist/queue/bullmq-queue.d.ts +26 -26
- package/dist/queue/index.d.ts +86 -86
- package/dist/queue/pg-boss-queue.d.ts +13 -13
- package/dist/queue/sqs-queue.d.ts +20 -20
- package/dist/queue/unstorage-queue.d.ts +47 -47
- package/dist/queue/unstorage-queue.js +1 -1
- package/dist/render/cid.d.ts +12 -12
- package/dist/render/css-inline.d.ts +12 -12
- package/dist/render/css-inline.js +1 -1
- package/dist/render/dark-mode.d.ts +12 -12
- package/dist/render/preheader.d.ts +16 -16
- package/dist/template-engines/handlebars.d.ts +19 -19
- package/dist/template-engines/handlebars.js +1 -1
- package/dist/template-engines/html-to-text.d.ts +12 -12
- package/dist/template-engines/html-to-text.js +1 -1
- package/dist/template-engines/i18n.d.ts +43 -43
- package/dist/template-engines/i18n.js +1 -1
- package/dist/template-engines/jsx-email.d.ts +8 -8
- package/dist/template-engines/jsx-email.js +1 -1
- package/dist/template-engines/liquid.d.ts +9 -9
- package/dist/template-engines/liquid.js +1 -1
- package/dist/template-engines/mjml.d.ts +9 -9
- package/dist/template-engines/mjml.js +1 -1
- package/dist/template-engines/react-email.d.ts +8 -8
- package/dist/template-engines/react-email.js +1 -1
- package/dist/template-engines/vue-email.d.ts +8 -8
- package/dist/template-engines/vue-email.js +1 -1
- package/dist/test/index.d.ts +89 -89
- package/dist/test/index.js +1 -1
- package/dist/utils/cache.d.ts +27 -27
- package/dist/utils/format-email-address.d.ts +6 -6
- package/dist/utils/format-email-address.js +1 -1
- package/dist/utils/normalize-email-aliases.d.ts +19 -19
- package/dist/utils/parse-address.d.ts +16 -16
- package/dist/utils/parse-eml.d.ts +18 -18
- package/dist/utils/result.d.ts +30 -30
- package/dist/utils/result.js +1 -1
- package/dist/utils/validation/check-feature-support.d.ts +33 -33
- package/dist/utils/validation/validate-email.d.ts +4 -4
- package/dist/webhooks/index.d.ts +134 -134
- package/dist/webhooks/index.js +1 -1
- package/package.json +1 -1
- package/dist/packem_shared/EmailError-B-sEf3bp.js +0 -1
- package/dist/packem_shared/MailMessage-DQRgs5Dz.js +0 -1
- package/dist/packem_shared/SmimeEncrypter-DavopRlE.js +0 -6
- package/dist/packem_shared/SmimeSigner-0onWksAv.js +0 -8
- package/dist/packem_shared/arcMessageSignatureBase-DDLEHW2E.js +0 -17
- package/dist/packem_shared/attachment-processor-CMp7qqMI.js +0 -1
- package/dist/packem_shared/azureProvider-Cw_Tmde6.js +0 -1
- package/dist/packem_shared/dedupeMiddleware-B6ajWOTi.js +0 -1
- package/dist/packem_shared/event-bus.d-DEl3w_EW.d.ts +0 -104
- package/dist/packem_shared/generate-boundary-DQbzDiOI.js +0 -1
- package/dist/packem_shared/index-BoZvzveg.js +0 -11
- package/dist/packem_shared/isValidSigningCertUrl-Bii1AMGC.js +0 -3
- package/dist/packem_shared/mail.d-B9SSqyy0.d.ts +0 -909
- package/dist/packem_shared/mailgunProvider-D9HUWGKN.js +0 -1
- package/dist/packem_shared/mailjetProvider-DelLs2Vt.js +0 -1
- package/dist/packem_shared/types.d-BId55FW2.d.ts +0 -107
- package/dist/packem_shared/types.d-CmoWvdZi.d.ts +0 -61
- package/dist/packem_shared/types.d-DCkecJse.d.ts +0 -51
- package/dist/packem_shared/types.d-Mpu0HZoG.d.ts +0 -24
- package/dist/packem_shared/types.d-lcJZmwRK.d.ts +0 -69
- package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +0 -9
- package/dist/packem_shared/utils-BfYfPB_I.js +0 -1
- package/dist/packem_shared/verifyMailgunWebhook-Cwl0OD3P.js +0 -1
- package/dist/packem_shared/verifyPostmarkWebhook-C72ZvbrG.js +0 -1
- package/dist/packem_shared/verifyResendWebhook-YK2zNDXR.js +0 -1
- package/dist/packem_shared/verifySendGridWebhook-Dbwc1tfG.js +0 -1
- package/dist/packem_shared/withEvents-CCVblSqj.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## @visulima/email [2.1.7](https://github.com/visulima/visulima/compare/%40visulima%2Femail%402.1.6...%40visulima%2Femail%402.1.7) (2026-07-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Dependencies
|
|
5
|
+
|
|
6
|
+
* **@visulima/fs:** upgraded to 5.0.11
|
|
7
|
+
|
|
1
8
|
## @visulima/email [2.1.6](https://github.com/visulima/visulima/compare/%40visulima%2Femail%402.1.5...%40visulima%2Femail%402.1.6) (2026-07-27)
|
|
2
9
|
|
|
3
10
|
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -1,304 +1,304 @@
|
|
|
1
1
|
import { KeyObject } from 'node:crypto';
|
|
2
|
-
import { E as EmailOptions } from "../packem_shared/types.d-
|
|
3
|
-
import { D as DkimOptions, E as EmailSigner, S as SmimeEncryptOptions, a as EmailEncrypter, b as SmimeSignOptions } from "../packem_shared/types.d-
|
|
2
|
+
import { E as EmailOptions } from "../packem_shared/types.d-B9295M4_.js";
|
|
3
|
+
import { D as DkimOptions, E as EmailSigner, S as SmimeEncryptOptions, a as EmailEncrypter, b as SmimeSignOptions } from "../packem_shared/types.d-B0t3PQ3t.js";
|
|
4
4
|
import 'node:buffer';
|
|
5
5
|
/**
|
|
6
|
-
* The signature algorithm for the ARC headers. RSA per RFC 8617, Ed25519 per RFC 8463.
|
|
7
|
-
*/
|
|
6
|
+
* The signature algorithm for the ARC headers. RSA per RFC 8617, Ed25519 per RFC 8463.
|
|
7
|
+
*/
|
|
8
8
|
type ArcAlgorithm = "ed25519-sha256" | "rsa-sha256";
|
|
9
9
|
/**
|
|
10
|
-
* Options for {@link signArc}.
|
|
11
|
-
*/
|
|
10
|
+
* Options for {@link signArc}.
|
|
11
|
+
*/
|
|
12
12
|
interface ArcSealOptions {
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
* Signature algorithm (`a=`). `rsa-sha256` (default) or `ed25519-sha256` (RFC 8463).
|
|
15
|
+
* @default "rsa-sha256"
|
|
16
|
+
*/
|
|
17
17
|
algorithm?: ArcAlgorithm;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
* The `Authentication-Results` value to chain (authserv-id plus method results),
|
|
20
|
+
* e.g. `example.com; spf=pass smtp.mailfrom=...; dkim=pass header.d=...`.
|
|
21
|
+
*/
|
|
22
22
|
authenticationResults: string;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
* Chain validation status for the seal (`cv`). For an originating sealer (instance 1) this is
|
|
25
|
+
* always `none`.
|
|
26
|
+
* @default "none"
|
|
27
|
+
*/
|
|
28
28
|
cv?: "fail" | "none" | "pass";
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
* The signing domain (`d`).
|
|
31
|
+
*/
|
|
32
32
|
domainName: string;
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
* Lower-cased header names covered by the ARC-Message-Signature (`h`).
|
|
35
|
+
* @default from, to, cc, subject, date, message-id, mime-version
|
|
36
|
+
*/
|
|
37
37
|
headersToSign?: string[];
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
* The ARC instance number (`i`). Only `1` (originating sealer) is supported.
|
|
40
|
+
* @default 1
|
|
41
|
+
*/
|
|
42
42
|
instance?: number;
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
* The DKIM/ARC key selector (`s`).
|
|
45
|
+
*/
|
|
46
46
|
keySelector: string;
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
* Passphrase for an encrypted private key.
|
|
49
|
+
*/
|
|
50
50
|
passphrase?: string;
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
* Private key (PEM string, or a `file://` path). RSA or Ed25519 to match `algorithm`.
|
|
53
|
+
*/
|
|
54
54
|
privateKey: string;
|
|
55
55
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
* Signature timestamp (`t`) in unix seconds. Defaults to now.
|
|
57
|
+
*/
|
|
58
58
|
timestamp?: number;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* The three ARC header fields produced for one instance.
|
|
62
|
-
*/
|
|
61
|
+
* The three ARC header fields produced for one instance.
|
|
62
|
+
*/
|
|
63
63
|
interface ArcHeaderSet {
|
|
64
64
|
"ARC-Authentication-Results": string;
|
|
65
65
|
"ARC-Message-Signature": string;
|
|
66
66
|
"ARC-Seal": string;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* Options for {@link verifyArc}.
|
|
70
|
-
*/
|
|
69
|
+
* Options for {@link verifyArc}.
|
|
70
|
+
*/
|
|
71
71
|
interface ArcVerifyOptions {
|
|
72
72
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
* The ARC/DKIM public key for the signing domain+selector — a PEM string or a `KeyObject`. Look it
|
|
74
|
+
* up at `<selector>._domainkey.<d>` (the `p=` tag), decoded to SPKI.
|
|
75
|
+
*/
|
|
76
76
|
publicKey: KeyObject | string;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
* The outcome of {@link verifyArc}.
|
|
80
|
-
*/
|
|
79
|
+
* The outcome of {@link verifyArc}.
|
|
80
|
+
*/
|
|
81
81
|
interface ArcVerifyResult {
|
|
82
82
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
* Per-component verification: the ARC-Message-Signature, the ARC-Seal, and the body hash.
|
|
84
|
+
*/
|
|
85
85
|
components: {
|
|
86
86
|
ams: boolean;
|
|
87
87
|
bodyHash: boolean;
|
|
88
88
|
seal: boolean;
|
|
89
89
|
};
|
|
90
90
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
* The chain-validation status (`cv`) from the ARC-Seal.
|
|
92
|
+
*/
|
|
93
93
|
cv?: string;
|
|
94
94
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
* A machine-readable reason when `valid` is `false`.
|
|
96
|
+
*/
|
|
97
97
|
reason?: string;
|
|
98
98
|
/**
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
* Whether the whole instance verified (signature + seal + body hash).
|
|
100
|
+
*/
|
|
101
101
|
valid: boolean;
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
|
-
* Computes the exact byte string that the ARC-Message-Signature `b=` value signs.
|
|
105
|
-
*
|
|
106
|
-
* Exposed so ARC verifiers (and tests) can re-derive the signing input.
|
|
107
|
-
* @param email The email being sealed.
|
|
108
|
-
* @param options The seal options.
|
|
109
|
-
* @returns The AMS header (without the `b=` value) and the data signed.
|
|
110
|
-
*/
|
|
104
|
+
* Computes the exact byte string that the ARC-Message-Signature `b=` value signs.
|
|
105
|
+
*
|
|
106
|
+
* Exposed so ARC verifiers (and tests) can re-derive the signing input.
|
|
107
|
+
* @param email The email being sealed.
|
|
108
|
+
* @param options The seal options.
|
|
109
|
+
* @returns The AMS header (without the `b=` value) and the data signed.
|
|
110
|
+
*/
|
|
111
111
|
declare const arcMessageSignatureBase: (email: EmailOptions, options: ArcSealOptions) => {
|
|
112
112
|
header: string;
|
|
113
113
|
signBase: string;
|
|
114
114
|
};
|
|
115
115
|
/**
|
|
116
|
-
* Computes the exact byte string that the ARC-Seal `b=` value signs (for an originating, i=1 seal).
|
|
117
|
-
*
|
|
118
|
-
* Exposed so ARC verifiers (and tests) can re-derive the signing input.
|
|
119
|
-
* @param aarValue The ARC-Authentication-Results value.
|
|
120
|
-
* @param amsValue The full ARC-Message-Signature value (including its `b=` signature).
|
|
121
|
-
* @param options The signing domain, selector, instance, timestamp and chain-validation status.
|
|
122
|
-
* @returns The ARC-Seal header (without the `b=` value) and the data signed.
|
|
123
|
-
*/
|
|
116
|
+
* Computes the exact byte string that the ARC-Seal `b=` value signs (for an originating, i=1 seal).
|
|
117
|
+
*
|
|
118
|
+
* Exposed so ARC verifiers (and tests) can re-derive the signing input.
|
|
119
|
+
* @param aarValue The ARC-Authentication-Results value.
|
|
120
|
+
* @param amsValue The full ARC-Message-Signature value (including its `b=` signature).
|
|
121
|
+
* @param options The signing domain, selector, instance, timestamp and chain-validation status.
|
|
122
|
+
* @returns The ARC-Seal header (without the `b=` value) and the data signed.
|
|
123
|
+
*/
|
|
124
124
|
declare const arcSealBase: (aarValue: string, amsValue: string, options: ArcSealOptions) => {
|
|
125
125
|
header: string;
|
|
126
126
|
signBase: string;
|
|
127
127
|
};
|
|
128
128
|
/**
|
|
129
|
-
* Seals a message with an ARC (Authenticated Received Chain, RFC 8617) header set for an originating
|
|
130
|
-
* sealer (instance `i=1`).
|
|
131
|
-
*
|
|
132
|
-
* Adds `ARC-Authentication-Results`, `ARC-Message-Signature`, and `ARC-Seal` headers. Use this when
|
|
133
|
-
* your service forwards mail and wants downstream receivers to trust the authentication results you
|
|
134
|
-
* observed. Supports RSA (default) and Ed25519 (`algorithm: "ed25519-sha256"`, RFC 8463) keys.
|
|
135
|
-
*
|
|
136
|
-
* IMPORTANT: the body hash (`bh=`) is computed over `text` + "\n\n" + `html` with relaxed
|
|
137
|
-
* canonicalization — the same simplification as the DKIM signer. For a third-party ARC verifier to
|
|
138
|
-
* accept the seal, the body actually transmitted on the wire must canonicalize to this same value, so
|
|
139
|
-
* apply ARC at the point where the MIME body is finalized (or feed in the exact rendered body).
|
|
140
|
-
* @param email The email to seal.
|
|
141
|
-
* @param options The seal options. See {@link ArcSealOptions}.
|
|
142
|
-
* @returns The email with the ARC header set added, and the raw {@link ArcHeaderSet}.
|
|
143
|
-
* @throws {Error} When the private key cannot be loaded or signing fails.
|
|
144
|
-
*/
|
|
129
|
+
* Seals a message with an ARC (Authenticated Received Chain, RFC 8617) header set for an originating
|
|
130
|
+
* sealer (instance `i=1`).
|
|
131
|
+
*
|
|
132
|
+
* Adds `ARC-Authentication-Results`, `ARC-Message-Signature`, and `ARC-Seal` headers. Use this when
|
|
133
|
+
* your service forwards mail and wants downstream receivers to trust the authentication results you
|
|
134
|
+
* observed. Supports RSA (default) and Ed25519 (`algorithm: "ed25519-sha256"`, RFC 8463) keys.
|
|
135
|
+
*
|
|
136
|
+
* IMPORTANT: the body hash (`bh=`) is computed over `text` + "\n\n" + `html` with relaxed
|
|
137
|
+
* canonicalization — the same simplification as the DKIM signer. For a third-party ARC verifier to
|
|
138
|
+
* accept the seal, the body actually transmitted on the wire must canonicalize to this same value, so
|
|
139
|
+
* apply ARC at the point where the MIME body is finalized (or feed in the exact rendered body).
|
|
140
|
+
* @param email The email to seal.
|
|
141
|
+
* @param options The seal options. See {@link ArcSealOptions}.
|
|
142
|
+
* @returns The email with the ARC header set added, and the raw {@link ArcHeaderSet}.
|
|
143
|
+
* @throws {Error} When the private key cannot be loaded or signing fails.
|
|
144
|
+
*/
|
|
145
145
|
declare const signArc: (email: EmailOptions, options: ArcSealOptions) => Promise<{
|
|
146
146
|
email: EmailOptions;
|
|
147
147
|
headers: ArcHeaderSet;
|
|
148
148
|
}>;
|
|
149
149
|
/**
|
|
150
|
-
* Verifies an originating (i=1) ARC header set against the signing domain's public key.
|
|
151
|
-
*
|
|
152
|
-
* Re-derives the AMS and ARC-Seal signing inputs from `email` + the supplied ARC headers, recomputes
|
|
153
|
-
* the body hash, and checks all three. The public key must be the one published for the seal's
|
|
154
|
-
* `s=`/`d=` (the DKIM-style `<selector>._domainkey.<domain>` TXT `p=` value).
|
|
155
|
-
* @param email The message that was sealed (same fields used when signing).
|
|
156
|
-
* @param headers The ARC header set (or any record containing the three `ARC-*` headers).
|
|
157
|
-
* @param options Verification options. See {@link ArcVerifyOptions}.
|
|
158
|
-
* @returns The verification result. See {@link ArcVerifyResult}.
|
|
159
|
-
*/
|
|
150
|
+
* Verifies an originating (i=1) ARC header set against the signing domain's public key.
|
|
151
|
+
*
|
|
152
|
+
* Re-derives the AMS and ARC-Seal signing inputs from `email` + the supplied ARC headers, recomputes
|
|
153
|
+
* the body hash, and checks all three. The public key must be the one published for the seal's
|
|
154
|
+
* `s=`/`d=` (the DKIM-style `<selector>._domainkey.<domain>` TXT `p=` value).
|
|
155
|
+
* @param email The message that was sealed (same fields used when signing).
|
|
156
|
+
* @param headers The ARC header set (or any record containing the three `ARC-*` headers).
|
|
157
|
+
* @param options Verification options. See {@link ArcVerifyOptions}.
|
|
158
|
+
* @returns The verification result. See {@link ArcVerifyResult}.
|
|
159
|
+
*/
|
|
160
160
|
declare const verifyArc: (email: EmailOptions, headers: ArcHeaderSet | Record<string, string>, options: ArcVerifyOptions) => ArcVerifyResult;
|
|
161
161
|
/**
|
|
162
|
-
* DKIM signer implementation
|
|
163
|
-
*/
|
|
162
|
+
* DKIM signer implementation
|
|
163
|
+
*/
|
|
164
164
|
declare class DkimSigner implements EmailSigner {
|
|
165
165
|
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
* Sanitizes a display name for use in quoted email headers per RFC 5322.
|
|
167
|
+
* Removes/replaces CR, LF, tabs with space, escapes backslashes and quotes,
|
|
168
|
+
* and strips non-printable control characters.
|
|
169
|
+
* @param name The display name to sanitize.
|
|
170
|
+
* @returns The sanitized display name, or empty string if nothing remains.
|
|
171
|
+
*/
|
|
172
172
|
private static sanitizeDisplayName;
|
|
173
173
|
/**
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
* Formats an email address for use in email headers.
|
|
175
|
+
* @param address The email address object to format.
|
|
176
|
+
* @param address.email The email address string.
|
|
177
|
+
* @param address.name Optional display name for the email address.
|
|
178
|
+
* @returns The formatted email address string in RFC 5322 format.
|
|
179
|
+
*/
|
|
180
180
|
private static formatAddress;
|
|
181
181
|
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
* Formats email addresses for headers.
|
|
183
|
+
* @param addresses The email address(es) to format (single or array).
|
|
184
|
+
* @returns The formatted email addresses string (comma-separated if multiple).
|
|
185
|
+
*/
|
|
186
186
|
private static formatAddresses;
|
|
187
187
|
private readonly options;
|
|
188
188
|
/**
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
* Creates a new DKIM signer.
|
|
190
|
+
* @param options DKIM signing options.
|
|
191
|
+
*/
|
|
192
192
|
constructor(options: DkimOptions);
|
|
193
193
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
* Signs an email message with DKIM.
|
|
195
|
+
* @param email The email options to sign.
|
|
196
|
+
* @returns The email options with DKIM signature header added.
|
|
197
|
+
* @throws {Error} When signing fails (e.g., invalid private key).
|
|
198
|
+
*/
|
|
199
199
|
sign(email: EmailOptions): Promise<EmailOptions>;
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
|
-
* Creates a DKIM signer instance.
|
|
203
|
-
* @param options DKIM signing options.
|
|
204
|
-
* @returns A new DkimSigner instance.
|
|
205
|
-
*/
|
|
202
|
+
* Creates a DKIM signer instance.
|
|
203
|
+
* @param options DKIM signing options.
|
|
204
|
+
* @returns A new DkimSigner instance.
|
|
205
|
+
*/
|
|
206
206
|
declare const createDkimSigner: (options: DkimOptions) => DkimSigner;
|
|
207
207
|
/**
|
|
208
|
-
* S/MIME encrypter implementation using PKIjs
|
|
209
|
-
* Note: Requires pkijs and asn1js for S/MIME operations
|
|
210
|
-
* Uses Node.js crypto for all cryptographic operations
|
|
211
|
-
*/
|
|
208
|
+
* S/MIME encrypter implementation using PKIjs
|
|
209
|
+
* Note: Requires pkijs and asn1js for S/MIME operations
|
|
210
|
+
* Uses Node.js crypto for all cryptographic operations
|
|
211
|
+
*/
|
|
212
212
|
declare class SmimeEncrypter implements EmailEncrypter {
|
|
213
213
|
/**
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
214
|
+
* Collects and normalizes all recipients (to, cc, bcc) from email options.
|
|
215
|
+
* Normalizes each to an array, extracts email addresses, and deduplicates.
|
|
216
|
+
* @param email The email options containing recipients.
|
|
217
|
+
* @returns An array of unique email addresses (strings).
|
|
218
|
+
*/
|
|
219
219
|
private static collectRecipients;
|
|
220
220
|
/**
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
* Formats an email address for use in email headers.
|
|
222
|
+
* @param address The email address to format (string or EmailAddress object).
|
|
223
|
+
* @returns The formatted email address string in RFC 5322 format.
|
|
224
|
+
*/
|
|
225
225
|
private static formatAddress;
|
|
226
226
|
/**
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
* Formats email addresses for use in email headers.
|
|
228
|
+
* @param addresses The email addresses to format (single or array, string or EmailAddress objects).
|
|
229
|
+
* @returns The formatted email addresses string (comma-separated if multiple).
|
|
230
|
+
*/
|
|
231
231
|
private static formatAddresses;
|
|
232
232
|
private readonly options;
|
|
233
233
|
/**
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
* Creates a new S/MIME encrypter.
|
|
235
|
+
* @param options S/MIME encryption options.
|
|
236
|
+
*/
|
|
237
237
|
constructor(options: SmimeEncryptOptions);
|
|
238
238
|
/**
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
239
|
+
* Encrypts an email message with S/MIME.
|
|
240
|
+
* @param email The email options to encrypt.
|
|
241
|
+
* @returns The encrypted email options.
|
|
242
|
+
* @throws {Error} When encryption fails (e.g., invalid certificate).
|
|
243
|
+
*/
|
|
244
244
|
encrypt(email: EmailOptions): Promise<EmailOptions>;
|
|
245
245
|
/**
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
* Builds the email message string from email options.
|
|
247
|
+
* @param email The email options to build the message from.
|
|
248
|
+
* @returns The formatted email message as a string.
|
|
249
|
+
*/
|
|
250
250
|
private buildMessage;
|
|
251
251
|
}
|
|
252
252
|
/**
|
|
253
|
-
* Creates a new S/MIME encrypter instance.
|
|
254
|
-
* @param options The S/MIME encryption options.
|
|
255
|
-
* @returns A new SmimeEncrypter instance ready to encrypt emails.
|
|
256
|
-
*/
|
|
253
|
+
* Creates a new S/MIME encrypter instance.
|
|
254
|
+
* @param options The S/MIME encryption options.
|
|
255
|
+
* @returns A new SmimeEncrypter instance ready to encrypt emails.
|
|
256
|
+
*/
|
|
257
257
|
declare const createSmimeEncrypter: (options: SmimeEncryptOptions) => SmimeEncrypter;
|
|
258
258
|
/**
|
|
259
|
-
* S/MIME signer implementation using PKIjs
|
|
260
|
-
* Note: Requires pkijs and asn1js for S/MIME operations
|
|
261
|
-
* Uses Node.js crypto for all cryptographic operations
|
|
262
|
-
*/
|
|
259
|
+
* S/MIME signer implementation using PKIjs
|
|
260
|
+
* Note: Requires pkijs and asn1js for S/MIME operations
|
|
261
|
+
* Uses Node.js crypto for all cryptographic operations
|
|
262
|
+
*/
|
|
263
263
|
declare class SmimeSigner implements EmailSigner {
|
|
264
264
|
/**
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
265
|
+
* Formats an email address for use in email headers.
|
|
266
|
+
* @param address The email address object to format.
|
|
267
|
+
* @param address.email The email address string.
|
|
268
|
+
* @param address.name Optional display name for the email address.
|
|
269
|
+
* @returns The formatted email address string in RFC 5322 format.
|
|
270
|
+
*/
|
|
271
271
|
private static formatAddress;
|
|
272
272
|
private readonly options;
|
|
273
273
|
/**
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
* Creates a new S/MIME signer.
|
|
275
|
+
* @param options S/MIME signing options.
|
|
276
|
+
*/
|
|
277
277
|
constructor(options: SmimeSignOptions);
|
|
278
278
|
/**
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
* Signs an email message with S/MIME.
|
|
280
|
+
* @param email The email options to sign.
|
|
281
|
+
* @returns The email options with S/MIME signature.
|
|
282
|
+
* @throws {Error} When signing fails (e.g., invalid certificate/key).
|
|
283
|
+
*/
|
|
284
284
|
sign(email: EmailOptions): Promise<EmailOptions>;
|
|
285
285
|
/**
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
* Builds the email message string from email options.
|
|
287
|
+
* @param email The email options to build the message from.
|
|
288
|
+
* @returns The formatted email message as a string.
|
|
289
|
+
*/
|
|
290
290
|
private buildMessage;
|
|
291
291
|
/**
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
292
|
+
* Formats email addresses for use in email headers.
|
|
293
|
+
* @param addresses The email addresses to format (single or array).
|
|
294
|
+
* @returns The formatted email addresses string (comma-separated if multiple).
|
|
295
|
+
*/
|
|
296
296
|
private formatAddresses;
|
|
297
297
|
}
|
|
298
298
|
/**
|
|
299
|
-
* Creates a new S/MIME signer instance.
|
|
300
|
-
* @param options The S/MIME signing options.
|
|
301
|
-
* @returns A new SmimeSigner instance ready to sign emails.
|
|
302
|
-
*/
|
|
299
|
+
* Creates a new S/MIME signer instance.
|
|
300
|
+
* @param options The S/MIME signing options.
|
|
301
|
+
* @returns A new SmimeSigner instance ready to sign emails.
|
|
302
|
+
*/
|
|
303
303
|
declare const createSmimeSigner: (options: SmimeSignOptions) => SmimeSigner;
|
|
304
304
|
export { type ArcAlgorithm, type ArcHeaderSet, type ArcSealOptions, type ArcVerifyOptions, type ArcVerifyResult, type DkimOptions, DkimSigner, type EmailEncrypter, type EmailSigner, type SmimeEncryptOptions, SmimeEncrypter, type SmimeSignOptions, SmimeSigner, arcMessageSignatureBase, arcSealBase, createDkimSigner, createSmimeEncrypter, createSmimeSigner, signArc, verifyArc };
|
package/dist/crypto/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{arcMessageSignatureBase as m,arcSealBase as i,signArc as a,verifyArc as t}from"../packem_shared/arcMessageSignatureBase-
|
|
1
|
+
import{arcMessageSignatureBase as m,arcSealBase as i,signArc as a,verifyArc as t}from"../packem_shared/arcMessageSignatureBase-D54jQIWu.js";import{DkimSigner as c,createDkimSigner as n}from"../packem_shared/DkimSigner-sLcIw9bp.js";import{SmimeEncrypter as g,createSmimeEncrypter as p}from"../packem_shared/SmimeEncrypter-CzTbQM-z.js";import{SmimeSigner as s,createSmimeSigner as x}from"../packem_shared/SmimeSigner-DjLShaOw.js";export{c as DkimSigner,g as SmimeEncrypter,s as SmimeSigner,m as arcMessageSignatureBase,i as arcSealBase,n as createDkimSigner,p as createSmimeEncrypter,x as createSmimeSigner,a as signArc,t as verifyArc};
|
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A DKIM/SPF auth result inside a DMARC aggregate record.
|
|
3
|
-
*/
|
|
2
|
+
* A DKIM/SPF auth result inside a DMARC aggregate record.
|
|
3
|
+
*/
|
|
4
4
|
interface DmarcAuthResult {
|
|
5
5
|
domain?: string;
|
|
6
6
|
result?: string;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* One `<record>` row of a DMARC aggregate report.
|
|
10
|
-
*/
|
|
9
|
+
* One `<record>` row of a DMARC aggregate report.
|
|
10
|
+
*/
|
|
11
11
|
interface DmarcRecordRow {
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
* The per-mechanism auth results.
|
|
14
|
+
*/
|
|
15
15
|
authResults: {
|
|
16
16
|
dkim: DmarcAuthResult[];
|
|
17
17
|
spf: DmarcAuthResult[];
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
* Number of messages this row represents.
|
|
21
|
+
*/
|
|
22
22
|
count: number;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
* The policy disposition applied (`none` / `quarantine` / `reject`).
|
|
25
|
+
*/
|
|
26
26
|
disposition?: string;
|
|
27
27
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
* The DKIM alignment result (`pass` / `fail`).
|
|
29
|
+
*/
|
|
30
30
|
dkim?: string;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* The `From:` header domain.
|
|
33
|
+
*/
|
|
34
34
|
headerFrom?: string;
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
* The source IP that sent the messages.
|
|
37
|
+
*/
|
|
38
38
|
sourceIp?: string;
|
|
39
39
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
* The SPF alignment result (`pass` / `fail`).
|
|
41
|
+
*/
|
|
42
42
|
spf?: string;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* A parsed DMARC aggregate (RUA) report.
|
|
46
|
-
*/
|
|
45
|
+
* A parsed DMARC aggregate (RUA) report.
|
|
46
|
+
*/
|
|
47
47
|
interface DmarcAggregateReport {
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
* Report window start (`date_range.begin`, unix seconds as a string).
|
|
50
|
+
*/
|
|
51
51
|
dateRangeBegin?: string;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
* Report window end (`date_range.end`, unix seconds as a string).
|
|
54
|
+
*/
|
|
55
55
|
dateRangeEnd?: string;
|
|
56
56
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
* The reporter's contact email.
|
|
58
|
+
*/
|
|
59
59
|
email?: string;
|
|
60
60
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
* The reporting organization.
|
|
62
|
+
*/
|
|
63
63
|
organizationName?: string;
|
|
64
64
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
* The published policy the report was evaluated against.
|
|
66
|
+
*/
|
|
67
67
|
policyPublished?: {
|
|
68
68
|
adkim?: string;
|
|
69
69
|
aspf?: string;
|
|
@@ -73,23 +73,23 @@ interface DmarcAggregateReport {
|
|
|
73
73
|
sp?: string;
|
|
74
74
|
};
|
|
75
75
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
* The per-source rows.
|
|
77
|
+
*/
|
|
78
78
|
records: DmarcRecordRow[];
|
|
79
79
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
* The unique report id.
|
|
81
|
+
*/
|
|
82
82
|
reportId?: string;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* Parses a DMARC aggregate (RUA) report XML document into a structured object.
|
|
86
|
-
*
|
|
87
|
-
* Reports arrive gzipped/zipped — decompress to the XML string first. `fast-xml-parser` is an optional
|
|
88
|
-
* peer dependency (`pnpm add fast-xml-parser`), loaded only via this `./deliverability/dmarc-report`
|
|
89
|
-
* entry point so the rest of the deliverability tooling stays dependency-free.
|
|
90
|
-
* @param xml The DMARC aggregate report XML.
|
|
91
|
-
* @returns The parsed report. See {@link DmarcAggregateReport}.
|
|
92
|
-
* @throws {EmailError} When `fast-xml-parser` is not installed or the XML cannot be parsed.
|
|
93
|
-
*/
|
|
85
|
+
* Parses a DMARC aggregate (RUA) report XML document into a structured object.
|
|
86
|
+
*
|
|
87
|
+
* Reports arrive gzipped/zipped — decompress to the XML string first. `fast-xml-parser` is an optional
|
|
88
|
+
* peer dependency (`pnpm add fast-xml-parser`), loaded only via this `./deliverability/dmarc-report`
|
|
89
|
+
* entry point so the rest of the deliverability tooling stays dependency-free.
|
|
90
|
+
* @param xml The DMARC aggregate report XML.
|
|
91
|
+
* @returns The parsed report. See {@link DmarcAggregateReport}.
|
|
92
|
+
* @throws {EmailError} When `fast-xml-parser` is not installed or the XML cannot be parsed.
|
|
93
|
+
*/
|
|
94
94
|
declare const parseDmarcReport: (xml: string) => Promise<DmarcAggregateReport>;
|
|
95
95
|
export { type DmarcAggregateReport, type DmarcAuthResult, type DmarcRecordRow, parseDmarcReport };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import l from"../packem_shared/EmailError-
|
|
1
|
+
import l from"../packem_shared/EmailError-CDvYwuqz.js";const g=a=>a==null?[]:Array.isArray(a)?a:[a],e=a=>{if(typeof a=="string")return a;if(typeof a=="number"||typeof a=="boolean")return String(a)},c=a=>{const r=e(a);if(r===void 0)return;const s=Number(r);return Number.isNaN(s)?void 0:s},f=a=>g(a).map(r=>({domain:e(r.domain),result:e(r.result)})),h=async a=>{let r;try{({XMLParser:r}=await import("fast-xml-parser"))}catch(t){throw t instanceof Error&&(t.code==="ERR_MODULE_NOT_FOUND"||t.message.includes("Cannot find module")||t.message.includes("Cannot find package"))?new l("deliverability","fast-xml-parser is not installed. Please install it: pnpm add fast-xml-parser",{cause:t}):new l("deliverability",`Failed to load fast-xml-parser: ${t.message}`,{cause:t})}let s;try{s=new r({ignoreAttributes:!0,parseTagValue:!1}).parse(a)}catch(t){throw new l("deliverability",`Failed to parse DMARC report: ${t.message}`,{cause:t})}const n=s.feedback??{},o=n.report_metadata??{},m=o.date_range??{},i=n.policy_published??{},y=g(n.record).map(t=>{const d=t.row??{},p=d.policy_evaluated??{},b=t.identifiers??{},u=t.auth_results??{};return{authResults:{dkim:f(u.dkim),spf:f(u.spf)},count:c(d.count)??0,disposition:e(p.disposition),dkim:e(p.dkim),headerFrom:e(b.header_from),sourceIp:e(d.source_ip),spf:e(p.spf)}});return{dateRangeBegin:e(m.begin),dateRangeEnd:e(m.end),email:e(o.email),organizationName:e(o.org_name),policyPublished:{adkim:e(i.adkim),aspf:e(i.aspf),domain:e(i.domain),p:e(i.p),pct:c(i.pct),sp:e(i.sp)},records:y,reportId:e(o.report_id)}};export{h as parseDmarcReport};
|