feat(cli): Add generate-keys CLI command

This commit is contained in:
Jesse Wierzbinski 2024-10-24 18:18:39 +02:00
parent 33f16bb9b1
commit 11bb0a6f49
No known key found for this signature in database
5 changed files with 77 additions and 77 deletions

View file

@ -0,0 +1,18 @@
import chalk from "chalk";
import { User } from "~/classes/database/user";
import { BaseCommand } from "~/cli/base";
export default class GenerateKeys extends BaseCommand<typeof GenerateKeys> {
static override args = {};
static override description = "Generates keys to use in Versia Server";
static override flags = {};
public async run(): Promise<void> {
const { public_key, private_key } = await User.generateKeys();
this.log(`Generated public key: ${chalk.gray(public_key)}`);
this.log(`Generated private key: ${chalk.gray(private_key)}`);
}
}