@visulima/email 1.0.0-alpha.4 → 1.0.0-alpha.40
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 +525 -0
- package/LICENSE.md +541 -847
- package/README.md +207 -5
- package/dist/crypto/index.d.ts +304 -4
- package/dist/crypto/index.js +1 -1
- package/dist/deliverability/dmarc-report.d.ts +95 -0
- package/dist/deliverability/dmarc-report.js +1 -0
- package/dist/deliverability/index.d.ts +360 -0
- package/dist/deliverability/index.js +1 -0
- package/dist/events/index.d.ts +31 -0
- package/dist/events/index.js +1 -0
- package/dist/inbound/index.d.ts +375 -0
- package/dist/inbound/index.js +1 -0
- package/dist/index.d.ts +94 -9
- package/dist/index.js +1 -1
- package/dist/middleware/index.d.ts +346 -0
- package/dist/middleware/index.js +1 -0
- package/dist/packem_shared/ALL_EVENTS-3kwh5CBE.js +1 -0
- package/dist/packem_shared/DkimSigner-BuSbnos1.js +18 -0
- package/dist/packem_shared/DraftMailMessage-C9tevR8K.js +1 -0
- package/dist/packem_shared/EmailError-B-sEf3bp.js +1 -0
- package/dist/packem_shared/Mail-DpjH0Exh.js +1 -0
- package/dist/packem_shared/MailMessage-L-Q9yc5v.js +1 -0
- package/dist/packem_shared/MemoryEventStore-CuhfO9aj.js +1 -0
- package/dist/packem_shared/MemoryQueue-Dl1Fa6OJ.js +1 -0
- package/dist/packem_shared/MemorySuppressionStore-DZnbz-_B.js +1 -0
- package/dist/packem_shared/RATE_LIMIT_PRESETS-BPADLgcA.js +1 -0
- package/dist/packem_shared/RequiredOptionError-DuNNY_a5.js +1 -0
- package/dist/packem_shared/SmimeEncrypter-C7usORKF.js +6 -0
- package/dist/packem_shared/SmimeSigner-DgAApLPS.js +8 -0
- package/dist/packem_shared/addDarkModeSupport-DZYxULjl.js +1 -0
- package/dist/packem_shared/address-formatter-BWR2Dddx.js +1 -0
- package/dist/packem_shared/aggregate-features-BqEjPd42.js +1 -0
- package/dist/packem_shared/ahaSendProvider-Dq5mElHZ.js +1 -0
- package/dist/packem_shared/arcMessageSignatureBase-BY4j0TxM.js +17 -0
- package/dist/packem_shared/attachment-processor-BjTNoMyb.js +1 -0
- package/dist/packem_shared/awsSesProvider-BGZJUIep.js +32 -0
- package/dist/packem_shared/azureProvider-DlM6UWUv.js +1 -0
- package/dist/packem_shared/brevoProvider-D_Hhc0Z-.js +1 -0
- package/dist/packem_shared/build-mime-message-Be6TOi1T.js +3 -0
- package/dist/packem_shared/buildListUnsubscribe-Cdr8MvR_.js +1 -0
- package/dist/packem_shared/buildMtaStsPolicy-oEQg8y_C.js +6 -0
- package/dist/packem_shared/circuitBreakerMiddleware-D2SA_07f.js +1 -0
- package/dist/packem_shared/cloudflareEmailProvider-D4adkOjA.js +1 -0
- package/dist/packem_shared/composeMiddleware-BHwLLEzK.js +1 -0
- package/dist/packem_shared/create-logger-BQTS3f-I.js +1 -0
- package/dist/packem_shared/createSuppressionStore-CeAZKCbY.js +1 -0
- package/dist/packem_shared/createTestEmail-BM3iNznm.js +1 -0
- package/dist/packem_shared/createWorker-_-yMWcNQ.js +1 -0
- package/dist/packem_shared/dedupeMiddleware-B6ajWOTi.js +1 -0
- package/dist/packem_shared/defineInboundHandler-CnL2BzlL.js +1 -0
- package/dist/packem_shared/defineProvider-C9q-7iwt.js +1 -0
- package/dist/packem_shared/detectMimeType-Dxv4MjZ7.js +1 -0
- package/dist/packem_shared/emailMatchers-DZDkrZ_3.js +1 -0
- package/dist/packem_shared/event-bus.d-DEl3w_EW.d.ts +104 -0
- package/dist/packem_shared/extractCidReferences-BuoTREMp.js +1 -0
- package/dist/packem_shared/extractReply-BUjIBt9A.js +5 -0
- package/dist/packem_shared/failoverProvider-BgX6zfnY.js +1 -0
- package/dist/packem_shared/format-address-DTl-9O70.js +1 -0
- package/dist/packem_shared/generate-boundary-DQbzDiOI.js +1 -0
- package/dist/packem_shared/generate-message-id-gXAuMz4g.js +1 -0
- package/dist/packem_shared/headers-to-record-De1Eg951.js +1 -0
- package/dist/packem_shared/httpProvider-DJAsYSun.js +1 -0
- package/dist/packem_shared/index-yDU-1zOZ.js +11 -0
- package/dist/packem_shared/infobipProvider-oOL-ThpP.js +1 -0
- package/dist/packem_shared/injectPreheader-CF9WHZ7J.js +1 -0
- package/dist/packem_shared/inlineCss-BQ7d2Cyz.js +1 -0
- package/dist/packem_shared/isValidSigningCertUrl-Bii1AMGC.js +3 -0
- package/dist/packem_shared/loggingMiddleware-CZIiVMVp.js +1 -0
- package/dist/packem_shared/loopsProvider-BXr0KSjB.js +1 -0
- package/dist/packem_shared/mail.d-B9SSqyy0.d.ts +909 -0
- package/dist/packem_shared/{mailCrabProvider-CM_CFDca.js → mailCrabProvider-C7Ao5H9p.js} +1 -1
- package/dist/packem_shared/mailPaceProvider-DklGeGEM.js +1 -0
- package/dist/packem_shared/mailchannelsProvider-DPfQVzUd.js +1 -0
- package/dist/packem_shared/mailerSendProvider-B8iT5Uhb.js +1 -0
- package/dist/packem_shared/mailgunProvider-Ctyrs9d0.js +1 -0
- package/dist/packem_shared/mailjetProvider-v55nFDsr.js +1 -0
- package/dist/packem_shared/mailomatProvider-BCyB4Q4B.js +1 -0
- package/dist/packem_shared/mailtrapProvider-DcVw3sxR.js +1 -0
- package/dist/packem_shared/make-request-BlK_B72c.js +1 -0
- package/dist/packem_shared/mandrillProvider-gqMFMwgs.js +1 -0
- package/dist/packem_shared/mockProvider-Behywbl1.js +1 -0
- package/dist/packem_shared/netcoreProvider-XMWO_Aoa.js +1 -0
- package/dist/packem_shared/nodemailerProvider-BFHobXxt.js +1 -0
- package/dist/packem_shared/normalizeMessageId-DAx2pGe2.js +1 -0
- package/dist/packem_shared/oauth2Middleware-CodqXkyj.js +1 -0
- package/dist/packem_shared/opentelemetryProvider-ByHC01ub.js +1 -0
- package/dist/packem_shared/outlook365Provider-BoNtxqIx.js +1 -0
- package/dist/packem_shared/parseAddress-DdbViBAJ.js +1 -0
- package/dist/packem_shared/parseArfReport-Ds6S3c4J.js +6 -0
- package/dist/packem_shared/parseCloudflareInbound-C__j-oNa.js +1 -0
- package/dist/packem_shared/parseDmarcRecord-DXZ-_rF0.js +1 -0
- package/dist/packem_shared/parseMailgunInbound-BpC6uPNe.js +1 -0
- package/dist/packem_shared/parsePostmarkInbound-Co3_c6-9.js +1 -0
- package/dist/packem_shared/parseSendGridInbound-DsALoijO.js +4 -0
- package/dist/packem_shared/parseSesInbound-CH5tHIjp.js +1 -0
- package/dist/packem_shared/parseTlsReport-wPe1lIDs.js +1 -0
- package/dist/packem_shared/plunkProvider-C0LO-1E3.js +1 -0
- package/dist/packem_shared/postProcessHtml-DqKi2Ucg.js +1 -0
- package/dist/packem_shared/postalProvider-B26IqgxE.js +1 -0
- package/dist/packem_shared/postmarkProvider-DWQJv5_M.js +1 -0
- package/dist/packem_shared/provider-base-gIoUu9so.js +1 -0
- package/dist/packem_shared/provider.d-J-y6iogK.d.ts +28 -0
- package/dist/packem_shared/quoted-printable-nSGDA1tA.js +7 -0
- package/dist/packem_shared/resendProvider-DhvKVyCD.js +1 -0
- package/dist/packem_shared/retry-3pnxTuNs.js +1 -0
- package/dist/packem_shared/retryMiddleware-DbViDX4r.js +1 -0
- package/dist/packem_shared/roundRobinProvider-D1by5KGW.js +1 -0
- package/dist/packem_shared/sanitize-header-DJhgZl3y.js +1 -0
- package/dist/packem_shared/scalewayProvider-D8dmHuwZ.js +1 -0
- package/dist/packem_shared/sendGridProvider-CChhLr7s.js +1 -0
- package/dist/packem_shared/smtpProvider-x4WBN-3W.js +25 -0
- package/dist/packem_shared/sparkpostProvider-BytvwqjP.js +1 -0
- package/dist/packem_shared/sweegoProvider-7xhOvagC.js +1 -0
- package/dist/packem_shared/toEmailSnapshot-DeRqM5SJ.js +1 -0
- package/dist/packem_shared/tracer.d-MU42G1jG.d.ts +494 -0
- package/dist/packem_shared/types.d-BId55FW2.d.ts +107 -0
- package/dist/packem_shared/types.d-CmoWvdZi.d.ts +61 -0
- package/dist/packem_shared/types.d-DCkecJse.d.ts +51 -0
- package/dist/packem_shared/types.d-Mpu0HZoG.d.ts +24 -0
- package/dist/packem_shared/types.d-ejzh-xBP.d.ts +209 -0
- package/dist/packem_shared/types.d-lcJZmwRK.d.ts +69 -0
- package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +9 -0
- package/dist/packem_shared/utils-BfYfPB_I.js +1 -0
- package/dist/packem_shared/validate-email-options-mCM9dVug.js +1 -0
- package/dist/packem_shared/verifyMailgunWebhook-Cwl0OD3P.js +1 -0
- package/dist/packem_shared/verifyPostmarkWebhook-C72ZvbrG.js +1 -0
- package/dist/packem_shared/verifyResendWebhook-YK2zNDXR.js +1 -0
- package/dist/packem_shared/verifySendGridWebhook-Dbwc1tfG.js +1 -0
- package/dist/packem_shared/withEvents-CCVblSqj.js +1 -0
- package/dist/packem_shared/withMetrics-DWywX_6M.js +1 -0
- package/dist/packem_shared/withRender-VP9wE5Yr.js +1 -0
- package/dist/packem_shared/withSuppression-DBaZDMAr.js +1 -0
- package/dist/packem_shared/withTelemetry-DL2qo0Hp.js +1 -0
- package/dist/packem_shared/zeptomailProvider-D3nQKXRf.js +1 -0
- package/dist/providers/ahasend/index.d.ts +36 -3
- package/dist/providers/ahasend/index.js +1 -1
- package/dist/providers/aws-ses/index.d.ts +47 -3
- package/dist/providers/aws-ses/index.js +1 -1
- package/dist/providers/azure/index.d.ts +52 -3
- package/dist/providers/azure/index.js +1 -1
- package/dist/providers/brevo/index.d.ts +65 -3
- package/dist/providers/brevo/index.js +1 -1
- package/dist/providers/cloudflare-email/index.d.ts +36 -0
- package/dist/providers/cloudflare-email/index.js +1 -0
- package/dist/providers/failover/index.d.ts +27 -3
- package/dist/providers/failover/index.js +1 -1
- package/dist/providers/http/index.d.ts +35 -3
- package/dist/providers/http/index.js +1 -1
- package/dist/providers/infobip/index.d.ts +56 -3
- package/dist/providers/infobip/index.js +1 -1
- package/dist/providers/loops/index.d.ts +47 -0
- package/dist/providers/loops/index.js +1 -0
- package/dist/providers/mailchannels/index.d.ts +26 -0
- package/dist/providers/mailchannels/index.js +1 -0
- package/dist/providers/mailcrab/index.d.ts +32 -3
- package/dist/providers/mailcrab/index.js +1 -1
- package/dist/providers/mailersend/index.d.ts +51 -3
- package/dist/providers/mailersend/index.js +1 -1
- package/dist/providers/mailgun/index.d.ts +73 -3
- package/dist/providers/mailgun/index.js +1 -1
- package/dist/providers/mailjet/index.d.ts +72 -3
- package/dist/providers/mailjet/index.js +1 -1
- package/dist/providers/mailomat/index.d.ts +40 -3
- package/dist/providers/mailomat/index.js +1 -1
- package/dist/providers/mailpace/index.d.ts +52 -3
- package/dist/providers/mailpace/index.js +1 -1
- package/dist/providers/mailtrap/index.d.ts +44 -3
- package/dist/providers/mailtrap/index.js +1 -1
- package/dist/providers/mandrill/index.d.ts +87 -3
- package/dist/providers/mandrill/index.js +1 -1
- package/dist/providers/mock/index.d.ts +12 -3
- package/dist/providers/mock/index.js +1 -1
- package/dist/providers/netcore/index.d.ts +35 -0
- package/dist/providers/netcore/index.js +1 -0
- package/dist/providers/nodemailer/index.d.ts +38 -3
- package/dist/providers/nodemailer/index.js +1 -1
- package/dist/providers/opentelemetry/index.d.ts +37 -3
- package/dist/providers/opentelemetry/index.js +1 -1
- package/dist/providers/outlook365/index.d.ts +48 -0
- package/dist/providers/outlook365/index.js +1 -0
- package/dist/providers/plunk/index.d.ts +38 -3
- package/dist/providers/plunk/index.js +1 -1
- package/dist/providers/postal/index.d.ts +48 -3
- package/dist/providers/postal/index.js +1 -1
- package/dist/providers/postmark/index.d.ts +60 -3
- package/dist/providers/postmark/index.js +1 -1
- package/dist/providers/resend/index.d.ts +51 -3
- package/dist/providers/resend/index.js +1 -1
- package/dist/providers/roundrobin/index.d.ts +27 -3
- package/dist/providers/roundrobin/index.js +1 -1
- package/dist/providers/scaleway/index.d.ts +44 -3
- package/dist/providers/scaleway/index.js +1 -1
- package/dist/providers/sendgrid/index.d.ts +84 -3
- package/dist/providers/sendgrid/index.js +1 -1
- package/dist/providers/smtp/index.d.ts +71 -3
- package/dist/providers/smtp/index.js +1 -1
- package/dist/providers/sparkpost/index.d.ts +43 -0
- package/dist/providers/sparkpost/index.js +1 -0
- package/dist/providers/sweego/index.d.ts +40 -3
- package/dist/providers/sweego/index.js +1 -1
- package/dist/providers/zeptomail/index.d.ts +37 -3
- package/dist/providers/zeptomail/index.js +1 -1
- package/dist/queue/bullmq-queue.d.ts +46 -0
- package/dist/queue/bullmq-queue.js +1 -0
- package/dist/queue/index.d.ts +147 -0
- package/dist/queue/index.js +1 -0
- package/dist/queue/pg-boss-queue.d.ts +41 -0
- package/dist/queue/pg-boss-queue.js +1 -0
- package/dist/queue/sqs-queue.d.ts +72 -0
- package/dist/queue/sqs-queue.js +1 -0
- package/dist/queue/unstorage-queue.d.ts +199 -0
- package/dist/queue/unstorage-queue.js +1 -0
- package/dist/render/index.d.ts +107 -0
- package/dist/render/index.js +1 -0
- package/dist/template-engines/handlebars.d.ts +23 -22
- package/dist/template-engines/handlebars.js +1 -1
- package/dist/template-engines/html-to-text.d.ts +24 -24
- package/dist/template-engines/html-to-text.js +1 -1
- package/dist/template-engines/i18n.d.ts +61 -0
- package/dist/template-engines/i18n.js +1 -0
- package/dist/template-engines/jsx-email.d.ts +11 -0
- package/dist/template-engines/jsx-email.js +1 -0
- package/dist/template-engines/liquid.d.ts +12 -0
- package/dist/template-engines/liquid.js +1 -0
- package/dist/template-engines/mjml.d.ts +10 -10
- package/dist/template-engines/mjml.js +1 -1
- package/dist/template-engines/react-email.d.ts +9 -9
- package/dist/template-engines/react-email.js +1 -1
- package/dist/template-engines/vue-email.d.ts +9 -9
- package/dist/template-engines/vue-email.js +1 -1
- package/dist/test/index.d.ts +159 -0
- package/dist/test/index.js +1 -0
- package/dist/utils/cache.d.ts +49 -48
- package/dist/utils/cache.js +1 -1
- package/dist/utils/format-email-address.d.ts +8 -7
- package/dist/utils/format-email-address.js +1 -1
- package/dist/utils/normalize-email-aliases.d.ts +20 -20
- package/dist/utils/normalize-email-aliases.js +1 -1
- package/dist/utils/parse-address.d.ts +18 -17
- package/dist/utils/parse-address.js +1 -1
- package/dist/utils/parse-eml.d.ts +22 -0
- package/dist/utils/parse-eml.js +6 -0
- package/dist/utils/result.d.ts +49 -0
- package/dist/utils/result.js +1 -0
- package/dist/utils/validation/check-feature-support.d.ts +53 -0
- package/dist/utils/validation/check-feature-support.js +1 -0
- package/dist/utils/validation/check-mx-records.d.ts +36 -35
- package/dist/utils/validation/check-mx-records.js +1 -1
- package/dist/utils/validation/disposable-email-domains.d.ts +1 -13
- package/dist/utils/validation/role-accounts.d.ts +18 -18
- package/dist/utils/validation/role-accounts.js +1 -1
- package/dist/utils/validation/validate-email.d.ts +5 -5
- package/dist/utils/validation/validate-email.js +1 -1
- package/dist/utils/validation/verify-email.d.ts +45 -42
- package/dist/utils/validation/verify-email.js +1 -1
- package/dist/utils/validation/verify-smtp.d.ts +35 -34
- package/dist/utils/validation/verify-smtp.js +4 -4
- package/dist/webhooks/index.d.ts +231 -0
- package/dist/webhooks/index.js +1 -0
- package/package.json +181 -48
- package/dist/attachment-helpers.d.ts +0 -64
- package/dist/crypto/dkim-signer.d.ts +0 -48
- package/dist/crypto/smime-encrypter.d.ts +0 -53
- package/dist/crypto/smime-signer.d.ts +0 -48
- package/dist/crypto/types.d.ts +0 -101
- package/dist/draft-mail-message.d.ts +0 -13
- package/dist/errors/email-error.d.ts +0 -17
- package/dist/errors/required-option-error.d.ts +0 -10
- package/dist/mail-message.d.ts +0 -425
- package/dist/mail.d.ts +0 -206
- package/dist/packem_shared/DkimSigner-pFd4c3fZ.js +0 -18
- package/dist/packem_shared/EmailError-zm2ffVav.js +0 -1
- package/dist/packem_shared/Mail-6Bltpy_p.js +0 -1
- package/dist/packem_shared/MailMessage-B76GPBBA.js +0 -1
- package/dist/packem_shared/RequiredOptionError-CevW3u2K.js +0 -1
- package/dist/packem_shared/SmimeEncrypter-CBevU534.js +0 -6
- package/dist/packem_shared/SmimeSigner-CObA4jzT.js +0 -8
- package/dist/packem_shared/address-formatter-Cm_E_ZMa.js +0 -1
- package/dist/packem_shared/ahaSendProvider-DlFKEQ6D.js +0 -1
- package/dist/packem_shared/attachment-processor-2rHmfa7j.js +0 -1
- package/dist/packem_shared/awsSesProvider-Ba-eVJxZ.js +0 -32
- package/dist/packem_shared/azureProvider-CQYAkgVF.js +0 -1
- package/dist/packem_shared/brevoProvider-5p6jjiK9.js +0 -1
- package/dist/packem_shared/build-mime-message-IYaUqqPJ.js +0 -2
- package/dist/packem_shared/create-logger-BiWdqFNg.js +0 -1
- package/dist/packem_shared/defineProvider-B9rSklAJ.js +0 -1
- package/dist/packem_shared/detectMimeType-S8WRsNtY.js +0 -1
- package/dist/packem_shared/failoverProvider-CAHQQueo.js +0 -1
- package/dist/packem_shared/generate-boundary-Cx8nXYS0.js +0 -1
- package/dist/packem_shared/generate-message-id-D4uA8gkj.js +0 -1
- package/dist/packem_shared/headers-to-record-Qo124ImV.js +0 -1
- package/dist/packem_shared/httpProvider-CZD6LZX3.js +0 -1
- package/dist/packem_shared/infobipProvider-CtLwrUaP.js +0 -1
- package/dist/packem_shared/mailPaceProvider-B6yKvh6z.js +0 -1
- package/dist/packem_shared/mailerSendProvider-CeeIXFnW.js +0 -1
- package/dist/packem_shared/mailgunProvider-mmjKzouh.js +0 -1
- package/dist/packem_shared/mailjetProvider-DwN6i0VA.js +0 -1
- package/dist/packem_shared/mailomatProvider-DMQmjKHT.js +0 -1
- package/dist/packem_shared/mailtrapProvider-BN3UBEQw.js +0 -1
- package/dist/packem_shared/make-request-BDzF9W9D.js +0 -1
- package/dist/packem_shared/mandrillProvider-370y7CLu.js +0 -1
- package/dist/packem_shared/mockProvider-DN5ZwutD.js +0 -1
- package/dist/packem_shared/nodemailerProvider-_w8QXMU-.js +0 -1
- package/dist/packem_shared/opentelemetryProvider-C_ZXOLSd.js +0 -1
- package/dist/packem_shared/plunkProvider-DfJumQ4U.js +0 -1
- package/dist/packem_shared/postalProvider-Bavx2FcH.js +0 -1
- package/dist/packem_shared/postmarkProvider-DFC0uvjO.js +0 -1
- package/dist/packem_shared/provider-base-Cmzx6BTO.js +0 -1
- package/dist/packem_shared/readFile-BlZxbhCU-C8bCdiA2.js +0 -1
- package/dist/packem_shared/resendProvider-CfqU7UdE.js +0 -1
- package/dist/packem_shared/roundRobinProvider-1WQnuKR8.js +0 -1
- package/dist/packem_shared/sanitize-header-wWav-Scu.js +0 -1
- package/dist/packem_shared/scalewayProvider-be1HPimL.js +0 -1
- package/dist/packem_shared/sendGridProvider-BVI1sq3n.js +0 -1
- package/dist/packem_shared/smtpProvider-BV-ufR53.js +0 -23
- package/dist/packem_shared/sweegoProvider-7419CSAq.js +0 -1
- package/dist/packem_shared/validate-email-options-DfJ7llf8.js +0 -1
- package/dist/packem_shared/zeptomailProvider-C2lh0Xmo.js +0 -1
- package/dist/providers/ahasend/provider.d.ts +0 -7
- package/dist/providers/ahasend/types.d.ts +0 -28
- package/dist/providers/aws-ses/provider.d.ts +0 -8
- package/dist/providers/aws-ses/types.d.ts +0 -38
- package/dist/providers/azure/provider.d.ts +0 -7
- package/dist/providers/azure/types.d.ts +0 -44
- package/dist/providers/brevo/provider.d.ts +0 -7
- package/dist/providers/brevo/types.d.ts +0 -57
- package/dist/providers/failover/provider.d.ts +0 -7
- package/dist/providers/failover/types.d.ts +0 -19
- package/dist/providers/http/provider.d.ts +0 -7
- package/dist/providers/http/types.d.ts +0 -27
- package/dist/providers/infobip/provider.d.ts +0 -7
- package/dist/providers/infobip/types.d.ts +0 -48
- package/dist/providers/mailcrab/provider.d.ts +0 -9
- package/dist/providers/mailcrab/types.d.ts +0 -22
- package/dist/providers/mailersend/provider.d.ts +0 -7
- package/dist/providers/mailersend/types.d.ts +0 -43
- package/dist/providers/mailgun/provider.d.ts +0 -7
- package/dist/providers/mailgun/types.d.ts +0 -65
- package/dist/providers/mailjet/provider.d.ts +0 -7
- package/dist/providers/mailjet/types.d.ts +0 -64
- package/dist/providers/mailomat/provider.d.ts +0 -7
- package/dist/providers/mailomat/types.d.ts +0 -32
- package/dist/providers/mailpace/provider.d.ts +0 -7
- package/dist/providers/mailpace/types.d.ts +0 -44
- package/dist/providers/mailtrap/provider.d.ts +0 -7
- package/dist/providers/mailtrap/types.d.ts +0 -36
- package/dist/providers/mandrill/provider.d.ts +0 -7
- package/dist/providers/mandrill/types.d.ts +0 -79
- package/dist/providers/mock/provider.d.ts +0 -8
- package/dist/providers/mock/types.d.ts +0 -50
- package/dist/providers/nodemailer/provider.d.ts +0 -7
- package/dist/providers/nodemailer/types.d.ts +0 -30
- package/dist/providers/opentelemetry/provider.d.ts +0 -8
- package/dist/providers/opentelemetry/types.d.ts +0 -31
- package/dist/providers/plunk/provider.d.ts +0 -7
- package/dist/providers/plunk/types.d.ts +0 -30
- package/dist/providers/postal/provider.d.ts +0 -7
- package/dist/providers/postal/types.d.ts +0 -40
- package/dist/providers/postmark/provider.d.ts +0 -7
- package/dist/providers/postmark/types.d.ts +0 -52
- package/dist/providers/provider.d.ts +0 -27
- package/dist/providers/resend/provider.d.ts +0 -7
- package/dist/providers/resend/types.d.ts +0 -43
- package/dist/providers/roundrobin/provider.d.ts +0 -7
- package/dist/providers/roundrobin/types.d.ts +0 -19
- package/dist/providers/scaleway/provider.d.ts +0 -7
- package/dist/providers/scaleway/types.d.ts +0 -36
- package/dist/providers/sendgrid/provider.d.ts +0 -7
- package/dist/providers/sendgrid/types.d.ts +0 -76
- package/dist/providers/smtp/provider.d.ts +0 -7
- package/dist/providers/smtp/types.d.ts +0 -63
- package/dist/providers/sweego/provider.d.ts +0 -7
- package/dist/providers/sweego/types.d.ts +0 -32
- package/dist/providers/utils/address-formatter.d.ts +0 -139
- package/dist/providers/utils/attachment-processor.d.ts +0 -58
- package/dist/providers/utils/index.d.ts +0 -4
- package/dist/providers/utils/payload-builder.d.ts +0 -78
- package/dist/providers/utils/provider-base.d.ts +0 -69
- package/dist/providers/zeptomail/provider.d.ts +0 -7
- package/dist/providers/zeptomail/types.d.ts +0 -29
- package/dist/template-engines/types.d.ts +0 -8
- package/dist/types.d.ts +0 -203
- package/dist/utils/build-mime-message.d.ts +0 -8
- package/dist/utils/create-logger.d.ts +0 -16
- package/dist/utils/format-email-addresses.d.ts +0 -8
- package/dist/utils/generate-boundary.d.ts +0 -7
- package/dist/utils/generate-message-id.d.ts +0 -6
- package/dist/utils/headers-to-record.d.ts +0 -9
- package/dist/utils/is-port-available.d.ts +0 -9
- package/dist/utils/make-request.d.ts +0 -18
- package/dist/utils/retry.d.ts +0 -10
- package/dist/utils/sanitize-header.d.ts +0 -14
- package/dist/utils/to-base64.d.ts +0 -8
- package/dist/utils/validation/validate-email-options.d.ts +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{createRequire as a}from"node:module";const d=a(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=o=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,s]=c.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return c.getBuiltinModule(o)}return d(o)},{resolveMx:p}=l("node:dns/promises"),h=async(o,e={})=>{const s=e.ttl??36e5;if(e.cache){const r=await e.cache.get(o);if(r!==void 0)return r}try{const r=(await p(o)).map(i=>({exchange:i.exchange,priority:i.priority})),t={records:r.toSorted((i,n)=>i.priority-n.priority),valid:r.length>0};return e.cache&&await e.cache.set(o,t,s),t}catch(r){const t={error:r instanceof Error?r.message:String(r),valid:!1};return e.cache&&await e.cache.set(o,t,s),t}};export{h as checkMxRecords};
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Re-exports all functionality from @visulima/disposable-email-domains.
|
|
3
|
-
* This provides access to disposable email domain checking utilities.
|
|
4
|
-
* @example
|
|
5
|
-
* ```ts
|
|
6
|
-
* import { isDisposableEmail, isDisposableDomain, getDomainList } from "\@visulima/email/validation/disposable-email-domains";
|
|
7
|
-
*
|
|
8
|
-
* if (isDisposableEmail("user@mailinator.com")) {
|
|
9
|
-
* console.log("Disposable email detected!");
|
|
10
|
-
* }
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export * from "@visulima/disposable-email-domains";
|
|
1
|
+
export * from '@visulima/disposable-email-domains';
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* Common role account prefixes that indicate non-personal email addresses.
|
|
3
|
+
* Includes RFC 2142 standard role accounts and common business/operational prefixes.
|
|
4
|
+
*/
|
|
5
5
|
declare const ROLE_ACCOUNT_PREFIXES: Set<string>;
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export { ROLE_ACCOUNT_PREFIXES };
|
|
7
|
+
* Checks if an email address is a role account (non-personal).
|
|
8
|
+
* @param email The email address to check.
|
|
9
|
+
* @param customPrefixes Optional set of additional role account prefixes.
|
|
10
|
+
* @returns True if the email is a role account, false otherwise.
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { isRoleAccount } from "@visulima/email/validation/role-accounts";
|
|
14
|
+
*
|
|
15
|
+
* if (isRoleAccount("noreply@example.com")) {
|
|
16
|
+
* console.log("This is a role account");
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const isRoleAccount: (email: string, customPrefixes?: Set<string>) => boolean;
|
|
21
|
+
export { ROLE_ACCOUNT_PREFIXES, isRoleAccount };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const c=new Set(["abuse","accounts","admin","adminhelp","administrator","adminoffice","adminteam","affiliates","alarms","alert","alternative","analytics","anonymous","archive","audit","automated","autoreply","backoffice","backup","batch","billing","board","bot","bounce","bug","bugreport","build","careers","cert","chapter","chatbot","ci","compliance","contact","continuousintegration","cron","csirt","customer-care","customercare","customerservice","customersupport","cvs","daemon","default","demo","deploy","deployment","dev","development","devops","digest","director","dnsadmin","docs","donotreply","enquiry","errors","events","executive","faculty","failover","feed","feedback","finance","forensics","ftp","git","guardian","guest","help","helpdesk","helpsec","hostmaster","hr","incident","incidents","indexer","info","ingest","inquiry","issues","it","jobs","legal","list","list-request","log","logistics","logs","maildaemon","mailer-daemon","malicious","management","manager","marketing","media","membership","metrics","mod","moderator","mods","monitor","network","news","newsletter","no-reply","noc","noreply","notifications","notify","operations","operator","owner","owners","parent","partners","patches","payments","phish","phishing","pipeline","post","postmaster","pr","press","privacy","procurement","qa","recruitment","redundancy","registrar","releases","reminder","reminders","reply","report","reports","request","resource","root","sales","scheduler","secondary","secops","secretariat","secretary","security","server","service","spam","spamreport","staff","standby","student","subscribe","subscriptions","summaries","supervisor","supplychain","support","supportteam","svn","sync","sysadmin","system","system-alert","system-msg","team","tech","techsupport","temp","tertiary","test","threat","threats","tracker","trial","unknown","unsubscribe","update","updates","usenet","usergroup","uucp","volunteer","vuln","vulnerability","webinars","webmaster","www"]),o=(e,r)=>c.has(e)||(r?.has(e)??!1),u=(e,r)=>{if(e.length<2)return!1;const t=["-",".","_"];for(const s of t){const n=`${e[0]}${s}${e[1]}`;if(o(n,r))return!0}return!1},p=(e,r)=>{for(const t of e)if(!o(t,r))return!1;return!0},l=(e,r)=>{if(!e||typeof e!="string")return!1;const t=e.toLowerCase().trim(),s=t.indexOf("@");if(s===-1||s===0)return!1;const n=t.slice(0,s);if(o(n,r))return!0;const a=n.split(/[+._-]/);if(a.length===1){const i=a[0];return i===void 0?!1:o(i,r)}return u(a,r)?!0:p(a,r)};export{c as ROLE_ACCOUNT_PREFIXES,l as isRoleAccount};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
* Validates an email address format according to basic RFC standards.
|
|
3
|
+
* @param email The email address string to validate.
|
|
4
|
+
* @returns True if the email address is valid, false otherwise.
|
|
5
|
+
*/
|
|
6
6
|
declare const validateEmail: (email: string) => boolean;
|
|
7
|
-
export default
|
|
7
|
+
export { validateEmail as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const f=s=>{if(!/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(s))return!1;const r=s.split("@");if(r.length!==2)return!1;const[e,t]=r;if(!e||!t||s.includes("..")||e.startsWith(".")||e.endsWith(".")||!t.includes(".")||t.startsWith("-")||t.endsWith("-"))return!1;const i=t.split(".");for(const n of i)if(n.startsWith("-")||n.endsWith("-")||n.length===0)return!1;return!0};export{f as default};
|
|
@@ -1,47 +1,50 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SmtpVerificationOptions } from "./verify-smtp.js";
|
|
2
|
+
import "../cache.js";
|
|
3
|
+
import "./check-mx-records.js";
|
|
2
4
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
* Options for comprehensive email verification.
|
|
6
|
+
*/
|
|
7
|
+
interface EmailVerificationOptions extends SmtpVerificationOptions {
|
|
8
|
+
checkDisposable?: boolean;
|
|
9
|
+
checkMx?: boolean;
|
|
10
|
+
checkRoleAccount?: boolean;
|
|
11
|
+
checkSmtp?: boolean;
|
|
12
|
+
customDisposableDomains?: Set<string>;
|
|
13
|
+
customRolePrefixes?: Set<string>;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
* Result of comprehensive email verification.
|
|
17
|
+
*/
|
|
18
|
+
interface EmailVerificationResult {
|
|
19
|
+
disposable?: boolean;
|
|
20
|
+
errors: string[];
|
|
21
|
+
formatValid: boolean;
|
|
22
|
+
mxValid?: boolean;
|
|
23
|
+
roleAccount?: boolean;
|
|
24
|
+
smtpValid?: boolean;
|
|
25
|
+
valid: boolean;
|
|
26
|
+
warnings: string[];
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
29
|
+
* Comprehensive email verification combining multiple checks.
|
|
30
|
+
* @param email The email address to verify.
|
|
31
|
+
* @param options Verification options.
|
|
32
|
+
* @returns Detailed verification result.
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { verifyEmail } from "@visulima/email/validation/verify-email";
|
|
36
|
+
*
|
|
37
|
+
* const result = await verifyEmail("user@example.com", {
|
|
38
|
+
* checkDisposable: true,
|
|
39
|
+
* checkRoleAccount: true,
|
|
40
|
+
* checkMx: true,
|
|
41
|
+
* checkSmtp: false
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* if (result.valid) {
|
|
45
|
+
* console.log("Email is valid!");
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
declare const verifyEmail: (email: string, options?: EmailVerificationOptions) => Promise<EmailVerificationResult>;
|
|
50
|
+
export { EmailVerificationOptions, EmailVerificationResult, verifyEmail };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{checkMxRecords as x}from"./check-mx-records.js";import{isRoleAccount as g}from"./role-accounts.js";import k from"./validate-email.js";import{verifySmtp as w}from"./verify-smtp.js";import{isDisposableEmail as y}from"@visulima/disposable-email-domains";const S=async(r,s={})=>{const{checkDisposable:f=!0,checkMx:p=!0,checkRoleAccount:d=!0,checkSmtp:u=!1,customDisposableDomains:h,customRolePrefixes:v,...b}=s,c=k(r),a=[],e=[];if(!c)return a.push("Invalid email format"),{errors:a,formatValid:!1,valid:!1,warnings:e};let o,l,m,n;if(f)try{o=y(r,h),o&&e.push("Email is from a disposable email service")}catch{}if(d&&(l=g(r,v),l&&e.push("Email appears to be a role account (non-personal)")),p){const i=r.split("@")[1];if(!i)return a.push("Invalid email format: missing domain"),{disposable:o,errors:a,formatValid:!1,mxValid:!1,roleAccount:l,valid:!1,warnings:e};const t=await x(i,{cache:s.cache});m=t.valid,t.valid||a.push(t.error??"No valid MX records found")}if(u){const i=await w(r,{...b,cache:s.cache,smtpCache:s.smtpCache});n=i.valid,!i.valid&&i.error&&a.push(`SMTP verification failed: ${i.error}`)}const V=c&&a.length===0;return{disposable:o,errors:a,formatValid:c,mxValid:m,roleAccount:l,smtpValid:n,valid:V,warnings:e}};export{S as verifyEmail};
|
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Cache } from "../cache.js";
|
|
2
|
+
import { MxCheckResult, MxRecord } from "./check-mx-records.js";
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
* Options for SMTP verification.
|
|
5
|
+
*/
|
|
6
|
+
interface SmtpVerificationOptions {
|
|
7
|
+
cache?: Cache<MxCheckResult>;
|
|
8
|
+
fromEmail?: string;
|
|
9
|
+
port?: number;
|
|
10
|
+
smtpCache?: Cache<SmtpVerificationResult>;
|
|
11
|
+
timeout?: number;
|
|
12
|
+
ttl?: number;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
* Detailed result of SMTP verification attempt.
|
|
16
|
+
*/
|
|
17
|
+
interface SmtpVerificationResult {
|
|
18
|
+
error?: string;
|
|
19
|
+
mxRecords?: MxRecord[];
|
|
20
|
+
smtpResponse?: string;
|
|
21
|
+
valid: boolean;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
* Verifies an email address by checking MX records and attempting SMTP verification.
|
|
25
|
+
* Note: Many mail servers block SMTP verification to prevent email harvesting.
|
|
26
|
+
* @param email The email address to verify.
|
|
27
|
+
* @param options Verification options.
|
|
28
|
+
* @returns Result containing verification status.
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { verifySmtp } from "@visulima/email/validation/verify-smtp";
|
|
32
|
+
*
|
|
33
|
+
* const result = await verifySmtp("user@example.com", {
|
|
34
|
+
* timeout: 5000,
|
|
35
|
+
* fromEmail: "test@example.com"
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare const verifySmtp: (email: string, options?: SmtpVerificationOptions) => Promise<SmtpVerificationResult>;
|
|
40
|
+
export { SmtpVerificationOptions, SmtpVerificationResult, verifySmtp };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
`)):
|
|
3
|
-
`)):
|
|
4
|
-
`)):
|
|
1
|
+
import{createRequire as T}from"node:module";import{checkMxRecords as S}from"./check-mx-records.js";const $=T(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=c=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[o,d]=p.versions.node.split(".").map(Number);if(o>22||o===22&&d>=3||o===20&&d>=16)return p.getBuiltinModule(c)}return $(c)},{Socket:j}=b("node:net"),O=async(c,o={})=>{const{fromEmail:d="test@example.com",port:g=25,timeout:w=5e3,ttl:R=36e5}=o;if(!c||typeof c!="string")return{error:"Invalid email address",valid:!1};const l=c.toLowerCase().trim(),h=l.indexOf("@");if(h===-1||h===l.length-1)return{error:"Invalid email format",valid:!1};const{smtpCache:n}=o,v=`smtp:${l}:${d}:${g}`;if(n){const i=await n.get(v);if(i!==void 0)return i}const x=l.slice(h+1),M=o.cache,e=await S(x,{cache:M});if(!e.valid||!e.records||e.records.length===0){const i={error:e.error??"No MX records found",mxRecords:e.records,valid:!1};return n&&await n.set(v,i,R),i}const _=e.records[0];return new Promise(i=>{const r=new j;let u="",t="connected";const m=()=>{r.removeAllListeners(),r.destroy()},f=a=>{n&&n.set(v,a,R).catch(()=>{}),i(a)},W=a=>{m(),f({error:a.message,mxRecords:e.records,valid:!1})},y=()=>{m(),f({error:"SMTP connection timeout",mxRecords:e.records,valid:!1})};r.setTimeout(w),r.on("error",W),r.on("timeout",y),r.on("data",a=>{u+=a.toString();const s=u.slice(-3);t==="connected"&&(s.startsWith("220")||s.startsWith("250"))?(t="helo",r.write(`HELO ${x}\r
|
|
2
|
+
`)):t==="helo"&&s.startsWith("250")?(t="mail-from",r.write(`MAIL FROM:<${d}>\r
|
|
3
|
+
`)):t==="mail-from"&&s.startsWith("250")?(t="rcpt-to",r.write(`RCPT TO:<${l}>\r
|
|
4
|
+
`)):t==="rcpt-to"&&s.startsWith("250")?(m(),f({mxRecords:e.records,smtpResponse:u,valid:!0})):t==="rcpt-to"&&(s.startsWith("550")||s.startsWith("551")||s.startsWith("553"))&&(m(),f({error:"Email address does not exist",mxRecords:e.records,smtpResponse:u,valid:!1}))}),_?r.connect(g,_.exchange):(m(),f({error:"No MX record available",mxRecords:e.records,valid:!1}))})};export{O as verifySmtp};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of verifying an inbound webhook signature.
|
|
3
|
+
*/
|
|
4
|
+
interface WebhookVerificationResult {
|
|
5
|
+
/**
|
|
6
|
+
* Machine-readable reason when {@link WebhookVerificationResult.valid} is `false`.
|
|
7
|
+
*/
|
|
8
|
+
reason?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the signature (and, when applicable, the timestamp) is valid.
|
|
11
|
+
*/
|
|
12
|
+
valid: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Headers passed to a webhook verifier. Either a plain record or a `Headers` instance.
|
|
16
|
+
*
|
|
17
|
+
* Lookups are case-insensitive.
|
|
18
|
+
*/
|
|
19
|
+
type WebhookHeaders = Headers | Record<string, string | string[] | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Shared options for verifiers that enforce a timestamp tolerance to guard against replay attacks.
|
|
22
|
+
*/
|
|
23
|
+
interface TimestampToleranceOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Maximum allowed difference, in seconds, between the signed timestamp and the current time.
|
|
26
|
+
*
|
|
27
|
+
* Set to `0` to disable the replay-protection window.
|
|
28
|
+
* @default 300
|
|
29
|
+
*/
|
|
30
|
+
tolerance?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Options for {@link verifyMailgunWebhook}.
|
|
34
|
+
*
|
|
35
|
+
* Mailgun nests these three fields under a `signature` object in the webhook JSON body.
|
|
36
|
+
*/
|
|
37
|
+
interface MailgunWebhookOptions extends TimestampToleranceOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Override the current time (milliseconds) — primarily for testing.
|
|
40
|
+
*/
|
|
41
|
+
now?: number;
|
|
42
|
+
/**
|
|
43
|
+
* The HMAC value from `signature.signature`.
|
|
44
|
+
*/
|
|
45
|
+
signature: string;
|
|
46
|
+
/**
|
|
47
|
+
* Your Mailgun HTTP webhook signing key (Settings → Webhooks).
|
|
48
|
+
*/
|
|
49
|
+
signingKey: string;
|
|
50
|
+
/**
|
|
51
|
+
* The timestamp from `signature.timestamp` (unix seconds, as a string or number).
|
|
52
|
+
*/
|
|
53
|
+
timestamp: number | string;
|
|
54
|
+
/**
|
|
55
|
+
* The token from `signature.token`.
|
|
56
|
+
*/
|
|
57
|
+
token: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Verifies a [Mailgun](https://documentation.mailgun.com/docs/mailgun/user-manual/tracking-messages/#webhooks) webhook.
|
|
61
|
+
*
|
|
62
|
+
* Mailgun computes `HMAC-SHA256(key = signingKey, message = timestamp + token)` and sends the hex
|
|
63
|
+
* digest as `signature.signature`.
|
|
64
|
+
* @param options Verification inputs. See {@link MailgunWebhookOptions}.
|
|
65
|
+
* @returns The verification result.
|
|
66
|
+
*/
|
|
67
|
+
declare const verifyMailgunWebhook: (options: MailgunWebhookOptions) => WebhookVerificationResult;
|
|
68
|
+
/**
|
|
69
|
+
* Options for {@link verifyPostmarkWebhook}.
|
|
70
|
+
*
|
|
71
|
+
* Postmark does not sign webhook payloads; instead it supports HTTP Basic Auth credentials embedded
|
|
72
|
+
* in the webhook URL (and IP allow-listing). This verifier checks the Basic Auth credentials.
|
|
73
|
+
*/
|
|
74
|
+
interface PostmarkWebhookOptions {
|
|
75
|
+
/**
|
|
76
|
+
* The value of the incoming `Authorization` header (e.g. `Basic dXNlcjpwYXNz`).
|
|
77
|
+
*/
|
|
78
|
+
authorization: string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The password configured on the Postmark webhook URL.
|
|
81
|
+
*/
|
|
82
|
+
password: string;
|
|
83
|
+
/**
|
|
84
|
+
* The username configured on the Postmark webhook URL.
|
|
85
|
+
*/
|
|
86
|
+
username: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Verifies a [Postmark](https://postmarkapp.com/support/article/1213-securing-inbound-and-open-webhooks)
|
|
90
|
+
* webhook by validating its HTTP Basic Auth credentials.
|
|
91
|
+
* @param options Verification inputs. See {@link PostmarkWebhookOptions}.
|
|
92
|
+
* @returns The verification result.
|
|
93
|
+
*/
|
|
94
|
+
declare const verifyPostmarkWebhook: (options: PostmarkWebhookOptions) => WebhookVerificationResult;
|
|
95
|
+
/**
|
|
96
|
+
* Options for {@link verifySendGridWebhook}.
|
|
97
|
+
*/
|
|
98
|
+
interface SendGridWebhookOptions extends TimestampToleranceOptions {
|
|
99
|
+
/**
|
|
100
|
+
* Override the current time (milliseconds) — primarily for testing.
|
|
101
|
+
*/
|
|
102
|
+
now?: number;
|
|
103
|
+
/**
|
|
104
|
+
* The raw, unparsed request body exactly as received.
|
|
105
|
+
*/
|
|
106
|
+
payload: string;
|
|
107
|
+
/**
|
|
108
|
+
* The verification key from the SendGrid Event Webhook settings.
|
|
109
|
+
*
|
|
110
|
+
* Either the base64-encoded DER (SPKI) string SendGrid displays, or a full PEM block.
|
|
111
|
+
*/
|
|
112
|
+
publicKey: string;
|
|
113
|
+
/**
|
|
114
|
+
* The value of the `X-Twilio-Email-Event-Webhook-Signature` header (base64 DER ECDSA signature).
|
|
115
|
+
*/
|
|
116
|
+
signature: string;
|
|
117
|
+
/**
|
|
118
|
+
* The value of the `X-Twilio-Email-Event-Webhook-Timestamp` header (unix epoch seconds).
|
|
119
|
+
*/
|
|
120
|
+
timestamp: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Verifies a [SendGrid Event Webhook](https://www.twilio.com/docs/sendgrid/for-developers/tracking-events/getting-started-event-webhook-security-features)
|
|
124
|
+
* using its ECDSA (prime256v1) signature, and rejects stale requests to prevent replay.
|
|
125
|
+
*
|
|
126
|
+
* The signed message is `timestamp + payload`. The signature header is the base64-encoded DER
|
|
127
|
+
* ECDSA signature. The timestamp is unix epoch seconds and must fall within `tolerance` of now.
|
|
128
|
+
* @param options Verification inputs. See {@link SendGridWebhookOptions}.
|
|
129
|
+
* @returns The verification result.
|
|
130
|
+
* @throws {EmailError} When the supplied public key cannot be parsed.
|
|
131
|
+
*/
|
|
132
|
+
declare const verifySendGridWebhook: (options: SendGridWebhookOptions) => WebhookVerificationResult;
|
|
133
|
+
/**
|
|
134
|
+
* The subset of an Amazon SNS message envelope relevant to signature verification.
|
|
135
|
+
*
|
|
136
|
+
* AWS SES delivers events (deliveries, bounces, complaints) wrapped in SNS notifications.
|
|
137
|
+
*/
|
|
138
|
+
interface SnsMessage {
|
|
139
|
+
[key: string]: unknown;
|
|
140
|
+
Message?: string;
|
|
141
|
+
MessageId?: string;
|
|
142
|
+
Signature?: string;
|
|
143
|
+
SignatureVersion?: string;
|
|
144
|
+
SigningCertURL?: string;
|
|
145
|
+
Subject?: string;
|
|
146
|
+
SubscribeURL?: string;
|
|
147
|
+
Timestamp?: string;
|
|
148
|
+
Token?: string;
|
|
149
|
+
TopicArn?: string;
|
|
150
|
+
Type?: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Resolves a signing-certificate URL to its PEM contents. Injectable for testing and caching.
|
|
154
|
+
*/
|
|
155
|
+
type CertificateResolver = (url: string) => Promise<string> | string;
|
|
156
|
+
/**
|
|
157
|
+
* Options for {@link verifySnsMessage}.
|
|
158
|
+
*/
|
|
159
|
+
interface SnsVerifyOptions {
|
|
160
|
+
/**
|
|
161
|
+
* Override how the signing certificate is fetched. Defaults to a `fetch`-based resolver that
|
|
162
|
+
* only accepts `https://*.amazonaws.com` URLs.
|
|
163
|
+
*/
|
|
164
|
+
certificateResolver?: CertificateResolver;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Validates that a signing-certificate URL points at an AWS SNS signing host over HTTPS.
|
|
168
|
+
* @param url The `SigningCertURL` from the SNS message.
|
|
169
|
+
* @returns `true` when the URL is an acceptable AWS SNS certificate endpoint.
|
|
170
|
+
*/
|
|
171
|
+
declare const isValidSigningCertUrl: (url: string) => boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Verifies the RSA signature on an Amazon SNS message (used to wrap AWS SES events).
|
|
174
|
+
*
|
|
175
|
+
* Signature version `1` uses SHA1, version `2` uses SHA256. The signing certificate is fetched from
|
|
176
|
+
* `SigningCertURL` (validated to be an `sns.<region>.amazonaws.com` HTTPS endpoint with no userinfo
|
|
177
|
+
* or explicit port) unless a custom {@link CertificateResolver} is supplied.
|
|
178
|
+
* @param message The parsed SNS message envelope.
|
|
179
|
+
* @param options Optional overrides. See {@link SnsVerifyOptions}.
|
|
180
|
+
* @returns The verification result.
|
|
181
|
+
* @throws {EmailError} When the certificate cannot be resolved.
|
|
182
|
+
*/
|
|
183
|
+
declare const verifySnsMessage: (message: SnsMessage, options?: SnsVerifyOptions) => Promise<WebhookVerificationResult>;
|
|
184
|
+
/**
|
|
185
|
+
* Options for {@link verifyStandardWebhook}.
|
|
186
|
+
*/
|
|
187
|
+
interface StandardWebhookOptions extends TimestampToleranceOptions {
|
|
188
|
+
/**
|
|
189
|
+
* The request headers, or the three signature headers as a plain record.
|
|
190
|
+
*
|
|
191
|
+
* Recognized header names (case-insensitive): `webhook-id` / `svix-id`,
|
|
192
|
+
* `webhook-timestamp` / `svix-timestamp`, and `webhook-signature` / `svix-signature`.
|
|
193
|
+
*/
|
|
194
|
+
headers: WebhookHeaders;
|
|
195
|
+
/**
|
|
196
|
+
* Override the current time (milliseconds) — primarily for testing.
|
|
197
|
+
*/
|
|
198
|
+
now?: number;
|
|
199
|
+
/**
|
|
200
|
+
* The raw, unparsed request body exactly as received.
|
|
201
|
+
*
|
|
202
|
+
* Parsing and re-serializing the body changes the bytes and breaks verification.
|
|
203
|
+
*/
|
|
204
|
+
payload: string;
|
|
205
|
+
/**
|
|
206
|
+
* The signing secret. Supports the `whsec_`-prefixed, base64-encoded form used by Svix/Resend,
|
|
207
|
+
* or a raw secret string.
|
|
208
|
+
*/
|
|
209
|
+
secret: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Verifies a webhook signed according to the [Standard Webhooks](https://www.standardwebhooks.com/) spec.
|
|
213
|
+
*
|
|
214
|
+
* This is the scheme used by Svix and, by extension, Resend. The signed content is
|
|
215
|
+
* `${id}.${timestamp}.${payload}`, HMAC-SHA256'd with the (base64-decoded) secret and base64-encoded.
|
|
216
|
+
* The `webhook-signature` header may contain multiple space-separated `v1,<sig>` entries; a match
|
|
217
|
+
* against any one of them passes.
|
|
218
|
+
* @param options Verification inputs. See {@link StandardWebhookOptions}.
|
|
219
|
+
* @returns The verification result.
|
|
220
|
+
*/
|
|
221
|
+
declare const verifyStandardWebhook: (options: StandardWebhookOptions) => WebhookVerificationResult;
|
|
222
|
+
/**
|
|
223
|
+
* Verifies a [Resend](https://resend.com/docs/dashboard/webhooks/verify-webhooks-requests) webhook.
|
|
224
|
+
*
|
|
225
|
+
* Resend uses Svix, so this is an alias for {@link verifyStandardWebhook} that accepts the
|
|
226
|
+
* `svix-*` headers.
|
|
227
|
+
* @param options Verification inputs. See {@link StandardWebhookOptions}.
|
|
228
|
+
* @returns The verification result.
|
|
229
|
+
*/
|
|
230
|
+
declare const verifyResendWebhook: (options: StandardWebhookOptions) => WebhookVerificationResult;
|
|
231
|
+
export { type CertificateResolver, type MailgunWebhookOptions, type PostmarkWebhookOptions, type SendGridWebhookOptions, type SnsMessage, type SnsVerifyOptions, type StandardWebhookOptions, type TimestampToleranceOptions, type WebhookHeaders, type WebhookVerificationResult, isValidSigningCertUrl, verifyMailgunWebhook, verifyPostmarkWebhook, verifyResendWebhook, verifySendGridWebhook, verifySnsMessage, verifyStandardWebhook };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{verifyMailgunWebhook as r}from"../packem_shared/verifyMailgunWebhook-Cwl0OD3P.js";import{verifyPostmarkWebhook as f}from"../packem_shared/verifyPostmarkWebhook-C72ZvbrG.js";import{verifySendGridWebhook as n}from"../packem_shared/verifySendGridWebhook-Dbwc1tfG.js";import{isValidSigningCertUrl as d,verifySnsMessage as k}from"../packem_shared/isValidSigningCertUrl-Bii1AMGC.js";import{verifyResendWebhook as s,verifyStandardWebhook as v}from"../packem_shared/verifyResendWebhook-YK2zNDXR.js";export{d as isValidSigningCertUrl,r as verifyMailgunWebhook,f as verifyPostmarkWebhook,s as verifyResendWebhook,n as verifySendGridWebhook,k as verifySnsMessage,v as verifyStandardWebhook};
|