U çe¨]:ã@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ÚkeyZlengthÚ algorithmZ time_stepZbackendZenforce_key_length©rúO/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/twofactor/totp.pyÚ__init__s þz TOTP.__init__cCst||jƒ}|j |¡S)N)ÚintrrÚgenerate)rÚtimeZcounterrrrrsz TOTP.generatecCst | |¡|¡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)Z __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