29 lines
786 B
Rust
29 lines
786 B
Rust
//! Token CRUD and the `slinuxm token` CLI (WS-D owns this file).
|
|
//!
|
|
//! STUB: `TokenCmd` and `run` signatures are final. Tokens have the prefix
|
|
//! `slinuxm_`, 32 random bytes, only the sha256 hash is stored, and the
|
|
//! plaintext is printed once on create.
|
|
|
|
use anyhow::Result;
|
|
use clap::Subcommand;
|
|
|
|
use crate::config::Config;
|
|
|
|
#[derive(Debug, Clone, Subcommand)]
|
|
pub enum TokenCmd {
|
|
/// Create a token and print it once.
|
|
Create {
|
|
/// Unique token name.
|
|
name: String,
|
|
},
|
|
/// List tokens (never prints secrets).
|
|
List,
|
|
/// Revoke a token by name.
|
|
Revoke { name: String },
|
|
}
|
|
|
|
/// Execute a token subcommand against the DB at `config.auth.db_path`.
|
|
pub async fn run(_cmd: TokenCmd, _config: &Config) -> Result<()> {
|
|
todo!("WS-D D3/D4")
|
|
}
|