From 1709c5ed3bfe7395280b0f6fe84ca16e14156e6f Mon Sep 17 00:00:00 2001 From: TheFirstSpine Date: Mon, 26 Aug 2024 20:15:08 +0200 Subject: [PATCH] feat(generate): add challenge --- package.json | 2 +- src/commands/generate.command.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1cf137a..98a79bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@thefirstspine/certificate-authority", - "version": "1.0.4", + "version": "1.0.5", "description": "Self-signed certificate authority to automate & check secure layer for protected endpoints.", "main": "./lib/index.js", "types": "./lib/index.d.ts", diff --git a/src/commands/generate.command.ts b/src/commands/generate.command.ts index 1e96bc9..2e2d54f 100644 --- a/src/commands/generate.command.ts +++ b/src/commands/generate.command.ts @@ -50,6 +50,13 @@ export class GenerateCommand { // Generating pair console.log('Generating pair...'); const result = this.generatePair(); + + // Validate pairs + console.log('Passing challenge...'); + if(!validatorService.challenge(result.certificate, result.privateKey)) { + console.log(`Pair doesn't pass the challenge.`); + return; + } // Write the ertificates fs.writeFileSync(key, result.privateKey);