pyauth / pyotp

Python One-Time Password Library
https://pyauth.github.io/pyotp/
Other
3.03k stars 326 forks source link

TOTP API documentation is missing digits argument #75

Open m-aciek opened 5 years ago

m-aciek commented 5 years ago

Because of overriding __init__() with *args, **kwargs argument we are missing arguments documentation for base class.

therealadityashankar commented 5 years ago

also the interval argument,

therealadityashankar commented 5 years ago

at least in the online docs

therealadityashankar commented 5 years ago

also, and before I point the issue, just wanna say it's really awesome you made this library, :heart:,

It'll be really nice if you put that initiation time is 0 with reference to time.time() in totps' (I figured this from the source code)

pythonmobile commented 2 years ago

Any reason why TOTP.now() is limited to only 10 digits?

>>> import pyotp
>>> totp = pyotp.TOTP('mysecret', digits=11)
>>> totp.now()
'01955539658'
>>>
schongallam commented 1 year ago

pythonmobile: totp.now() will generate up to an 11-character string, if asked to. Due to the 31-bit truncation stipulated by RFC 4226, only 9 cryptologically meaningful digits can be generated. The 10th digit (i.e., string index 1) is almost always going to be a '0' or '1', occasionally '2'. For reasons I'm still exploring, the version of pyotp I'm using (2.8.0) always generates a '1' in the left-most digit place. (sorry for the necropost)