
    ng                         d dl mZ d dlmZmZ d dlmZmZ d dlZ ej                         j                  Z
dZdZ edgd	      Zd
edefdZdededefdZddedefdZy)    )CryptContext)datetime	timedelta)JWTErrorjwtNHS256   bcryptauto)schemes
deprecatedpasswordreturnc                 ,    t         j                  |       S N)pwd_contexthash)r   s    0/var/www/html/trade_iq/helper_functions/login.pyhash_passwordr      s    H%%    plain_passwordhashed_passwordc                 .    t         j                  | |      S r   )r   verify)r   r   s     r   verify_passwordr      s    no>>r   dataexpires_deltac                     | j                         }t        j                         |xs t        t              z   }|j                  d|i       t        j                  |t        t              S )N)minutesexp)	algorithm)
copyr   utcnowr   ACCESS_TOKEN_EXPIRE_MINUTESupdater   encode
SECRET_KEY	ALGORITHM)r   r   	to_encodeexpires       r   create_access_tokenr+      sN    		I__-"a9E`3abFeV_%::iyAAr   r   )passlib.contextr   r   r   joser   r   uuiduuid4hexr'   r(   r$   r   strr   boolr   dictr+    r   r   <module>r5      s    ( (  TZZ\
	  H:&A&C &C &?C ?# ?$ ?Bd B9 Br   