Limited use registration token support

Co-authored-by: Ginger <ginger@gingershaped.computer>
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
dasha_uwu
2026-01-24 11:29:56 +05:00
committed by Jason Volk
parent 0dbe79df8e
commit 56f3f5ea15
12 changed files with 494 additions and 43 deletions

36
src/admin/token/mod.rs Normal file
View File

@@ -0,0 +1,36 @@
mod commands;
use clap::Subcommand;
use tuwunel_core::Result;
use crate::admin_command_dispatch;
#[admin_command_dispatch]
#[derive(Debug, Subcommand)]
pub(crate) enum TokenCommand {
/// - Issue a new registration token
Issue {
/// The maximum number of times this token is allowed to be used before
/// it expires.
#[arg(long)]
max_uses: Option<u64>,
/// The maximum age of this token (e.g. 30s, 5m, 7d). It will expire
/// after this much time has passed.
#[arg(long)]
max_age: Option<String>,
/// A shortcut for `--max-uses 1`.
#[arg(long)]
once: bool,
},
/// - Revoke a registration token
Revoke {
/// The token to revoke.
token: String,
},
/// - List all registration tokens
List,
}