diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/primitives/twofactor/hotp.py | 4 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/twofactor/totp.py | 4 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/twofactor/utils.py | 16 |
3 files changed, 12 insertions, 12 deletions
diff --git a/src/cryptography/hazmat/primitives/twofactor/hotp.py b/src/cryptography/hazmat/primitives/twofactor/hotp.py index 8c0cec14..12bc7661 100644 --- a/src/cryptography/hazmat/primitives/twofactor/hotp.py +++ b/src/cryptography/hazmat/primitives/twofactor/hotp.py @@ -62,6 +62,6 @@ class HOTP(object): return struct.unpack(">I", p)[0] & 0x7fffffff def get_provisioning_uri(self, account_name, counter, issuer): - return _generate_uri(self, 'hotp', account_name, issuer, [ - ('counter', int(counter)), + return _generate_uri(self, "hotp", account_name, issuer, [ + ("counter", int(counter)), ]) diff --git a/src/cryptography/hazmat/primitives/twofactor/totp.py b/src/cryptography/hazmat/primitives/twofactor/totp.py index 98493b6d..60705901 100644 --- a/src/cryptography/hazmat/primitives/twofactor/totp.py +++ b/src/cryptography/hazmat/primitives/twofactor/totp.py @@ -34,6 +34,6 @@ class TOTP(object): raise InvalidToken("Supplied TOTP value does not match.") def get_provisioning_uri(self, account_name, issuer): - return _generate_uri(self._hotp, 'totp', account_name, issuer, [ - ('period', int(self._time_step)), + return _generate_uri(self._hotp, "totp", account_name, issuer, [ + ("period", int(self._time_step)), ]) diff --git a/src/cryptography/hazmat/primitives/twofactor/utils.py b/src/cryptography/hazmat/primitives/twofactor/utils.py index 91d2e148..0ed8c4c8 100644 --- a/src/cryptography/hazmat/primitives/twofactor/utils.py +++ b/src/cryptography/hazmat/primitives/twofactor/utils.py @@ -11,20 +11,20 @@ from six.moves.urllib.parse import quote, urlencode def _generate_uri(hotp, type_name, account_name, issuer, extra_parameters): parameters = [ - ('digits', hotp._length), - ('secret', base64.b32encode(hotp._key)), - ('algorithm', hotp._algorithm.name.upper()), + ("digits", hotp._length), + ("secret", base64.b32encode(hotp._key)), + ("algorithm", hotp._algorithm.name.upper()), ] if issuer is not None: - parameters.append(('issuer', issuer)) + parameters.append(("issuer", issuer)) parameters.extend(extra_parameters) uriparts = { - 'type': type_name, - 'label': ('%s:%s' % (quote(issuer), quote(account_name)) if issuer + "type": type_name, + "label": ("%s:%s" % (quote(issuer), quote(account_name)) if issuer else quote(account_name)), - 'parameters': urlencode(parameters), + "parameters": urlencode(parameters), } - return 'otpauth://{type}/{label}?{parameters}'.format(**uriparts) + return "otpauth://{type}/{label}?{parameters}".format(**uriparts) |