o
    5˜Žjà  ã                   @   sX   d dl Z d dlZd dlmZ dedededefdd„Zded	eeef defd
d„ZdS )é    N)ÚAnyÚtokenÚhashÚkwargsÚreturnc                    sT   t  |  d¡¡}d ‡ fdd„tˆ ƒD ƒ¡}tj| ¡ | d¡t jd� ¡ }||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   s"   � | ]}|› d ˆ | › �V  qdS )ú=N© )Ú.0Úk©r   r	   úV/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/aiogram/utils/auth_widget.pyÚ	<genexpr>   s   €  z"check_signature.<locals>.<genexpr>)Ú	digestmod)	ÚhashlibÚsha256ÚencodeÚjoinÚsortedÚhmacÚnewÚdigestÚ	hexdigest)r   r   r   ÚsecretÚcheck_stringÚhmac_stringr	   r   r   Úcheck_signature   s   ýür   Údatac                 C   s   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   r	   r	   r   Úcheck_integrity   s   	r   )	r   r   Útypingr   ÚstrÚboolr   Údictr   r	   r	   r	   r   Ú<module>   s
    "