diff --git a/backend/auth.py b/backend/auth.py index 6b2d946..e05c010 100644 --- a/backend/auth.py +++ b/backend/auth.py @@ -1,2 +1,19 @@ from database import execute -import bcrypt \ No newline at end of file +import bcrypt + +def create_user(username, password): + + password_hash = bcrypt.hashpw( + password.encode(), + bcrypt.gensalt() + ).decode() + + user_id = execute( + """ + INSERT INTO users (username, password_hash) + VALUES (?, ?) + """, + (username, password_hash) + ) + + return user_id \ No newline at end of file