constantoine/totp-rs

BUG: Issuer error

Closed this issue · 2 comments

Example:

let auth = "otpauth://totp/Cloudflare:123?secret=OOO&issuer=Cloudflare";
let totp = TOTP::<Vec<u8>>::from_url(auth);
// totp = Err(Issuer,)

I identified the issue, I'm adding some tests, but I'll spend a bit more time investigating and making sure there isn't other errors like this. I'll update this issue when I'm about to release

Okay, two issues

  • In your case, Issuer could be prefixed with /
  • The url library decoded url parameters, but didn't decode the path, which could lead to inconsistencies between the Issuer in the path and the Issuer in the url query, which would only occur with special characters in the issuer

Those are unfortunate cases which are now tested to ensure no regressions in the future. I'm going to publish 2.0.1 soon