summaryrefslogtreecommitdiff
path: root/passlib/exc.py
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2015-01-09 12:36:13 -0500
committerEli Collins <elic@assurancetechnologies.com>2015-01-09 12:36:13 -0500
commitac875402668621e11a3d795291112d3d3dd79672 (patch)
tree1abb1d6522930954de2425f2b2291daa082da347 /passlib/exc.py
parent3f11055a6c11b2d3cc3fb9aecd10b4ea1e7432bd (diff)
downloadpasslib-ac875402668621e11a3d795291112d3d3dd79672.tar.gz
TOTP implementation mostly finalize
TOTP module reworked drastically. Should have committed this a long time ago. Now have what is (hopefully) the final API for the TOTP module. * Supports TOTP & HOTP * Supports URI rendering & parsing * Highlevel methods to handle state management, client clock skew estimation, etc. * Unittests mostly complete (a few edge cases) * Persistent serialization supports encrypting secrets with a password, to mitigate exposure of storage medium. * Basic API documentation. Should be suitable for following use-cases: * lowlevel methods for implementing HOTP/TOTP on server * highlevel methods for implementing HOTP/TOTP on server, and letting them handle details of tracking client state. * methods for implementing an HOTP / TOTP client.
Diffstat (limited to 'passlib/exc.py')
-rw-r--r--passlib/exc.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/passlib/exc.py b/passlib/exc.py
index daac72a..5c2e548 100644
--- a/passlib/exc.py
+++ b/passlib/exc.py
@@ -39,6 +39,21 @@ class PasswordSizeError(ValueError):
# this also prevents a glibc crypt segfault issue, detailed here ...
# http://www.openwall.com/lists/oss-security/2011/11/15/1
+class TokenReuseError(ValueError):
+ """Error raised by various methods in :mod:`passlib.totp` if a token is reused.
+ This exception derives from :exc:`!ValueError`.
+
+ .. versionadded:: 1.7
+ """
+
+ #: optional value indicating when current counter period will end,
+ #: and a new token can be generated.
+ expire_time = None
+
+ def __init__(self, *args, **kwds):
+ self.expire_time = kwds.pop("expire_time", None)
+ ValueError.__init__(self, *args, **kwds)
+
#=============================================================================
# warnings
#=============================================================================