26 lines
903 B
JavaScript
26 lines
903 B
JavaScript
#!/usr/bin/env node
|
|
import { Command } from "commander";
|
|
import { createRootKeysCommand } from "../commands/keys/keys.js";
|
|
import { promptForNewPassword } from "../prompt/prompt.js";
|
|
import { runFunction } from "../run-function/run-function.js";
|
|
|
|
const program = new Command()
|
|
.name("create-root-keys")
|
|
.description(
|
|
"Create root keychain (encrypted vault + signed public-key file)"
|
|
)
|
|
.option("-o, --output <dir>", "Output directory", "./keys")
|
|
.action((options: { output: string }) =>
|
|
runFunction("create-root-keys", async (signal) => {
|
|
const password = await promptForNewPassword(
|
|
"Enter password for the root vault"
|
|
);
|
|
await createRootKeysCommand(password, {
|
|
output: options.output,
|
|
...(signal !== undefined ? { signal } : {}),
|
|
});
|
|
})
|
|
);
|
|
|
|
program.parse();
|