riverrun/one_time_pass_ecto

`last` needs to be 1 or greater or the library doesn't work

Closed this issue · 1 comments

If you use 0 as the "last" value, the verification fails:

secret = OneTimePassEcto.Base.gen_secret(32)
code = OneTimePassEcto.Base.gen_hotp(secret, 0)
OneTimePassEcto.Base.check_hotp(code, secret) # => false

But it works with 1:

secret = OneTimePassEcto.Base.gen_secret(32)
code = OneTimePassEcto.Base.gen_hotp(secret, 1)
OneTimePassEcto.Base.check_hotp(code, secret) # => 1

Took me a while to figure this out! Seems like it would be good to document this somewhere?

Sorry for the delay in getting back to you - there is just never enough time :)

I have added a little note to the documentation.

And for your information, I am deprecating this library, as I do not have the time and energy needed to devote to it. I have updated the README with recommendations for other one-time password libraries.