~martijnbraam/numberstation

c96aa969a77254382a653f64cf34460fcb7b917a — Martijn Braam 2 years ago 990afd0
Fix the hotp counter variable in the url format
1 files changed, 4 insertions(+), 2 deletions(-)

M numberstation/otpurl.py
M numberstation/otpurl.py => numberstation/otpurl.py +4 -2
@@ 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