aiotp


Nameaiotp JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/albu-org/aiotp
SummaryOne-time password package in Python
upload_time2023-10-20 21:19:26
maintainer
docs_urlNone
authoralbu
requires_python~=3.7
licenseLGPLv3
keywords otp totp hotp 2fa aiotp one-time
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ### aiotp - One-time password package in Python
---

- Installation

```
pip install aiotp
```
---

- Usage

#### Time-based OTPs

``` python
import asyncio

from aiotp import TOTP
from aiotp import random_b32
# from aiotp.sync import HOTP, TOTP, random_b32, random_hex

async def main():
    key = await random_b32()

    async with TOTP(key, digits=4, interval=5) as totp:
        code = await totp.create()

        result = await totp.verify(code)
        print(result) # -> True

        await asyncio.sleep(5)

        result = await totp.verify(code)
        print(result) # -> False

asyncio.run(main())
```

#### Counter-based OTPs

``` python
import asyncio

from aiotp import HOTP
from aiotp import random_b32
# from aiotp.sync import HOTP, TOTP, random_b32, random_hex

async def main():
    key = await random_b32()

    async with HOTP(key, digits=4) as hotp:
        code = await hotp.create(1000)

        result = await hotp.verify(code, 1000)
        print(result) # -> True

        result = await hotp.verify(code, 1001)
        print(result) # -> False

asyncio.run(main())
```
---

- Links

* [Package (PyPi)](https://pypi.python.org/pypi/aiotp)
* [RFC 6238: TOTP (algorithm)](https://tools.ietf.org/html/rfc6238)
* [RFC 4226: HOTP (algorithm)](https://tools.ietf.org/html/rfc4226)
---

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/albu-org/aiotp",
    "name": "aiotp",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.7",
    "maintainer_email": "",
    "keywords": "otp,totp,hotp,2FA,aiotp,one-time",
    "author": "albu",
    "author_email": "albuorg@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1a/36/387d2fe6016accce52e8f392fc29a662b19fda3eca3f4d314435dc6fd885/aiotp-1.0.0.tar.gz",
    "platform": null,
    "description": "### aiotp - One-time password package in Python\n---\n\n- Installation\n\n```\npip install aiotp\n```\n---\n\n- Usage\n\n#### Time-based OTPs\n\n``` python\nimport asyncio\n\nfrom aiotp import TOTP\nfrom aiotp import random_b32\n# from aiotp.sync import HOTP, TOTP, random_b32, random_hex\n\nasync def main():\n    key = await random_b32()\n\n    async with TOTP(key, digits=4, interval=5) as totp:\n        code = await totp.create()\n\n        result = await totp.verify(code)\n        print(result) # -> True\n\n        await asyncio.sleep(5)\n\n        result = await totp.verify(code)\n        print(result) # -> False\n\nasyncio.run(main())\n```\n\n#### Counter-based OTPs\n\n``` python\nimport asyncio\n\nfrom aiotp import HOTP\nfrom aiotp import random_b32\n# from aiotp.sync import HOTP, TOTP, random_b32, random_hex\n\nasync def main():\n    key = await random_b32()\n\n    async with HOTP(key, digits=4) as hotp:\n        code = await hotp.create(1000)\n\n        result = await hotp.verify(code, 1000)\n        print(result) # -> True\n\n        result = await hotp.verify(code, 1001)\n        print(result) # -> False\n\nasyncio.run(main())\n```\n---\n\n- Links\n\n* [Package (PyPi)](https://pypi.python.org/pypi/aiotp)\n* [RFC 6238: TOTP (algorithm)](https://tools.ietf.org/html/rfc6238)\n* [RFC 4226: HOTP (algorithm)](https://tools.ietf.org/html/rfc4226)\n---\n",
    "bugtrack_url": null,
    "license": "LGPLv3",
    "summary": "One-time password package in Python",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/albu-org/aiotp"
    },
    "split_keywords": [
        "otp",
        "totp",
        "hotp",
        "2fa",
        "aiotp",
        "one-time"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e07689b5e400d631a3b7987c3d3c2b4e4f3a38969e584d286cfe250bacff1172",
                "md5": "1d4d5b7cdef9b0cc2557f96236d5fb12",
                "sha256": "bb1c32833cc15d75bf4c9ba94fed663aa0c91f137994b95f944d2332b65a98a3"
            },
            "downloads": -1,
            "filename": "aiotp-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1d4d5b7cdef9b0cc2557f96236d5fb12",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.7",
            "size": 23935,
            "upload_time": "2023-10-20T21:19:24",
            "upload_time_iso_8601": "2023-10-20T21:19:24.843385Z",
            "url": "https://files.pythonhosted.org/packages/e0/76/89b5e400d631a3b7987c3d3c2b4e4f3a38969e584d286cfe250bacff1172/aiotp-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a36387d2fe6016accce52e8f392fc29a662b19fda3eca3f4d314435dc6fd885",
                "md5": "37d38ef98cb2177ab3931559aeff2fb0",
                "sha256": "4b02a22c1b7fc200ccc5ed73ac9aa5936f015ea1da2219025a5e9b2420369d08"
            },
            "downloads": -1,
            "filename": "aiotp-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "37d38ef98cb2177ab3931559aeff2fb0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.7",
            "size": 18653,
            "upload_time": "2023-10-20T21:19:26",
            "upload_time_iso_8601": "2023-10-20T21:19:26.968716Z",
            "url": "https://files.pythonhosted.org/packages/1a/36/387d2fe6016accce52e8f392fc29a662b19fda3eca3f4d314435dc6fd885/aiotp-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-20 21:19:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "albu-org",
    "github_project": "aiotp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "aiotp"
}
        
Elapsed time: 2.79885s