Skip to content

Commit

Permalink
feat(generate): add challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
thefirstspine committed Aug 26, 2024
1 parent 372972f commit 1709c5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 7 additions & 0 deletions src/commands/generate.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1709c5e

Please sign in to comment.