pyauth / pyotp

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

pyotp.parse_uri does not convert 'interval' or 'counter' to int #108

Closed kemlath closed 3 years ago

kemlath commented 3 years ago

OTP uri's that specify a period or initial count do not work since they are stored as str instead of int. This makes e.g. totp.now() fail because totp.timecode() divides by self.interval which currently is a str when period is specified in the uri.

Simple fix in parse_uri line 87 and 89 cast to int:

elif key == 'period': otp_data['interval'] = int(value) elif key == 'counter': otp_data['initial_count'] = int(value)

kislyuk commented 3 years ago

Thank you for reporting.

Fix released in v2.4.1, please test.