bitwarden_vault::totp

Function generate_totp

Source
pub fn generate_totp(
    key: String,
    time: Option<DateTime<Utc>>,
) -> Result<TotpResponse, TotpError>
Expand description

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.

Arguments:

  • key - The key to generate the TOTP code from
  • time - The time in UTC to generate the TOTP code for, defaults to current system time