Skip to content

Don't extend HmacOneTimePasswordGenerator in TimeBasedOneTimePasswordGenerator #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2022

Conversation

jchambers
Copy link
Owner

Prior to this change,TimeBasedOneTimePasswordGenerator extends HmacOneTimePasswordGenerator. That moooooostly makes sense (TOTP as a standard is, in fact, an extension of HOTP), but creates a couple weird situations in the public API. In particular, it creates a situation where counter-based password-generation methods are visible in TimeBasedOneTimePasswordGenerator instances, and it doesn't really make sense to be requesting one-time passwords from a TOTP generator by counter instead of by time.

After this change, TimeBasedOneTimePasswordGenerator no longer has a base class, and instead delegates to a private HmacOneTimePasswordGenerator instance for password generation. That means its public interface will no longer have counter-based OTP-generation methods. This is technically a breaking API change, but only for callers who were trying to do counter-based operations with a TOTP generator.

Feedback is very welcome!

@jchambers jchambers added this to the 0.4.0 milestone Dec 27, 2021
@jchambers jchambers force-pushed the no_common_base_class branch from b65c0c9 to 891aaba Compare January 9, 2022 02:17
@jchambers jchambers force-pushed the no_common_base_class branch from 891aaba to 813aa85 Compare January 9, 2022 02:24
@jchambers jchambers merged commit 9914c74 into master Jan 9, 2022
@jchambers jchambers deleted the no_common_base_class branch January 9, 2022 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant