Skip to content

Commit

Permalink
fix(keygen): keygen fails to load
Browse files Browse the repository at this point in the history
The keygen originally depended on the encryption service, but the service depends on nestjs dependency injection to work, which made the keygen fail to load.
  • Loading branch information
nhedger committed Aug 24, 2023
1 parent 8d3ce33 commit b5f1fab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cli/keygen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { parseArgs } from "node:util";
import { EncryptionService, Cipher, ciphers } from "../lib";
import { randomBytes } from "node:crypto";
import { Cipher, ciphers } from "../lib/encryption.ciphers";

const {
values: { cipher },
Expand All @@ -19,6 +20,9 @@ if (!ciphers[cipher as Cipher]) {
console.error(
`The provided cipher "${cipher}" is not supported. Supported ciphers are: ${supportedCiphers}`,
);
process.exit(1);
}

console.log(EncryptionService.generateKey(cipher as Cipher));
console.log(
randomBytes(ciphers[cipher as Cipher].keyLength).toString("base64"),
);

0 comments on commit b5f1fab

Please sign in to comment.