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::shared::render_result;
13
14#[derive(Debug, Subcommand)]
15pub enum KeysCommands {
16    #[command(about = "Generate a fresh RSA-2048 signing keypair")]
17    Generate(generate::GenerateArgs),
18
19    #[command(
20        name = "issue-plugin-token",
21        about = "Mint a long-lived RS256 JWT with `aud=plugin` for hook/governance authentication"
22    )]
23    IssuePluginToken(issue_plugin_token::IssuePluginTokenArgs),
24}
25
26pub async fn execute(cmd: KeysCommands) -> Result<()> {
27    match cmd {
28        KeysCommands::Generate(args) => generate::execute(args),
29        KeysCommands::IssuePluginToken(args) => {
30            let result = issue_plugin_token::execute(args).await?;
31            render_result(&result);
32            Ok(())
33        },
34    }
35}