aboutsummaryrefslogtreecommitdiffstats
path: root/doc/manual/python.rst
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-08-21 14:43:48 -0400
committerJack Lloyd <[email protected]>2018-08-21 14:43:48 -0400
commita451e7db1071c14bb0cad801b972b0d11c91d5f6 (patch)
tree1c2b6b469be2cbce3425a0543ff0c91410589e02 /doc/manual/python.rst
parented4e07959656f47bb28707b4bbb888c6765740e9 (diff)
Add HOTP to Python
Diffstat (limited to 'doc/manual/python.rst')
-rw-r--r--doc/manual/python.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/manual/python.rst b/doc/manual/python.rst
index 19cf10622..381346e5f 100644
--- a/doc/manual/python.rst
+++ b/doc/manual/python.rst
@@ -370,3 +370,25 @@ Format Preserving Encryption (FE1 scheme)
The msg should be a botan2.MPI or an object which can be converted to one
+HOTP
+-----------------------------------------
+.. versionadded:: 2.8.0
+
+.. py:class:: HOTP(key, hash="SHA-1", digits=6)
+
+ .. py:method:: generate(counter)
+
+ Generate an HOTP code for the provided counter
+
+ .. py:method:: check(code, counter, resync_range=0)
+
+ Check if provided ``code`` is the correct code for ``counter``.
+ If ``resync_range`` is greater than zero, HOTP also checks
+ up to ``resync_range`` following counter values.
+
+ Returns a tuple of (bool,int) where the boolean indicates if the
+ code was valid, and the int indicates the next counter value
+ that should be used. If the code did not verify, the next
+ counter value is always identical to the counter that was passed
+ in. If the code did verify and resync_range was zero, then the
+ next counter will always be counter+1.