3
lá˜_ô ã @ s€ d dl mZmZmZ d dlmZmZ d dlmZ d dl m
Z
d dlmZ d dl
mZ d dlmZ d dlmZ G d d
„ d
eƒZdS )é )Úabsolute_importÚdivisionÚprint_function)ÚUnsupportedAlgorithmÚ_Reasons)Ú_get_backend)ÚHMACBackend)Ú
constant_time)ÚInvalidToken)ÚHOTP)Ú
_generate_uric @ s. e Zd Zddd„Zdd„ Zdd„ Zd d
„ ZdS )ÚTOTPNTc C s: t |ƒ}t|tƒstdtjƒ‚|| _t|||||ƒ| _d S )Nz.Backend object does not implement HMACBackend.) r Ú
isinstancer r r ZBACKEND_MISSING_INTERFACEÚ
_time_stepr Ú_hotp)ÚselfÚkeyZlengthÚ algorithmZ time_stepZbackendZenforce_key_length© r ú/usr/lib64/python3.6/totp.pyÚ__init__ s
z
TOTP.__init__c C s t || j ƒ}| jj|ƒS )N)Úintr r Úgenerate)r ÚtimeZcounterr r r r $ s z
TOTP.generatec C s t j| j|ƒ|ƒstdƒ‚d S )Nz#Supplied TOTP value does not match.)r Zbytes_eqr r
)r Útotpr r r r Úverify( s zTOTP.verifyc C s t | jd||dt| jƒfgƒS )Nr Zperiod)r r r r )r Zaccount_nameZissuerr r r Úget_provisioning_uri, s zTOTP.get_provisioning_uri)NT)Ú__name__Ú
__module__Ú__qualname__r r r r r r r r r
s
r
N)Z
__future__r r r Zcryptography.exceptionsr r Zcryptography.hazmat.backendsr Z'cryptography.hazmat.backends.interfacesr Zcryptography.hazmat.primitivesr Z(cryptography.hazmat.primitives.twofactorr
Z-cryptography.hazmat.primitives.twofactor.hotpr Z.cryptography.hazmat.primitives.twofactor.utilsr Úobjectr
r r r r Ú