Skip to main content

systemprompt_cli/commands/admin/keys/
mod.rs

1//! `admin keys` command tree: RSA signing-key management for the JWT plane.
2//!
3//! [`KeysCommands`] generates fresh RS256 keypairs and mints long-lived
4//! `aud=plugin` tokens used for hook and governance authentication.
5
6mod generate;
7mod issue_plugin_token;
8
9use anyhow::Result;
10use clap::Subcommand;
11
12use crate::context::CommandContext;
13use crate::shared::render_result;
14
15#[derive(Debug, Subcommand)]
16pub enum KeysCommands {
17    #[command(about = "Generate a fresh RSA-2048 signing keypair")]
18    Generate(generate::GenerateArgs),
19
20    #[command(
21        name = "issue-plugin-token",
22        about = "Mint a long-lived RS256 JWT with `aud=plugin` for hook/governance authentication"
23    )]
24    IssuePluginToken(issue_plugin_token::IssuePluginTokenArgs),
25}
26
27pub async fn execute(cmd: KeysCommands, ctx: &CommandContext) -> Result<()> {
28    match cmd {
29        KeysCommands::Generate(args) => generate::execute(args),
30        KeysCommands::IssuePluginToken(args) => {
31            let result = issue_plugin_token::execute(args).await?;
32            render_result(&result, &ctx.cli);
33            Ok(())
34        },
35    }
36}