xlzd / gotp

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

totp.go times other than now #6

Closed Dr-Syn closed 2 years ago

Dr-Syn commented 4 years ago

Good afternoon;

In the totp.go function "At" you've got an 'int' timestamp - presumably a UNIX time integer - being fed into that function.

Seeing as you've already got "time" as a dependency, perhaps it might be better for that to be a "Time" object? This way, users of the library can have the Time functions calculate the various windows and such rather than having to extract the current or future time, do the conversion, and then convert to an int to feed into that function.

I already have to call https://golang.org/pkg/time/#Unix to get that, after all

mergenchik commented 2 years ago

Yes, actually we can add extra method which will accept Time struct as parameter.

mergenchik commented 2 years ago

Maybe also solve #10 by adding extra method.

mergenchik commented 2 years ago

Closing this issue, implemented in #24

Dr-Syn commented 1 year ago

Oh awesome; thank you!