@rushstack/debug-certificate-manager 1.5.2 → 1.5.4

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.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "@rushstack/debug-certificate-manager",
3
3
  "entries": [
4
+ {
5
+ "version": "1.5.4",
6
+ "tag": "@rushstack/debug-certificate-manager_v1.5.4",
7
+ "date": "Tue, 26 Aug 2025 00:12:57 GMT",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "comment": "Fix handling of home directory paths when reading debug-certificate-manager.json config file."
12
+ }
13
+ ]
14
+ }
15
+ },
16
+ {
17
+ "version": "1.5.3",
18
+ "tag": "@rushstack/debug-certificate-manager_v1.5.3",
19
+ "date": "Tue, 19 Aug 2025 20:45:02 GMT",
20
+ "comments": {
21
+ "dependency": [
22
+ {
23
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.74.3`"
24
+ }
25
+ ]
26
+ }
27
+ },
4
28
  {
5
29
  "version": "1.5.2",
6
30
  "tag": "@rushstack/debug-certificate-manager_v1.5.2",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Change Log - @rushstack/debug-certificate-manager
2
2
 
3
- This log was last generated on Fri, 01 Aug 2025 00:12:48 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 26 Aug 2025 00:12:57 GMT and should not be manually modified.
4
+
5
+ ## 1.5.4
6
+ Tue, 26 Aug 2025 00:12:57 GMT
7
+
8
+ ### Patches
9
+
10
+ - Fix handling of home directory paths when reading debug-certificate-manager.json config file.
11
+
12
+ ## 1.5.3
13
+ Tue, 19 Aug 2025 20:45:02 GMT
14
+
15
+ _Version update only_
4
16
 
5
17
  ## 1.5.2
6
18
  Fri, 01 Aug 2025 00:12:48 GMT
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.9"
8
+ "packageVersion": "7.52.11"
9
9
  }
10
10
  ]
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CertificateStore.d.ts","sourceRoot":"","sources":["../src/CertificateStore.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAC5C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IAEpC,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAqB;gBAElB,OAAO,GAAE,wBAA6B;IAkEzD;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;OAEG;IACH,IAAW,iBAAiB,IAAI,MAAM,CAErC;IAED;;OAEG;IACH,IAAW,eAAe,IAAI,MAAM,CAEnC;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED;;OAEG;IACH,IAAW,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAYjD;IAED,IAAW,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAQ3D;IAED;;OAEG;IACH,IAAW,eAAe,IAAI,MAAM,GAAG,SAAS,CAY/C;IAED,IAAW,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAQzD;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,MAAM,GAAG,SAAS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AM,GAAG,SAAS,CAYvC;IAED,IAAW,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAQzC;CACF"}
@@ -62,6 +62,9 @@ class CertificateStore {
62
62
  debugCertificateManagerConfig = JSON.parse(configContent);
63
63
  if (debugCertificateManagerConfig.storePath) {
64
64
  storePath = path.resolve(currentDir, debugCertificateManagerConfig.storePath);
65
+ if (storePath.startsWith('~')) {
66
+ storePath = path.join((0, os_1.homedir)(), storePath.slice(2));
67
+ }
65
68
  }
66
69
  }
67
70
  const parentDir = path.dirname(currentDir);
@@ -1 +1 @@
1
- {"version":3,"file":"CertificateStore.js","sourceRoot":"","sources":["../src/CertificateStore.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,2BAA6B;AAE7B,oEAA0D;AA6B1D;;;GAGG;AACH,MAAa,gBAAgB;IAU3B,YAAmB,UAAoC,EAAE;;QACvD,MAAM,kBAAkB,GAAuB,OAAO,CAAC,SAAS,CAAC;QAEjE,IAAI,SAA6B,CAAC;QAClC,IAAI,6BAA6B,GAAyC,SAAS,CAAC;QAEpF,IAAI,kBAAkB,EAAE,CAAC;YACvB,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,qFAAqF;YACrF,IAAI,UAAU,GAAuB,OAAO,CAAC,GAAG,EAAE,CAAC;YACnD,OAAO,UAAU,EAAE,CAAC;gBAClB,MAAM,iCAAiC,GAAW,IAAI,CAAC,IAAI,CACzD,UAAU,EACV,SAAS,EACT,gCAAgC,CACjC,CAAC;gBACF,IAAI,8BAAU,CAAC,MAAM,CAAC,iCAAiC,CAAC,EAAE,CAAC;oBACzD,MAAM,aAAa,GAAW,8BAAU,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAC;oBACrF,6BAA6B,GAAG,IAAI,CAAC,KAAK,CAA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GAAG,CAAC,EAAE,CAAC;oBACrC,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAW,OAAO,CAAC,GAAuB;QACxC,IAAI,GAAG,EAAE,CAAC;YACR,8BAAU,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC3C,CAAC;aAAM,IAAI,8BAAU,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5C,8BAAU,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;IACtB,CAAC;CACF;AAxLD,4CAwLC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport { homedir } from 'os';\n\nimport { FileSystem } from '@rushstack/node-core-library';\n\n/**\n * Options for configuring paths and filenames used by the `CertificateStore`.\n * @public\n */\nexport interface ICertificateStoreOptions {\n /**\n * Path to the directory where the certificate store will be created.\n * If not provided, it defaults to `<homedir>/.rushstack`.\n */\n storePath?: string;\n /**\n * Filename of the CA certificate file within the store directory.\n * If not provided, it defaults to `rushstack-ca.pem`.\n */\n caCertificateFilename?: string;\n /**\n * Filename of the TLS certificate file within the store directory.\n * If not provided, it defaults to `rushstack-serve.pem`.\n */\n certificateFilename?: string;\n /**\n * Filename of the TLS key file within the store directory.\n * If not provided, it defaults to `rushstack-serve.key`.\n */\n keyFilename?: string;\n}\n\n/**\n * Store to retrieve and save debug certificate data.\n * @public\n */\nexport class CertificateStore {\n private readonly _caCertificatePath: string;\n private readonly _certificatePath: string;\n private readonly _keyPath: string;\n private readonly _storePath: string;\n\n private _caCertificateData: string | undefined;\n private _certificateData: string | undefined;\n private _keyData: string | undefined;\n\n public constructor(options: ICertificateStoreOptions = {}) {\n const requestedStorePath: string | undefined = options.storePath;\n\n let storePath: string | undefined;\n let debugCertificateManagerConfig: ICertificateStoreOptions | undefined = undefined;\n\n if (requestedStorePath) {\n storePath = path.resolve(requestedStorePath);\n } else {\n // TLS Sync extension configuration lives in `.vscode/debug-certificate-manager.json`\n let currentDir: string | undefined = process.cwd();\n while (currentDir) {\n const debugCertificateManagerConfigFile: string = path.join(\n currentDir,\n '.vscode',\n 'debug-certificate-manager.json'\n );\n if (FileSystem.exists(debugCertificateManagerConfigFile)) {\n const configContent: string = FileSystem.readFile(debugCertificateManagerConfigFile);\n debugCertificateManagerConfig = JSON.parse(configContent) as ICertificateStoreOptions;\n if (debugCertificateManagerConfig.storePath) {\n storePath = path.resolve(currentDir, debugCertificateManagerConfig.storePath);\n }\n }\n const parentDir: string | undefined = path.dirname(currentDir);\n if (parentDir === currentDir) {\n break; // reached the root directory\n }\n currentDir = parentDir;\n }\n\n if (!storePath) {\n // Fallback to the user's home directory under `.rushstack`\n const unresolvedUserFolder: string = homedir();\n const userProfilePath: string = path.resolve(unresolvedUserFolder);\n if (!FileSystem.exists(userProfilePath)) {\n throw new Error(\"Unable to determine the current user's home directory\");\n }\n storePath = path.join(userProfilePath, '.rushstack');\n }\n }\n FileSystem.ensureFolder(storePath);\n\n const caCertificatePath: string = path.join(\n storePath,\n options.caCertificateFilename ??\n debugCertificateManagerConfig?.caCertificateFilename ??\n 'rushstack-ca.pem'\n );\n const certificatePath: string = path.join(\n storePath,\n options.certificateFilename ??\n debugCertificateManagerConfig?.certificateFilename ??\n 'rushstack-serve.pem'\n );\n const keyPath: string = path.join(\n storePath,\n options.keyFilename ?? debugCertificateManagerConfig?.keyFilename ?? 'rushstack-serve.key'\n );\n\n this._storePath = storePath;\n this._caCertificatePath = caCertificatePath;\n this._certificatePath = certificatePath;\n this._keyPath = keyPath;\n }\n\n /**\n * Path to the directory where the debug certificates are stored.\n */\n public get storePath(): string {\n return this._storePath;\n }\n\n /**\n * Path to the saved debug CA certificate\n */\n public get caCertificatePath(): string {\n return this._caCertificatePath;\n }\n\n /**\n * Path to the saved debug TLS certificate\n */\n public get certificatePath(): string {\n return this._certificatePath;\n }\n\n /**\n * Path to the saved debug TLS key\n */\n public get keyPath(): string {\n return this._keyPath;\n }\n\n /**\n * Debug Certificate Authority certificate pem file contents.\n */\n public get caCertificateData(): string | undefined {\n if (!this._caCertificateData) {\n try {\n this._caCertificateData = FileSystem.readFile(this._caCertificatePath);\n } catch (err) {\n if (!FileSystem.isNotExistError(err)) {\n throw err;\n }\n }\n }\n\n return this._caCertificateData;\n }\n\n public set caCertificateData(certificate: string | undefined) {\n if (certificate) {\n FileSystem.writeFile(this._caCertificatePath, certificate);\n } else if (FileSystem.exists(this._caCertificatePath)) {\n FileSystem.deleteFile(this._caCertificatePath);\n }\n\n this._caCertificateData = certificate;\n }\n\n /**\n * Debug TLS Server certificate pem file contents.\n */\n public get certificateData(): string | undefined {\n if (!this._certificateData) {\n try {\n this._certificateData = FileSystem.readFile(this._certificatePath);\n } catch (err) {\n if (!FileSystem.isNotExistError(err)) {\n throw err;\n }\n }\n }\n\n return this._certificateData;\n }\n\n public set certificateData(certificate: string | undefined) {\n if (certificate) {\n FileSystem.writeFile(this._certificatePath, certificate);\n } else if (FileSystem.exists(this._certificatePath)) {\n FileSystem.deleteFile(this._certificatePath);\n }\n\n this._certificateData = certificate;\n }\n\n /**\n * Key used to sign the debug pem certificate.\n */\n public get keyData(): string | undefined {\n if (!this._keyData) {\n try {\n this._keyData = FileSystem.readFile(this._keyPath);\n } catch (err) {\n if (!FileSystem.isNotExistError(err)) {\n throw err;\n }\n }\n }\n\n return this._keyData;\n }\n\n public set keyData(key: string | undefined) {\n if (key) {\n FileSystem.writeFile(this._keyPath, key);\n } else if (FileSystem.exists(this._keyPath)) {\n FileSystem.deleteFile(this._keyPath);\n }\n\n this._keyData = key;\n }\n}\n"]}
1
+ {"version":3,"file":"CertificateStore.js","sourceRoot":"","sources":["../src/CertificateStore.ts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AAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC3C,CAAC;aAAM,IAAI,8BAAU,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5C,8BAAU,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;IACtB,CAAC;CACF;AA3LD,4CA2LC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport { homedir } from 'os';\n\nimport { FileSystem } from '@rushstack/node-core-library';\n\n/**\n * Options for configuring paths and filenames used by the `CertificateStore`.\n * @public\n */\nexport interface ICertificateStoreOptions {\n /**\n * Path to the directory where the certificate store will be created.\n * If not provided, it defaults to `<homedir>/.rushstack`.\n */\n storePath?: string;\n /**\n * Filename of the CA certificate file within the store directory.\n * If not provided, it defaults to `rushstack-ca.pem`.\n */\n caCertificateFilename?: string;\n /**\n * Filename of the TLS certificate file within the store directory.\n * If not provided, it defaults to `rushstack-serve.pem`.\n */\n certificateFilename?: string;\n /**\n * Filename of the TLS key file within the store directory.\n * If not provided, it defaults to `rushstack-serve.key`.\n */\n keyFilename?: string;\n}\n\n/**\n * Store to retrieve and save debug certificate data.\n * @public\n */\nexport class CertificateStore {\n private readonly _caCertificatePath: string;\n private readonly _certificatePath: string;\n private readonly _keyPath: string;\n private readonly _storePath: string;\n\n private _caCertificateData: string | undefined;\n private _certificateData: string | undefined;\n private _keyData: string | undefined;\n\n public constructor(options: ICertificateStoreOptions = {}) {\n const requestedStorePath: string | undefined = options.storePath;\n\n let storePath: string | undefined;\n let debugCertificateManagerConfig: ICertificateStoreOptions | undefined = undefined;\n\n if (requestedStorePath) {\n storePath = path.resolve(requestedStorePath);\n } else {\n // TLS Sync extension configuration lives in `.vscode/debug-certificate-manager.json`\n let currentDir: string | undefined = process.cwd();\n while (currentDir) {\n const debugCertificateManagerConfigFile: string = path.join(\n currentDir,\n '.vscode',\n 'debug-certificate-manager.json'\n );\n if (FileSystem.exists(debugCertificateManagerConfigFile)) {\n const configContent: string = FileSystem.readFile(debugCertificateManagerConfigFile);\n debugCertificateManagerConfig = JSON.parse(configContent) as ICertificateStoreOptions;\n if (debugCertificateManagerConfig.storePath) {\n storePath = path.resolve(currentDir, debugCertificateManagerConfig.storePath);\n if (storePath.startsWith('~')) {\n storePath = path.join(homedir(), storePath.slice(2));\n }\n }\n }\n const parentDir: string | undefined = path.dirname(currentDir);\n if (parentDir === currentDir) {\n break; // reached the root directory\n }\n currentDir = parentDir;\n }\n\n if (!storePath) {\n // Fallback to the user's home directory under `.rushstack`\n const unresolvedUserFolder: string = homedir();\n const userProfilePath: string = path.resolve(unresolvedUserFolder);\n if (!FileSystem.exists(userProfilePath)) {\n throw new Error(\"Unable to determine the current user's home directory\");\n }\n storePath = path.join(userProfilePath, '.rushstack');\n }\n }\n FileSystem.ensureFolder(storePath);\n\n const caCertificatePath: string = path.join(\n storePath,\n options.caCertificateFilename ??\n debugCertificateManagerConfig?.caCertificateFilename ??\n 'rushstack-ca.pem'\n );\n const certificatePath: string = path.join(\n storePath,\n options.certificateFilename ??\n debugCertificateManagerConfig?.certificateFilename ??\n 'rushstack-serve.pem'\n );\n const keyPath: string = path.join(\n storePath,\n options.keyFilename ?? debugCertificateManagerConfig?.keyFilename ?? 'rushstack-serve.key'\n );\n\n this._storePath = storePath;\n this._caCertificatePath = caCertificatePath;\n this._certificatePath = certificatePath;\n this._keyPath = keyPath;\n }\n\n /**\n * Path to the directory where the debug certificates are stored.\n */\n public get storePath(): string {\n return this._storePath;\n }\n\n /**\n * Path to the saved debug CA certificate\n */\n public get caCertificatePath(): string {\n return this._caCertificatePath;\n }\n\n /**\n * Path to the saved debug TLS certificate\n */\n public get certificatePath(): string {\n return this._certificatePath;\n }\n\n /**\n * Path to the saved debug TLS key\n */\n public get keyPath(): string {\n return this._keyPath;\n }\n\n /**\n * Debug Certificate Authority certificate pem file contents.\n */\n public get caCertificateData(): string | undefined {\n if (!this._caCertificateData) {\n try {\n this._caCertificateData = FileSystem.readFile(this._caCertificatePath);\n } catch (err) {\n if (!FileSystem.isNotExistError(err)) {\n throw err;\n }\n }\n }\n\n return this._caCertificateData;\n }\n\n public set caCertificateData(certificate: string | undefined) {\n if (certificate) {\n FileSystem.writeFile(this._caCertificatePath, certificate);\n } else if (FileSystem.exists(this._caCertificatePath)) {\n FileSystem.deleteFile(this._caCertificatePath);\n }\n\n this._caCertificateData = certificate;\n }\n\n /**\n * Debug TLS Server certificate pem file contents.\n */\n public get certificateData(): string | undefined {\n if (!this._certificateData) {\n try {\n this._certificateData = FileSystem.readFile(this._certificatePath);\n } catch (err) {\n if (!FileSystem.isNotExistError(err)) {\n throw err;\n }\n }\n }\n\n return this._certificateData;\n }\n\n public set certificateData(certificate: string | undefined) {\n if (certificate) {\n FileSystem.writeFile(this._certificatePath, certificate);\n } else if (FileSystem.exists(this._certificatePath)) {\n FileSystem.deleteFile(this._certificatePath);\n }\n\n this._certificateData = certificate;\n }\n\n /**\n * Key used to sign the debug pem certificate.\n */\n public get keyData(): string | undefined {\n if (!this._keyData) {\n try {\n this._keyData = FileSystem.readFile(this._keyPath);\n } catch (err) {\n if (!FileSystem.isNotExistError(err)) {\n throw err;\n }\n }\n }\n\n return this._keyData;\n }\n\n public set keyData(key: string | undefined) {\n if (key) {\n FileSystem.writeFile(this._keyPath, key);\n } else if (FileSystem.exists(this._keyPath)) {\n FileSystem.deleteFile(this._keyPath);\n }\n\n this._keyData = key;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/debug-certificate-manager",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "Cross-platform functionality to create debug ssl certificates.",
5
5
  "main": "lib/index.js",
6
6
  "typings": "dist/debug-certificate-manager.d.ts",
@@ -18,7 +18,7 @@
18
18
  "devDependencies": {
19
19
  "@types/node-forge": "1.0.4",
20
20
  "eslint": "~9.25.1",
21
- "@rushstack/heft": "0.74.2",
21
+ "@rushstack/heft": "0.74.3",
22
22
  "local-node-rig": "1.0.0"
23
23
  },
24
24
  "scripts": {