feat(cli): authforgectl recovery list and revoke
* RecoveryCmd::List no longer takes a user — lists all active codes across users, matching the daemon's ListRecoveryCodes signature. * RecoveryCmd::Revoke <user> calls RevokeRecoveryCode; exits 1 with a stderr message when the user has no active code. * bus.rs gains list_recovery_codes() / revoke_recovery_code(user). * Two new clap-parser tests cover the new subcommand shapes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use authforge_common::policy::Policy;
|
||||
use authforge_common::types::{Credential, PendingFlag, PolicyApplyResult};
|
||||
use authforge_common::types::{Credential, PendingFlag, PolicyApplyResult, RecoveryCodeSummary};
|
||||
|
||||
const BUS_NAME: &str = "io.dangerousthings.AuthForge";
|
||||
const OBJECT_PATH: &str = "/io/dangerousthings/AuthForge";
|
||||
@@ -56,4 +56,12 @@ impl Daemon {
|
||||
pub async fn generate_recovery_code(&self, user: &str) -> Result<String> {
|
||||
Ok(self.proxy.call("GenerateRecoveryCode", &(user,)).await?)
|
||||
}
|
||||
|
||||
pub async fn list_recovery_codes(&self) -> Result<Vec<RecoveryCodeSummary>> {
|
||||
Ok(self.proxy.call("ListRecoveryCodes", &()).await?)
|
||||
}
|
||||
|
||||
pub async fn revoke_recovery_code(&self, user: &str) -> Result<bool> {
|
||||
Ok(self.proxy.call("RevokeRecoveryCode", &(user,)).await?)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user