Metadata-Version: 2.2
Name: init-data-python
Version: 1.0.0
Summary: A Python library that offers simple interface for validating Telegram Mini App initialization data.
Author-email: artender <artem1347929@gmail.com>
License: MIT License
        
        Copyright (c) 2025 artender
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE

# `init-data-python`
A Python library that offers simple interface for validating Telegram Mini App initialization data.

# Installation
```bash
pip install init-data-python
```

# Usage
Instantiate `InitData` with raw initialization data and a bot token, then call `.validate()` to get the validation
result as a boolean.
```python
from init_data import InitData

init_data_raw = "query_id=AAHdF6IQAAAAAN0XohDhrOrc&user=%7B%22id%22%3A279058397%2C%22first_name%22%3A%22Vladislav%22%2C%22last_name%22%3A%22Kibenko%22%2C%22username%22%3A%22vdkfrost%22%2C%22language_code%22%3A%22ru%22%2C%22is_premium%22%3Atrue%7D&auth_date=1662771648&hash=c501b71e775f74ce10e377dea85a7ea24ecd640b223ea86dfe453e0eaed2e2b2"
bot_token = "5768337691:AAH5YkoiEuPk8-FZa32hStHTqXiLPtAEhx8"

InitData(init_data_raw, bot_token).validate() # -> True
```
You can also specify the number of decoding iterations if the initialization data was encoded multiple times.
```python
InitData(...).validate(times_to_decode=2)
```
- Note: `times_to_decode` is a keyword-only parameter.
