diff --git a/pve-rs/src/tfa/mod.rs b/pve-rs/src/tfa/mod.rs index 56e63f2..df192b4 100644 --- a/pve-rs/src/tfa/mod.rs +++ b/pve-rs/src/tfa/mod.rs @@ -357,6 +357,37 @@ mod export { ) } + /// Add a totp entry without validating it, used for user.cfg keys. + /// Returns the ID. + #[export] + fn add_totp_entry( + #[try_from_ref] this: &Tfa, + userid: &str, + description: String, + totp: String, + ) -> Result { + Ok(this + .inner + .lock() + .unwrap() + .add_totp(userid, description, totp.parse()?)) + } + + /// Add a yubico entry without validating it, used for user.cfg keys. + /// Returns the ID. + #[export] + fn add_yubico_entry( + #[try_from_ref] this: &Tfa, + userid: &str, + description: String, + yubico: String, + ) -> String { + this.inner + .lock() + .unwrap() + .add_yubico(userid, description, yubico) + } + #[export] fn api_update_tfa_entry( #[try_from_ref] this: &Tfa,