tuwunel_admin/token/list.rs
1use futures::StreamExt;
2use tuwunel_core::Result;
3
4use crate::admin_command;
5
6#[admin_command]
7pub(super) async fn list(&self) -> Result {
8 let tokens: Vec<_> = self
9 .services
10 .registration_tokens
11 .iterate_tokens()
12 .await
13 .collect()
14 .await;
15
16 write!(self, "Found {} registration tokens:\n", tokens.len()).await?;
17
18 for token in tokens {
19 write!(self, "- {token}\n").await?;
20 }
21
22 Ok(())
23}