Fix totp parsing

This commit is contained in:
Bernd Schoolmann 2024-05-03 21:47:05 +02:00
parent 70f6a47fd5
commit e71622e236
No known key found for this signature in database

View File

@ -17,4 +17,8 @@ def hotp(key, counter, digits=6, digest='sha1'):
def totp(key, time_step=30, digits=6, digest='sha1'):
if key.startswith('otpauth://'):
key = key.split('secret=')[1].split('&')[0]
key = key.replace(' ', '')
key = key.strip()
return hotp(key, int(time.time() / time_step), digits, digest)