From 068b746a79372ba0d9da44c16124890b0389e485 Mon Sep 17 00:00:00 2001 From: timvisee Date: Wed, 4 Jan 2023 16:20:38 +0100 Subject: [PATCH] Parse otpauth URL with Steam as issuer as Steam TOTP --- src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 82cecca..3b08937 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -516,7 +516,10 @@ impl TOTP { match url.host() { Some(Host::Domain("totp")) => {} #[cfg(feature = "steam")] - Some(Host::Domain("steam")) => algorithm = Algorithm::Steam, + Some(Host::Domain("steam")) => { + algorithm = Algorithm::Steam; + digits = 5; + } _ => { return Err(TotpUrlError::Host(url.host().unwrap().to_string())); } @@ -570,6 +573,12 @@ impl TOTP { ) .ok_or_else(|| TotpUrlError::Secret(value.to_string()))?; } + #[cfg(feature = "steam")] + "issuer" if value.to_lowercase() == "steam" => { + algorithm = Algorithm::Steam; + digits = 5; + issuer = Some(value.into()); + } "issuer" => { let param_issuer = value .parse::()