diff options
author | Steven Buss <steven.buss@gmail.com> | 2015-04-13 13:35:50 -0400 |
---|---|---|
committer | Steven Buss <steven.buss@gmail.com> | 2015-04-13 18:20:47 -0400 |
commit | e079c554e7b3506dfd8be56b2fd20336c79ce7a0 (patch) | |
tree | 3bd7751ae0bed4d2e33042e8979d8f0e4b832980 | |
parent | b6c8faa1a473447b9e91ab700a6f9b0af0468432 (diff) | |
download | cryptography-e079c554e7b3506dfd8be56b2fd20336c79ce7a0.tar.gz cryptography-e079c554e7b3506dfd8be56b2fd20336c79ce7a0.tar.bz2 cryptography-e079c554e7b3506dfd8be56b2fd20336c79ce7a0.zip |
Move cryptography.exceptions.InvalidToken to cryptography.hazmat.primitives.twofactor
-rw-r--r-- | src/cryptography/exceptions.py | 14 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/twofactor/__init__.py | 4 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/twofactor/hotp.py | 3 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/twofactor/totp.py | 3 | ||||
-rw-r--r-- | tests/hazmat/primitives/twofactor/test_hotp.py | 3 | ||||
-rw-r--r-- | tests/hazmat/primitives/twofactor/test_totp.py | 3 |
6 files changed, 24 insertions, 6 deletions
diff --git a/src/cryptography/exceptions.py b/src/cryptography/exceptions.py index 102165c7..1e80e4ac 100644 --- a/src/cryptography/exceptions.py +++ b/src/cryptography/exceptions.py @@ -6,6 +6,9 @@ from __future__ import absolute_import, division, print_function from enum import Enum +from cryptography import utils +from cryptography.hazmat.primitives import twofactor + class _Reasons(Enum): BACKEND_MISSING_INTERFACE = 0 @@ -53,5 +56,12 @@ class InvalidKey(Exception): pass -class InvalidToken(Exception): - pass +InvalidToken = utils.deprecated( + twofactor.InvalidToken, + __name__, + ( + "The InvalidToken exception has moved to the " + "cryptography.hazmat.primitives.twofactor module" + ), + utils.DeprecatedIn08 +) diff --git a/src/cryptography/hazmat/primitives/twofactor/__init__.py b/src/cryptography/hazmat/primitives/twofactor/__init__.py index 4b540884..e71f9e67 100644 --- a/src/cryptography/hazmat/primitives/twofactor/__init__.py +++ b/src/cryptography/hazmat/primitives/twofactor/__init__.py @@ -3,3 +3,7 @@ # for complete details. from __future__ import absolute_import, division, print_function + + +class InvalidToken(Exception): + pass diff --git a/src/cryptography/hazmat/primitives/twofactor/hotp.py b/src/cryptography/hazmat/primitives/twofactor/hotp.py index 1dac920f..ba228b40 100644 --- a/src/cryptography/hazmat/primitives/twofactor/hotp.py +++ b/src/cryptography/hazmat/primitives/twofactor/hotp.py @@ -9,11 +9,12 @@ import struct import six from cryptography.exceptions import ( - InvalidToken, UnsupportedAlgorithm, _Reasons + UnsupportedAlgorithm, _Reasons ) from cryptography.hazmat.backends.interfaces import HMACBackend from cryptography.hazmat.primitives import constant_time, hmac from cryptography.hazmat.primitives.hashes import SHA1, SHA256, SHA512 +from cryptography.hazmat.primitives.twofactor import InvalidToken class HOTP(object): diff --git a/src/cryptography/hazmat/primitives/twofactor/totp.py b/src/cryptography/hazmat/primitives/twofactor/totp.py index 0b04a131..03df9292 100644 --- a/src/cryptography/hazmat/primitives/twofactor/totp.py +++ b/src/cryptography/hazmat/primitives/twofactor/totp.py @@ -5,10 +5,11 @@ from __future__ import absolute_import, division, print_function from cryptography.exceptions import ( - InvalidToken, UnsupportedAlgorithm, _Reasons + UnsupportedAlgorithm, _Reasons ) from cryptography.hazmat.backends.interfaces import HMACBackend from cryptography.hazmat.primitives import constant_time +from cryptography.hazmat.primitives.twofactor import InvalidToken from cryptography.hazmat.primitives.twofactor.hotp import HOTP diff --git a/tests/hazmat/primitives/twofactor/test_hotp.py b/tests/hazmat/primitives/twofactor/test_hotp.py index a76aa6e3..a5d1c284 100644 --- a/tests/hazmat/primitives/twofactor/test_hotp.py +++ b/tests/hazmat/primitives/twofactor/test_hotp.py @@ -8,10 +8,11 @@ import os import pytest -from cryptography.exceptions import InvalidToken, _Reasons +from cryptography.exceptions import _Reasons from cryptography.hazmat.backends.interfaces import HMACBackend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.hashes import MD5, SHA1 +from cryptography.hazmat.primitives.twofactor import InvalidToken from cryptography.hazmat.primitives.twofactor.hotp import HOTP from ....utils import ( diff --git a/tests/hazmat/primitives/twofactor/test_totp.py b/tests/hazmat/primitives/twofactor/test_totp.py index 05321089..6039983e 100644 --- a/tests/hazmat/primitives/twofactor/test_totp.py +++ b/tests/hazmat/primitives/twofactor/test_totp.py @@ -6,9 +6,10 @@ from __future__ import absolute_import, division, print_function import pytest -from cryptography.exceptions import InvalidToken, _Reasons +from cryptography.exceptions import _Reasons from cryptography.hazmat.backends.interfaces import HMACBackend from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.twofactor import InvalidToken from cryptography.hazmat.primitives.twofactor.totp import TOTP from ....utils import ( |