@visulima/email 1.0.0-alpha.2 → 1.0.0-alpha.21
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 +246 -0
- package/LICENSE.md +536 -899
- package/README.md +36 -21
- package/dist/crypto/index.d.ts +147 -4
- package/dist/crypto/index.js +1 -1
- package/dist/index.d.ts +785 -9
- package/dist/index.js +1 -1
- package/dist/packem_shared/{DkimSigner-pFd4c3fZ.js → DkimSigner-CT2DSHD1.js} +4 -4
- package/dist/packem_shared/Mail-D93oo_9g.js +1 -0
- package/dist/packem_shared/MailMessage-BvaH5tZZ.js +1 -0
- package/dist/packem_shared/{SmimeEncrypter-CBevU534.js → SmimeEncrypter-ZhHEgDwY.js} +2 -2
- package/dist/packem_shared/{SmimeSigner-CObA4jzT.js → SmimeSigner-CYSVF6ez.js} +1 -1
- package/dist/packem_shared/{ahaSendProvider-DlFKEQ6D.js → ahaSendProvider-DOAAW65O.js} +1 -1
- package/dist/packem_shared/{attachment-processor-2rHmfa7j.js → attachment-processor-DsmIomKc.js} +1 -1
- package/dist/packem_shared/{awsSesProvider-Ba-eVJxZ.js → awsSesProvider-DX1630Ms.js} +7 -7
- package/dist/packem_shared/azureProvider-EkNYKAiF.js +1 -0
- package/dist/packem_shared/{brevoProvider-5p6jjiK9.js → brevoProvider-CkR4U4RD.js} +1 -1
- package/dist/packem_shared/build-mime-message-6xstxaUV.js +2 -0
- package/dist/packem_shared/defineProvider-CtLH0VBE.js +1 -0
- package/dist/packem_shared/detectMimeType-bo5oxfnt.js +1 -0
- package/dist/packem_shared/failoverProvider-W5ctAhdC.js +1 -0
- package/dist/packem_shared/httpProvider-DUg1AQfO.js +1 -0
- package/dist/packem_shared/{infobipProvider-CtLwrUaP.js → infobipProvider-BhTsWi7e.js} +1 -1
- package/dist/packem_shared/{mailCrabProvider-CM_CFDca.js → mailCrabProvider-B7H6HwWu.js} +1 -1
- package/dist/packem_shared/mailPaceProvider-DRt6Z9Hr.js +1 -0
- package/dist/packem_shared/{mailerSendProvider-CeeIXFnW.js → mailerSendProvider-Dx_iHInH.js} +1 -1
- package/dist/packem_shared/mailgunProvider-ChkLGZZW.js +1 -0
- package/dist/packem_shared/mailjetProvider-BMRhNe6H.js +1 -0
- package/dist/packem_shared/{mailomatProvider-DMQmjKHT.js → mailomatProvider-CydV-JB6.js} +1 -1
- package/dist/packem_shared/{mailtrapProvider-BN3UBEQw.js → mailtrapProvider-CuAfJWDr.js} +1 -1
- package/dist/packem_shared/{make-request-BDzF9W9D.js → make-request-CaT4d5oC.js} +1 -1
- package/dist/packem_shared/{mandrillProvider-370y7CLu.js → mandrillProvider-BBeLbaw0.js} +1 -1
- package/dist/packem_shared/mockProvider-C0P1lKOy.js +1 -0
- package/dist/packem_shared/{nodemailerProvider-_w8QXMU-.js → nodemailerProvider-DFcvoVFv.js} +1 -1
- package/dist/packem_shared/{opentelemetryProvider-C_ZXOLSd.js → opentelemetryProvider-Dwv88G3O.js} +1 -1
- package/dist/packem_shared/{plunkProvider-DfJumQ4U.js → plunkProvider-BQyjG6YT.js} +1 -1
- package/dist/packem_shared/{postalProvider-Bavx2FcH.js → postalProvider-DPHQ620q.js} +1 -1
- package/dist/packem_shared/{postmarkProvider-DFC0uvjO.js → postmarkProvider-bMTC2gdJ.js} +1 -1
- package/dist/packem_shared/provider.d-DcfYeGJJ.d.ts +28 -0
- package/dist/packem_shared/readFile-BAVMZg5e-C4whBIPd.js +1 -0
- package/dist/packem_shared/resendProvider-Cns1tvF5.js +1 -0
- package/dist/packem_shared/roundRobinProvider-FvZQKl6n.js +1 -0
- package/dist/packem_shared/{scalewayProvider-be1HPimL.js → scalewayProvider-O1dHz7iJ.js} +1 -1
- package/dist/packem_shared/{sendGridProvider-BVI1sq3n.js → sendGridProvider-DmywC-eT.js} +1 -1
- package/dist/packem_shared/{smtpProvider-BV-ufR53.js → smtpProvider-Unjao_fn.js} +8 -8
- package/dist/packem_shared/sweegoProvider-D086G6xG.js +1 -0
- package/dist/packem_shared/types.d-CNnnk-Ya.d.ts +102 -0
- package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +9 -0
- package/dist/packem_shared/types.d-wwpgA3to.d.ts +204 -0
- package/dist/packem_shared/validate-email-options-DPo3SgC0.js +1 -0
- package/dist/packem_shared/zeptomailProvider-DKKEpEsW.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/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/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 +59 -3
- package/dist/providers/mock/index.js +1 -1
- package/dist/providers/nodemailer/index.d.ts +38 -3
- package/dist/providers/nodemailer/index.js +1 -1
- package/dist/providers/opentelemetry/index.d.ts +529 -3
- package/dist/providers/opentelemetry/index.js +1 -1
- 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/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/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/mjml.d.ts +10 -10
- package/dist/template-engines/react-email.d.ts +9 -9
- package/dist/template-engines/vue-email.d.ts +9 -9
- package/dist/utils/cache.d.ts +49 -48
- package/dist/utils/format-email-address.d.ts +8 -7
- package/dist/utils/normalize-email-aliases.d.ts +20 -20
- package/dist/utils/parse-address.d.ts +18 -17
- package/dist/utils/parse-address.js +1 -1
- package/dist/utils/validation/check-mx-records.d.ts +36 -35
- 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/validate-email.d.ts +5 -5
- 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 +1 -1
- package/package.json +61 -61
- 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/Mail-6Bltpy_p.js +0 -1
- package/dist/packem_shared/MailMessage-B76GPBBA.js +0 -1
- package/dist/packem_shared/azureProvider-CQYAkgVF.js +0 -1
- package/dist/packem_shared/build-mime-message-IYaUqqPJ.js +0 -2
- 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/httpProvider-CZD6LZX3.js +0 -1
- package/dist/packem_shared/mailPaceProvider-B6yKvh6z.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/mockProvider-DN5ZwutD.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/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
package/README.md
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<!-- START_PACKAGE_OG_IMAGE_PLACEHOLDER -->
|
|
2
|
+
|
|
3
|
+
<a href="https://www.anolilab.com/open-source" align="center">
|
|
4
|
+
|
|
5
|
+
<img src="__assets__/package-og.svg" alt="email" />
|
|
6
|
+
|
|
7
|
+
</a>
|
|
8
|
+
|
|
9
|
+
<h3 align="center">A comprehensive email library with multi-provider support, crypto utilities, and template engines</h3>
|
|
10
|
+
|
|
11
|
+
<!-- END_PACKAGE_OG_IMAGE_PLACEHOLDER -->
|
|
7
12
|
|
|
8
13
|
<br />
|
|
9
14
|
|
|
10
15
|
<div align="center">
|
|
11
16
|
|
|
12
|
-
[![typescript-image]
|
|
17
|
+
[![typescript-image][typescript-badge]][typescript-url]
|
|
18
|
+
[![mit licence][license-badge]][license]
|
|
19
|
+
[![npm downloads][npm-downloads-badge]][npm-downloads]
|
|
20
|
+
[![Chat][chat-badge]][chat]
|
|
21
|
+
[![PRs Welcome][prs-welcome-badge]][prs-welcome]
|
|
13
22
|
|
|
14
23
|
</div>
|
|
15
24
|
|
|
@@ -128,7 +137,7 @@ await writeFile("draft.eml", eml);
|
|
|
128
137
|
|
|
129
138
|
### Using Different Providers
|
|
130
139
|
|
|
131
|
-
|
|
140
|
+
```typescript
|
|
132
141
|
import { createMail, MailMessage, smtpProvider, resendProvider } from "@visulima/email";
|
|
133
142
|
|
|
134
143
|
// SMTP provider
|
|
@@ -150,13 +159,10 @@ const smtpMail = createMail(smtp);
|
|
|
150
159
|
const resendMail = createMail(resend);
|
|
151
160
|
|
|
152
161
|
// Send via specific provider
|
|
153
|
-
const message = new MailMessage()
|
|
154
|
-
.to("user@example.com")
|
|
155
|
-
.from("sender@example.com")
|
|
156
|
-
.subject("Hello")
|
|
157
|
-
.html("<h1>Hello World</h1>");
|
|
162
|
+
const message = new MailMessage().to("user@example.com").from("sender@example.com").subject("Hello").html("<h1>Hello World</h1>");
|
|
158
163
|
|
|
159
164
|
await resendMail.send(message);
|
|
165
|
+
```
|
|
160
166
|
|
|
161
167
|
### Direct Email Sending
|
|
162
168
|
|
|
@@ -1388,14 +1394,23 @@ If you would like to help take a look at the [list of issues](https://github.com
|
|
|
1388
1394
|
- [Daniel Bannert](https://github.com/prisis)
|
|
1389
1395
|
- [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
|
|
1390
1396
|
|
|
1397
|
+
## Made with ❤️ at Anolilab
|
|
1398
|
+
|
|
1399
|
+
This is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Anolilab](https://www.anolilab.com/open-source) is a Development and AI Studio. Contact us at [hello@anolilab.com](mailto:hello@anolilab.com) if you need any help with these technologies or just want to say hi!
|
|
1400
|
+
|
|
1391
1401
|
## License
|
|
1392
1402
|
|
|
1393
|
-
The visulima email is open-sourced software licensed under the [MIT][license
|
|
1403
|
+
The visulima email is open-sourced software licensed under the [MIT][license]
|
|
1404
|
+
|
|
1405
|
+
<!-- badges -->
|
|
1394
1406
|
|
|
1395
|
-
[
|
|
1396
|
-
[
|
|
1397
|
-
[
|
|
1398
|
-
[
|
|
1399
|
-
[
|
|
1400
|
-
[
|
|
1401
|
-
|
|
1407
|
+
[license-badge]: https://img.shields.io/npm/l/@visulima/email?style=for-the-badge
|
|
1408
|
+
[license]: https://github.com/visulima/visulima/blob/main/LICENSE
|
|
1409
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dm/@visulima/email?style=for-the-badge
|
|
1410
|
+
[npm-downloads]: https://www.npmjs.com/package/@visulima/email
|
|
1411
|
+
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
|
|
1412
|
+
[prs-welcome]: https://github.com/visulima/visulima/blob/main/.github/CONTRIBUTING.md
|
|
1413
|
+
[chat-badge]: https://img.shields.io/discord/932323359193186354.svg?style=for-the-badge
|
|
1414
|
+
[chat]: https://discord.gg/TtFJY8xkFK
|
|
1415
|
+
[typescript-badge]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
|
|
1416
|
+
[typescript-url]: https://www.typescriptlang.org/
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -1,4 +1,147 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { E as EmailOptions } from "../packem_shared/types.d-wwpgA3to.js";
|
|
2
|
+
import { D as DkimOptions, E as EmailSigner, S as SmimeEncryptOptions, a as EmailEncrypter, b as SmimeSignOptions } from "../packem_shared/types.d-CNnnk-Ya.js";
|
|
3
|
+
import 'node:buffer';
|
|
4
|
+
/**
|
|
5
|
+
* DKIM signer implementation
|
|
6
|
+
*/
|
|
7
|
+
declare class DkimSigner implements EmailSigner {
|
|
8
|
+
/**
|
|
9
|
+
* Sanitizes a display name for use in quoted email headers per RFC 5322.
|
|
10
|
+
* Removes/replaces CR, LF, tabs with space, escapes backslashes and quotes,
|
|
11
|
+
* and strips non-printable control characters.
|
|
12
|
+
* @param name The display name to sanitize.
|
|
13
|
+
* @returns The sanitized display name, or empty string if nothing remains.
|
|
14
|
+
*/
|
|
15
|
+
private static sanitizeDisplayName;
|
|
16
|
+
/**
|
|
17
|
+
* Formats an email address for use in email headers.
|
|
18
|
+
* @param address The email address object to format.
|
|
19
|
+
* @param address.email The email address string.
|
|
20
|
+
* @param address.name Optional display name for the email address.
|
|
21
|
+
* @returns The formatted email address string in RFC 5322 format.
|
|
22
|
+
*/
|
|
23
|
+
private static formatAddress;
|
|
24
|
+
/**
|
|
25
|
+
* Formats email addresses for headers.
|
|
26
|
+
* @param addresses The email address(es) to format (single or array).
|
|
27
|
+
* @returns The formatted email addresses string (comma-separated if multiple).
|
|
28
|
+
*/
|
|
29
|
+
private static formatAddresses;
|
|
30
|
+
private readonly options;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new DKIM signer.
|
|
33
|
+
* @param options DKIM signing options.
|
|
34
|
+
*/
|
|
35
|
+
constructor(options: DkimOptions);
|
|
36
|
+
/**
|
|
37
|
+
* Signs an email message with DKIM.
|
|
38
|
+
* @param email The email options to sign.
|
|
39
|
+
* @returns The email options with DKIM signature header added.
|
|
40
|
+
* @throws {Error} When signing fails (e.g., invalid private key).
|
|
41
|
+
*/
|
|
42
|
+
sign(email: EmailOptions): Promise<EmailOptions>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a DKIM signer instance.
|
|
46
|
+
* @param options DKIM signing options.
|
|
47
|
+
* @returns A new DkimSigner instance.
|
|
48
|
+
*/
|
|
49
|
+
declare const createDkimSigner: (options: DkimOptions) => DkimSigner;
|
|
50
|
+
/**
|
|
51
|
+
* S/MIME encrypter implementation using PKIjs
|
|
52
|
+
* Note: Requires pkijs and asn1js for S/MIME operations
|
|
53
|
+
* Uses Node.js crypto for all cryptographic operations
|
|
54
|
+
*/
|
|
55
|
+
declare class SmimeEncrypter implements EmailEncrypter {
|
|
56
|
+
/**
|
|
57
|
+
* Collects and normalizes all recipients (to, cc, bcc) from email options.
|
|
58
|
+
* Normalizes each to an array, extracts email addresses, and deduplicates.
|
|
59
|
+
* @param email The email options containing recipients.
|
|
60
|
+
* @returns An array of unique email addresses (strings).
|
|
61
|
+
*/
|
|
62
|
+
private static collectRecipients;
|
|
63
|
+
/**
|
|
64
|
+
* Formats an email address for use in email headers.
|
|
65
|
+
* @param address The email address to format (string or EmailAddress object).
|
|
66
|
+
* @returns The formatted email address string in RFC 5322 format.
|
|
67
|
+
*/
|
|
68
|
+
private static formatAddress;
|
|
69
|
+
/**
|
|
70
|
+
* Formats email addresses for use in email headers.
|
|
71
|
+
* @param addresses The email addresses to format (single or array, string or EmailAddress objects).
|
|
72
|
+
* @returns The formatted email addresses string (comma-separated if multiple).
|
|
73
|
+
*/
|
|
74
|
+
private static formatAddresses;
|
|
75
|
+
private readonly options;
|
|
76
|
+
/**
|
|
77
|
+
* Creates a new S/MIME encrypter.
|
|
78
|
+
* @param options S/MIME encryption options.
|
|
79
|
+
*/
|
|
80
|
+
constructor(options: SmimeEncryptOptions);
|
|
81
|
+
/**
|
|
82
|
+
* Encrypts an email message with S/MIME.
|
|
83
|
+
* @param email The email options to encrypt.
|
|
84
|
+
* @returns The encrypted email options.
|
|
85
|
+
* @throws {Error} When encryption fails (e.g., invalid certificate).
|
|
86
|
+
*/
|
|
87
|
+
encrypt(email: EmailOptions): Promise<EmailOptions>;
|
|
88
|
+
/**
|
|
89
|
+
* Builds the email message string from email options.
|
|
90
|
+
* @param email The email options to build the message from.
|
|
91
|
+
* @returns The formatted email message as a string.
|
|
92
|
+
*/
|
|
93
|
+
private buildMessage;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Creates a new S/MIME encrypter instance.
|
|
97
|
+
* @param options The S/MIME encryption options.
|
|
98
|
+
* @returns A new SmimeEncrypter instance ready to encrypt emails.
|
|
99
|
+
*/
|
|
100
|
+
declare const createSmimeEncrypter: (options: SmimeEncryptOptions) => SmimeEncrypter;
|
|
101
|
+
/**
|
|
102
|
+
* S/MIME signer implementation using PKIjs
|
|
103
|
+
* Note: Requires pkijs and asn1js for S/MIME operations
|
|
104
|
+
* Uses Node.js crypto for all cryptographic operations
|
|
105
|
+
*/
|
|
106
|
+
declare class SmimeSigner implements EmailSigner {
|
|
107
|
+
/**
|
|
108
|
+
* Formats an email address for use in email headers.
|
|
109
|
+
* @param address The email address object to format.
|
|
110
|
+
* @param address.email The email address string.
|
|
111
|
+
* @param address.name Optional display name for the email address.
|
|
112
|
+
* @returns The formatted email address string in RFC 5322 format.
|
|
113
|
+
*/
|
|
114
|
+
private static formatAddress;
|
|
115
|
+
private readonly options;
|
|
116
|
+
/**
|
|
117
|
+
* Creates a new S/MIME signer.
|
|
118
|
+
* @param options S/MIME signing options.
|
|
119
|
+
*/
|
|
120
|
+
constructor(options: SmimeSignOptions);
|
|
121
|
+
/**
|
|
122
|
+
* Signs an email message with S/MIME.
|
|
123
|
+
* @param email The email options to sign.
|
|
124
|
+
* @returns The email options with S/MIME signature.
|
|
125
|
+
* @throws {Error} When signing fails (e.g., invalid certificate/key).
|
|
126
|
+
*/
|
|
127
|
+
sign(email: EmailOptions): Promise<EmailOptions>;
|
|
128
|
+
/**
|
|
129
|
+
* Builds the email message string from email options.
|
|
130
|
+
* @param email The email options to build the message from.
|
|
131
|
+
* @returns The formatted email message as a string.
|
|
132
|
+
*/
|
|
133
|
+
private buildMessage;
|
|
134
|
+
/**
|
|
135
|
+
* Formats email addresses for use in email headers.
|
|
136
|
+
* @param addresses The email addresses to format (single or array).
|
|
137
|
+
* @returns The formatted email addresses string (comma-separated if multiple).
|
|
138
|
+
*/
|
|
139
|
+
private formatAddresses;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Creates a new S/MIME signer instance.
|
|
143
|
+
* @param options The S/MIME signing options.
|
|
144
|
+
* @returns A new SmimeSigner instance ready to sign emails.
|
|
145
|
+
*/
|
|
146
|
+
declare const createSmimeSigner: (options: SmimeSignOptions) => SmimeSigner;
|
|
147
|
+
export { type DkimOptions, DkimSigner, type EmailEncrypter, type EmailSigner, type SmimeEncryptOptions, SmimeEncrypter, type SmimeSignOptions, SmimeSigner, createDkimSigner, createSmimeEncrypter, createSmimeSigner };
|
package/dist/crypto/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DkimSigner as m,createDkimSigner as i}from"../packem_shared/DkimSigner-
|
|
1
|
+
import{DkimSigner as m,createDkimSigner as i}from"../packem_shared/DkimSigner-CT2DSHD1.js";import{SmimeEncrypter as S,createSmimeEncrypter as n}from"../packem_shared/SmimeEncrypter-ZhHEgDwY.js";import{SmimeSigner as c,createSmimeSigner as p}from"../packem_shared/SmimeSigner-CYSVF6ez.js";export{m as DkimSigner,S as SmimeEncrypter,c as SmimeSigner,i as createDkimSigner,n as createSmimeEncrypter,p as createSmimeSigner};
|