ADD: added database connection for players data handling and started login funtion with database
This commit is contained in:
12
backend/internal/common/passwordHasher.go
Normal file
12
backend/internal/common/passwordHasher.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package common
|
||||
|
||||
import "golang.org/x/crypto/bcrypt"
|
||||
|
||||
func HashPassword(password string) (string, error) {
|
||||
// Use bcrypt to hash the password
|
||||
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(hashedPassword), nil
|
||||
}
|
||||
Reference in New Issue
Block a user