diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2016-10-03 18:42:13 -0400 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2016-10-03 18:42:13 -0400 |
| commit | 1f09d22394fdd2c82e77529f78cbb5f920d096f8 (patch) | |
| tree | a84f4fba21e106be435ac4d231319d9cf2e71728 /docs/lib | |
| parent | 1c618f549b45480b47968246a05a497038958bcd (diff) | |
| download | passlib-1f09d22394fdd2c82e77529f78cbb5f920d096f8.tar.gz | |
totp: documented the global from_uri() / from_json() helpers, as well as to_dict() method.
Diffstat (limited to 'docs/lib')
| -rw-r--r-- | docs/lib/passlib.totp-tutorial.rst | 6 | ||||
| -rw-r--r-- | docs/lib/passlib.totp.rst | 19 |
2 files changed, 25 insertions, 0 deletions
diff --git a/docs/lib/passlib.totp-tutorial.rst b/docs/lib/passlib.totp-tutorial.rst index df1688d..39a8382 100644 --- a/docs/lib/passlib.totp-tutorial.rst +++ b/docs/lib/passlib.totp-tutorial.rst @@ -157,6 +157,12 @@ their output is relatively simple to inspect (e.g. in Postgres JSON columns), they can include stateful data (see :ref:`totp-stateful-usage` below), and they support storing the keys in an encrypted fashion (see :ref:`totp-context-usage` below). +For cases where a python dictionary is more useful than a json string, +the :meth:`BaseOTP.to_dict` method returns a python dict identical to parsing +the output of :meth:`BaseOTP.to_json`. This value can be reconstructed +via :func:`from_json`, which will autodetect whether the input +is a dictionary vs string. + .. seealso:: For more details, see the :meth:`~passlib.totp.BaseOTP.from_json` constructor, diff --git a/docs/lib/passlib.totp.rst b/docs/lib/passlib.totp.rst index 7ecd5be..90e8242 100644 --- a/docs/lib/passlib.totp.rst +++ b/docs/lib/passlib.totp.rst @@ -61,6 +61,7 @@ can be performed with the following methods: After which, your application may clear the flag, or discard the object, as appropriate. .. automethod:: BaseOTP.to_json +.. automethod:: BaseOTP.to_dict .. automethod:: BaseOTP.from_json .. @@ -213,6 +214,24 @@ Support Functions ================= .. autofunction:: generate_secret(entropy=256) +.. function:: from_uri(uri) + + Create an HOTP / TOTP instance from a provisioning URI, + such as generated by :meth:`BaseOTP.to_uri`. + + :returns: + :class:`HTOP` or :class:`TOTP` instance, as appropriate + +.. function:: from_json(json) + + Create an HOTP / 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 + Deviations ========== |
