diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2016-11-07 19:15:49 -0500 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2016-11-07 19:15:49 -0500 |
| commit | 63f952a7c9b0e306a8116e21cab9d8da6b811d6a (patch) | |
| tree | 9e3a662648dc4e9f70d9c112857d0b73a866b14f /docs/lib | |
| parent | 4a8c04e2f2a232dbd021e094ef718066f5d63268 (diff) | |
| download | passlib-63f952a7c9b0e306a8116e21cab9d8da6b811d6a.tar.gz | |
totp: stripping out HOTP support -- not generally used/useful in the real world
to justify the contortions it requires in the shared BaseOTP api.
Diffstat (limited to 'docs/lib')
| -rw-r--r-- | docs/lib/passlib.totp-tutorial.rst | 14 | ||||
| -rw-r--r-- | docs/lib/passlib.totp.rst | 65 |
2 files changed, 9 insertions, 70 deletions
diff --git a/docs/lib/passlib.totp-tutorial.rst b/docs/lib/passlib.totp-tutorial.rst index 39a8382..4a56088 100644 --- a/docs/lib/passlib.totp-tutorial.rst +++ b/docs/lib/passlib.totp-tutorial.rst @@ -12,7 +12,7 @@ Overview ======== The :mod:`passlib.totp` module provides a set of classes for adding two-factor authentication (2FA) support into your application, -using the widely supported TOTP / HOTP specifications. +using the widely supported TOTP specification. This module is designed to support a variety of use cases, including: @@ -32,11 +32,6 @@ to the more complex highlevel ones. .. seealso:: The :mod:`passlib.totp` api reference, which lists all details of all the classes and methods mentioned here. -.. todo:: - - This tutorial is currently focused on TOTP usage, - and needs to be expanded to include HOTP. - .. rst-class:: emphasize-children Basic Usage @@ -110,7 +105,7 @@ parameters of the :meth:`~passlib.totp.BaseOTP.to_uri` method: On the client side, passlib offers a helper method for loading from a provisioning URI. This can be useful for testing URI encoding & output: - >>> # create new TOTP/HOTP instance from a provisioning uri: + >>> # create new TOTP instance from a provisioning uri: >>> from passlib import totp >>> otp = totp.from_uri('otpauth://totp/demo-user?secret=GVDOQ7NP6XPJWE4CWCLFFSXZH6DTAZWM&issuer=myapp.example.org') >>> otp.base32_key @@ -383,11 +378,6 @@ guarantees an attacker will be able to guess any given token. The Gory Details ---------------- -For HOTP, the formula is ``odds = guesses * (1 + window) / 10**digits``; -where ``guesses`` is the number of attempts an attacker can make before being -locked out, ``window`` is the :meth:`HOTP.verify` window (as measured in counter steps), -and ``digits`` is the number of digits in the HTOP token. - For TOTP, the formula is ``odds = guesses * (1 + 2 * window / period) / 10**digits``; where ``window`` in this case is the :meth:`TOTP.verify` window (measured in seconds), and ``period`` is the number of seconds before the token is rotated. diff --git a/docs/lib/passlib.totp.rst b/docs/lib/passlib.totp.rst index 90e8242..8e5c9d6 100644 --- a/docs/lib/passlib.totp.rst +++ b/docs/lib/passlib.totp.rst @@ -8,11 +8,10 @@ .. versionadded:: 1.7 The :mod:`!passlib.totp` module provides a number of classes for implementing -two-factor authentication (2FA) using the TOTP [#totpspec]_ / HOTP [#hotpspec]_ specifications. +two-factor authentication (2FA) using the TOTP [#totpspec]_ specification. This page provides a reference to all the classes and methods in this module. -Passlib's OTP support is centered around two classes: :class:`TOTP` and :class:`HOTP`, -whose shared code is defined in the :class:`BaseOTP` class. There are also +Passlib's OTP support is centered around the :class:`TOTP` class. There are also some additional helpers, including the :class:`OTPContext` class, which helps to securely serialize TOTP secrets & state to a database. @@ -47,7 +46,7 @@ suitable for configuring an OTP client such as Google Authenticator. BaseOTP – Serialization ----------------------- -While :class:`TOTP` and :class:`HOTP` instances can be used statelessly +While :class:`TOTP` instances can be used statelessly to calculate token values, they can also be used in a persistent manner, to handle tracking of previously used tokens, etc. In this case, they will need to be serialized to / from external storage, which @@ -156,56 +155,6 @@ Support Classes .. rst-class:: emphasize-children -HOTP (Counter-based tokens) -=========================== - -HOTP – Constructor ------------------- -.. note:: - - HOTP is used much less frequently, since it's fragile - (as it's much easier for the server & client to get out of sync in their token - count). Unless you have a particular reason, you probably want :class:`TOTP` instead. - -.. autoclass:: HOTP(key=None, format="base32", \*, new=False, \*\*kwds) - -HOTP – Client-Side Token Generation ------------------------------------ -.. automethod:: HOTP.advance - -HOTP – Server-Side Token Verification -------------------------------------- -.. automethod:: HOTP.verify -.. automethod:: HOTP.consume - -HOTP – Provisioning & Serialization ------------------------------------ -:class:`!HOTP`'s provisioning & serialization methods are inherited from :class:`!BaseOTP`, -and are documented under: - -* :ref:`BaseOTP Client Provisioning <baseotp-client-provisioning>` -* :ref:`BaseOTP Serialization <baseotp-serialization>` - - -HOTP – Internal State Attributes --------------------------------- -The following attributes are used to track the internal state of this generator, -and will be included in the output of :meth:`~BaseOTP.to_json`: - -.. autoattribute:: HOTP.counter - -.. attribute:: HOTP.changed - - Boolean flag set by :meth:`~HOTP.advance` and :meth:`~HOTP.consume` - to indicate that the object's internal state has been modified since creation. - -(Note: All internal state attribute can be initialized via constructor options, -but this is mainly an internal / testing detail). - -Support Classes ---------------- -.. autoclass:: HotpMatch() - OTPContext (Persistence Frontend) ================================= .. autoclass:: OTPContext @@ -216,21 +165,21 @@ Support Functions .. function:: from_uri(uri) - Create an HOTP / TOTP instance from a provisioning URI, + Create an TOTP instance from a provisioning URI, such as generated by :meth:`BaseOTP.to_uri`. :returns: - :class:`HTOP` or :class:`TOTP` instance, as appropriate + :class:`TOTP` instance .. function:: from_json(json) - Create an HOTP / TOTP instance from a JSON string, + Create an TOTP instance from a JSON string, such as generated by :meth:`BaseOTP.to_json`. Also accepts a dict object with the same format, such as returned by :meth:`BaseOTP.to_dict`. :returns: - :class:`HTOP` or :class:`TOTP` instance, as appropriate + :class:`TOTP` instance Deviations ========== |
