T2fa


NameT2fa JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/yourusername/your-repository
SummaryA simple TOTP generator package to help you in developing tools that require TOTP
upload_time2024-12-27 18:35:14
maintainerNone
docs_urlNone
authorAizer
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # T2fa - Simple and Easy-to-Use TOTP Generator

**T2fa** is a lightweight and easy-to-use Time-Based One-Time Password (TOTP) generator. This library is perfect for developers who need to integrate TOTP functionality into their tools, whether for authentication or security-related applications. With T2fa, you can easily generate TOTP tokens for use in requests-based tools, APIs, and many other applications that require secure one-time passwords.

## Features

- **Easy Integration**: T2fa allows for simple integration with your Python projects.
- **Multiple Algorithm Support**: Supports SHA-1, SHA-256, and SHA-512 algorithms for TOTP generation.
- **Flexible**: Customize the number of digits and time intervals for OTP generation.
- **Cross-Platform**: Works on all major platforms where Python is supported.
- **Secure**: Implements TOTP as per RFC 6238, ensuring the highest level of security.

## Installation

### Using pip

You can easily install T2fa via `pip`, Python's package manager. Simply run the following command:

```bash
pip install T2fa
```

### Manual Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/AxZeRxD/T2fa.git
   cd T2fa
   ```

2. Install dependencies:
   ```bash
   pip install -r requirements.txt
   ```

3. (Optional) You can now manually run the tests or use the tool in your project.

## Usage

### Importing T2fa

To get started, you first need to import the `Totp` class from the package:

```python
from T2fa import Totp
```

### Example Usage

```python
# Example of generating and verifying OTP
secret = "khxi okcj zqtc j54b 2t2x awcr xx3x g5ln"  # Secret key used for TOTP generation

# Initialize the TOTP object for SHA-1 algorithm
pyauth_sha1 = Totp.gen(secret=secret, algorithm="SHA1", digits=6, interval=30)

# Generate OTP
otp_sha1 = pyauth_sha1.genotp()
print(f"Generated OTP (SHA1): {otp_sha1}")

# Verify OTP
if pyauth_sha1.verifyotp(otp_sha1):
    print(f"OTP (SHA1) is valid.")
else:
    print(f"OTP (SHA1) is invalid.")
```

### Supported Algorithms

- **SHA-1**: Default algorithm for TOTP generation.
- **SHA-256**: A more secure option with a longer hash length.
- **SHA-512**: Provides even higher security and longer hash length.

You can switch between these algorithms using the `algorithm` parameter when creating a TOTP instance.

### Configuration

You can configure various aspects of the OTP generation:

- **`digits`**: Number of digits in the OTP (default is 6).
- **`interval`**: The time window for OTP validity in seconds (default is 30 seconds).
- **`algorithm`**: The hashing algorithm to use for OTP generation (options: "SHA1", "SHA256", "SHA512").

## Example for Customization

```python
# Custom configuration for SHA-256 with a 8-digit OTP and 60-second interval
pyauth_sha256 = Totp.gen(secret=secret, algorithm="SHA256", digits=8, interval=60)
otp_sha256 = pyauth_sha256.genotp()
print(f"Generated OTP (SHA256): {otp_sha256}")
```

## Testing

You can run tests to ensure that everything works as expected. If you're using pytest or another test runner, you can run:

```bash
python pytest
```

Or simply run your Python script to check if TOTP generation and verification are working properly.

## Contributing

We welcome contributions! If you have suggestions for improvements, please fork the repository and create a pull request.

1. Fork the repository.
2. Create a new branch for your changes.
3. Commit your changes.
4. Push your changes to your fork.
5. Submit a pull request to the main repository.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- The TOTP implementation follows the RFC 6238 standard for time-based one-time passwords.
- This project was inspired by various TOTP libraries available in the Python ecosystem.
- Thanks to the open-source community for their valuable contributions!

---

- [Discord](https://discord.gg/programmer)
- [Youtube](https://youtube.com/@nukersop)
- [Github](https://github.com/AxZeRxD)

> For any additional questions or support, feel free to open an issue in the repository.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yourusername/your-repository",
    "name": "T2fa",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Aizer",
    "author_email": "mohit.4sure@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/88/07/6ecccee97d6c66fb5d603c42617bd5b75e901f3039ba21f1cf0a7602728e/t2fa-0.1.0.tar.gz",
    "platform": null,
    "description": "# T2fa - Simple and Easy-to-Use TOTP Generator\r\n\r\n**T2fa** is a lightweight and easy-to-use Time-Based One-Time Password (TOTP) generator. This library is perfect for developers who need to integrate TOTP functionality into their tools, whether for authentication or security-related applications. With T2fa, you can easily generate TOTP tokens for use in requests-based tools, APIs, and many other applications that require secure one-time passwords.\r\n\r\n## Features\r\n\r\n- **Easy Integration**: T2fa allows for simple integration with your Python projects.\r\n- **Multiple Algorithm Support**: Supports SHA-1, SHA-256, and SHA-512 algorithms for TOTP generation.\r\n- **Flexible**: Customize the number of digits and time intervals for OTP generation.\r\n- **Cross-Platform**: Works on all major platforms where Python is supported.\r\n- **Secure**: Implements TOTP as per RFC 6238, ensuring the highest level of security.\r\n\r\n## Installation\r\n\r\n### Using pip\r\n\r\nYou can easily install T2fa via `pip`, Python's package manager. Simply run the following command:\r\n\r\n```bash\r\npip install T2fa\r\n```\r\n\r\n### Manual Installation\r\n\r\n1. Clone the repository:\r\n   ```bash\r\n   git clone https://github.com/AxZeRxD/T2fa.git\r\n   cd T2fa\r\n   ```\r\n\r\n2. Install dependencies:\r\n   ```bash\r\n   pip install -r requirements.txt\r\n   ```\r\n\r\n3. (Optional) You can now manually run the tests or use the tool in your project.\r\n\r\n## Usage\r\n\r\n### Importing T2fa\r\n\r\nTo get started, you first need to import the `Totp` class from the package:\r\n\r\n```python\r\nfrom T2fa import Totp\r\n```\r\n\r\n### Example Usage\r\n\r\n```python\r\n# Example of generating and verifying OTP\r\nsecret = \"khxi okcj zqtc j54b 2t2x awcr xx3x g5ln\"  # Secret key used for TOTP generation\r\n\r\n# Initialize the TOTP object for SHA-1 algorithm\r\npyauth_sha1 = Totp.gen(secret=secret, algorithm=\"SHA1\", digits=6, interval=30)\r\n\r\n# Generate OTP\r\notp_sha1 = pyauth_sha1.genotp()\r\nprint(f\"Generated OTP (SHA1): {otp_sha1}\")\r\n\r\n# Verify OTP\r\nif pyauth_sha1.verifyotp(otp_sha1):\r\n    print(f\"OTP (SHA1) is valid.\")\r\nelse:\r\n    print(f\"OTP (SHA1) is invalid.\")\r\n```\r\n\r\n### Supported Algorithms\r\n\r\n- **SHA-1**: Default algorithm for TOTP generation.\r\n- **SHA-256**: A more secure option with a longer hash length.\r\n- **SHA-512**: Provides even higher security and longer hash length.\r\n\r\nYou can switch between these algorithms using the `algorithm` parameter when creating a TOTP instance.\r\n\r\n### Configuration\r\n\r\nYou can configure various aspects of the OTP generation:\r\n\r\n- **`digits`**: Number of digits in the OTP (default is 6).\r\n- **`interval`**: The time window for OTP validity in seconds (default is 30 seconds).\r\n- **`algorithm`**: The hashing algorithm to use for OTP generation (options: \"SHA1\", \"SHA256\", \"SHA512\").\r\n\r\n## Example for Customization\r\n\r\n```python\r\n# Custom configuration for SHA-256 with a 8-digit OTP and 60-second interval\r\npyauth_sha256 = Totp.gen(secret=secret, algorithm=\"SHA256\", digits=8, interval=60)\r\notp_sha256 = pyauth_sha256.genotp()\r\nprint(f\"Generated OTP (SHA256): {otp_sha256}\")\r\n```\r\n\r\n## Testing\r\n\r\nYou can run tests to ensure that everything works as expected. If you're using pytest or another test runner, you can run:\r\n\r\n```bash\r\npython pytest\r\n```\r\n\r\nOr simply run your Python script to check if TOTP generation and verification are working properly.\r\n\r\n## Contributing\r\n\r\nWe welcome contributions! If you have suggestions for improvements, please fork the repository and create a pull request.\r\n\r\n1. Fork the repository.\r\n2. Create a new branch for your changes.\r\n3. Commit your changes.\r\n4. Push your changes to your fork.\r\n5. Submit a pull request to the main repository.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Acknowledgments\r\n\r\n- The TOTP implementation follows the RFC 6238 standard for time-based one-time passwords.\r\n- This project was inspired by various TOTP libraries available in the Python ecosystem.\r\n- Thanks to the open-source community for their valuable contributions!\r\n\r\n---\r\n\r\n- [Discord](https://discord.gg/programmer)\r\n- [Youtube](https://youtube.com/@nukersop)\r\n- [Github](https://github.com/AxZeRxD)\r\n\r\n> For any additional questions or support, feel free to open an issue in the repository.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple TOTP generator package to help you in developing tools that require TOTP",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/yourusername/your-repository"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eabb671e659c031bb921f8fc8a55ca80ac60e1c30c208e7239977bf5981a1088",
                "md5": "4436f481994994f2560ad47eabbc038c",
                "sha256": "81e5df5ced74bb0d6d547438e942f1326dc3685a833ea417d5559c1e1d00279e"
            },
            "downloads": -1,
            "filename": "T2fa-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4436f481994994f2560ad47eabbc038c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 3880,
            "upload_time": "2024-12-27T18:35:10",
            "upload_time_iso_8601": "2024-12-27T18:35:10.515250Z",
            "url": "https://files.pythonhosted.org/packages/ea/bb/671e659c031bb921f8fc8a55ca80ac60e1c30c208e7239977bf5981a1088/T2fa-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "88076ecccee97d6c66fb5d603c42617bd5b75e901f3039ba21f1cf0a7602728e",
                "md5": "9b268e89db2df692f0fc709b27bfa11c",
                "sha256": "8def7066a337f78ca19e00f5b0f5fb7090748f828d13589669403b2a8945abc1"
            },
            "downloads": -1,
            "filename": "t2fa-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9b268e89db2df692f0fc709b27bfa11c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4079,
            "upload_time": "2024-12-27T18:35:14",
            "upload_time_iso_8601": "2024-12-27T18:35:14.403873Z",
            "url": "https://files.pythonhosted.org/packages/88/07/6ecccee97d6c66fb5d603c42617bd5b75e901f3039ba21f1cf0a7602728e/t2fa-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-27 18:35:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yourusername",
    "github_project": "your-repository",
    "github_not_found": true,
    "lcname": "t2fa"
}
        
Elapsed time: 0.69329s