feat(TapNodeTools): Add ability to create HTTPS certificates with self-signed option

This commit is contained in:
Philipp Kunz 2024-09-18 18:43:46 +02:00
parent 5a94f116e1
commit c712a9a09c
3 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,10 @@
# Changelog # 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) ## 2024-09-18 - 5.1.4 - fix(ts_node)
Fixed issues in HTTPS certificate generation for TapNodeTools Fixed issues in HTTPS certificate generation for TapNodeTools

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/tapbundle', 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.' description: 'A test automation library bundling utilities and tools for TAP (Test Anything Protocol) based testing, specifically tailored for tapbuffer.'
} }

View File

@ -16,8 +16,14 @@ class TapNodeTools {
} }
public async createHttpsCert( public async createHttpsCert(
commonName: string = 'localhost' commonName: string = 'localhost',
allowSelfSigned: boolean = true
): Promise<{ key: string; cert: string }> { ): 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 // Generate a key pair
const keys = plugins.smartcrypto.nodeForge.pki.rsa.generateKeyPair(2048); const keys = plugins.smartcrypto.nodeForge.pki.rsa.generateKeyPair(2048);