o
    uäh‚  ã                   @   s<   d dl Z d dlmZ ddlmZ dZdZG dd„ deƒZdS )	é    N)ÚOptionalé   )ÚTOTPÚ23456789BCDFGHJKMNPQRTVWXYé   c                       sb   e Zd ZdZ				ddedee dee ded	ed
df‡ fdd„Zded
ef‡ fdd„Z‡  Z	S )ÚSteamz=
    Steam's custom TOTP. Subclass of `pyotp.totp.TOTP`.
    Né   r   ÚsÚnameÚissuerÚintervalÚdigitsÚreturnc                    s"   || _ tƒ j|dtj||d dS )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__© úF/var/www/html/venv/lib/python3.10/site-packages/pyotp/contrib/steam.pyr      s   zSteam.__init__Úinputc           	         sV   t ƒ  |¡}t|ƒ}d}ttƒ}ttƒD ]}|| }tt|ƒ }||7 }|| }q|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   r   r   r       s   
zSteam.generate_otp)NNr   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr   r   r   r   Ú__classcell__r   r   r   r   r   
   s(    úþýüûúùr   )r   Útypingr   Útotpr   r   r!   r   r   r   r   r   Ú<module>   s    