This commit is contained in:
seb
2026-07-06 01:31:11 +02:00
commit 917930d0fa
34 changed files with 2912 additions and 0 deletions

24
generate-cert.js Normal file
View File

@@ -0,0 +1,24 @@
import { execSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { logger } from './src/logger.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const certsDir = path.join(__dirname, 'certs');
const keyPath = path.join(certsDir, 'key.pem');
const certPath = path.join(certsDir, 'cert.pem');
fs.mkdirSync(certsDir, { recursive: true });
const subject = '/CN=localhost/O=JTL POS Sync/C=DE';
const san = 'subjectAltName=DNS:localhost,IP:127.0.0.1,IP:0.0.0.0';
execSync(
`openssl req -x509 -newkey rsa:2048 -nodes -keyout "${keyPath}" -out "${certPath}" -days 3650 -subj "${subject}" -addext "${san}"`,
{ stdio: 'inherit' }
);
logger.success(`Wrote ${keyPath}`);
logger.success(`Wrote ${certPath}`);