
    qh*                     Z    S SK r S SKrS SKrSSKJrJr  SSKJr  SSKJ	r	   " S S\	5      r
g)	    N   )
AuthFailedAuthMissingParameter)handle_http_errors   )BaseAuthc                   B    \ rS rSrSrSrS rS
S jrS r\	S 5       r
S	rg)TelegramAuth
   telegramidc                    U R                  S5      nUc  [        U S5      eUR                  S5      nUR                  S5      nUb  Uc  [        U S5      eUR                  5        VVs/ s H  u  pVUS:w  d  M  U SU 3PM     nnnSR	                  [        U5      5      n[        R                  " UR                  5       5      R                  5       n[        R                  " XR                  5       [        R                  S9R                  5       n	[        [        R                  " 5       5      n
[        U5      nX-
  S	:  a  [        U S
5      eX:w  a  [        U S5      eg s  snnf )N	BOT_TOKENSOCIAL_AUTH_TELEGRAM_BOT_TOKENhash	auth_datezhash or auth_date=
)msg	digestmodiQ zAuth date is outdatedzInvalid hash supplied)settingr   getitemsjoinsortedhashlibsha256encodedigesthmacnew	hexdigestinttimer   )selfresponse	bot_tokenreceived_hash_stringr   kvdata_check_string
secret_key
built_hashcurrent_timestampauth_timestamps               O/var/www/html/env/lib/python3.13/site-packages/social_core/backends/telegram.pyverify_dataTelegramAuth.verify_data   s?   LL-	&t-MNN'||F3LL-	'9+<&t-@AA4<NN4DT4DDAVZs!A3Z4DT IIf->&?@^^I$4$4$67>>@
XX446'..

)+ 	  		,Y-5T#:;;-T#:;; . Us   (E 8E Nc                     U$ N )r%   useruidr&   detailsargskwargss          r0   
extra_dataTelegramAuth.extra_data&   s        c                     UR                  SS5      nUR                  SS5      nU SU 3R                  5       nUR                  S5      =(       d    [        XR                     5      UUUS.$ )N
first_name 	last_name username)rC   r?   rA   fullname)r   stripstrID_KEY)r%   r&   r?   rA   rD   s        r0   get_user_detailsTelegramAuth.get_user_details)   sk    \\,3
LLb1	 \9+.446 Z0NC8M4N$" 	
 	
r=   c                     U R                   nU R                  U5        UR                  U R                   U S.5        U R                  R                  " U0 UD6$ )N)r&   backend)datar1   updatestrategyauthenticate)r%   r9   r:   r&   s       r0   auth_completeTelegramAuth.auth_complete4   sH    99"499>?}}))4:6::r=   r5   r4   )__name__
__module____qualname____firstlineno__namerG   r1   r;   rH   r   rP   __static_attributes__r5   r=   r0   r
   r
   
   s/    DF<0	
 ; ;r=   r
   )r   r    r$   
exceptionsr   r   utilsr   baser   r
   r5   r=   r0   <module>r[      s#       9 & /;8 /;r=   