@mavogel/awscdk-rootmail 0.1.33 → 0.1.35
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/.jsii +8 -8
- package/lib/rootmail.js +1 -1
- package/lib/ses-receive.js +1 -1
- package/node_modules/@aws-sdk/checksums/dist-cjs/submodules/flexible-checksums/index.js +2 -1
- package/node_modules/@aws-sdk/checksums/dist-cjs/submodules/sha/index.js +464 -40
- package/node_modules/@aws-sdk/checksums/dist-cjs/submodules/xxh/index.js +914 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/flexible-checksums/stringUnionSelector.js +2 -1
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/index.browser.js +2 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/index.js +3 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/sha512/Sha512.js +71 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/sha512/Sha512Js.js +276 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/sha512/Sha512WebCrypto.js +76 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/U64.js +190 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/Xxh3.js +274 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/index.js +3 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/xxhash3_128/Xxh3_128.js +179 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/xxhash3_64/Xxh3_64.js +117 -0
- package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/xxhash64/Xxh64.js +150 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/sha/index.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/sha/index.d.ts +3 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/sha/sha512/Sha512.d.ts +17 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/sha/sha512/Sha512Js.d.ts +29 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/sha/sha512/Sha512WebCrypto.d.ts +22 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/U64.d.ts +110 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/Xxh3.d.ts +139 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/index.d.ts +3 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/xxhash3_128/Xxh3_128.d.ts +37 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/xxhash3_64/Xxh3_64.d.ts +27 -0
- package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/xxhash64/Xxh64.d.ts +41 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/sha/index.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/sha/index.d.ts +3 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/sha/sha512/Sha512.d.ts +12 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/sha/sha512/Sha512Js.d.ts +22 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/sha/sha512/Sha512WebCrypto.d.ts +14 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/U64.d.ts +27 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/Xxh3.d.ts +65 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/index.d.ts +3 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/xxhash3_128/Xxh3_128.d.ts +12 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/xxhash3_64/Xxh3_64.d.ts +10 -0
- package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/xxhash64/Xxh64.d.ts +17 -0
- package/node_modules/@aws-sdk/checksums/package.json +13 -3
- package/node_modules/@aws-sdk/checksums/xxh.d.ts +5 -0
- package/node_modules/@aws-sdk/checksums/xxh.js +5 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +3 -3
- package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-route-53/package.json +3 -3
- package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-s3/package.json +7 -7
- package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ses/package.json +3 -3
- package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ssm/package.json +3 -3
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +26 -13
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +6 -3
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +51 -1
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +2 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-host-header/hostHeaderMiddleware.js +4 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/util-endpoints/lib/aws/parseArn.js +4 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-browser/defaultUserAgent.js +18 -9
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.js +6 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsSmithyRpcV2JsonProtocol.js +51 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/util/util-arn-parser/arn.js +2 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsSmithyRpcV2JsonProtocol.d.ts +25 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsSmithyRpcV2JsonProtocol.d.ts +36 -0
- package/node_modules/@aws-sdk/core/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/submodules/s3/index.js +34 -16
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/submodules/s3-control/index.js +6 -3
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/submodules/s3/middleware-bucket-endpoint/bucketHostnameUtils.js +6 -3
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/submodules/s3/middleware-s3-express/classes/S3ExpressIdentityCache.js +8 -4
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/submodules/s3/middleware-s3-express/classes/S3ExpressIdentityProviderImpl.js +18 -8
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/submodules/s3/middleware-ssec/middleware-ssec.js +2 -1
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/submodules/s3-control/middleware-process-arnables/parse-outpost-arnables.js +4 -2
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/submodules/s3-control/middleware-redirect-from-postid/redirect-from-postid.js +2 -1
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-types/submodules/s3/middleware-s3-express/classes/S3ExpressIdentityCache.d.ts +1 -0
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-types/submodules/s3/middleware-s3-express/classes/S3ExpressIdentityProviderImpl.d.ts +3 -1
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-types/ts3.4/submodules/s3/middleware-s3-express/classes/S3ExpressIdentityCache.d.ts +1 -0
- package/node_modules/@aws-sdk/middleware-sdk-s3/dist-types/ts3.4/submodules/s3/middleware-s3-express/classes/S3ExpressIdentityProviderImpl.d.ts +3 -1
- package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +3 -3
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +3 -3
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +1 -1
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/xml-builder/package.json +1 -1
- package/node_modules/mailparser/CHANGELOG.md +26 -0
- package/node_modules/mailparser/README.md +21 -1
- package/node_modules/mailparser/dist/cjs/index.d.ts +3 -1
- package/node_modules/mailparser/dist/cjs/index.js +4 -2
- package/node_modules/mailparser/dist/cjs/mail-parser.d.ts +8 -1
- package/node_modules/mailparser/dist/cjs/mail-parser.js +5 -0
- package/node_modules/mailparser/dist/cjs/otp-token.d.ts +9 -0
- package/node_modules/mailparser/dist/cjs/otp-token.js +186 -0
- package/node_modules/mailparser/dist/cjs/simple-parser.js +3 -0
- package/node_modules/mailparser/dist/cjs/types.d.ts +21 -0
- package/node_modules/mailparser/dist/esm/index.d.ts +3 -1
- package/node_modules/mailparser/dist/esm/index.js +3 -2
- package/node_modules/mailparser/dist/esm/mail-parser.d.ts +8 -1
- package/node_modules/mailparser/dist/esm/mail-parser.js +5 -0
- package/node_modules/mailparser/dist/esm/otp-token.d.ts +9 -0
- package/node_modules/mailparser/dist/esm/otp-token.js +180 -0
- package/node_modules/mailparser/dist/esm/simple-parser.js +3 -0
- package/node_modules/mailparser/dist/esm/types.d.ts +21 -0
- package/node_modules/mailparser/package.json +3 -3
- package/node_modules/nodemailer/CHANGELOG.md +19 -0
- package/node_modules/nodemailer/dist/cjs/dkim/sign.js +1 -1
- package/node_modules/nodemailer/dist/cjs/errors.d.ts +2 -0
- package/node_modules/nodemailer/dist/cjs/errors.js +3 -1
- package/node_modules/nodemailer/dist/cjs/mail-composer/index.d.ts +12 -0
- package/node_modules/nodemailer/dist/cjs/mail-composer/index.js +53 -0
- package/node_modules/nodemailer/dist/cjs/mailer/index.d.ts +3 -2
- package/node_modules/nodemailer/dist/cjs/mime-node/index.js +10 -2
- package/node_modules/nodemailer/dist/cjs/nodemailer.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
- package/node_modules/nodemailer/dist/cjs/well-known/services.js +7 -0
- package/node_modules/nodemailer/dist/esm/dkim/sign.js +1 -1
- package/node_modules/nodemailer/dist/esm/errors.d.ts +2 -0
- package/node_modules/nodemailer/dist/esm/errors.js +2 -0
- package/node_modules/nodemailer/dist/esm/mail-composer/index.d.ts +12 -0
- package/node_modules/nodemailer/dist/esm/mail-composer/index.js +53 -0
- package/node_modules/nodemailer/dist/esm/mailer/index.d.ts +3 -2
- package/node_modules/nodemailer/dist/esm/mime-node/index.js +10 -2
- package/node_modules/nodemailer/dist/esm/nodemailer.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
- package/node_modules/nodemailer/dist/esm/well-known/services.js +7 -0
- package/node_modules/nodemailer/dist/well-known/services.json +8 -0
- package/node_modules/nodemailer/package.json +5 -5
- package/package.json +7 -7
|
@@ -5,8 +5,9 @@ import { CONTEXT_ARN_REGION, CONTEXT_OUTPOST_ID, CONTEXT_SIGNING_REGION, CONTEXT
|
|
|
5
5
|
export const parseOutpostArnablesMiddleaware = (options) => (next, context) => async (args) => {
|
|
6
6
|
const { input } = args;
|
|
7
7
|
const parameter = input.Name && validateArn(input.Name) ? "Name" : input.Bucket && validateArn(input.Bucket) ? "Bucket" : undefined;
|
|
8
|
-
if (!parameter)
|
|
8
|
+
if (!parameter) {
|
|
9
9
|
return next(args);
|
|
10
|
+
}
|
|
10
11
|
const clientRegion = await options.region();
|
|
11
12
|
const useArnRegion = await options.useArnRegion();
|
|
12
13
|
const useFipsEndpoint = await options.useFipsEndpoint();
|
|
@@ -52,8 +53,9 @@ export const parseOutpostArnablesMiddleaware = (options) => (next, context) => a
|
|
|
52
53
|
if (!input.AccountId) {
|
|
53
54
|
input.AccountId = arn.accountId;
|
|
54
55
|
}
|
|
55
|
-
if (useArnRegion)
|
|
56
|
+
if (useArnRegion) {
|
|
56
57
|
context[CONTEXT_ARN_REGION] = arn.region;
|
|
58
|
+
}
|
|
57
59
|
return next(args);
|
|
58
60
|
};
|
|
59
61
|
export const parseOutpostArnablesMiddleawareOptions = {
|
|
@@ -3,8 +3,9 @@ import { CONTEXT_SIGNING_SERVICE } from "../constants";
|
|
|
3
3
|
import { getOutpostEndpoint } from "../middleware-process-arnables/getOutpostEndpoint";
|
|
4
4
|
export const redirectFromPostIdMiddleware = (config) => (next, context) => async (args) => {
|
|
5
5
|
const { input, request } = args;
|
|
6
|
-
if (!HttpRequest.isInstance(request))
|
|
6
|
+
if (!HttpRequest.isInstance(request)) {
|
|
7
7
|
return next(args);
|
|
8
|
+
}
|
|
8
9
|
if (input.OutpostId) {
|
|
9
10
|
const { isCustomEndpoint } = config;
|
|
10
11
|
const useFipsEndpoint = await config.useFipsEndpoint();
|
|
@@ -12,5 +12,6 @@ export declare class S3ExpressIdentityCache {
|
|
|
12
12
|
get(key: string): undefined | S3ExpressIdentityCacheEntry;
|
|
13
13
|
set(key: string, entry: S3ExpressIdentityCacheEntry): S3ExpressIdentityCacheEntry;
|
|
14
14
|
delete(key: string): void;
|
|
15
|
+
clear(): void;
|
|
15
16
|
purgeExpired(): Promise<void>;
|
|
16
17
|
}
|
|
@@ -21,7 +21,9 @@ export declare class S3ExpressIdentityProviderImpl implements S3ExpressIdentityP
|
|
|
21
21
|
private createSessionFn;
|
|
22
22
|
private cache;
|
|
23
23
|
static REFRESH_WINDOW_MS: number;
|
|
24
|
-
|
|
24
|
+
private accessKeyId?;
|
|
25
|
+
private cacheGeneration;
|
|
26
|
+
constructor(createSessionFn: (bucket: string) => Promise<{
|
|
25
27
|
Credentials: Credentials;
|
|
26
28
|
}>, cache?: S3ExpressIdentityCache);
|
|
27
29
|
getS3ExpressIdentity(awsIdentity: AwsCredentialIdentity, identityProperties: {
|
|
@@ -7,5 +7,6 @@ export declare class S3ExpressIdentityCache {
|
|
|
7
7
|
get(key: string): undefined | S3ExpressIdentityCacheEntry;
|
|
8
8
|
set(key: string, entry: S3ExpressIdentityCacheEntry): S3ExpressIdentityCacheEntry;
|
|
9
9
|
delete(key: string): void;
|
|
10
|
+
clear(): void;
|
|
10
11
|
purgeExpired(): Promise<void>;
|
|
11
12
|
}
|
|
@@ -12,8 +12,10 @@ export declare class S3ExpressIdentityProviderImpl implements S3ExpressIdentityP
|
|
|
12
12
|
private createSessionFn;
|
|
13
13
|
private cache;
|
|
14
14
|
static REFRESH_WINDOW_MS: number;
|
|
15
|
+
private accessKeyId?;
|
|
16
|
+
private cacheGeneration;
|
|
15
17
|
constructor(
|
|
16
|
-
createSessionFn: (
|
|
18
|
+
createSessionFn: (bucket: string) => Promise<{
|
|
17
19
|
Credentials: Credentials;
|
|
18
20
|
}>,
|
|
19
21
|
cache?: S3ExpressIdentityCache,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-s3",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.84",
|
|
4
4
|
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/middleware-sdk-s3",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
"test:types": "tsc -p tsconfig.test.json"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@aws-sdk/core": "^3.
|
|
98
|
-
"@aws-sdk/signature-v4-multi-region": "^3.996.
|
|
97
|
+
"@aws-sdk/core": "^3.979.0",
|
|
98
|
+
"@aws-sdk/signature-v4-multi-region": "^3.996.50",
|
|
99
99
|
"@aws-sdk/types": "^3.975.0",
|
|
100
100
|
"@smithy/core": "^3.37.0",
|
|
101
101
|
"@smithy/types": "^4.19.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/nested-clients",
|
|
3
|
-
"version": "3.997.
|
|
3
|
+
"version": "3.997.53",
|
|
4
4
|
"description": "Nested clients for AWS SDK packages.",
|
|
5
5
|
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"test:watch": "yarn g:vitest watch"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@aws-sdk/core": "^3.
|
|
104
|
-
"@aws-sdk/signature-v4-multi-region": "^3.996.
|
|
103
|
+
"@aws-sdk/core": "^3.979.0",
|
|
104
|
+
"@aws-sdk/signature-v4-multi-region": "^3.996.50",
|
|
105
105
|
"@aws-sdk/types": "^3.975.0",
|
|
106
106
|
"@smithy/core": "^3.37.0",
|
|
107
107
|
"@smithy/fetch-http-handler": "^5.8.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/token-providers",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1160.0",
|
|
4
4
|
"description": "A collection of token providers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@aws-sdk/core": "^3.
|
|
52
|
-
"@aws-sdk/nested-clients": "^3.997.
|
|
51
|
+
"@aws-sdk/core": "^3.979.0",
|
|
52
|
+
"@aws-sdk/nested-clients": "^3.997.53",
|
|
53
53
|
"@aws-sdk/types": "^3.975.0",
|
|
54
54
|
"@smithy/core": "^3.37.0",
|
|
55
55
|
"@smithy/types": "^4.19.0",
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.14.1](https://github.com/nodemailer/mailparser/compare/v3.14.0...v3.14.1) (2026-10-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* update dependencies ([e5ae8e4](https://github.com/nodemailer/mailparser/commit/e5ae8e4d06058878e7a2bea4440f31af659a3c10))
|
|
9
|
+
|
|
10
|
+
## [3.14.0](https://github.com/nodemailer/mailparser/compare/v3.13.0...v3.14.0) (2026-10-29)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* export parseOtpToken for OTP-Token values read outside the parser ([fda26b2](https://github.com/nodemailer/mailparser/commit/fda26b2c1a14927b17a16a42d406576f21de4fc4))
|
|
16
|
+
|
|
17
|
+
## [3.13.0](https://github.com/nodemailer/mailparser/compare/v3.12.4...v3.13.0) (2026-10-29)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* parse the OTP-Token header into mail.otp ([bc20682](https://github.com/nodemailer/mailparser/commit/bc206829c8cc287b7d980d604d0a3fbe6cbc0179))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* update dependencies ([f94b954](https://github.com/nodemailer/mailparser/commit/f94b954efcdf63d117097ebdecf79acb71e81bfa))
|
|
28
|
+
|
|
3
29
|
## [3.12.4](https://github.com/nodemailer/mailparser/compare/v3.12.3...v3.12.4) (2026-10-22)
|
|
4
30
|
|
|
5
31
|
|
|
@@ -24,7 +24,7 @@ const mailparser = require('mailparser');
|
|
|
24
24
|
or, from an ES module or TypeScript (type declarations are included):
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
|
-
import { simpleParser, MailParser, parseAddressHeader } from 'mailparser';
|
|
27
|
+
import { simpleParser, MailParser, parseAddressHeader, parseOtpToken } from 'mailparser';
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
@@ -54,6 +54,26 @@ parseAddressHeader('=?utf-8?Q?J=C3=B5geva?= <info@xn--mnchen-3ya.example>, Team:
|
|
|
54
54
|
|
|
55
55
|
Each entry of `value` has a `name` (an empty string when there is none, encoded words decoded) and either an `address` (a punycode domain decoded to Unicode) or, for a group, a `group` list of the same entries. RFC 2047 does not allow encoded words in the address itself, so an address part hiding one is kept only when it decodes to a plain `local@domain`, otherwise `address` is an empty string; a display name that decodes to something looking like an address stays a name.
|
|
56
56
|
|
|
57
|
+
### One-time passcodes
|
|
58
|
+
|
|
59
|
+
A message with an `OTP-Token` header ([draft-goto-otp-token](https://datatracker.ietf.org/doc/draft-goto-otp-token/), the header Nodemailer sets with its `otp` option) gets an `otp` property on the `simpleParser` result and on the `MailParser` instance, an object with `code` (the passcode) and `origin` (the origin it is bound to, such as `"https://example.com"`).
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
const mail = await simpleParser('OTP-Token: "123456"; origin="https://example.com"\r\nSubject: Code\r\n\r\nYour code is 123456');
|
|
63
|
+
// mail.otp: { code: '123456', origin: 'https://example.com' }
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`otp` is set only when the message header has exactly one `OTP-Token` header and its value is valid: a structured field String with an `origin` parameter holding a canonical `https` origin, or an `http` origin on a loopback host. An `OTP-Token` header of a MIME part or a forwarded message is ignored. The header is not authenticated, so check that the message carries a valid DKIM signature from the domain of the origin before offering the code. The header comes from an Internet-Draft, so `otp` is experimental and may change in a minor release when the draft does.
|
|
67
|
+
|
|
68
|
+
For a header that comes from somewhere else than a message being parsed, such as an IMAP `HEADER.FIELDS` fetch or a provider API, `parseOtpToken(values)` takes the raw values of every `OTP-Token` header of the message's own header section (a string or an array) and returns the same `{ code, origin }` object, or `undefined`. The same rules apply, so more than one value returns `undefined`.
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
const { parseOtpToken } = require('mailparser');
|
|
72
|
+
|
|
73
|
+
parseOtpToken(['"123456"; origin="https://example.com"']);
|
|
74
|
+
// { code: '123456', origin: 'https://example.com' }
|
|
75
|
+
```
|
|
76
|
+
|
|
57
77
|
### Character sets
|
|
58
78
|
|
|
59
79
|
Text bodies are decoded with libmime's `createDecodeStream()`, which resolves charset aliases, decodes the Japanese charsets iconv-lite does not support (ISO-2022-JP and friends) and keeps a multibyte character that is split across chunks intact. A body in a charset that is not known, or one that is refused, is decoded as UTF-8 with invalid bytes replaced by U+FFFD, the same fallback encoded words in headers get. The refused charsets are UTF-7 (and its aliases), which can carry markup past a filter that looks for `<` (`+ADw-script+AD4-` decodes to `<script>`), and the base64 and hex transfer encodings. A UTF-7 body therefore keeps its `+ADw-` sequences as literal text. The refusal applies with the `Iconv` option as well.
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import MailParser from './mail-parser.js';
|
|
2
2
|
import simpleParser from './simple-parser.js';
|
|
3
3
|
import { parseAddressHeader } from './address-header.js';
|
|
4
|
-
|
|
4
|
+
import { parseOtpToken } from './otp-token.js';
|
|
5
|
+
export { MailParser, simpleParser, parseAddressHeader, parseOtpToken };
|
|
5
6
|
export type { SimpleParserCallback } from './simple-parser.js';
|
|
6
7
|
export type * from './types.js';
|
|
7
8
|
declare const _default: {
|
|
8
9
|
MailParser: typeof MailParser;
|
|
9
10
|
simpleParser: typeof simpleParser;
|
|
10
11
|
parseAddressHeader: typeof parseAddressHeader;
|
|
12
|
+
parseOtpToken: typeof parseOtpToken;
|
|
11
13
|
};
|
|
12
14
|
export default _default;
|
|
@@ -3,12 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseAddressHeader = exports.simpleParser = exports.MailParser = void 0;
|
|
6
|
+
exports.parseOtpToken = exports.parseAddressHeader = exports.simpleParser = exports.MailParser = void 0;
|
|
7
7
|
const mail_parser_js_1 = __importDefault(require("./mail-parser.js"));
|
|
8
8
|
exports.MailParser = mail_parser_js_1.default;
|
|
9
9
|
const simple_parser_js_1 = __importDefault(require("./simple-parser.js"));
|
|
10
10
|
exports.simpleParser = simple_parser_js_1.default;
|
|
11
11
|
const address_header_js_1 = require("./address-header.js");
|
|
12
12
|
Object.defineProperty(exports, "parseAddressHeader", { enumerable: true, get: function () { return address_header_js_1.parseAddressHeader; } });
|
|
13
|
-
|
|
13
|
+
const otp_token_js_1 = require("./otp-token.js");
|
|
14
|
+
Object.defineProperty(exports, "parseOtpToken", { enumerable: true, get: function () { return otp_token_js_1.parseOtpToken; } });
|
|
15
|
+
exports.default = { MailParser: mail_parser_js_1.default, simpleParser: simple_parser_js_1.default, parseAddressHeader: address_header_js_1.parseAddressHeader, parseOtpToken: otp_token_js_1.parseOtpToken };
|
|
14
16
|
Object.defineProperty(exports, 'default', { value: exports, enumerable: false, writable: true, configurable: true });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transform } from 'node:stream';
|
|
2
2
|
import type { TransformCallback } from 'node:stream';
|
|
3
|
-
import type { AddressObject, AttachmentStream, EmailAddress, HeaderLines, Headers, MailParserOptions, MessageText } from './types.js';
|
|
3
|
+
import type { AddressObject, AttachmentStream, EmailAddress, HeaderLines, Headers, MailParserOptions, MessageText, Otp } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* A lower level, streaming e-mail parser. It is a Transform stream: write the raw message in and
|
|
6
6
|
* read the parsed content out. It emits:
|
|
@@ -46,6 +46,13 @@ declare class MailParser extends Transform {
|
|
|
46
46
|
inReplyTo?: string;
|
|
47
47
|
/** The `Reply-To` header, set once the headers have been parsed. */
|
|
48
48
|
replyTo?: AddressObject;
|
|
49
|
+
/**
|
|
50
|
+
* One-time passcode from the `OTP-Token` header, set once the headers have been parsed if the
|
|
51
|
+
* message has a valid one. The header is not authenticated, see `ParsedMail.otp`.
|
|
52
|
+
*
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
55
|
+
otp?: Otp;
|
|
49
56
|
constructor(config?: MailParserOptions);
|
|
50
57
|
_transform(chunk: Buffer, encoding: BufferEncoding, done: TransformCallback): void;
|
|
51
58
|
_flush(done: TransformCallback): void;
|
|
@@ -14,6 +14,7 @@ const node_stream_1 = require("node:stream");
|
|
|
14
14
|
const tlds_cjs_1 = __importDefault(require("./tlds.cjs"));
|
|
15
15
|
const stream_hash_js_1 = __importDefault(require("./stream-hash.js"));
|
|
16
16
|
const address_header_js_1 = require("./address-header.js");
|
|
17
|
+
const otp_token_js_1 = require("./otp-token.js");
|
|
17
18
|
const { Splitter, ChunkedPassthrough } = mailsplit_1.default;
|
|
18
19
|
// Bounds for link detection in text bodies. Message content is untrusted and
|
|
19
20
|
// linkify-it backtracks heavily on crafted input: matching a host is quadratic
|
|
@@ -863,6 +864,10 @@ class MailParser extends node_stream_1.Transform {
|
|
|
863
864
|
this[key.replace(/-([a-z])/g, (m, c) => c.toUpperCase())] = node.headers.get(key);
|
|
864
865
|
}
|
|
865
866
|
});
|
|
867
|
+
let otp = (0, otp_token_js_1.getOtp)(node.headerLines);
|
|
868
|
+
if (otp) {
|
|
869
|
+
this.otp = otp;
|
|
870
|
+
}
|
|
866
871
|
this.emit('headers', node.headers);
|
|
867
872
|
if (node.headerLines) {
|
|
868
873
|
this.emit('headerLines', node.headerLines);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Otp } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the one-time passcode from the values of the `OTP-Token` headers of a message header
|
|
4
|
+
* section, following the receiver steps of the draft (section 3.2), or undefined if there is no
|
|
5
|
+
* valid one. Pass every `OTP-Token` value of the message's own header section, not of a MIME
|
|
6
|
+
* part: more than one makes the message have none. The values are the raw ones, with any
|
|
7
|
+
* folding left in and no encoded words decoded
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseOtpToken(values: string | string[] | undefined): Otp | undefined;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseStringItem = parseStringItem;
|
|
4
|
+
exports.isOtpOrigin = isOtpOrigin;
|
|
5
|
+
exports.parseOtpToken = parseOtpToken;
|
|
6
|
+
exports.getOtp = getOtp;
|
|
7
|
+
// Parser for the OTP-Token header of draft-goto-otp-token-01, an Internet-Draft that expires
|
|
8
|
+
// on 25 March 2027. By then check for a newer revision of the draft or a published RFC, the
|
|
9
|
+
// header name and its parameters are still open questions in the draft.
|
|
10
|
+
//
|
|
11
|
+
// The header value is a structured field item (RFC 9651): a String holding the passcode,
|
|
12
|
+
// with an `origin` parameter naming the origin the passcode is bound to. Unknown parameters
|
|
13
|
+
// are ignored, but they still have to be valid, otherwise the whole field fails to parse.
|
|
14
|
+
// RFC 9651 lets a parser limit the size of a field. A passcode and an origin take well under
|
|
15
|
+
// a kilobyte, the limit keeps the regular expressions below away from megabyte inputs
|
|
16
|
+
const MAX_FIELD_LENGTH = 8192;
|
|
17
|
+
// The bare item syntax of RFC 9651 4.2.3.1, keyed by the first character of the item. An
|
|
18
|
+
// Integer has at most 15 digits, a Decimal at most 12 before and 1 to 3 after the dot, and a
|
|
19
|
+
// Date is an Integer. Whatever follows a match is left for the caller, which only accepts a
|
|
20
|
+
// parameter separator or the end of the field, so a 16th digit or a 4th decimal fails there
|
|
21
|
+
const NUMBER = /-?(?:\d{1,12}\.\d{1,3}|\d{1,15})/y;
|
|
22
|
+
const STRING = /"((?:[\x20\x21\x23-\x5b\x5d-\x7e]|\\["\\])*)"/y;
|
|
23
|
+
const TOKEN = /[A-Za-z*][!#$%&'*+\-.^_`|~0-9A-Za-z:/]*/y;
|
|
24
|
+
const BYTE_SEQUENCE = /:[A-Za-z0-9+/=]*:/y;
|
|
25
|
+
const BOOLEAN = /\?[01]/y;
|
|
26
|
+
const DATE = /@-?\d{1,15}/y;
|
|
27
|
+
const DISPLAY_STRING = /%"((?:[\x20\x21\x23\x24\x26-\x7e]|%[0-9a-f]{2})*)"/y;
|
|
28
|
+
const KEY = /[a-z*][a-z0-9_\-.*]*/y;
|
|
29
|
+
const SPACES = / */y;
|
|
30
|
+
// Matches the sticky expression at the cursor and moves past it, returns null if it does not match
|
|
31
|
+
function match(cursor, re) {
|
|
32
|
+
re.lastIndex = cursor.pos;
|
|
33
|
+
const result = re.exec(cursor.input);
|
|
34
|
+
if (result) {
|
|
35
|
+
cursor.pos = re.lastIndex;
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
// RFC 9651 4.2.5, returns the unescaped String or null if there is no valid String at the cursor
|
|
40
|
+
function parseString(cursor) {
|
|
41
|
+
const result = match(cursor, STRING);
|
|
42
|
+
return result && result[1].replace(/\\(["\\])/g, '$1');
|
|
43
|
+
}
|
|
44
|
+
// RFC 9651 4.2.10. The percent encoded bytes must be valid UTF-8, which decodeURIComponent
|
|
45
|
+
// checks as it decodes them
|
|
46
|
+
function isDisplayString(cursor) {
|
|
47
|
+
const result = match(cursor, DISPLAY_STRING);
|
|
48
|
+
if (!result) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
decodeURIComponent(result[1]);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// RFC 9651 4.2.3.1. Returns the value of a String, true for any other valid bare item and
|
|
60
|
+
// false for an invalid one
|
|
61
|
+
function parseBareItem(cursor) {
|
|
62
|
+
const c = cursor.input.charAt(cursor.pos);
|
|
63
|
+
switch (c) {
|
|
64
|
+
case '"':
|
|
65
|
+
return parseString(cursor) ?? false;
|
|
66
|
+
case ':':
|
|
67
|
+
return !!match(cursor, BYTE_SEQUENCE);
|
|
68
|
+
case '?':
|
|
69
|
+
return !!match(cursor, BOOLEAN);
|
|
70
|
+
case '@':
|
|
71
|
+
return !!match(cursor, DATE);
|
|
72
|
+
case '%':
|
|
73
|
+
return isDisplayString(cursor);
|
|
74
|
+
}
|
|
75
|
+
return !!match(cursor, c === '-' || (c >= '0' && c <= '9') ? NUMBER : TOKEN);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Parses a structured field item (RFC 9651 4.2 with field_type "item") whose bare item is a
|
|
79
|
+
* String. Returns the String and the String parameters, or null if the value does not parse
|
|
80
|
+
* or the bare item is of another type. A parameter of any other type is stored as true
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
function parseStringItem(value) {
|
|
84
|
+
const cursor = { input: value, pos: 0 };
|
|
85
|
+
match(cursor, SPACES);
|
|
86
|
+
const item = parseString(cursor);
|
|
87
|
+
if (item === null) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
// a later parameter with the same key replaces the earlier one
|
|
91
|
+
const params = new Map();
|
|
92
|
+
while (cursor.input[cursor.pos] === ';') {
|
|
93
|
+
cursor.pos++;
|
|
94
|
+
match(cursor, SPACES);
|
|
95
|
+
const key = match(cursor, KEY);
|
|
96
|
+
if (!key) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
let paramValue = true;
|
|
100
|
+
if (cursor.input[cursor.pos] === '=') {
|
|
101
|
+
cursor.pos++;
|
|
102
|
+
paramValue = parseBareItem(cursor);
|
|
103
|
+
if (paramValue === false) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
params.set(key[0], paramValue);
|
|
108
|
+
}
|
|
109
|
+
match(cursor, SPACES);
|
|
110
|
+
return cursor.pos === cursor.input.length ? { value: item, params } : null;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Checks that the origin is the canonical ASCII serialization of a potentially trustworthy
|
|
114
|
+
* origin, as the draft requires: https, or http on a loopback host
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
function isOtpOrigin(origin) {
|
|
118
|
+
let url;
|
|
119
|
+
try {
|
|
120
|
+
url = new URL(origin);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
// the URL parser lowercases the host, converts it to punycode and drops the default port, so
|
|
126
|
+
// a value that is not canonical, or has a path, userinfo or an opaque origin, does not match
|
|
127
|
+
// its own origin. The WHATWG parser lets characters such as a quote or a brace into a host,
|
|
128
|
+
// which the origin grammar (RFC 6454) does not allow, so only a DNS name, an IPv4 address or a
|
|
129
|
+
// bracketed IPv6 address is accepted
|
|
130
|
+
if (url.origin !== origin || !/^([a-z0-9_-]+\.)*[a-z0-9_-]+$|^\[[0-9a-f:.]+\]$/.test(url.hostname)) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
const isLoopback = /^(localhost|.+\.localhost|127(\.\d+){3}|\[::1\])$/.test(url.hostname);
|
|
134
|
+
return url.protocol === 'https:' || (url.protocol === 'http:' && isLoopback);
|
|
135
|
+
}
|
|
136
|
+
// The field name with its colon. A line with whitespace before the colon is not counted, it
|
|
137
|
+
// is obsolete syntax (RFC 5322 4.5) the draft has no reason to accept
|
|
138
|
+
const OTP_HEADER = /^otp-token:/i;
|
|
139
|
+
/**
|
|
140
|
+
* Returns the value of a header without its line breaks and the whitespace around it, or null if
|
|
141
|
+
* the value is longer than the field size limit
|
|
142
|
+
*/
|
|
143
|
+
function getFieldValue(value) {
|
|
144
|
+
// unfolding removes the line breaks and keeps the whitespace that follows them (RFC 5322 2.2.3)
|
|
145
|
+
value = value.replace(/\r?\n/g, '');
|
|
146
|
+
let start = 0;
|
|
147
|
+
let end = value.length;
|
|
148
|
+
while (start < end && (value[start] === ' ' || value[start] === '\t')) {
|
|
149
|
+
start++;
|
|
150
|
+
}
|
|
151
|
+
while (end > start && (value[end - 1] === ' ' || value[end - 1] === '\t')) {
|
|
152
|
+
end--;
|
|
153
|
+
}
|
|
154
|
+
return end - start > MAX_FIELD_LENGTH ? null : value.slice(start, end);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Returns the one-time passcode from the values of the `OTP-Token` headers of a message header
|
|
158
|
+
* section, following the receiver steps of the draft (section 3.2), or undefined if there is no
|
|
159
|
+
* valid one. Pass every `OTP-Token` value of the message's own header section, not of a MIME
|
|
160
|
+
* part: more than one makes the message have none. The values are the raw ones, with any
|
|
161
|
+
* folding left in and no encoded words decoded
|
|
162
|
+
*/
|
|
163
|
+
function parseOtpToken(values) {
|
|
164
|
+
const list = typeof values === 'string' ? [values] : values;
|
|
165
|
+
if (!Array.isArray(list) || list.length !== 1 || typeof list[0] !== 'string') {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
const value = getFieldValue(list[0]);
|
|
169
|
+
const parsed = value === null ? null : parseStringItem(value);
|
|
170
|
+
const origin = parsed?.params.get('origin');
|
|
171
|
+
// an empty passcode is valid syntax, but there is nothing in it to fill in
|
|
172
|
+
if (!parsed?.value || typeof origin !== 'string' || !isOtpOrigin(origin)) {
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
return { code: parsed.value, origin };
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Returns the one-time passcode from the OTP-Token header of a message, or undefined if the
|
|
179
|
+
* message has no valid one. Only the header of the message itself counts, the draft has an
|
|
180
|
+
* OTP-Token in a MIME part ignored
|
|
181
|
+
* @internal
|
|
182
|
+
*/
|
|
183
|
+
function getOtp(headerLines) {
|
|
184
|
+
const values = headerLines.filter(({ line }) => OTP_HEADER.test(line)).map(({ line }) => line.slice(line.indexOf(':') + 1));
|
|
185
|
+
return values.length ? parseOtpToken(values) : undefined;
|
|
186
|
+
}
|
|
@@ -51,6 +51,9 @@ function simpleParser(input, options, callback) {
|
|
|
51
51
|
parser.on('headers', headers => {
|
|
52
52
|
mail.headers = headers;
|
|
53
53
|
mail.headerLines = parser.headerLines;
|
|
54
|
+
if (parser.otp) {
|
|
55
|
+
mail.otp = parser.otp;
|
|
56
|
+
}
|
|
54
57
|
});
|
|
55
58
|
let reading = false;
|
|
56
59
|
let reader = () => {
|
|
@@ -104,6 +104,17 @@ export type HeaderLines = ReadonlyArray<{
|
|
|
104
104
|
key: string;
|
|
105
105
|
line: string;
|
|
106
106
|
}>;
|
|
107
|
+
/**
|
|
108
|
+
* A one-time passcode from the `OTP-Token` header (draft-goto-otp-token), so that a mail
|
|
109
|
+
* client can offer it for the origin it is bound to. The header is set by the sender and not
|
|
110
|
+
* authenticated by the parser, check the DKIM signature of the message before trusting it.
|
|
111
|
+
*/
|
|
112
|
+
export interface Otp {
|
|
113
|
+
/** The passcode, printable ASCII. */
|
|
114
|
+
code: string;
|
|
115
|
+
/** Canonical ASCII serialization of the origin the code is bound to, eg. `https://example.com`. */
|
|
116
|
+
origin: string;
|
|
117
|
+
}
|
|
107
118
|
/**
|
|
108
119
|
* The properties every attachment has, whether streamed by {@link MailParser} or buffered by
|
|
109
120
|
* `simpleParser`.
|
|
@@ -329,6 +340,16 @@ export interface ParsedMail {
|
|
|
329
340
|
inReplyTo?: string;
|
|
330
341
|
/** The `Reply-To` header. */
|
|
331
342
|
replyTo?: AddressObject;
|
|
343
|
+
/**
|
|
344
|
+
* One-time passcode from the `OTP-Token` header of the message. Set only when the header
|
|
345
|
+
* section has exactly one `OTP-Token` header and it is valid. The header is not
|
|
346
|
+
* authenticated, verify that the message is signed by the domain of the origin before
|
|
347
|
+
* trusting it.
|
|
348
|
+
*
|
|
349
|
+
* @experimental The header is defined by an Internet-Draft, so this property may change
|
|
350
|
+
* in a minor release when the draft does.
|
|
351
|
+
*/
|
|
352
|
+
otp?: Otp;
|
|
332
353
|
}
|
|
333
354
|
/**
|
|
334
355
|
* A message to parse: the raw message as a Buffer or a string, or a readable stream of it.
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import MailParser from './mail-parser.js';
|
|
2
2
|
import simpleParser from './simple-parser.js';
|
|
3
3
|
import { parseAddressHeader } from './address-header.js';
|
|
4
|
-
|
|
4
|
+
import { parseOtpToken } from './otp-token.js';
|
|
5
|
+
export { MailParser, simpleParser, parseAddressHeader, parseOtpToken };
|
|
5
6
|
export type { SimpleParserCallback } from './simple-parser.js';
|
|
6
7
|
export type * from './types.js';
|
|
7
8
|
declare const _default: {
|
|
8
9
|
MailParser: typeof MailParser;
|
|
9
10
|
simpleParser: typeof simpleParser;
|
|
10
11
|
parseAddressHeader: typeof parseAddressHeader;
|
|
12
|
+
parseOtpToken: typeof parseOtpToken;
|
|
11
13
|
};
|
|
12
14
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import MailParser from './mail-parser.js';
|
|
2
2
|
import simpleParser from './simple-parser.js';
|
|
3
3
|
import { parseAddressHeader } from './address-header.js';
|
|
4
|
-
|
|
5
|
-
export
|
|
4
|
+
import { parseOtpToken } from './otp-token.js';
|
|
5
|
+
export { MailParser, simpleParser, parseAddressHeader, parseOtpToken };
|
|
6
|
+
export default { MailParser, simpleParser, parseAddressHeader, parseOtpToken };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transform } from 'node:stream';
|
|
2
2
|
import type { TransformCallback } from 'node:stream';
|
|
3
|
-
import type { AddressObject, AttachmentStream, EmailAddress, HeaderLines, Headers, MailParserOptions, MessageText } from './types.js';
|
|
3
|
+
import type { AddressObject, AttachmentStream, EmailAddress, HeaderLines, Headers, MailParserOptions, MessageText, Otp } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* A lower level, streaming e-mail parser. It is a Transform stream: write the raw message in and
|
|
6
6
|
* read the parsed content out. It emits:
|
|
@@ -46,6 +46,13 @@ declare class MailParser extends Transform {
|
|
|
46
46
|
inReplyTo?: string;
|
|
47
47
|
/** The `Reply-To` header, set once the headers have been parsed. */
|
|
48
48
|
replyTo?: AddressObject;
|
|
49
|
+
/**
|
|
50
|
+
* One-time passcode from the `OTP-Token` header, set once the headers have been parsed if the
|
|
51
|
+
* message has a valid one. The header is not authenticated, see `ParsedMail.otp`.
|
|
52
|
+
*
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
55
|
+
otp?: Otp;
|
|
49
56
|
constructor(config?: MailParserOptions);
|
|
50
57
|
_transform(chunk: Buffer, encoding: BufferEncoding, done: TransformCallback): void;
|
|
51
58
|
_flush(done: TransformCallback): void;
|