diff --git a/.travis.yml b/.travis.yml index 44a864f..8496169 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ matrix: - python: 3.5 - python: 3.6 - python: 3.7 + - python: 3.8 dist: xenial sudo: true diff --git a/totp_generator/core_utils.py b/totp_generator/core_utils.py index b401cca..c2b8ea9 100644 --- a/totp_generator/core_utils.py +++ b/totp_generator/core_utils.py @@ -109,7 +109,13 @@ def get_services(self): def get_totp_code(self, service): # force six digits - code = "%06d" % (onetimepass.get_totp(self.creds[service]['code'])) + secret = self.creds[service]['code'] + # this attempts to correct the padding when it is missing + # see https://github.com/tadeck/onetimepass/pull/22 + mod = len(secret) % 8 + if mod: + secret += '=' * (8 - mod) + code = "%06d" % (onetimepass.get_totp(secret)) return code def import_creds_from_file(self, file_name):