Skip to content

Commit

Permalink
removed bcrypt dependency in favor of argon2
Browse files Browse the repository at this point in the history
  • Loading branch information
seekinginfiniteloop committed Jun 21, 2024
1 parent e944d98 commit 783e2a2
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 33 deletions.
8 changes: 4 additions & 4 deletions backend/app/core/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

from app.core.config import settings

pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
from datetime import timezone
pwd_context = CryptContext(schemes=["argon2"], deprecated="auto")


ALGORITHM = "HS256"


def create_access_token(subject: str | Any, expires_delta: timedelta) -> str:
expire = datetime.utcnow() + expires_delta
expire = datetime.now(timezone.utc) + expires_delta
to_encode = {"exp": expire, "sub": str(subject)}
encoded_jwt = jwt.encode(to_encode, settings.SECRET_KEY, algorithm=ALGORITHM)
return encoded_jwt
return jwt.encode(to_encode, settings.SECRET_KEY, algorithm=ALGORITHM)


def verify_password(plain_password: str, hashed_password: str) -> bool:
Expand Down
171 changes: 149 additions & 22 deletions backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 783e2a2

Please sign in to comment.