@mavogel/awscdk-rootmail 0.1.34 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/.jsii +8 -8
  2. package/lib/rootmail.js +1 -1
  3. package/lib/ses-receive.js +1 -1
  4. package/node_modules/@aws-sdk/checksums/dist-cjs/submodules/sha/index.js +464 -40
  5. package/node_modules/@aws-sdk/checksums/dist-cjs/submodules/xxh/index.js +914 -0
  6. package/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/index.browser.js +2 -0
  7. package/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/index.js +3 -0
  8. package/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/sha512/Sha512.js +71 -0
  9. package/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/sha512/Sha512Js.js +276 -0
  10. package/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/sha512/Sha512WebCrypto.js +76 -0
  11. package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/U64.js +190 -0
  12. package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/Xxh3.js +274 -0
  13. package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/index.js +3 -0
  14. package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/xxhash3_128/Xxh3_128.js +179 -0
  15. package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/xxhash3_64/Xxh3_64.js +117 -0
  16. package/node_modules/@aws-sdk/checksums/dist-es/submodules/xxh/xxhash64/Xxh64.js +150 -0
  17. package/node_modules/@aws-sdk/checksums/dist-types/submodules/sha/index.browser.d.ts +2 -0
  18. package/node_modules/@aws-sdk/checksums/dist-types/submodules/sha/index.d.ts +3 -0
  19. package/node_modules/@aws-sdk/checksums/dist-types/submodules/sha/sha512/Sha512.d.ts +17 -0
  20. package/node_modules/@aws-sdk/checksums/dist-types/submodules/sha/sha512/Sha512Js.d.ts +29 -0
  21. package/node_modules/@aws-sdk/checksums/dist-types/submodules/sha/sha512/Sha512WebCrypto.d.ts +22 -0
  22. package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/U64.d.ts +110 -0
  23. package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/Xxh3.d.ts +139 -0
  24. package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/index.d.ts +3 -0
  25. package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/xxhash3_128/Xxh3_128.d.ts +37 -0
  26. package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/xxhash3_64/Xxh3_64.d.ts +27 -0
  27. package/node_modules/@aws-sdk/checksums/dist-types/submodules/xxh/xxhash64/Xxh64.d.ts +41 -0
  28. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/sha/index.browser.d.ts +2 -0
  29. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/sha/index.d.ts +3 -0
  30. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/sha/sha512/Sha512.d.ts +12 -0
  31. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/sha/sha512/Sha512Js.d.ts +22 -0
  32. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/sha/sha512/Sha512WebCrypto.d.ts +14 -0
  33. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/U64.d.ts +27 -0
  34. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/Xxh3.d.ts +65 -0
  35. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/index.d.ts +3 -0
  36. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/xxhash3_128/Xxh3_128.d.ts +12 -0
  37. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/xxhash3_64/Xxh3_64.d.ts +10 -0
  38. package/node_modules/@aws-sdk/checksums/dist-types/ts3.4/submodules/xxh/xxhash64/Xxh64.d.ts +17 -0
  39. package/node_modules/@aws-sdk/checksums/package.json +14 -4
  40. package/node_modules/@aws-sdk/checksums/xxh.d.ts +5 -0
  41. package/node_modules/@aws-sdk/checksums/xxh.js +5 -0
  42. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +51 -14
  43. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/models/enums.js +1 -0
  44. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/schemas/schemas_0.js +46 -13
  45. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DeleteAccountPolicyCommand.d.ts +22 -5
  46. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeAccountPoliciesCommand.d.ts +2 -2
  47. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeLogGroupsCommand.d.ts +1 -0
  48. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/PutAccountPolicyCommand.d.ts +18 -2
  49. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/TagLogGroupCommand.d.ts +1 -1
  50. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/TagResourceCommand.d.ts +1 -1
  51. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/TestMetricFilterCommand.d.ts +1 -2
  52. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/models/enums.d.ts +1 -0
  53. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/models/models_0.d.ts +124 -58
  54. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/models/models_1.d.ts +58 -0
  55. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/schemas/schemas_0.d.ts +3 -0
  56. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/commands/DeleteAccountPolicyCommand.d.ts +4 -3
  57. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/commands/TagLogGroupCommand.d.ts +1 -1
  58. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/commands/TagResourceCommand.d.ts +1 -1
  59. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/commands/TestMetricFilterCommand.d.ts +1 -2
  60. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/models/enums.d.ts +1 -0
  61. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/models/models_0.d.ts +21 -12
  62. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/models/models_1.d.ts +12 -0
  63. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/schemas/schemas_0.d.ts +3 -0
  64. package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +5 -5
  65. package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
  66. package/node_modules/@aws-sdk/client-route-53/package.json +5 -5
  67. package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +1 -1
  68. package/node_modules/@aws-sdk/client-s3/package.json +9 -9
  69. package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
  70. package/node_modules/@aws-sdk/client-ses/package.json +5 -5
  71. package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +1 -1
  72. package/node_modules/@aws-sdk/client-ssm/package.json +5 -5
  73. package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +1 -4
  74. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +51 -1
  75. package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js +1 -4
  76. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -0
  77. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsSmithyRpcV2JsonProtocol.js +51 -0
  78. package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.d.ts +3 -7
  79. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +1 -0
  80. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsSmithyRpcV2JsonProtocol.d.ts +25 -0
  81. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +1 -0
  82. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsSmithyRpcV2JsonProtocol.d.ts +36 -0
  83. package/node_modules/@aws-sdk/core/package.json +3 -3
  84. package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
  85. package/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
  86. package/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
  87. package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
  88. package/node_modules/@aws-sdk/credential-provider-node/package.json +8 -8
  89. package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
  90. package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
  91. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
  92. package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +4 -4
  93. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  94. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +8 -1
  95. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  96. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  97. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  98. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/enums.js +7 -0
  99. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/Signin.d.ts +1 -2
  100. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/SigninClient.d.ts +1 -2
  101. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/commands/CreateOAuth2TokenCommand.d.ts +5 -59
  102. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/commands/CreateOAuth2TokenWithIAMCommand.d.ts +5 -33
  103. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/index.d.ts +1 -2
  104. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/enums.d.ts +16 -9
  105. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/errors.d.ts +8 -39
  106. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/models_0.d.ts +36 -48
  107. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/models/enums.d.ts +7 -0
  108. package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
  109. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
  110. package/node_modules/@aws-sdk/token-providers/package.json +4 -4
  111. package/node_modules/@smithy/core/dist-cjs/index.js +4 -2
  112. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +32 -16
  113. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +36 -17
  114. package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +8 -4
  115. package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +16 -8
  116. package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +8 -4
  117. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +2 -1
  118. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +10 -5
  119. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +18 -9
  120. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +18 -9
  121. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +42 -24
  122. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +20 -10
  123. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +24 -12
  124. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +13 -4
  125. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +7 -1
  126. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +13 -4
  127. package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +6 -3
  128. package/node_modules/@smithy/core/dist-es/legacy-root-exports/util-identity-and-auth/DefaultIdentityProviderConfig.js +2 -1
  129. package/node_modules/@smithy/core/dist-es/normalizeProvider.js +2 -1
  130. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeDeserializer.js +8 -4
  131. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeSerializer.js +6 -3
  132. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeDeserializer2.js +12 -6
  133. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeSerializer2.js +4 -2
  134. package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +2 -1
  135. package/node_modules/@smithy/core/dist-es/submodules/client/middleware-stack/MiddlewareStack.js +10 -5
  136. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/create-aggregated-client.js +2 -1
  137. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/exceptions.js +4 -2
  138. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/checksum.js +2 -1
  139. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/get-value-from-text-node.js +2 -1
  140. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/object-mapping.js +4 -2
  141. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/schemaLogFilter.js +10 -4
  142. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/serde-json.js +2 -1
  143. package/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js +8 -4
  144. package/node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/booleanSelector.js +6 -3
  145. package/node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/numberSelector.js +2 -1
  146. package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointUrlConfig.js +8 -4
  147. package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/resolveEndpoint.js +2 -1
  148. package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +6 -3
  149. package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +2 -1
  150. package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/Int64.js +2 -1
  151. package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/SmithyMessageDecoderStream.js +2 -1
  152. package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde/utils.js +2 -1
  153. package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde-universal/getUnmarshalledStream.js +4 -2
  154. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +8 -4
  155. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +4 -2
  156. package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +2 -1
  157. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +7 -5
  158. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +7 -5
  159. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +7 -5
  160. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +6 -3
  161. package/node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.js +3 -0
  162. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/configurations.js +4 -2
  163. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/parseRetryAfterHeader.js +2 -1
  164. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retry-pre-sra-deprecated/StandardRetryStrategy.js +6 -3
  165. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retryMiddleware.js +6 -3
  166. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/util.js +6 -3
  167. package/node_modules/@smithy/core/dist-es/submodules/serde/index.browser.js +1 -0
  168. package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
  169. package/node_modules/@smithy/core/dist-es/submodules/serde/index.native.js +1 -0
  170. package/node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js +2 -1
  171. package/node_modules/@smithy/core/dist-es/submodules/serde/util-body-length/calculateBodyLength.browser.js +6 -3
  172. package/node_modules/@smithy/core/dist-es/submodules/transport/httpResponse.js +2 -1
  173. package/node_modules/@smithy/core/dist-es/submodules/transport/normalizeProvider.js +2 -1
  174. package/node_modules/@smithy/core/dist-es/submodules/transport/toEndpointV1.js +2 -1
  175. package/node_modules/@smithy/core/dist-types/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.d.ts +1 -0
  176. package/node_modules/@smithy/core/dist-types/submodules/serde/index.browser.d.ts +1 -0
  177. package/node_modules/@smithy/core/dist-types/submodules/serde/index.d.ts +1 -0
  178. package/node_modules/@smithy/core/dist-types/submodules/serde/index.native.d.ts +1 -0
  179. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.d.ts +1 -0
  180. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.browser.d.ts +1 -0
  181. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.d.ts +1 -0
  182. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.native.d.ts +1 -0
  183. package/node_modules/@smithy/core/package.json +1 -1
  184. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +22 -9
  185. package/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +2 -1
  186. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +14 -8
  187. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +6 -0
  188. package/node_modules/@smithy/node-http-handler/package.json +2 -2
  189. package/node_modules/@smithy/signature-v4/dist-cjs/index.js +23 -11
  190. package/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js +4 -2
  191. package/node_modules/@smithy/signature-v4/dist-es/SignatureV4Base.js +4 -2
  192. package/node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js +5 -1
  193. package/node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js +2 -1
  194. package/node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js +2 -1
  195. package/node_modules/@smithy/signature-v4/dist-es/headerUtil.js +6 -3
  196. package/node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js +2 -1
  197. package/node_modules/@smithy/signature-v4/dist-es/prepareRequest.js +2 -1
  198. package/node_modules/@smithy/signature-v4/package.json +2 -2
  199. package/node_modules/mailparser/CHANGELOG.md +26 -0
  200. package/node_modules/mailparser/README.md +21 -1
  201. package/node_modules/mailparser/dist/cjs/index.d.ts +3 -1
  202. package/node_modules/mailparser/dist/cjs/index.js +4 -2
  203. package/node_modules/mailparser/dist/cjs/mail-parser.d.ts +8 -1
  204. package/node_modules/mailparser/dist/cjs/mail-parser.js +5 -0
  205. package/node_modules/mailparser/dist/cjs/otp-token.d.ts +9 -0
  206. package/node_modules/mailparser/dist/cjs/otp-token.js +186 -0
  207. package/node_modules/mailparser/dist/cjs/simple-parser.js +3 -0
  208. package/node_modules/mailparser/dist/cjs/types.d.ts +21 -0
  209. package/node_modules/mailparser/dist/esm/index.d.ts +3 -1
  210. package/node_modules/mailparser/dist/esm/index.js +3 -2
  211. package/node_modules/mailparser/dist/esm/mail-parser.d.ts +8 -1
  212. package/node_modules/mailparser/dist/esm/mail-parser.js +5 -0
  213. package/node_modules/mailparser/dist/esm/otp-token.d.ts +9 -0
  214. package/node_modules/mailparser/dist/esm/otp-token.js +180 -0
  215. package/node_modules/mailparser/dist/esm/simple-parser.js +3 -0
  216. package/node_modules/mailparser/dist/esm/types.d.ts +21 -0
  217. package/node_modules/mailparser/package.json +3 -3
  218. package/node_modules/nodemailer/CHANGELOG.md +19 -0
  219. package/node_modules/nodemailer/dist/cjs/dkim/sign.js +1 -1
  220. package/node_modules/nodemailer/dist/cjs/errors.d.ts +2 -0
  221. package/node_modules/nodemailer/dist/cjs/errors.js +3 -1
  222. package/node_modules/nodemailer/dist/cjs/mail-composer/index.d.ts +12 -0
  223. package/node_modules/nodemailer/dist/cjs/mail-composer/index.js +53 -0
  224. package/node_modules/nodemailer/dist/cjs/mailer/index.d.ts +3 -2
  225. package/node_modules/nodemailer/dist/cjs/mime-node/index.js +10 -2
  226. package/node_modules/nodemailer/dist/cjs/nodemailer.d.ts +1 -1
  227. package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
  228. package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
  229. package/node_modules/nodemailer/dist/cjs/well-known/services.js +7 -0
  230. package/node_modules/nodemailer/dist/esm/dkim/sign.js +1 -1
  231. package/node_modules/nodemailer/dist/esm/errors.d.ts +2 -0
  232. package/node_modules/nodemailer/dist/esm/errors.js +2 -0
  233. package/node_modules/nodemailer/dist/esm/mail-composer/index.d.ts +12 -0
  234. package/node_modules/nodemailer/dist/esm/mail-composer/index.js +53 -0
  235. package/node_modules/nodemailer/dist/esm/mailer/index.d.ts +3 -2
  236. package/node_modules/nodemailer/dist/esm/mime-node/index.js +10 -2
  237. package/node_modules/nodemailer/dist/esm/nodemailer.d.ts +1 -1
  238. package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
  239. package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
  240. package/node_modules/nodemailer/dist/esm/well-known/services.js +7 -0
  241. package/node_modules/nodemailer/dist/well-known/services.json +8 -0
  242. package/node_modules/nodemailer/package.json +5 -5
  243. package/package.json +7 -7
  244. /package/node_modules/@smithy/core/dist-es/submodules/{protocols → serde}/writeKey.js +0 -0
  245. /package/node_modules/@smithy/core/dist-types/submodules/{protocols → serde}/writeKey.d.ts +0 -0
  246. /package/node_modules/@smithy/core/dist-types/ts3.4/submodules/{protocols → serde}/writeKey.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- const { hasOwn, fromUtf8, fromHex, toHex, toUint8Array, isArrayBuffer } = require("@smithy/core/serde");
1
+ const { hasOwn, fromUtf8, fromHex, toHex, toUint8Array, writeKey, isArrayBuffer } = require("@smithy/core/serde");
2
2
  const { normalizeProvider } = require("@smithy/core/client");
3
3
  const { escapeUri, HttpRequest } = require("@smithy/core/protocols");
4
4
 
@@ -6,8 +6,9 @@ class HeaderFormatter {
6
6
  format(headers) {
7
7
  const chunks = [];
8
8
  for (const headerName in headers) {
9
- if (!hasOwn(headers, headerName))
9
+ if (!hasOwn(headers, headerName)) {
10
10
  continue;
11
+ }
11
12
  const bytes = fromUtf8(headerName);
12
13
  chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
13
14
  }
@@ -124,8 +125,9 @@ function negate(bytes) {
124
125
  }
125
126
  for (let i = 7; i > -1; i--) {
126
127
  bytes[i]++;
127
- if (bytes[i] !== 0)
128
+ if (bytes[i] !== 0) {
128
129
  break;
130
+ }
129
131
  }
130
132
  }
131
133
 
@@ -177,8 +179,9 @@ const getCanonicalQuery = ({ query = {} }) => {
177
179
  const keys = [];
178
180
  const serialized = {};
179
181
  for (const key in query) {
180
- if (!hasOwn(query, key))
182
+ if (!hasOwn(query, key)) {
181
183
  continue;
184
+ }
182
185
  if (key.toLowerCase() === SIGNATURE_HEADER) {
183
186
  continue;
184
187
  }
@@ -257,10 +260,12 @@ ${toHex(hashedRequest)}`;
257
260
  if (this.uriEscapePath) {
258
261
  const normalizedPathSegments = [];
259
262
  for (const pathSegment of path.split("/")) {
260
- if (pathSegment?.length === 0)
263
+ if (pathSegment?.length === 0) {
261
264
  continue;
262
- if (pathSegment === ".")
265
+ }
266
+ if (pathSegment === ".") {
263
267
  continue;
268
+ }
264
269
  if (pathSegment === "..") {
265
270
  normalizedPathSegments.pop();
266
271
  }
@@ -331,7 +336,7 @@ const getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) =>
331
336
  continue;
332
337
  }
333
338
  const canonicalHeaderName = headerName.toLowerCase();
334
- if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS ||
339
+ if (hasOwn(ALWAYS_UNSIGNABLE_HEADERS, canonicalHeaderName) ||
335
340
  unsignableHeaders?.has(canonicalHeaderName) ||
336
341
  PROXY_HEADER_PATTERN.test(canonicalHeaderName) ||
337
342
  SEC_HEADER_PATTERN.test(canonicalHeaderName)) {
@@ -339,6 +344,9 @@ const getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) =>
339
344
  continue;
340
345
  }
341
346
  }
347
+ if (canonicalHeaderName === "__proto__") {
348
+ writeKey(canonical);
349
+ }
342
350
  canonical[canonicalHeaderName] = headers[headerName]
343
351
  .replace(/[\r\n]/g, " ")
344
352
  .replace(/[ \t]+/g, " ")
@@ -349,8 +357,9 @@ const getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) =>
349
357
 
350
358
  const getPayloadHash = async ({ headers, body }, hashConstructor) => {
351
359
  for (const headerName in headers) {
352
- if (!hasOwn(headers, headerName))
360
+ if (!hasOwn(headers, headerName)) {
353
361
  continue;
362
+ }
354
363
  if (headerName.toLowerCase() === SHA256_HEADER) {
355
364
  return headers[headerName];
356
365
  }
@@ -369,8 +378,9 @@ const getPayloadHash = async ({ headers, body }, hashConstructor) => {
369
378
  const hasHeader = (soughtHeader, headers) => {
370
379
  soughtHeader = soughtHeader.toLowerCase();
371
380
  for (const headerName in headers) {
372
- if (!hasOwn(headers, headerName))
381
+ if (!hasOwn(headers, headerName)) {
373
382
  continue;
383
+ }
374
384
  if (soughtHeader === headerName.toLowerCase()) {
375
385
  return true;
376
386
  }
@@ -381,8 +391,9 @@ const hasHeader = (soughtHeader, headers) => {
381
391
  const moveHeadersToQuery = (request, options = {}) => {
382
392
  const { headers, query = {} } = HttpRequest.clone(request);
383
393
  for (const name in headers) {
384
- if (!hasOwn(headers, name))
394
+ if (!hasOwn(headers, name)) {
385
395
  continue;
396
+ }
386
397
  const lname = name.toLowerCase();
387
398
  if ((lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname)) ||
388
399
  options.hoistableHeaders?.has(lname)) {
@@ -400,8 +411,9 @@ const moveHeadersToQuery = (request, options = {}) => {
400
411
  const prepareRequest = (request) => {
401
412
  request = HttpRequest.clone(request);
402
413
  for (const headerName in request.headers) {
403
- if (!hasOwn(request.headers, headerName))
414
+ if (!hasOwn(request.headers, headerName)) {
404
415
  continue;
416
+ }
405
417
  if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {
406
418
  delete request.headers[headerName];
407
419
  }
@@ -4,8 +4,9 @@ export class HeaderFormatter {
4
4
  format(headers) {
5
5
  const chunks = [];
6
6
  for (const headerName in headers) {
7
- if (!hasOwn(headers, headerName))
7
+ if (!hasOwn(headers, headerName)) {
8
8
  continue;
9
+ }
9
10
  const bytes = fromUtf8(headerName);
10
11
  chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
11
12
  }
@@ -122,7 +123,8 @@ function negate(bytes) {
122
123
  }
123
124
  for (let i = 7; i > -1; i--) {
124
125
  bytes[i]++;
125
- if (bytes[i] !== 0)
126
+ if (bytes[i] !== 0) {
126
127
  break;
128
+ }
127
129
  }
128
130
  }
@@ -41,10 +41,12 @@ ${toHex(hashedRequest)}`;
41
41
  if (this.uriEscapePath) {
42
42
  const normalizedPathSegments = [];
43
43
  for (const pathSegment of path.split("/")) {
44
- if (pathSegment?.length === 0)
44
+ if (pathSegment?.length === 0) {
45
45
  continue;
46
- if (pathSegment === ".")
46
+ }
47
+ if (pathSegment === ".") {
47
48
  continue;
49
+ }
48
50
  if (pathSegment === "..") {
49
51
  normalizedPathSegments.pop();
50
52
  }
@@ -1,3 +1,4 @@
1
+ import { hasOwn, writeKey } from "@smithy/core/serde";
1
2
  import { ALWAYS_UNSIGNABLE_HEADERS, PROXY_HEADER_PATTERN, SEC_HEADER_PATTERN } from "./constants";
2
3
  export const getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) => {
3
4
  const canonical = {};
@@ -6,7 +7,7 @@ export const getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHead
6
7
  continue;
7
8
  }
8
9
  const canonicalHeaderName = headerName.toLowerCase();
9
- if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS ||
10
+ if (hasOwn(ALWAYS_UNSIGNABLE_HEADERS, canonicalHeaderName) ||
10
11
  unsignableHeaders?.has(canonicalHeaderName) ||
11
12
  PROXY_HEADER_PATTERN.test(canonicalHeaderName) ||
12
13
  SEC_HEADER_PATTERN.test(canonicalHeaderName)) {
@@ -14,6 +15,9 @@ export const getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHead
14
15
  continue;
15
16
  }
16
17
  }
18
+ if (canonicalHeaderName === "__proto__") {
19
+ writeKey(canonical);
20
+ }
17
21
  canonical[canonicalHeaderName] = headers[headerName]
18
22
  .replace(/[\r\n]/g, " ")
19
23
  .replace(/[ \t]+/g, " ")
@@ -5,8 +5,9 @@ export const getCanonicalQuery = ({ query = {} }) => {
5
5
  const keys = [];
6
6
  const serialized = {};
7
7
  for (const key in query) {
8
- if (!hasOwn(query, key))
8
+ if (!hasOwn(query, key)) {
9
9
  continue;
10
+ }
10
11
  if (key.toLowerCase() === SIGNATURE_HEADER) {
11
12
  continue;
12
13
  }
@@ -3,8 +3,9 @@ import { isArrayBuffer, toHex, toUint8Array } from "@smithy/core/serde";
3
3
  import { SHA256_HEADER, UNSIGNED_PAYLOAD } from "./constants";
4
4
  export const getPayloadHash = async ({ headers, body }, hashConstructor) => {
5
5
  for (const headerName in headers) {
6
- if (!hasOwn(headers, headerName))
6
+ if (!hasOwn(headers, headerName)) {
7
7
  continue;
8
+ }
8
9
  if (headerName.toLowerCase() === SHA256_HEADER) {
9
10
  return headers[headerName];
10
11
  }
@@ -2,8 +2,9 @@ import { hasOwn } from "@smithy/core/serde";
2
2
  export const hasHeader = (soughtHeader, headers) => {
3
3
  soughtHeader = soughtHeader.toLowerCase();
4
4
  for (const headerName in headers) {
5
- if (!hasOwn(headers, headerName))
5
+ if (!hasOwn(headers, headerName)) {
6
6
  continue;
7
+ }
7
8
  if (soughtHeader === headerName.toLowerCase()) {
8
9
  return true;
9
10
  }
@@ -13,8 +14,9 @@ export const hasHeader = (soughtHeader, headers) => {
13
14
  export const getHeaderValue = (soughtHeader, headers) => {
14
15
  soughtHeader = soughtHeader.toLowerCase();
15
16
  for (const headerName in headers) {
16
- if (!hasOwn(headers, headerName))
17
+ if (!hasOwn(headers, headerName)) {
17
18
  continue;
19
+ }
18
20
  if (soughtHeader === headerName.toLowerCase()) {
19
21
  return headers[headerName];
20
22
  }
@@ -24,8 +26,9 @@ export const getHeaderValue = (soughtHeader, headers) => {
24
26
  export const deleteHeader = (soughtHeader, headers) => {
25
27
  soughtHeader = soughtHeader.toLowerCase();
26
28
  for (const headerName in headers) {
27
- if (!hasOwn(headers, headerName))
29
+ if (!hasOwn(headers, headerName)) {
28
30
  continue;
31
+ }
29
32
  if (soughtHeader === headerName.toLowerCase()) {
30
33
  delete headers[headerName];
31
34
  }
@@ -3,8 +3,9 @@ import { HttpRequest } from "@smithy/core/protocols";
3
3
  export const moveHeadersToQuery = (request, options = {}) => {
4
4
  const { headers, query = {} } = HttpRequest.clone(request);
5
5
  for (const name in headers) {
6
- if (!hasOwn(headers, name))
6
+ if (!hasOwn(headers, name)) {
7
7
  continue;
8
+ }
8
9
  const lname = name.toLowerCase();
9
10
  if ((lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname)) ||
10
11
  options.hoistableHeaders?.has(lname)) {
@@ -4,8 +4,9 @@ import { GENERATED_HEADERS } from "./constants";
4
4
  export const prepareRequest = (request) => {
5
5
  request = HttpRequest.clone(request);
6
6
  for (const headerName in request.headers) {
7
- if (!hasOwn(request.headers, headerName))
7
+ if (!hasOwn(request.headers, headerName)) {
8
8
  continue;
9
+ }
9
10
  if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {
10
11
  delete request.headers[headerName];
11
12
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/signature-v4",
3
- "version": "5.7.4",
3
+ "version": "5.7.5",
4
4
  "description": "A standalone implementation of the AWS Signature V4 request signing algorithm",
5
5
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/signature-v4",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "test:watch": "yarn g:vitest watch"
39
39
  },
40
40
  "dependencies": {
41
- "@smithy/core": "^3.35.0",
41
+ "@smithy/core": "^3.38.0",
42
42
  "@smithy/types": "^4.19.0",
43
43
  "tslib": "^2.6.2"
44
44
  },
@@ -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
- export { MailParser, simpleParser, parseAddressHeader };
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
- exports.default = { MailParser: mail_parser_js_1.default, simpleParser: simple_parser_js_1.default, parseAddressHeader: address_header_js_1.parseAddressHeader };
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 = () => {