@@ 25,7 25,9 @@ class OTPUrl:
self.issuer = qs['issuer'][0] if 'issuer' in qs else None
self.period = int(qs['period'][0]) if 'period' in qs else 30
self.digits = int(qs['digits'][0]) if 'digits' in qs else 6
- self.initial_count = int(qs['initial_count'][0]) if 'initial_count' in qs else 0
+ self.initial_count = int(qs['counter'][0]) if 'counter' in qs else 0
+ if 'initial_count' in qs:
+ self.initial_count = int(qs['initial_count'][0])
self.digest = hashlib.sha1
if 'digest' in qs:
@@ 61,7 63,7 @@ class OTPUrl:
if self.type == 'totp':
properties['period'] = self.period
elif self.type == 'hotp':
- properties['initial_count'] = self.initial_count
+ properties['counter'] = self.initial_count
qs = urlencode(properties, doseq=True)
url = urlunparse(['otpauth', self.type, '/' + self.label, '', qs, ''])
return url