Parse otpauth URL with Steam as issuer as Steam TOTP

This commit is contained in:
timvisee 2023-01-04 16:20:38 +01:00
parent c5fd8207fb
commit 068b746a79
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
1 changed files with 10 additions and 1 deletions

View File

@ -516,7 +516,10 @@ impl TOTP {
match url.host() { match url.host() {
Some(Host::Domain("totp")) => {} Some(Host::Domain("totp")) => {}
#[cfg(feature = "steam")] #[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())); return Err(TotpUrlError::Host(url.host().unwrap().to_string()));
} }
@ -570,6 +573,12 @@ impl TOTP {
) )
.ok_or_else(|| TotpUrlError::Secret(value.to_string()))?; .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" => { "issuer" => {
let param_issuer = value let param_issuer = value
.parse::<String>() .parse::<String>()