3 œäL]:ã@stddlmZmZmZddlmZmZddlmZddl m Z ddl m Z ddl mZddlmZGdd „d eƒZd S) é)Úabsolute_importÚdivisionÚprint_function)ÚUnsupportedAlgorithmÚ_Reasons)Ú HMACBackend)Ú constant_time)Ú InvalidToken)ÚHOTP)Ú _generate_uric@s.eZdZd dd„Zdd„Zdd„Zdd „Zd S) ÚTOTPTcCs2t|tƒstdtjƒ‚||_t|||||ƒ|_dS)Nz.Backend object does not implement HMACBackend.)Ú isinstancerrrZBACKEND_MISSING_INTERFACEÚ _time_stepr Ú_hotp)ÚselfÚkeyÚlengthÚ algorithmZ time_stepÚbackendZenforce_key_length©rúW/tmp/pip-install-wfra5znf/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyÚ__init__s  z TOTP.__init__cCst||jƒ}|jj|ƒS)N)ÚintrrÚgenerate)rÚtimeÚcounterrrrrsz TOTP.generatecCstj|j|ƒ|ƒstdƒ‚dS)Nz#Supplied TOTP value does not match.)rZbytes_eqrr )rÚtotprrrrÚverify!sz TOTP.verifycCst|jd||dt|jƒfgƒS)NrZperiod)r rrr)rZ account_nameZissuerrrrÚget_provisioning_uri%s zTOTP.get_provisioning_uriN)T)Ú__name__Ú __module__Ú __qualname__rrrrrrrrr s r N)Ú __future__rrrZcryptography.exceptionsrrZ'cryptography.hazmat.backends.interfacesrZcryptography.hazmat.primitivesrZ(cryptography.hazmat.primitives.twofactorr Z-cryptography.hazmat.primitives.twofactor.hotpr Z.cryptography.hazmat.primitives.twofactor.utilsr Úobjectr rrrrÚs