o
    
c                     @   sF   d dl Z d dlmZ d dlmZ d dlmZmZmZ G dd dZ	dS )    N)constant_time)InvalidToken)_ALLOWED_HASH_TYPESHOTP_generate_uric                   @   s   e Zd Z		ddededededejdefd	d
Z	dej
eef defddZdededdfddZdedeje defddZdS )TOTPNTkeylength	algorithm	time_stepbackendenforce_key_lengthc                 C   s   || _ t||||d| _d S )N)r   )
_time_stepr   _hotp)selfr   r	   r
   r   r   r    r   Z/opt/certbot/lib/python3.10/site-packages/cryptography/hazmat/primitives/twofactor/totp.py__init__   s   	zTOTP.__init__timereturnc                 C   s   t || j }| j|S )N)intr   r   generate)r   r   counterr   r   r   r      s   zTOTP.generatetotpc                 C   s   t | ||stdd S )Nz#Supplied TOTP value does not match.)r   bytes_eqr   r   )r   r   r   r   r   r   verify#   s   zTOTP.verifyaccount_nameissuerc                 C   s   t | jd||dt| jfgS )Nr   period)r   r   r   r   )r   r   r   r   r   r   get_provisioning_uri'   s   zTOTP.get_provisioning_uri)NT)__name__
__module____qualname__bytesr   r   typingAnyboolr   Unionfloatr   r   strOptionalr   r   r   r   r   r      s2    
r   )
r$   cryptography.hazmat.primitivesr   (cryptography.hazmat.primitives.twofactorr   -cryptography.hazmat.primitives.twofactor.hotpr   r   r   r   r   r   r   r   <module>   s
   