
    dh                     Z    d dl Z d dlZd dlmZmZ dedededefdZdedeeef   defd	Zy)
    N)AnyDicttokenhashkwargsreturnc                 >   t        j                  | j                  d            }dj                  fdt	              D              }t        j                  |j                         |j                  d      t         j                        j                         }||k(  S )a	  
    Generate hexadecimal representation
    of the HMAC-SHA-256 signature of the data-check-string
    with the SHA256 hash of the bot's token used as a secret key

    :param token:
    :param hash:
    :param kwargs: all params received on auth
    :return:
    zutf-8
c              3   2   K   | ]  }| d |      yw)=N ).0kr   s     S/var/www/netwell/bot/venv/lib/python3.12/site-packages/aiogram/utils/auth_widget.py	<genexpr>z"check_signature.<locals>.<genexpr>   s      HAs!F1I;/Hs   )	digestmod)	hashlibsha256encodejoinsortedhmacnewdigest	hexdigest)r   r   r   secretcheck_stringhmac_strings     `   r   check_signaturer      su     ^^ELL12F99HHHL((,,W5ik  $    datac                     t        | fi |S )z
    Verify the authentication and the integrity
    of the data received on user's auth

    :param token: Bot's token
    :param data: all data that came on auth
    :return:
    )r   )r   r!   s     r   check_integrityr#      s     5)D))r    )	r   r   typingr   r   strboolr   r#   r   r    r   <module>r'      sQ      3 c S T &	*3 	*d38n 	* 	*r    