homebridge-config-ui-x 5.12.0 → 5.12.1-beta.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.
Files changed (250) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/core/auth/auth.controller.d.ts +4 -0
  3. package/dist/core/config/config.interfaces.d.ts +14 -0
  4. package/dist/core/config/config.service.d.ts +6 -0
  5. package/dist/core/config/config.service.js +8 -0
  6. package/dist/core/config/config.service.js.map +1 -1
  7. package/dist/core/config/config.startup.js +48 -17
  8. package/dist/core/config/config.startup.js.map +1 -1
  9. package/dist/core/feature-flags/feature-flags.registry.js +5 -0
  10. package/dist/core/feature-flags/feature-flags.registry.js.map +1 -1
  11. package/dist/core/homebridge-ipc/homebridge-ipc.service.js +1 -0
  12. package/dist/core/homebridge-ipc/homebridge-ipc.service.js.map +1 -1
  13. package/dist/core/spa/spa-html.service.d.ts +5 -0
  14. package/dist/core/spa/spa-html.service.js +32 -0
  15. package/dist/core/spa/spa-html.service.js.map +1 -0
  16. package/dist/core/spa/spa.filter.d.ts +3 -0
  17. package/dist/core/spa/spa.filter.js +22 -2
  18. package/dist/core/spa/spa.filter.js.map +1 -1
  19. package/dist/core/ssl/ssl-cert-generator.service.d.ts +15 -0
  20. package/dist/core/ssl/ssl-cert-generator.service.js +125 -0
  21. package/dist/core/ssl/ssl-cert-generator.service.js.map +1 -0
  22. package/dist/globalDefaults.js +3 -0
  23. package/dist/globalDefaults.js.map +1 -1
  24. package/dist/main.js +18 -4
  25. package/dist/main.js.map +1 -1
  26. package/dist/modules/accessories/accessories.controller.d.ts +1 -1
  27. package/dist/modules/accessories/accessories.interfaces.d.ts +94 -0
  28. package/dist/modules/accessories/accessories.interfaces.js +2 -0
  29. package/dist/modules/accessories/accessories.interfaces.js.map +1 -0
  30. package/dist/modules/accessories/accessories.module.js +2 -0
  31. package/dist/modules/accessories/accessories.module.js.map +1 -1
  32. package/dist/modules/accessories/accessories.service.d.ts +21 -3
  33. package/dist/modules/accessories/accessories.service.js +281 -17
  34. package/dist/modules/accessories/accessories.service.js.map +1 -1
  35. package/dist/modules/child-bridges/child-bridges.interfaces.d.ts +9 -0
  36. package/dist/modules/config-editor/config-editor.controller.d.ts +4 -0
  37. package/dist/modules/config-editor/config-editor.controller.js +64 -0
  38. package/dist/modules/config-editor/config-editor.controller.js.map +1 -1
  39. package/dist/modules/config-editor/config-editor.service.d.ts +6 -1
  40. package/dist/modules/config-editor/config-editor.service.js +45 -1
  41. package/dist/modules/config-editor/config-editor.service.js.map +1 -1
  42. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js +1 -1
  43. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js.map +1 -1
  44. package/dist/modules/plugins/plugins.service.js +15 -0
  45. package/dist/modules/plugins/plugins.service.js.map +1 -1
  46. package/dist/modules/server/server.controller.d.ts +50 -0
  47. package/dist/modules/server/server.controller.js +201 -2
  48. package/dist/modules/server/server.controller.js.map +1 -1
  49. package/dist/modules/server/server.service.d.ts +48 -0
  50. package/dist/modules/server/server.service.js +502 -14
  51. package/dist/modules/server/server.service.js.map +1 -1
  52. package/dist/modules/status/status.gateway.d.ts +2 -0
  53. package/dist/modules/status/status.interfaces.d.ts +11 -0
  54. package/dist/modules/status/status.service.d.ts +4 -1
  55. package/dist/modules/status/status.service.js +9 -0
  56. package/dist/modules/status/status.service.js.map +1 -1
  57. package/docs/matter-todo.md +15 -0
  58. package/docs/ssl-upload-pr.md +103 -0
  59. package/package.json +3 -1
  60. package/public/3rdpartylicenses.txt +631 -657
  61. package/public/assets/matter.svg +8 -0
  62. package/public/assets/plugin-ui-utils/ui.js +3 -0
  63. package/public/assets/plugin-ui-utils/ui.js.map +1 -1
  64. package/public/chunk-23V3ZHHN.js +4 -0
  65. package/public/chunk-2IZ5GLDL.js +1 -0
  66. package/public/chunk-2ZETN4H4.js +1 -0
  67. package/public/{chunk-NXNTFMYU.js → chunk-376NJ4JA.js} +52 -2
  68. package/public/chunk-4JPNEFLH.js +1 -0
  69. package/public/chunk-4RTFV66E.js +1 -0
  70. package/public/chunk-5GBDFFOQ.js +1 -0
  71. package/public/chunk-5J6FDLB7.js +1 -0
  72. package/public/chunk-5OAGPV2D.js +1 -0
  73. package/public/chunk-65SHUKA4.js +1 -0
  74. package/public/chunk-6BJX5CLA.js +2 -0
  75. package/public/chunk-6C4IUINW.js +12 -0
  76. package/public/chunk-6OVZOJUT.js +1 -0
  77. package/public/chunk-6SBZOHFM.js +1 -0
  78. package/public/chunk-74YM4OSM.js +1 -0
  79. package/public/chunk-7CY762OC.js +1 -0
  80. package/public/chunk-7LNXXBIE.js +1 -0
  81. package/public/chunk-7NOPBNIZ.js +1 -0
  82. package/public/chunk-7TW4U5ET.js +1 -0
  83. package/public/chunk-AKBDMFNY.js +1 -0
  84. package/public/chunk-ALWBPP22.js +1 -0
  85. package/public/chunk-B4AJQJMI.js +1 -0
  86. package/public/chunk-B6RKSEW3.js +1 -0
  87. package/public/chunk-BLF5IIQI.js +1 -0
  88. package/public/{chunk-SIVN6M76.js → chunk-BMOLDRJ3.js} +1 -1
  89. package/public/{chunk-FANHX5JR.js → chunk-BOC4GPPW.js} +1 -1
  90. package/public/chunk-BYRP6GXK.js +1 -0
  91. package/public/chunk-C5FPXJOQ.js +1 -0
  92. package/public/chunk-C72MXF33.js +1 -0
  93. package/public/chunk-CLQGWMDP.js +1 -0
  94. package/public/chunk-CXRLFGOD.js +1 -0
  95. package/public/chunk-CZI3UVMH.js +1 -0
  96. package/public/chunk-DFVNQJY7.js +1 -0
  97. package/public/chunk-DPOOINVO.js +1 -0
  98. package/public/chunk-DSCDW5PD.js +1 -0
  99. package/public/chunk-DVLX24N2.js +1 -0
  100. package/public/chunk-DYMBIGE6.js +2 -0
  101. package/public/chunk-ELSY3N4O.js +1 -0
  102. package/public/chunk-ELTBAOHD.js +19 -0
  103. package/public/chunk-ENNQMSYQ.js +1 -0
  104. package/public/chunk-F7JEYIYP.js +1 -0
  105. package/public/chunk-FBMNEU62.js +1 -0
  106. package/public/chunk-FLCYAQH5.js +1 -0
  107. package/public/chunk-G53OXLP6.js +1 -0
  108. package/public/chunk-GAYKGX4P.js +1 -0
  109. package/public/chunk-GNKBS4UO.js +1 -0
  110. package/public/chunk-GTDQP2AN.js +1 -0
  111. package/public/chunk-GXT4SPB4.js +4 -0
  112. package/public/chunk-H2UEBCT6.js +1 -0
  113. package/public/chunk-H3VX2BIO.js +1 -0
  114. package/public/chunk-H6UNJZBF.js +1 -0
  115. package/public/{chunk-V4JCOKHQ.js → chunk-H7F7H5MW.js} +1 -1
  116. package/public/chunk-IE2OD64R.js +2 -0
  117. package/public/chunk-JB4LNFON.js +1 -0
  118. package/public/chunk-JPGTD7MD.js +1 -0
  119. package/public/{chunk-N2EK3VS7.js → chunk-JRJZJIV2.js} +1 -1
  120. package/public/chunk-K45E54BZ.js +1 -0
  121. package/public/chunk-KIZPS7DE.js +1 -0
  122. package/public/chunk-KQ3Z53BI.js +1 -0
  123. package/public/chunk-L4VGJUWK.js +1 -0
  124. package/public/chunk-L6Q2JELL.js +1 -0
  125. package/public/chunk-LOHNS7FV.js +2 -0
  126. package/public/chunk-M3KQANPV.js +3 -0
  127. package/public/chunk-M6TAMCUV.js +1 -0
  128. package/public/chunk-MHFV5QSL.js +1 -0
  129. package/public/chunk-ML4BDJRC.js +1 -0
  130. package/public/chunk-MOJIJ4KI.js +1 -0
  131. package/public/chunk-NHVLW3LX.js +1 -0
  132. package/public/chunk-NJGEMRNN.js +1 -0
  133. package/public/chunk-NJRKOKSU.js +1 -0
  134. package/public/chunk-NXZQXLGL.js +2 -0
  135. package/public/chunk-O4N7TQYF.js +1 -0
  136. package/public/chunk-OB3PTX3Z.js +1 -0
  137. package/public/chunk-P5MQL2T7.js +1 -0
  138. package/public/chunk-PAWAMEPH.js +1 -0
  139. package/public/chunk-PMDJKRLE.js +1 -0
  140. package/public/chunk-PTFXXQF2.js +1 -0
  141. package/public/chunk-PYOONJ25.js +1 -0
  142. package/public/chunk-Q65KD35M.js +1 -0
  143. package/public/chunk-QCZZKIYO.js +1 -0
  144. package/public/chunk-QD637MO5.js +1 -0
  145. package/public/chunk-QDCSNDML.js +68 -0
  146. package/public/chunk-QKXN6IC6.js +1 -0
  147. package/public/chunk-QMJOVI3M.js +1 -0
  148. package/public/chunk-QZ3OEC3U.js +1 -0
  149. package/public/chunk-RMCMUFT7.js +1 -0
  150. package/public/chunk-RYV47HXJ.js +1 -0
  151. package/public/chunk-SJOWHT2B.js +1 -0
  152. package/public/chunk-SLRAVUKI.js +1 -0
  153. package/public/chunk-TFTTSOLT.js +1 -0
  154. package/public/chunk-U5D4L5DP.js +1 -0
  155. package/public/chunk-UFIZB5XW.js +1 -0
  156. package/public/chunk-UX5CFJ7O.js +4 -0
  157. package/public/chunk-V4ZGSQKL.js +1 -0
  158. package/public/chunk-VNT2T75N.js +1 -0
  159. package/public/chunk-VQZXH6H7.js +1 -0
  160. package/public/chunk-VSPME4PA.js +2 -0
  161. package/public/chunk-W76BGWDJ.js +16 -0
  162. package/public/chunk-WBNNLXVW.js +4 -0
  163. package/public/chunk-WG5DYV7E.js +1 -0
  164. package/public/chunk-WLUIIX75.js +1 -0
  165. package/public/chunk-WRZTVTB6.js +1 -0
  166. package/public/chunk-XBMS7SCE.js +5 -0
  167. package/public/chunk-XHXRISSG.js +35 -0
  168. package/public/chunk-XIHWQFTE.js +1 -0
  169. package/public/chunk-XLLRYJGK.js +1 -0
  170. package/public/chunk-XUGDJIIQ.js +1 -0
  171. package/public/chunk-YCP75D2G.js +8 -0
  172. package/public/chunk-YNWFNSNN.js +19 -0
  173. package/public/chunk-YTCGCDXK.js +1 -0
  174. package/public/chunk-YTH23ATC.js +1 -0
  175. package/public/chunk-YUNDMK7D.js +1 -0
  176. package/public/chunk-ZCGZM7LU.js +1 -0
  177. package/public/chunk-ZFKD5Q4T.js +1 -0
  178. package/public/chunk-ZJFRXDDO.js +1 -0
  179. package/public/index.html +2 -2
  180. package/public/main-YL4WUDRU.js +1 -0
  181. package/public/media/matter-P563JGDL.svg +8 -0
  182. package/public/polyfills-34U4WL3Z.js +1 -0
  183. package/public/styles-WJHG5ONB.css +1 -0
  184. package/scripts/extract-plugin-alias.js +53 -2
  185. package/public/chunk-3MO7ICHF.js +0 -1
  186. package/public/chunk-3PGUQRQW.js +0 -1
  187. package/public/chunk-3SKLXSFI.js +0 -1
  188. package/public/chunk-54X33YUH.js +0 -5
  189. package/public/chunk-56HOZZW6.js +0 -1
  190. package/public/chunk-5ZHDYUXA.js +0 -1
  191. package/public/chunk-6SUIFFAZ.js +0 -1
  192. package/public/chunk-7DOT7I4R.js +0 -1
  193. package/public/chunk-7O4JAXGA.js +0 -50
  194. package/public/chunk-A5EOSR6S.js +0 -1
  195. package/public/chunk-AIGU7Y6G.js +0 -1
  196. package/public/chunk-AK4UTJX2.js +0 -1
  197. package/public/chunk-BAHYSQO5.js +0 -1
  198. package/public/chunk-BJKMZCEQ.js +0 -1
  199. package/public/chunk-BNHW6YHK.js +0 -1
  200. package/public/chunk-BNQ6BOCY.js +0 -1
  201. package/public/chunk-BPQAV2XG.js +0 -1
  202. package/public/chunk-CCKAIEVL.js +0 -1
  203. package/public/chunk-CJJAQM22.js +0 -19
  204. package/public/chunk-D5Z6KR3J.js +0 -1
  205. package/public/chunk-DRKO4DTB.js +0 -1
  206. package/public/chunk-EBANXPKG.js +0 -1
  207. package/public/chunk-EQHGBDO3.js +0 -1
  208. package/public/chunk-GOLMQCNJ.js +0 -1
  209. package/public/chunk-GPTVUF5H.js +0 -1
  210. package/public/chunk-HRAMBCZG.js +0 -1
  211. package/public/chunk-IQUWZEQX.js +0 -1
  212. package/public/chunk-JE6FI7IW.js +0 -16
  213. package/public/chunk-JHD5MRCG.js +0 -2
  214. package/public/chunk-JI6C4NXH.js +0 -1
  215. package/public/chunk-JJZ232C2.js +0 -12
  216. package/public/chunk-JYAM3PTI.js +0 -1
  217. package/public/chunk-KCF7ILFR.js +0 -1
  218. package/public/chunk-KEKO5EFZ.js +0 -1
  219. package/public/chunk-KK7LTOA5.js +0 -1
  220. package/public/chunk-L2Y7HWNA.js +0 -1
  221. package/public/chunk-LVPMGB27.js +0 -1
  222. package/public/chunk-MA4NUDLX.js +0 -1
  223. package/public/chunk-ML7UNHWF.js +0 -1
  224. package/public/chunk-MY5KM2NY.js +0 -1
  225. package/public/chunk-NBTW66C4.js +0 -3
  226. package/public/chunk-NLWU3URB.js +0 -1
  227. package/public/chunk-NVN7DYND.js +0 -1
  228. package/public/chunk-OL7NNVJO.js +0 -1
  229. package/public/chunk-PHO7WRKK.js +0 -1
  230. package/public/chunk-PHWW4YF2.js +0 -1
  231. package/public/chunk-QPGFU6MO.js +0 -1
  232. package/public/chunk-QTIB6YCV.js +0 -1
  233. package/public/chunk-RZVF77KW.js +0 -4
  234. package/public/chunk-SNO4VAGT.js +0 -1
  235. package/public/chunk-STRTFJ4I.js +0 -1
  236. package/public/chunk-TGQIPKOK.js +0 -51
  237. package/public/chunk-TMGK6CPZ.js +0 -8
  238. package/public/chunk-UIZYHRTQ.js +0 -4
  239. package/public/chunk-UO2L3YPH.js +0 -1
  240. package/public/chunk-XCOJYJKE.js +0 -4
  241. package/public/chunk-XKFVEK25.js +0 -2
  242. package/public/chunk-XPGD2BHY.js +0 -40
  243. package/public/chunk-YBNR45V5.js +0 -5
  244. package/public/chunk-YK5NYQW5.js +0 -1
  245. package/public/chunk-ZDEL6332.js +0 -1
  246. package/public/chunk-ZRDN4L2J.js +0 -5
  247. package/public/chunk-ZYETXD5U.js +0 -1
  248. package/public/main-YYHATWMC.js +0 -1
  249. package/public/polyfills-5KWHJ7II.js +0 -2
  250. package/public/styles-G2ZRD7VU.css +0 -1
@@ -12,11 +12,13 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  };
13
13
  import { Buffer } from 'node:buffer';
14
14
  import { exec, spawn } from 'node:child_process';
15
+ import { createPrivateKey, createPublicKey, X509Certificate } from 'node:crypto';
15
16
  import { createWriteStream } from 'node:fs';
16
17
  import { readdir, unlink } from 'node:fs/promises';
17
18
  import { extname, join, resolve } from 'node:path';
18
19
  import process from 'node:process';
19
20
  import { pipeline } from 'node:stream';
21
+ import { createSecureContext } from 'node:tls';
20
22
  import { promisify } from 'node:util';
21
23
  import { Categories } from '@homebridge/hap-client/dist/hap-types.js';
22
24
  import { BadRequestException, Inject, Injectable, InternalServerErrorException, NotFoundException, ServiceUnavailableException, } from '@nestjs/common';
@@ -27,6 +29,7 @@ import { check as tcpCheck } from 'tcp-port-used';
27
29
  import { ConfigService } from '../../core/config/config.service.js';
28
30
  import { HomebridgeIpcService } from '../../core/homebridge-ipc/homebridge-ipc.service.js';
29
31
  import { Logger } from '../../core/logger/logger.service.js';
32
+ import { SslCertGeneratorService } from '../../core/ssl/ssl-cert-generator.service.js';
30
33
  import { AccessoriesService } from '../accessories/accessories.service.js';
31
34
  import { ConfigEditorService } from '../config-editor/config-editor.service.js';
32
35
  const pump = promisify(pipeline);
@@ -50,25 +53,37 @@ let ServerService = class ServerService {
50
53
  this.accessoryId = this.configService.homebridgeConfig.bridge.username.split(':').join('');
51
54
  this.accessoryInfoPath = join(this.configService.storagePath, 'persist', `AccessoryInfo.${this.accessoryId}.json`);
52
55
  }
53
- async deleteSingleDeviceAccessories(id, cachedAccessoriesDir) {
54
- const cachedAccessories = join(cachedAccessoriesDir, `cachedAccessories.${id}`);
55
- const cachedAccessoriesBackup = join(cachedAccessoriesDir, `.cachedAccessories.${id}.bak`);
56
- if (await pathExists(cachedAccessories)) {
57
- await unlink(cachedAccessories);
58
- this.logger.warn(`Bridge ${id} accessory removal: removed ${cachedAccessories}.`);
56
+ async deleteSingleDeviceAccessories(id, cachedAccessoriesDir, protocol = 'both') {
57
+ if (protocol === 'hap' || protocol === 'both') {
58
+ const cachedAccessories = join(cachedAccessoriesDir, `cachedAccessories.${id}`);
59
+ const cachedAccessoriesBackup = join(cachedAccessoriesDir, `.cachedAccessories.${id}.bak`);
60
+ if (await pathExists(cachedAccessories)) {
61
+ await unlink(cachedAccessories);
62
+ this.logger.warn(`Bridge ${id} HAP accessory removal: removed ${cachedAccessories}.`);
63
+ }
64
+ if (await pathExists(cachedAccessoriesBackup)) {
65
+ await unlink(cachedAccessoriesBackup);
66
+ this.logger.warn(`Bridge ${id} HAP accessory removal: removed ${cachedAccessoriesBackup}.`);
67
+ }
59
68
  }
60
- if (await pathExists(cachedAccessoriesBackup)) {
61
- await unlink(cachedAccessoriesBackup);
62
- this.logger.warn(`Bridge ${id} accessory removal: removed ${cachedAccessoriesBackup}.`);
69
+ if (protocol === 'matter' || protocol === 'both') {
70
+ const deviceId = id.split(':').join('').toUpperCase();
71
+ const matterPath = join(this.configService.storagePath, 'matter', deviceId);
72
+ if (await pathExists(matterPath)) {
73
+ await remove(matterPath);
74
+ this.logger.warn(`Bridge ${id} Matter accessory removal: removed Matter bridge storage at ${matterPath}.`);
75
+ }
63
76
  }
64
77
  }
65
78
  async deleteSingleDevicePairing(id, resetPairingInfo) {
66
79
  const persistPath = join(this.configService.storagePath, 'persist');
67
80
  const accessoryInfo = join(persistPath, `AccessoryInfo.${id}.json`);
68
81
  const identifierCache = join(persistPath, `IdentifierCache.${id}.json`);
82
+ const deviceId = id.includes(':') ? id.split(':').join('').toUpperCase() : id.toUpperCase();
83
+ const matterPath = join(this.configService.storagePath, 'matter', deviceId);
69
84
  try {
70
85
  const configFile = await this.configEditorService.getConfigFile();
71
- const username = id.match(/.{1,2}/g).join(':').toUpperCase();
86
+ const username = id.includes(':') ? id.toUpperCase() : id.match(/.{1,2}/g)?.join(':').toUpperCase() || id.toUpperCase();
72
87
  const uiConfig = configFile.platforms.find(x => x.platform === 'config');
73
88
  let blacklistChanged = false;
74
89
  let bridgesChanged = false;
@@ -134,6 +149,10 @@ let ServerService = class ServerService {
134
149
  await unlink(identifierCache);
135
150
  this.logger.warn(`Bridge ${id} reset: removed ${identifierCache}.`);
136
151
  }
152
+ if (await pathExists(matterPath)) {
153
+ await remove(matterPath);
154
+ this.logger.warn(`Bridge ${id} reset: removed Matter bridge storage at ${matterPath}.`);
155
+ }
137
156
  await this.deleteDeviceAccessories(id);
138
157
  }
139
158
  async restartServer() {
@@ -177,6 +196,12 @@ let ServerService = class ServerService {
177
196
  await this.configEditorService.updateConfigFile(configFile);
178
197
  await remove(resolve(this.configService.storagePath, 'accessories'));
179
198
  await remove(resolve(this.configService.storagePath, 'persist'));
199
+ const deviceId = oldUsername.split(':').join('').toUpperCase();
200
+ const matterPath = join(this.configService.storagePath, 'matter', deviceId);
201
+ if (await pathExists(matterPath)) {
202
+ await remove(matterPath);
203
+ this.logger.warn(`Bridge ${oldUsername} reset: removed Matter bridge storage at ${matterPath}.`);
204
+ }
180
205
  this.logger.log('Homebridge bridge reset: accessories and persist directories were removed.');
181
206
  }
182
207
  async getDevicePairings() {
@@ -184,9 +209,68 @@ let ServerService = class ServerService {
184
209
  const devices = (await readdir(persistPath))
185
210
  .filter(x => x.match(/AccessoryInfo\.([A-Fa-f0-9]+)\.json$/));
186
211
  const configFile = await this.configEditorService.getConfigFile();
187
- return Promise.all(devices.map(async (x) => {
212
+ const hapDevices = await Promise.all(devices.map(async (x) => {
188
213
  return await this.getDevicePairingById(x.split('.')[1], configFile);
189
214
  }));
215
+ const matterExternalDevices = await this.getMatterExternalAccessories(hapDevices);
216
+ return [...hapDevices, ...matterExternalDevices].sort((a, b) => a.name.localeCompare(b.name));
217
+ }
218
+ async getMatterExternalAccessories(hapDevices) {
219
+ const matterPath = join(this.configService.storagePath, 'matter');
220
+ if (!await pathExists(matterPath)) {
221
+ return [];
222
+ }
223
+ const matterDirs = (await readdir(matterPath))
224
+ .filter(x => x.match(/^[A-F0-9]{12}$/));
225
+ const matterExternalDevices = [];
226
+ for (const deviceId of matterDirs) {
227
+ try {
228
+ const hasHapAccessoryInfo = hapDevices.some(d => d._id === deviceId);
229
+ if (hasHapAccessoryInfo) {
230
+ continue;
231
+ }
232
+ const mainBridgeId = this.configService.homebridgeConfig.bridge.username.split(':').join('').toUpperCase();
233
+ if (deviceId.toUpperCase() === mainBridgeId) {
234
+ continue;
235
+ }
236
+ const accessoriesPath = join(matterPath, deviceId, 'accessories.json');
237
+ if (!await pathExists(accessoriesPath)) {
238
+ continue;
239
+ }
240
+ const accessories = await readJson(accessoriesPath);
241
+ if (!Array.isArray(accessories) || accessories.length === 0) {
242
+ continue;
243
+ }
244
+ const accessory = accessories[0];
245
+ const commissioningPath = join(matterPath, deviceId, 'commissioning.json');
246
+ let commissioned = false;
247
+ if (await pathExists(commissioningPath)) {
248
+ const commissioningInfo = await readJson(commissioningPath);
249
+ commissioned = commissioningInfo.commissioned || false;
250
+ }
251
+ const device = {
252
+ _id: deviceId,
253
+ _username: deviceId.match(/.{1,2}/g)?.join(':').toUpperCase() || deviceId,
254
+ _main: false,
255
+ _category: 'other',
256
+ _matter: true,
257
+ _matterOnly: true,
258
+ _isPaired: commissioned,
259
+ _plugin: accessory.plugin,
260
+ name: accessory.displayName || 'Matter External Accessory',
261
+ displayName: accessory.displayName || 'Matter External Accessory',
262
+ manufacturer: accessory.manufacturer || 'Unknown',
263
+ model: accessory.model || 'Unknown',
264
+ serialNumber: accessory.serialNumber || deviceId,
265
+ category: 1,
266
+ };
267
+ matterExternalDevices.push(device);
268
+ }
269
+ catch (e) {
270
+ this.logger.error(`Failed to read Matter external accessory ${deviceId}: ${e.message}`);
271
+ }
272
+ }
273
+ return matterExternalDevices;
190
274
  }
191
275
  async getDevicePairingById(deviceId, configFile = null) {
192
276
  const persistPath = join(this.configService.storagePath, 'persist');
@@ -219,6 +303,10 @@ let ServerService = class ServerService {
219
303
  device._isPaired = device.pairedClients && Object.keys(device.pairedClients).length > 0;
220
304
  device._setupCode = this.generateSetupCode(device);
221
305
  device._couldBeStale = !device._main && device._category === 'bridge' && !pluginBlock;
306
+ device._matter = !!(pluginBlock?._bridge?.matter);
307
+ if (device._matter && pluginBlock && 'accessory' in pluginBlock) {
308
+ this.logger.warn(`Device ${deviceId} has Matter configuration on an accessory-based plugin. Matter is only supported for platform-based plugins.`);
309
+ }
222
310
  delete device.signSk;
223
311
  delete device.signPk;
224
312
  delete device.configHash;
@@ -232,6 +320,44 @@ let ServerService = class ServerService {
232
320
  await this.deleteSingleDevicePairing(id, resetPairingInfo);
233
321
  return { ok: true };
234
322
  }
323
+ async deleteDeviceMatterConfig(id) {
324
+ try {
325
+ const configFile = await this.configEditorService.getConfigFile();
326
+ const username = id.includes(':') ? id.toUpperCase() : id.match(/.{1,2}/g)?.join(':').toUpperCase() || id.toUpperCase();
327
+ const pluginBlocks = [
328
+ ...(configFile.accessories || []),
329
+ ...(configFile.platforms || []),
330
+ ]
331
+ .filter((block) => block._bridge?.username?.toUpperCase() === username.toUpperCase());
332
+ const pluginBlock = pluginBlocks.find((block) => block._bridge?.matter);
333
+ if (!pluginBlock) {
334
+ this.logger.error(`Failed to find Matter configuration for child bridge ${id}.`);
335
+ throw new NotFoundException(`Matter configuration not found for bridge ${id}`);
336
+ }
337
+ if ('accessory' in pluginBlock) {
338
+ this.logger.warn(`Removing Matter configuration from accessory-based plugin block for bridge ${id}. Matter is only supported for platform-based plugins.`);
339
+ }
340
+ delete pluginBlock._bridge.matter;
341
+ this.logger.warn(`Bridge ${id} Matter configuration removed from config.json.`);
342
+ await this.configEditorService.updateConfigFile(configFile);
343
+ }
344
+ catch (e) {
345
+ if (e instanceof NotFoundException) {
346
+ throw e;
347
+ }
348
+ this.logger.error(`Failed to remove Matter configuration for child bridge ${id} as ${e.message}.`);
349
+ throw new InternalServerErrorException(`Failed to remove Matter configuration: ${e.message}`);
350
+ }
351
+ this.logger.warn(`Shutting down Homebridge before removing Matter storage for bridge ${id}...`);
352
+ await this.homebridgeIpcService.restartAndWaitForClose();
353
+ const deviceId = id.includes(':') ? id.split(':').join('').toUpperCase() : id.toUpperCase();
354
+ const matterPath = join(this.configService.storagePath, 'matter', deviceId);
355
+ if (await pathExists(matterPath)) {
356
+ await remove(matterPath);
357
+ this.logger.warn(`Bridge ${id} Matter storage removed at ${matterPath}.`);
358
+ }
359
+ return { ok: true };
360
+ }
235
361
  async deleteDevicesPairing(bridges) {
236
362
  this.logger.warn(`Shutting down Homebridge before resetting paired bridges ${bridges.map(x => x.id).join(', ')}...`);
237
363
  await this.homebridgeIpcService.restartAndWaitForClose();
@@ -255,9 +381,9 @@ let ServerService = class ServerService {
255
381
  this.logger.warn(`Shutting down Homebridge before removing accessories for paired bridges ${bridges.map(x => x.id).join(', ')}...`);
256
382
  await this.homebridgeIpcService.restartAndWaitForClose();
257
383
  const cachedAccessoriesDir = join(this.configService.storagePath, 'accessories');
258
- for (const { id } of bridges) {
384
+ for (const { id, protocol } of bridges) {
259
385
  try {
260
- await this.deleteSingleDeviceAccessories(id, cachedAccessoriesDir);
386
+ await this.deleteSingleDeviceAccessories(id, cachedAccessoriesDir, protocol || 'both');
261
387
  }
262
388
  catch (e) {
263
389
  this.logger.error(`Failed to remove accessories for bridge ${id} as ${e.message}.`);
@@ -338,13 +464,19 @@ let ServerService = class ServerService {
338
464
  await this.homebridgeIpcService.restartAndWaitForClose();
339
465
  this.logger.warn('Shutting down Homebridge before removing cached accessories');
340
466
  try {
341
- this.logger.log('Clearing all cached accessories...');
467
+ this.logger.log('Clearing all HAP cached accessories...');
342
468
  for (const thisCachedAccessoriesPath of cachedAccessoryPaths) {
343
469
  if (await pathExists(thisCachedAccessoriesPath)) {
344
470
  await unlink(thisCachedAccessoriesPath);
345
471
  this.logger.warn(`Removed ${thisCachedAccessoriesPath}.`);
346
472
  }
347
473
  }
474
+ const matterDir = join(this.configService.storagePath, 'matter');
475
+ if (await pathExists(matterDir)) {
476
+ this.logger.log('Clearing all Matter cached accessories...');
477
+ await remove(matterDir);
478
+ this.logger.warn(`Removed Matter storage directory at ${matterDir}.`);
479
+ }
348
480
  }
349
481
  catch (e) {
350
482
  this.logger.error(`Failed to clear all cached accessories at ${cachedAccessoriesPath} as ${e.message}.`);
@@ -353,6 +485,96 @@ let ServerService = class ServerService {
353
485
  }
354
486
  return { ok: true };
355
487
  }
488
+ async getMatterAccessories() {
489
+ const matterDir = join(this.configService.storagePath, 'matter');
490
+ if (!await pathExists(matterDir)) {
491
+ return [];
492
+ }
493
+ const matterBridges = (await readdir(matterDir))
494
+ .filter(x => x.match(/^[A-F0-9]+$/));
495
+ const matterAccessories = [];
496
+ await Promise.all(matterBridges.map(async (deviceId) => {
497
+ try {
498
+ const accessoriesPath = join(matterDir, deviceId, 'accessories.json');
499
+ if (await pathExists(accessoriesPath)) {
500
+ const accessories = await readJson(accessoriesPath);
501
+ if (Array.isArray(accessories)) {
502
+ for (const accessory of accessories) {
503
+ accessory.$deviceId = deviceId;
504
+ accessory.$protocol = 'matter';
505
+ matterAccessories.push(accessory);
506
+ }
507
+ }
508
+ }
509
+ }
510
+ catch (e) {
511
+ this.logger.error(`Failed to read Matter accessories for bridge ${deviceId}: ${e.message}`);
512
+ }
513
+ }));
514
+ return matterAccessories;
515
+ }
516
+ async deleteMatterAccessory(deviceId, uuid) {
517
+ const matterAccessoriesPath = join(this.configService.storagePath, 'matter', deviceId, 'accessories.json');
518
+ if (!await pathExists(matterAccessoriesPath)) {
519
+ this.logger.error(`Matter accessories file not found for bridge ${deviceId}`);
520
+ throw new NotFoundException();
521
+ }
522
+ this.logger.warn(`Shutting down Homebridge before removing Matter accessory ${uuid} from bridge ${deviceId}...`);
523
+ await this.homebridgeIpcService.restartAndWaitForClose();
524
+ const matterAccessories = await readJson(matterAccessoriesPath);
525
+ const accessoryIndex = matterAccessories.findIndex(x => x.uuid === uuid);
526
+ if (accessoryIndex > -1) {
527
+ matterAccessories.splice(accessoryIndex, 1);
528
+ await writeJson(matterAccessoriesPath, matterAccessories, { spaces: 2 });
529
+ this.logger.warn(`Removed Matter accessory with UUID ${uuid} from bridge ${deviceId}.`);
530
+ }
531
+ else {
532
+ this.logger.error(`Cannot find Matter accessory with UUID ${uuid} in bridge ${deviceId}.`);
533
+ throw new NotFoundException();
534
+ }
535
+ return { ok: true };
536
+ }
537
+ async deleteMatterAccessories(accessories) {
538
+ this.logger.warn(`Shutting down Homebridge before removing Matter accessories ${accessories.map(x => x.uuid).join(', ')}.`);
539
+ await this.homebridgeIpcService.restartAndWaitForClose();
540
+ const accessoriesByBridge = new Map();
541
+ for (const { deviceId, uuid } of accessories) {
542
+ if (!accessoriesByBridge.has(deviceId)) {
543
+ accessoriesByBridge.set(deviceId, []);
544
+ }
545
+ accessoriesByBridge.get(deviceId).push({ uuid });
546
+ }
547
+ for (const [deviceId, bridgeAccessories] of accessoriesByBridge.entries()) {
548
+ const matterAccessoriesPath = join(this.configService.storagePath, 'matter', deviceId, 'accessories.json');
549
+ try {
550
+ if (!await pathExists(matterAccessoriesPath)) {
551
+ this.logger.error(`Matter accessories file not found for bridge ${deviceId}`);
552
+ continue;
553
+ }
554
+ const matterAccessories = await readJson(matterAccessoriesPath);
555
+ for (const { uuid } of bridgeAccessories) {
556
+ try {
557
+ const accessoryIndex = matterAccessories.findIndex(x => x.uuid === uuid);
558
+ if (accessoryIndex > -1) {
559
+ matterAccessories.splice(accessoryIndex, 1);
560
+ this.logger.warn(`Removed Matter accessory with UUID ${uuid} from bridge ${deviceId}.`);
561
+ }
562
+ else {
563
+ this.logger.error(`Cannot find Matter accessory with UUID ${uuid} in bridge ${deviceId}.`);
564
+ }
565
+ }
566
+ catch (e) {
567
+ this.logger.error(`Failed to remove Matter accessory with UUID ${uuid} from bridge ${deviceId} as ${e.message}.`);
568
+ }
569
+ }
570
+ await writeJson(matterAccessoriesPath, matterAccessories, { spaces: 2 });
571
+ }
572
+ catch (e) {
573
+ this.logger.error(`Failed to process Matter accessories for bridge ${deviceId} as ${e.message}.`);
574
+ }
575
+ }
576
+ return { ok: true };
577
+ }
356
578
  async getSetupCode() {
357
579
  if (this.setupCode) {
358
580
  return this.setupCode;
@@ -457,6 +679,30 @@ let ServerService = class ServerService {
457
679
  }
458
680
  return { port };
459
681
  }
682
+ async lookupUnusedMatterPort() {
683
+ const min = 5530;
684
+ const max = 5541;
685
+ const config = await this.configEditorService.getConfigFile();
686
+ const usedMatterPorts = new Set();
687
+ if (config.bridge?.matter?.port) {
688
+ usedMatterPorts.add(config.bridge.matter.port);
689
+ }
690
+ for (const block of [...(config.accessories || []), ...(config.platforms || [])]) {
691
+ if (block._bridge?.matter?.port) {
692
+ if ('accessory' in block) {
693
+ this.logger.warn(`Found Matter configuration on accessory-based plugin block, skipping port ${block._bridge.matter.port}`);
694
+ continue;
695
+ }
696
+ usedMatterPorts.add(block._bridge.matter.port);
697
+ }
698
+ }
699
+ for (let port = min; port <= max; port += 1) {
700
+ if (!usedMatterPorts.has(port) && !await tcpCheck(port)) {
701
+ return { port };
702
+ }
703
+ }
704
+ throw new InternalServerErrorException('No available ports in the Matter port range (5530-5541)');
705
+ }
460
706
  async getHomebridgePort() {
461
707
  const config = await this.configEditorService.getConfigFile();
462
708
  return { port: config.bridge.port };
@@ -589,6 +835,248 @@ let ServerService = class ServerService {
589
835
  });
590
836
  });
591
837
  }
838
+ async uploadSslKeyCert(req) {
839
+ const parts = req.parts ? req.parts() : null;
840
+ const files = [];
841
+ if (parts) {
842
+ for await (const part of parts) {
843
+ if (part.file) {
844
+ files.push(part);
845
+ }
846
+ }
847
+ }
848
+ else {
849
+ const single = await req.file();
850
+ if (single?.file) {
851
+ files.push(single);
852
+ }
853
+ }
854
+ if (!files.length) {
855
+ throw new BadRequestException('No files uploaded. Please upload both the private key and certificate files.');
856
+ }
857
+ const readStreamToBuffer = async (stream) => {
858
+ const chunks = [];
859
+ await new Promise((resolvePromise, rejectPromise) => {
860
+ stream.on('data', (d) => chunks.push(Buffer.isBuffer(d) ? d : Buffer.from(d)));
861
+ stream.on('end', () => resolvePromise());
862
+ stream.on('error', rejectPromise);
863
+ });
864
+ return Buffer.concat(chunks);
865
+ };
866
+ let keyPem = null;
867
+ let certPem = null;
868
+ for (const f of files) {
869
+ if (f.file?.truncated) {
870
+ throw new InternalServerErrorException(`Upload exceeds maximum size ${globalThis.backup.maxBackupSizeText}.`);
871
+ }
872
+ const buf = await readStreamToBuffer(f.file);
873
+ const text = buf.toString('utf8');
874
+ if (/-----BEGIN (?:RSA |EC )?PRIVATE KEY-----/.test(text)) {
875
+ keyPem = buf;
876
+ }
877
+ else if (/-----BEGIN CERTIFICATE-----/.test(text)) {
878
+ certPem = buf;
879
+ }
880
+ else if (f.fieldname === 'key') {
881
+ keyPem = buf;
882
+ }
883
+ else if (f.fieldname === 'cert') {
884
+ certPem = buf;
885
+ }
886
+ }
887
+ if (!keyPem || !certPem) {
888
+ throw new BadRequestException('Both a PEM private key and certificate must be provided.');
889
+ }
890
+ try {
891
+ const x509 = new X509Certificate(certPem);
892
+ const certPub = x509.publicKey.export({ type: 'spki', format: 'der' });
893
+ const priv = createPrivateKey({ key: keyPem });
894
+ const pubFromPriv = createPublicKey(priv).export({ type: 'spki', format: 'der' });
895
+ if (!certPub.equals(pubFromPriv)) {
896
+ throw new BadRequestException('The private key does not match the certificate public key.');
897
+ }
898
+ createSecureContext({ key: keyPem, cert: certPem });
899
+ }
900
+ catch (e) {
901
+ if (e instanceof BadRequestException) {
902
+ throw e;
903
+ }
904
+ throw new BadRequestException(`Invalid key/certificate: ${e?.message || e}`);
905
+ }
906
+ const sslDir = join(this.configService.storagePath, 'ssl-certs');
907
+ const keyPath = join(sslDir, 'ui-ssl.key');
908
+ const certPath = join(sslDir, 'ui-ssl.crt');
909
+ const { ensureDir, writeFile } = await import('fs-extra');
910
+ await ensureDir(sslDir);
911
+ await writeFile(keyPath, keyPem);
912
+ await writeFile(certPath, certPem);
913
+ const configFile = await this.configEditorService.getConfigFile();
914
+ const uiConfigBlock = configFile.platforms.find((x) => x.platform === 'config');
915
+ if (!uiConfigBlock) {
916
+ throw new InternalServerErrorException('Config platform block not found.');
917
+ }
918
+ if (!uiConfigBlock.ssl) {
919
+ uiConfigBlock.ssl = {};
920
+ }
921
+ uiConfigBlock.ssl.key = keyPath;
922
+ uiConfigBlock.ssl.cert = certPath;
923
+ delete uiConfigBlock.ssl.pfx;
924
+ delete uiConfigBlock.ssl.passphrase;
925
+ uiConfigBlock.ssl.selfSigned = false;
926
+ await this.configEditorService.updateConfigFile(configFile);
927
+ return {
928
+ ok: true,
929
+ type: 'keycert',
930
+ keyPath,
931
+ certPath,
932
+ details: 'Certificate and key validated and saved.',
933
+ };
934
+ }
935
+ async uploadSslPfx(req) {
936
+ let passphrase;
937
+ let filePart;
938
+ if (req.parts) {
939
+ for await (const part of req.parts()) {
940
+ if (part.type === 'file' || part.file) {
941
+ filePart = part;
942
+ }
943
+ else if (part.type === 'field' || part.value) {
944
+ if (part.fieldname === 'passphrase') {
945
+ passphrase = part.value;
946
+ }
947
+ }
948
+ }
949
+ }
950
+ else {
951
+ filePart = await req.file();
952
+ passphrase = req.body?.passphrase;
953
+ }
954
+ if (!filePart) {
955
+ throw new BadRequestException('No PFX file uploaded.');
956
+ }
957
+ if (filePart.file?.truncated) {
958
+ throw new InternalServerErrorException(`Upload exceeds maximum size ${globalThis.backup.maxBackupSizeText}.`);
959
+ }
960
+ const readStreamToBuffer = async (stream) => {
961
+ const chunks = [];
962
+ await new Promise((resolvePromise, rejectPromise) => {
963
+ stream.on('data', (d) => chunks.push(Buffer.isBuffer(d) ? d : Buffer.from(d)));
964
+ stream.on('end', () => resolvePromise());
965
+ stream.on('error', rejectPromise);
966
+ });
967
+ return Buffer.concat(chunks);
968
+ };
969
+ const pfxBuffer = await readStreamToBuffer(filePart.file);
970
+ try {
971
+ createSecureContext({ pfx: pfxBuffer, passphrase });
972
+ }
973
+ catch (e) {
974
+ throw new BadRequestException(`Invalid PFX or passphrase: ${e?.message || e}`);
975
+ }
976
+ const sslDir = join(this.configService.storagePath, 'ssl-certs');
977
+ const pfxPath = join(sslDir, 'ui-ssl.pfx');
978
+ const { ensureDir, writeFile } = await import('fs-extra');
979
+ await ensureDir(sslDir);
980
+ await writeFile(pfxPath, pfxBuffer);
981
+ const configFile = await this.configEditorService.getConfigFile();
982
+ const uiConfigBlock = configFile.platforms.find((x) => x.platform === 'config');
983
+ if (!uiConfigBlock) {
984
+ throw new InternalServerErrorException('Config platform block not found.');
985
+ }
986
+ if (!uiConfigBlock.ssl) {
987
+ uiConfigBlock.ssl = {};
988
+ }
989
+ uiConfigBlock.ssl.pfx = pfxPath;
990
+ uiConfigBlock.ssl.passphrase = passphrase || '';
991
+ delete uiConfigBlock.ssl.key;
992
+ delete uiConfigBlock.ssl.cert;
993
+ uiConfigBlock.ssl.selfSigned = false;
994
+ await this.configEditorService.updateConfigFile(configFile);
995
+ return {
996
+ ok: true,
997
+ type: 'pfx',
998
+ pfxPath,
999
+ details: 'PFX validated and saved.',
1000
+ };
1001
+ }
1002
+ async validateCurrentSslConfig() {
1003
+ const configFile = await this.configEditorService.getConfigFile();
1004
+ const uiConfigBlock = configFile.platforms.find((x) => x.platform === 'config');
1005
+ const ssl = uiConfigBlock?.ssl || {};
1006
+ if (!ssl || (!ssl.selfSigned && !ssl.key && !ssl.cert && !ssl.pfx)) {
1007
+ return { ok: true, valid: true, type: 'off', details: 'HTTPS is disabled.' };
1008
+ }
1009
+ if (ssl.selfSigned) {
1010
+ return { ok: true, valid: true, type: 'selfsigned', details: 'Self-signed mode enabled.' };
1011
+ }
1012
+ try {
1013
+ if (ssl.key && ssl.cert) {
1014
+ const { readFile } = await import('fs-extra');
1015
+ const keyPem = await readFile(ssl.key);
1016
+ const certPem = await readFile(ssl.cert);
1017
+ const x509 = new X509Certificate(certPem);
1018
+ const certPub = x509.publicKey.export({ type: 'spki', format: 'der' });
1019
+ const priv = createPrivateKey({ key: keyPem });
1020
+ const pubFromPriv = createPublicKey(priv).export({ type: 'spki', format: 'der' });
1021
+ if (!certPub.equals(pubFromPriv)) {
1022
+ return { ok: true, valid: false, type: 'keycert', details: 'Private key does not match certificate.' };
1023
+ }
1024
+ createSecureContext({ key: keyPem, cert: certPem });
1025
+ return { ok: true, valid: true, type: 'keycert', details: 'Key and certificate are valid and match.' };
1026
+ }
1027
+ if (ssl.pfx) {
1028
+ const { readFile } = await import('fs-extra');
1029
+ const pfx = await readFile(ssl.pfx);
1030
+ createSecureContext({ pfx, passphrase: ssl.passphrase });
1031
+ return { ok: true, valid: true, type: 'pfx', details: 'PFX file and passphrase are valid.' };
1032
+ }
1033
+ }
1034
+ catch (e) {
1035
+ return { ok: true, valid: false, type: ssl.pfx ? 'pfx' : 'keycert', details: e?.message || String(e) };
1036
+ }
1037
+ return { ok: true, valid: false, type: 'off', details: 'No SSL configuration found.' };
1038
+ }
1039
+ async generateSelfSignedCertificate(options = {}) {
1040
+ const hostnames = Array.isArray(options.hostnames) && options.hostnames.length
1041
+ ? options.hostnames.map(h => String(h).trim()).filter(Boolean)
1042
+ : ['localhost', '127.0.0.1'];
1043
+ const mode = options.mode || 'keycert';
1044
+ const generator = new SslCertGeneratorService();
1045
+ await generator.generateCertificate(hostnames);
1046
+ const sslDir = join(this.configService.storagePath, 'ssl-certs');
1047
+ const keyPath = join(sslDir, 'private-key.pem');
1048
+ const certPath = join(sslDir, 'certificate.pem');
1049
+ const configFile = await this.configEditorService.getConfigFile();
1050
+ const uiConfigBlock = configFile.platforms.find((x) => x.platform === 'config');
1051
+ if (!uiConfigBlock.ssl) {
1052
+ uiConfigBlock.ssl = {};
1053
+ }
1054
+ if (mode === 'keycert') {
1055
+ uiConfigBlock.ssl.key = keyPath;
1056
+ uiConfigBlock.ssl.cert = certPath;
1057
+ delete uiConfigBlock.ssl.pfx;
1058
+ delete uiConfigBlock.ssl.passphrase;
1059
+ delete uiConfigBlock.ssl.selfSigned;
1060
+ delete uiConfigBlock.ssl.selfSignedHostnames;
1061
+ }
1062
+ else {
1063
+ delete uiConfigBlock.ssl.key;
1064
+ delete uiConfigBlock.ssl.cert;
1065
+ delete uiConfigBlock.ssl.pfx;
1066
+ delete uiConfigBlock.ssl.passphrase;
1067
+ uiConfigBlock.ssl.selfSigned = true;
1068
+ uiConfigBlock.ssl.selfSignedHostnames = hostnames;
1069
+ }
1070
+ await this.configEditorService.updateConfigFile(configFile);
1071
+ return {
1072
+ ok: true,
1073
+ type: 'generated',
1074
+ mode,
1075
+ keyPath: mode === 'keycert' ? keyPath : undefined,
1076
+ certPath: mode === 'keycert' ? certPath : undefined,
1077
+ details: `Self-signed certificate generated for ${hostnames.join(', ')}`,
1078
+ };
1079
+ }
592
1080
  };
593
1081
  ServerService = __decorate([
594
1082
  Injectable(),