diff --git a/crates/bitwarden-uniffi/src/vault/mod.rs b/crates/bitwarden-uniffi/src/vault/mod.rs index 6dc84b4d4..3ea9597a3 100644 --- a/crates/bitwarden-uniffi/src/vault/mod.rs +++ b/crates/bitwarden-uniffi/src/vault/mod.rs @@ -48,6 +48,6 @@ impl ClientVault { /// - OTP Auth URI /// - Steam URI pub async fn generate_totp(&self, key: String, time: Option>) -> TotpResponse { - self.0 .0.read().await.vault().generate_totp(key).await + self.0 .0.read().await.vault().generate_totp(key, time).await } } diff --git a/crates/bitwarden/src/vault/totp.rs b/crates/bitwarden/src/vault/totp.rs index d754c62f9..19b32a6a7 100644 --- a/crates/bitwarden/src/vault/totp.rs +++ b/crates/bitwarden/src/vault/totp.rs @@ -6,13 +6,25 @@ use serde::{Deserialize, Serialize}; #[serde(rename_all = "camelCase", deny_unknown_fields)] #[cfg_attr(feature = "mobile", derive(uniffi::Record))] pub struct TotpResponse { + /// Generated TOTP code pub code: String, - pub interval: u32, + /// Time period + pub period: u32, } +/// Generate a OATH or RFC 6238 TOTP code from a provided key. +/// +/// https://datatracker.ietf.org/doc/html/rfc6238 +/// +/// Key can be either: +/// - A base32 encoded string +/// - OTP Auth URI +/// - Steam URI +/// +/// Supports providing an optional time, and defaults to current system time if none is provided. pub async fn generate_totp(_key: String, _time: Option>) -> TotpResponse { TotpResponse { code: "000 000".to_string(), - interval: 30, + period: 30, } } diff --git a/languages/kotlin/doc.md b/languages/kotlin/doc.md index 52af31c85..6174df750 100644 --- a/languages/kotlin/doc.md +++ b/languages/kotlin/doc.md @@ -1283,11 +1283,11 @@ implementations. code string - + Generated TOTP code - interval + period integer - + Time period