hivectl: print token to stdout for non-agent users (#662)

This commit is contained in:
damocles 2026-05-30 21:39:42 +02:00 committed by Mara
commit 18253bf2f5
3 changed files with 121 additions and 40 deletions

View file

@ -263,6 +263,20 @@ pub async fn ensure_user_for(
Ok(())
}
/// Register a matrix account for `name` and return the freshly-minted
/// access token. Unlike [`ensure_user_for`], the token is **not**
/// persisted to disk — the caller is responsible for storing it. Used
/// by `hivectl matrix create-user` for human (non-agent) accounts so
/// we don't create stray `/var/lib/hyperhive/agents/<name>/` directories
/// for users that aren't agents (#662).
pub async fn provision_user_token(
client: &reqwest::Client,
name: &str,
register_token: &str,
) -> Result<String> {
register_user(client, name, register_token).await
}
/// Per-agent matrix sync: ensure the agent has a matrix account + token.
/// All operations are idempotent; failures are logged as warnings but
/// don't abort the caller.