
    U\h                     B    d dl Z d dlmZ ddlmZ dZdZ G d de      Zy)	    N)Optional   )TOTP23456789BCDFGHJKMNPQRTVWXY   c                   f     e Zd ZdZ	 	 	 	 ddedee   dee   dededdf fd	Zd
edef fdZ xZ	S )Steamz=
    Steam's custom TOTP. Subclass of `pyotp.totp.TOTP`.
    Nsnameissuerintervaldigitsreturnc                 X    || _         t        | 	  |dt        j                  ||       y)z
        :param s: secret in base32 format
        :param interval: the time interval in seconds for OTP. This defaults to 30.
        :param name: account name
        :param issuer: issuer
        
   )r
   r   digestr   r   N)r   super__init__hashlibsha1)selfr
   r   r   r   r   	__class__s         O/var/www/html/trade_iq/venv/lib/python3.12/site-packages/pyotp/contrib/steam.pyr   zSteam.__init__   s)     !1R4PVW    inputc                     t         	|   |      }t        |      }d}t        t              }t        t              D ]#  }||z  }t        t        |         }||z  }||z  }% |S )z
        :param input: the HMAC counter value to use as the OTP input.
            Usually either the counter, or the computed integer based on the Unix timestamp
         )r   generate_otpintlenSTEAM_CHARSrangeSTEAM_DEFAULT_DIGITS)
r   r   str_codeint_code
steam_codetotal_chars_poscharr   s
            r   r   zSteam.generate_otp    su    
 7'.x=
+&+, 	%A[(Cs3x(D$J$H		% r   )NN   r   )
__name__
__module____qualname____doc__strr   r   r   r   __classcell__)r   s   @r   r	   r	   
   s|     # $XX smX 	X
 X X 
X"# #  r   r	   )r   typingr   totpr   r!   r#   r	    r   r   <module>r5      s%      * 'D 'r   