arcane-os 0.20.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.21.0
4
+
5
+ - Serve mail over HTTPS with HTTP/2 through the published `node-http-server`
6
+ PEM API, with HTTP/1.1 fallback on the same selected port, default 8025.
7
+ Preserve the friendly occupied-port failure and owned listener lifecycle.
8
+ - Read `MAIL_TLS_CERT_PATH` and `MAIL_TLS_KEY_PATH` with the provider profile
9
+ from `.env.json` in one startup read. Resolve relative PEM paths from that
10
+ file's directory and report missing TLS settings before binding. Keep file
11
+ and TLS handling portable across Windows, Linux and macOS.
12
+ - Use native HTTP/2 headers and authority for the mail and CORS contracts,
13
+ preserving exact report content, subscription verification, provider
14
+ outcomes, existing credential injection and cancellation.
15
+ - Extend the mail reference and purpose-gate report with TLS ownership and
16
+ configuration; add focused protocol and configuration test source.
17
+
3
18
  ## 0.20.0
4
19
 
5
20
  - Restore repository-shaped application packages: selected app files remain
package/README.md CHANGED
@@ -19,12 +19,13 @@ version-locked SDK runtime, while an integrated Arcane checkout uses its live
19
19
  `arcane/` runtime. Both profiles preserve the same app URLs, theme, packaging,
20
20
  event, cancellation, and browser run contracts.
21
21
 
22
- This checkout defines the `0.20.0` SDK contract. Applications pin one exact npm
22
+ This checkout defines the `0.21.0` SDK contract. Applications pin one exact npm
23
23
  version and lockfile; registry state is deliberately not baked into application
24
24
  artifacts.
25
25
 
26
- The [mail gateway](docs/reference/mail.md) serves the configured host and defaults
27
- browser mail to `/v1/mail` on the current domain. Multiple applications can share
26
+ The [mail gateway](docs/reference/mail.md) serves HTTPS with HTTP/2 on port 8025,
27
+ using certificate paths from `.env.json`, and defaults browser mail to
28
+ `/v1/mail` on the current domain. Multiple applications can share
28
29
  one server with explicit allowed origins. Subscription verification is disabled
29
30
  until a `verifySubscription` callback is configured; that callback receives the
30
31
  application name and bearer subscription key before each provider attempt.
@@ -48,7 +48,7 @@ meaning and cardinality rules:
48
48
  | `--workspace` | directory | Commands that select an external or integrated workspace; defaults to `.`. |
49
49
  | `--app` | app id or label | Workspace/app operations except shared scope and `verify-bundle`; optional diagnostic label for `mail serve`. |
50
50
  | `--arcane-root` | directory | `doctor`, native `build`/`run`, `native-doctor`, `native-prepare` |
51
- | `--host` / `--port` | host / integer 0–65535 | Browser `dev`/`run` default to HTTPS at `127.0.0.1:8000`; `mail serve` defaults to HTTP at `0.0.0.0:8025` and accepts an explicit bind host. |
51
+ | `--host` / `--port` | host / integer 0–65535 | Browser `dev`/`run` default to HTTPS at `127.0.0.1:8000`; `mail serve` defaults to HTTPS with HTTP/2 at `0.0.0.0:8025` and accepts an explicit bind host. |
52
52
  | `--http-port` | integer 0–65535 | Browser `dev`/`run` HTTP redirect listener; defaults to `0`, which selects an available port. |
53
53
  | `--public` | flag | `dev`; binds to `0.0.0.0` unless `--host` explicitly selects another address. |
54
54
  | `--http` | flag | `dev` only; serves source and PWA routes on one HTTP listener selected by `--port`, without TLS. |
@@ -906,7 +906,7 @@ loss after the attempt begins is ambiguous because Resend may have accepted it.
906
906
 
907
907
  ### Mail gateway
908
908
 
909
- `mail serve` starts one owned Node HTTP gateway:
909
+ `mail serve` starts one owned HTTPS gateway with HTTP/2:
910
910
 
911
911
  ```text
912
912
  arcane mail serve [--profile <profile>] [--from <verified-sender>] [--app <label>] [--origin <exact-origin>] [--allow-to <addresses>] [--host 0.0.0.0] [--port 8025] [--request-timeout <ms>]
@@ -914,6 +914,30 @@ arcane mail serve [--profile <profile>] [--from <verified-sender>] [--app <label
914
914
 
915
915
  The selected `.env.json` profile supplies only the server-side Resend API key;
916
916
  omitting `--profile` selects `mail`.
917
+
918
+ Add the listener's certificate configuration at the top level of the same file:
919
+
920
+ ```json
921
+ {
922
+ "RESEND_API_KEY": "",
923
+ "MAIL_TLS_CERT_PATH": ".arcane/mail/fullchain.pem",
924
+ "MAIL_TLS_KEY_PATH": ".arcane/mail/private-key.pem"
925
+ }
926
+ ```
927
+
928
+ Supply an existing PEM certificate chain and its private key. Paths resolve
929
+ relative to `.env.json`, or may be absolute. They are shared across provider
930
+ profiles. Missing TLS settings name the fields to fill in before a listener
931
+ opens; the TLS owner reports PEM file errors. Keep private-key material outside
932
+ tracked source. The SDK repository already ignores `.arcane/` and `.env.json`.
933
+
934
+ The selected `node-http-server` module negotiates HTTP/2 with HTTP/1.1 fallback
935
+ on the same HTTPS port, default `8025`, with no plain-HTTP listener. Callers use
936
+ a hostname covered by the certificate, such as
937
+ `https://mail.example.com:8025/v1/mail`; `0.0.0.0` identifies the bind address.
938
+ Restart the gateway after replacing renewed certificate files. Certificate
939
+ issuance and renewal remain with the deployment's certificate owner.
940
+
917
941
  The CLI does not read a browser app key. Its optional `--app` value labels the
918
942
  server; the incoming request's `X-Mail-App` identifies the application for
919
943
  subscription verification. The HTTP authentication contract pairs that
@@ -273,11 +273,13 @@ committed acceptance result.
273
273
  ## Operate the CLI and gateway
274
274
 
275
275
  Create `.env.json` in the directory from which the mail command runs, then fill
276
- in the provider key:
276
+ in the provider key and the HTTPS certificate paths:
277
277
 
278
278
  ```json
279
279
  {
280
- "RESEND_API_KEY": ""
280
+ "RESEND_API_KEY": "",
281
+ "MAIL_TLS_CERT_PATH": "",
282
+ "MAIL_TLS_KEY_PATH": ""
281
283
  }
282
284
  ```
283
285
 
@@ -370,6 +372,34 @@ address and port. The server can serve callers from multiple domains on the
370
372
  same machine. Route the page's `/v1/mail` to this listener, or configure an
371
373
  explicit shared endpoint in the caller.
372
374
 
375
+ `mail serve` uses HTTPS with HTTP/2 on that selected port. The published
376
+ `node-http-server` PEM API owns TLS and negotiates HTTP/2 or HTTP/1.1 on the
377
+ same listener. It creates no additional plain-HTTP listener. The returned URL
378
+ uses `https://`; `0.0.0.0` is the bind address, so callers use the deployed
379
+ domain, for example `https://mail.example.com:8025/v1/mail`.
380
+
381
+ Set `MAIL_TLS_CERT_PATH` to the PEM certificate chain and `MAIL_TLS_KEY_PATH`
382
+ to its PEM private-key file. These top-level settings belong to the listener
383
+ and apply regardless of the selected provider profile. Relative paths resolve
384
+ from the directory containing `.env.json`; absolute paths are also accepted.
385
+ The certificate must cover the hostname callers use. One certificate may
386
+ cover multiple names; the gateway does not require one certificate per calling
387
+ application. Keep private-key files outside tracked source, such as in the
388
+ already-ignored `.arcane/` directory or an existing host certificate directory.
389
+
390
+ Startup reads the JSON configuration once, reports missing TLS settings before
391
+ binding, and lets the TLS owner report unreadable or unusable PEM files. It
392
+ does not generate certificates, modify system trust, or add a renewal watcher.
393
+ Restart the gateway after the configured certificate files are renewed.
394
+ The same Node file and TLS APIs are used on Windows, Linux, and macOS; Android
395
+ requires a compatible Node host and accessible configuration and certificate
396
+ paths. These platform contracts are separate from actual platform execution.
397
+
398
+ The public `createToolchain().mail({action: 'serve', ...options})` operation
399
+ uses the same JSON certificate pair. Internally, `startResendMailServer` accepts
400
+ `certPath` and `keyPath` and retains its existing HTTP behavior when neither
401
+ is supplied. That internal function is not an npm package export.
402
+
373
403
  If the selected port is occupied, startup reports
374
404
  `Mail port <port> is already taken, possibly by another mail server.`
375
405
  The CLI exits with status 1. Programmatic callers receive the same message,
@@ -383,7 +413,8 @@ preserve each report's sender or its provider template's default.
383
413
  `--origin` selects an exact allowed caller origin; the
384
414
  programmatic `origin` option also accepts an array for multiple origins. With
385
415
  no origins configured, the gateway accepts an Origin matching its request
386
- Host using HTTP or HTTPS. Requests without Origin continue normally.
416
+ authority (`:authority` for HTTP/2, `Host` for HTTP/1.1) using HTTP or HTTPS.
417
+ Requests without Origin continue normally.
387
418
  Cross-origin preflight permits `Content-Type`, `Idempotency-Key`, `X-Mail-App`,
388
419
  and `Authorization`. This is origin configuration, not a loopback policy.
389
420
 
@@ -423,7 +454,7 @@ POST request before any provider attempt; results are not cached.
423
454
 
424
455
  | Configured-verifier outcome | Gateway response |
425
456
  | --- | --- |
426
- | Missing, empty, or repeated `X-Mail-App` | `400 mail_invalid_headers` |
457
+ | Missing or empty `X-Mail-App` | `400 mail_invalid_headers` |
427
458
  | Missing or malformed Bearer credential | `401 mail_subscription_required` |
428
459
  | Callback returns anything except `true` | `401 mail_subscription_invalid` |
429
460
  | Callback throws | `503 mail_subscription_verification_failed`, retryable with the configured `retryableDelayMs` |
@@ -435,6 +466,11 @@ result. The SDK supplies no default verification URL or built-in Stripe
435
466
  endpoint adapter. Connecting the actual subscription endpoint is a separate
436
467
  hosting integration.
437
468
 
469
+ The gateway uses Node's native header representations. HTTP/1.1 uses
470
+ `headersDistinct`, retaining its repeated-field detection. HTTP/2 uses the
471
+ compatibility request's `headers` object; Node owns duplicate joining or
472
+ discarding for each field. The SDK does not split a native header value again.
473
+
438
474
  CLI startup output says `Subscription verification: disabled` or
439
475
  `Subscription verification: configured`. Structured `server.ready` output
440
476
  includes the corresponding `callerAuthentication` value.
@@ -391,3 +391,35 @@ review does not claim execution on those platforms or an actual provider send.
391
391
  The updated test source covers disposable JSON storage, exact named selection,
392
392
  preservation of other settings, missing settings, credential-free error output,
393
393
  cancellation before writes, and CLI defaults. Local tests and checks were not run.
394
+
395
+ ## HTTPS and HTTP/2 follow-up
396
+
397
+ The user explicitly selected HTTPS with HTTP/2. The mail listener remains on
398
+ its dedicated configured port, default 8025, with the published
399
+ `node-http-server` module owning TLS, protocol negotiation and listener/session
400
+ shutdown. This increment preserves the provider attempt, report content,
401
+ subscription callback, sender selection, recipient configuration and cancellation.
402
+
403
+ | Method or action | Gates | Decision, callers, and concrete purpose |
404
+ | --- | --- | --- |
405
+ | `readMailServerSettings` | Y/Y/N | Read the same `.env.json` once for server startup, select the existing provider profile and resolve the two shared PEM path settings relative to that file. This avoids a second configuration read and platform-specific credential or certificate processes. |
406
+ | `readMailProviderKey` and `serveMailGateway` | Y/Y/N | Preserve the existing credential-injection interface and missing-provider error while consuming the already-read startup key. Require the selected TLS pair before binding; forward only the paths to the listener. Direct provider sending and key CRUD remain unchanged. |
407
+ | `MAIL_TLS_CERT_PATH` and `MAIL_TLS_KEY_PATH` | Y/Y/N | Clear top-level names identify certificate and private-key file paths for one listener, independently of any provider profile or calling application. Missing settings and unusable JSON values name the field without printing its content. |
408
+ | `startResendMailServer` TLS options | Y/Y/N | Add `certPath` and `keyPath` through the module's published PEM API. HTTPS-only mode creates one listener with HTTP/2 and HTTP/1.1 negotiation on the selected port. This internal source integration retains its existing HTTP behavior when neither path is supplied; it is not an npm package export. The public toolchain mail operation requires the JSON pair. |
409
+ | `listenForMailRequests` and returned URL | Y/Y/N | Observe the actual secure listener for bind errors and advertise HTTPS when selected. Preserve the friendly occupied-port failure, native cause, cancellation and owned shutdown. |
410
+ | Native mail header access and current-domain comparison | Y/Y/Y | Remove the HTTP/1-only assumption that every request has `headersDistinct` and `Host`. HTTP/2 supplies native `headers` and `authority`; consume those directly without rebuilding or splitting headers. Node owns its HTTP/2 duplicate-field behavior. |
411
+ | Certificate generation, platform trust changes, renewal watchers, duplicate PEM reads and a development-server import | N/N/Y | Add none. The operator supplies an existing certificate pair; the HTTP server module owns PEM loading. The development resolver has development-specific defaults and errors, so importing or extracting it adds no useful shared behavior for these two path resolutions. |
412
+
413
+ Ordinary startup performs one JSON read, two path resolutions and one listener
414
+ launch. Certificate file reads occur once at the module's transport owner.
415
+ There are no new per-request file reads, provider requests, polling loops or
416
+ certificate processes. These are source observations, not measured speedups.
417
+ The JSON and Node TLS paths are portable across Windows, Linux and macOS;
418
+ Android needs a compatible Node host and readable configuration/certificate files.
419
+
420
+ Focused test source covers TLS option selection, the secure listener's occupied
421
+ port, HTTP/2 header/authority handling, provider and subscription forwarding,
422
+ JSON paths and missing TLS settings. Synthetic TLS selection is not evidence of
423
+ an encrypted handshake. No local tests, checks, server launch, real TLS
424
+ negotiation or provider send were performed for this follow-up review. Selected
425
+ package and publication results belong to the delivery record.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arcane-os",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Arcane OS JavaScript SDK, project-local CLI, browser runtime, and repository-portable application packager.",
5
5
  "type": "module",
6
6
  "main": "./src/index.mjs",
package/src/cli/main.mjs CHANGED
@@ -86,6 +86,7 @@ Usage:
86
86
  ${CLI_NAME} mail key delete [profile]
87
87
  ${CLI_NAME} mail send [--profile <profile>] [--from <address>] --report-key <id> --report-stdin [--request-timeout <ms>]
88
88
  ${CLI_NAME} mail serve [--profile <profile>] [--from <address>] [--app <label>] [--origin <origin>] [--allow-to <addresses>] [--host 0.0.0.0] [--port 8025] [--request-timeout <ms>]
89
+ HTTPS/HTTP2; .env.json supplies RESEND_API_KEY, MAIL_TLS_CERT_PATH, and MAIL_TLS_KEY_PATH.
89
90
 
90
91
  Development:
91
92
  --public Bind dev to all IPv4 interfaces (0.0.0.0) and print network URLs.
@@ -111,6 +111,32 @@ export async function readMailCredential(options={}){
111
111
  return configuredMailKey(settings,location);
112
112
  }
113
113
 
114
+ export async function readMailServerSettings(options = {}) {
115
+ const location = mailCredentialLocation(options);
116
+ const settings = await readMailSettings(location.filePath, options.signal);
117
+ const serverSettings = (options.readCredential ?? null) === null
118
+ ? {apiKey: configuredMailKey(settings, location)}
119
+ : {};
120
+ const tlsSettings = {
121
+ MAIL_TLS_CERT_PATH: 'certPath',
122
+ MAIL_TLS_KEY_PATH: 'keyPath'
123
+ };
124
+ for (const [setting, option] of Object.entries(tlsSettings)) {
125
+ const value = settings[setting];
126
+ if (value === undefined || value === null || value === '') {
127
+ continue;
128
+ }
129
+ if (!is.string(value)) {
130
+ throw new ArcaneError(
131
+ ERROR_CODES.usage,
132
+ `${setting} in ${location.filePath} must be a PEM file path string.`
133
+ );
134
+ }
135
+ serverSettings[option] = path.resolve(path.dirname(location.filePath), value);
136
+ }
137
+ return serverSettings;
138
+ }
139
+
114
140
  export async function getMailCredentialStatus(options={}){
115
141
  const location=mailCredentialLocation(options);
116
142
  const settings=await readMailSettings(location.filePath,options.signal);
@@ -134,20 +134,33 @@ function createRequestId(factory){
134
134
  return randomUUID();
135
135
  }
136
136
 
137
- function requireRequestHeader(request,headerName){
138
- const headerValues=request.headersDistinct[headerName]??[];
139
- if(headerValues.length!==1||!headerValues[0]){
140
- throw new MailGatewayFault('mail_invalid_headers',{statusCode:400});
137
+ function readRequestHeader(request, headerName) {
138
+ const distinctHeaders = request.headersDistinct;
139
+ if (distinctHeaders) {
140
+ const headerValues = distinctHeaders[headerName] ?? [];
141
+ return headerValues.length === 1 ? headerValues[0] : undefined;
142
+ }
143
+ // HTTP/2 owns header normalization and does not expose headersDistinct.
144
+ return request.headers[headerName];
145
+ }
146
+
147
+ function requireRequestHeader(request, headerName) {
148
+ const headerValue = readRequestHeader(request, headerName);
149
+ if (!headerValue) {
150
+ throw new MailGatewayFault(
151
+ 'mail_invalid_headers',
152
+ {statusCode: 400}
153
+ );
141
154
  }
142
- return headerValues[0];
155
+ return headerValue;
143
156
  }
144
157
 
145
158
  async function verifyMailSubscription(request,configuration,signal){
146
159
  const appName=requireRequestHeader(request,'x-mail-app');
147
- const authorizationHeaders=request.headersDistinct.authorization??[];
148
- const subscriptionKey=authorizationHeaders.length===1
149
- ?/^Bearer (.+)$/iu.exec(authorizationHeaders[0])?.[1]
150
- :undefined;
160
+ const authorization = readRequestHeader(request, 'authorization');
161
+ const subscriptionKey = authorization
162
+ ? /^Bearer (.+)$/iu.exec(authorization)?.[1]
163
+ : undefined;
151
164
  if(!subscriptionKey){
152
165
  throw new MailGatewayFault('mail_subscription_required',{statusCode:401});
153
166
  }
@@ -869,10 +882,11 @@ function createConfiguredMailHandler(configuration){
869
882
  }
870
883
  const requestOrigin=request.headers.origin;
871
884
  if(requestOrigin){
885
+ const requestAuthority = request.authority || request.headers.host;
872
886
  const originAllowed=configuration.allowedOrigins.size>0
873
887
  ?configuration.allowedOrigins.has(requestOrigin)
874
- :requestOrigin===`https://${request.headers.host}`
875
- ||requestOrigin===`http://${request.headers.host}`;
888
+ :requestOrigin===`https://${requestAuthority}`
889
+ ||requestOrigin===`http://${requestAuthority}`;
876
890
  if(!originAllowed){
877
891
  throw new MailGatewayFault('mail_origin_not_allowed',{statusCode:403});
878
892
  }
@@ -1008,7 +1022,8 @@ function listenForMailRequests(mailServer){
1008
1022
  server.removeListener('error',onError);
1009
1023
  resolve(server);
1010
1024
  });
1011
- mailServer.server.once('error',onError);
1025
+ const listener = mailServer.secureServer ?? mailServer.server;
1026
+ listener.once('error', onError);
1012
1027
  });
1013
1028
  }
1014
1029
 
@@ -1017,11 +1032,24 @@ export async function startResendMailServer(options={}){
1017
1032
  if(configuration.signal?.aborted){
1018
1033
  throw configuration.signal.reason??new Error('Mail server start was cancelled.');
1019
1034
  }
1020
- const mailServer=new Server({
1021
- host:configuration.host,
1022
- port:configuration.port,
1023
- server:{timeout:0}
1024
- });
1035
+ if ((options.certPath === undefined) !== (options.keyPath === undefined)) {
1036
+ throw configurationError('Mail HTTPS requires both certPath and keyPath when either is supplied.');
1037
+ }
1038
+ const httpsSelected = options.certPath !== undefined;
1039
+ const mailServer = new Server(
1040
+ {
1041
+ host: configuration.host,
1042
+ port: configuration.port,
1043
+ server: {timeout: 0},
1044
+ https: httpsSelected ? {
1045
+ certificate: options.certPath,
1046
+ privateKey: options.keyPath,
1047
+ port: configuration.port,
1048
+ only: true,
1049
+ http2: true
1050
+ } : {}
1051
+ }
1052
+ );
1025
1053
  const requestHandler=createConfiguredMailHandler(configuration);
1026
1054
  mailServer.onRawRequest=function routeRawMailRequest(request,response){
1027
1055
  requestHandler.handle(request,response);
@@ -1050,7 +1078,7 @@ export async function startResendMailServer(options={}){
1050
1078
  throw configurationError('Mail server has no TCP listener address.');
1051
1079
  }
1052
1080
  const displayHost=address.address.includes(':')?`[${address.address}]`:address.address;
1053
- const origin=`http://${displayHost}:${String(address.port)}`;
1081
+ const origin = `${httpsSelected ? 'https' : 'http'}://${displayHost}:${String(address.port)}`;
1054
1082
  let closePromise=null;
1055
1083
  let resolveLifecycle;
1056
1084
  let rejectLifecycle;
package/src/mail.mjs CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  getMailCredentialStatus,
6
6
  mailCredentialLocation,
7
7
  readMailCredential,
8
+ readMailServerSettings,
8
9
  setMailCredential
9
10
  } from './mail-credentials.mjs';
10
11
  import {sendResendMail,startResendMailServer} from './mail-server.mjs';
@@ -125,10 +126,11 @@ async function sendMailFromReport(options){
125
126
  }
126
127
  }
127
128
 
128
- async function readMailProviderKey(options){
129
- const readCredential=resolveMailCommandDependency(options,'readCredential',readMailCredential);
129
+ async function readMailProviderKey(options, serverSettings){
130
130
  const credentialOptions=mailCredentialOptions(options);
131
- const apiKey=await readCredential(credentialOptions);
131
+ const apiKey = serverSettings !== undefined && (options.readCredential ?? null) === null
132
+ ? serverSettings.apiKey
133
+ : await resolveMailCommandDependency(options, 'readCredential', readMailCredential)(credentialOptions);
132
134
  if(apiKey===null){
133
135
  const location=mailCredentialLocation(credentialOptions);
134
136
  throw new ArcaneError(
@@ -147,10 +149,25 @@ async function readMailProviderKey(options){
147
149
 
148
150
  async function serveMailGateway(options){
149
151
  const startServer=resolveMailCommandDependency(options,'startServer',startResendMailServer);
152
+ const readServerSettings = resolveMailCommandDependency(options, 'readServerSettings', readMailServerSettings);
150
153
  throwIfAborted(options.signal);
151
- let apiKey=await readMailProviderKey(options);
154
+ const serverSettings = await readServerSettings(
155
+ {...mailCredentialOptions(options), readCredential: options.readCredential}
156
+ );
157
+ throwIfAborted(options.signal);
158
+ let apiKey=await readMailProviderKey(options, serverSettings);
152
159
  try{
153
160
  throwIfAborted(options.signal);
161
+ const missingSettings = [];
162
+ if (!serverSettings.certPath) missingSettings.push('MAIL_TLS_CERT_PATH');
163
+ if (!serverSettings.keyPath) missingSettings.push('MAIL_TLS_KEY_PATH');
164
+ if (missingSettings.length) {
165
+ const location = mailCredentialLocation(options);
166
+ throw new ArcaneError(
167
+ ERROR_CODES.prerequisiteMissing,
168
+ `Missing ${missingSettings.join(', ')} in ${location.filePath}. Mail HTTPS requires a certificate and private key.`
169
+ );
170
+ }
154
171
  const recipientAllowlist=mailRecipientOptions(options.allowTo,'allowTo');
155
172
  const errorRecipients=options.errorTo===undefined
156
173
  ? recipientAllowlist
@@ -162,10 +179,12 @@ async function serveMailGateway(options){
162
179
  ?[]
163
180
  :is.array(options.origin)?[...options.origin]:[options.origin],
164
181
  bodyTimeoutMs:options.bodyTimeoutMs,
182
+ certPath:serverSettings.certPath,
165
183
  errorRecipients,
166
184
  fetchImpl:options.fetchImpl,
167
185
  from:options.from,
168
186
  host:options.host??'0.0.0.0',
187
+ keyPath:serverSettings.keyPath,
169
188
  onEvent:options.onEvent,
170
189
  port:options.port,
171
190
  providerTimeoutMs:options.requestTimeout,