o
    i                     @   sd   d dl m Z mZ d dlmZ d dlmZ dZdZdZedgdd	Z	d
d Z
dd ZdefddZdS )    )datetime	timedelta)jwt)CryptContextCHANGE_THIS_SECRETHS256<   bcryptauto)schemes
deprecatedc                 C   s   t | |S N)pwd_ctxverify)raw_passwordhashed_password r   +/var/www/html/stock_analysis/be/app/auth.pyverify_password   s   r   c                 C   s
   t | S r   )r   hash)passwordr   r   r   hash_password   s   
r   usernamec                 C   s,   t  ttd }| |d}tj|ttdS )N)minutes)subexp)	algorithm)r   utcnowr   ACCESS_TOKEN_EXPIRE_MINUTESr   encode
SECRET_KEY	ALGORITHM)r   expirepayloadr   r   r   create_token   s
   r$   N)r   r   joser   passlib.contextr   r    r!   r   r   r   r   strr$   r   r   r   r   <module>   s    