From c712a9a09c8da6351f1ff69c8bd9d9effcbd307d Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 18 Sep 2024 18:43:46 +0200 Subject: [PATCH] feat(TapNodeTools): Add ability to create HTTPS certificates with self-signed option --- changelog.md | 5 +++++ ts/00_commitinfo_data.ts | 2 +- ts_node/classes.tapnodetools.ts | 8 +++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index dfff62e..e951c13 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog +## 2024-09-18 - 5.2.0 - feat(TapNodeTools) +Add ability to create HTTPS certificates with self-signed option + +- Introduced a new parameter `allowSelfSigned` to the `createHttpsCert` function. + ## 2024-09-18 - 5.1.4 - fix(ts_node) Fixed issues in HTTPS certificate generation for TapNodeTools diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 709a6b5..989ac13 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/tapbundle', - version: '5.1.4', + version: '5.2.0', description: 'A test automation library bundling utilities and tools for TAP (Test Anything Protocol) based testing, specifically tailored for tapbuffer.' } diff --git a/ts_node/classes.tapnodetools.ts b/ts_node/classes.tapnodetools.ts index c9003fb..220a22f 100644 --- a/ts_node/classes.tapnodetools.ts +++ b/ts_node/classes.tapnodetools.ts @@ -16,8 +16,14 @@ class TapNodeTools { } public async createHttpsCert( - commonName: string = 'localhost' + commonName: string = 'localhost', + allowSelfSigned: boolean = true ): Promise<{ key: string; cert: string }> { + if (allowSelfSigned) { + // set node to allow self-signed certificates + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + } + // Generate a key pair const keys = plugins.smartcrypto.nodeForge.pki.rsa.generateKeyPair(2048);