Closed orion78fr closed 2 years ago
I'm definitely open to the idea, I think it'll be really helpful!
Step & Digits can be moved up to TOTP parameters. Similarly, counter & digits would also get moved up in HOTP.
I'm assuming you're thinking of having one utility method return either a HOTP or TOTP instance?
I'm assuming you're thinking of having one utility method return either a HOTP or TOTP instance?
Exactly, because the type is in the URI.
That sounds perfect! I'm assuming you'll return an enum which contains either an HOTP or TOTP associated value?
Also, I would gladly accept a PR, I'm on the newer side to rust myself, so no issues there!
I'm assuming you'll return an enum which contains either an HOTP or TOTP associated value?
Yeah, that's why parameters like number of digit and step size needs to be moved to the HOTP / TOTP structs, because these are specified in the uri.
I'm not sure when I'll be done as I'll do it during free time, but I started working on it.
Yeah, that's why parameters like number of digit and step size needs to be moved to the HOTP / TOTP structs, because these are specified in the uri.
Yeah, that makes sense. Thanks for the help!
Implemented with #2!
What do you think about an otpauth uri parser ? https://github.com/google/google-authenticator/wiki/Key-Uri-Format
Seems like an easy-enough task, I may be able to write a PR for it if you want (disclaimer: I'm a rust beginner). Like a function in the util mod that takes a &str of the uri and give back an enum of TOTP, HOTP or Error message.
Edit : By the way, this may need to move the digits & step to the TOTP struct, as these are constants for the TOTP generation.