xlzd / gotp

Golang OTP(One-Time Password) Library.
MIT License
468 stars 67 forks source link

Add utils - TOPT.AtTime, IsSecretValid, and int64 of timestamps #24

Closed ShadiestGoat closed 2 years ago

ShadiestGoat commented 2 years ago

Hello! This is a small PR that resolves issue #6, #10 and #18. I think this would be considered a breaking change, since I changed the types from int to int64 to all timestamps & intervals. I didn't change it to digits, because I don't see how that is related to timestamps & so it shouldn't really matter.

For IsSecretValid(), I just copied an already existing method of OTP.byteSecret, but instead of panic on an error, I just return false.

I don't have a lot of experience with test making, so I just used the other tests as an example for the tests. Please, feel free to edit this if there is something not up to standard!

mergenchik commented 2 years ago

Hi Shady Goat (I hope it is not your name :)). Thank you for your contributions, I think we need to release it as a new version, since there are breaking changes. I wrote an email to @xlzd to discuss new version on 2022-08-07 (5 days ago), he did not reply yet. Let's wait one two weeks more. I will review the changes.

ShadiestGoat commented 2 years ago

Thank you for the information! I will wait eagerly for the next version.

ShadiestGoat commented 2 years ago

@mergenchik done.