ó
    ùŠÂj	  ã                   óJ   • 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)ÚAnyÚOptionalé   )Úutils)ÚOTPc                   óÄ   ^ • \ rS rSrSr     SS\S\S\S\\   S\\   S	\S
S4U 4S jjjr	S\S
\4S jr
S\S\S
\4S jr   SS\\   S	\\   S\\   S
\4S jjrSrU =r$ )ÚHOTPé   z&
Handler for HMAC-based OTP counters.
NÚsÚdigitsÚdigestÚnameÚissuerÚinitial_countÚreturnc                 ó¶   >• Uc  [         R                  nO/U[         R                  [         R                  4;   a  [	        S5      eX`l        [        TU ]  XX4US9  g)aE  
:param s: secret in base32 format
:param initial_count: starting HMAC counter value, defaults to 0
:param digits: number of integers in the OTP. Some apps expect this to be 6 digits, others support more.
:param digest: digest function to use in the HMAC (expected to be SHA1)
:param name: account name
:param issuer: issuer
NzUselected digest function must generate digest size greater than or equals to 18 bytes)r   r   r   r   r   )ÚhashlibÚsha1Úmd5Ú	shake_128Ú
ValueErrorr   ÚsuperÚ__init__)Úselfr   r   r   r   r   r   Ú	__class__s          €Ú@/var/www/website/venv/lib/python3.13/site-packages/pyotp/hotp.pyr   ÚHOTP.__init__   sP   ø€ ð" ‰>Ü—\‘\‰FØœŸ™¤W×%6Ñ%6Ð7Ó7ÜÐtÓuÐuà*ÔÜ‰Ñ˜1°FÈfÐÒUó    Úcountc                 ó>   • U R                  U R                  U-   5      $ )zZ
Generates the OTP for the given count.

:param count: the OTP HMAC counter
:returns: OTP
)Úgenerate_otpr   )r   r   s     r   ÚatÚHOTP.at&   s    € ð × Ñ  ×!3Ñ!3°eÑ!;Ó<Ð<r   ÚotpÚcounterc                 ór   • [         R                  " [        U5      [        U R                  U5      5      5      $ )zˆ
Verifies the OTP passed in against the current counter OTP.

:param otp: the OTP to check against
:param counter: the OTP HMAC counter
)r   Ústrings_equalÚstrr"   )r   r$   r%   s      r   ÚverifyÚHOTP.verify/   s)   € ô ×"Ò"¤3 s£8¬S°·±¸Ó1AÓ-BÓCÐCr   Úissuer_namec           	      ó  • [         R                  " U R                  4U(       a  UOU R                  U(       a  UOU R                  U(       a  UOU R
                  U R                  5       R                  U R                  S.UD6$ )aÝ  
Returns the provisioning URI for the OTP.  This can then be
encoded in a QR Code and used to provision an OTP app like
Google Authenticator.

See also:
    https://github.com/google/google-authenticator/wiki/Key-Uri-Format

:param name: name of the user account
:param initial_count: starting HMAC counter value, defaults to 0
:param issuer_name: the name of the OTP issuer; this will be the
    organization title of the OTP entry in Authenticator
:returns: provisioning URI
)r   r   r   Ú	algorithmr   )r   Ú	build_uriÚsecretr   r   r   r   r   )r   r   r   r+   Úkwargss        r   Úprovisioning_uriÚHOTP.provisioning_uri8   sd   € ô* �ŠØ�K‰Kð
æ‘ 4§9¡9Þ+8™-¸d×>PÑ>PÞ"-‘;°4·;±;Ø—k‘k“m×(Ñ(Ø—;‘;ñ
ð ñ
ð 	
r   )r   )é   NNNr   )NNN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r(   Úintr   r   r   r"   Úboolr)   r1   Ú__static_attributes__Ú__classcell__)r   s   @r   r	   r	      sð   ø† ñð ØØ"Ø $ØñVàðVð ðVð ð	Vð
 �s‰mðVð ˜‘ðVð ðVð 
÷Vð Vð2=˜ð = ô =ðD˜#ð D¨ð D°ô Dð #Ø'+Ø%)ñ	
à�s‰mð
ð   ‘}ð
ð ˜c‘]ð	
ð 
÷
ó 
r   r	   )	r   Útypingr   r   Ú r   r$   r   r	   © r   r   Ú<module>r@      s   ðÛ ß  å Ý ôM
ˆ3õ M
r   