Trying to add jwt shit but failing cause im tired

This commit is contained in:
2025-05-15 21:33:55 +03:30
parent 49b38470cf
commit 855c778654
5 changed files with 6 additions and 15 deletions

2
internal/auth/jwt.go Normal file
View File

@@ -0,0 +1,2 @@
package auth

View File

@@ -1,15 +0,0 @@
package auth
import (
"golang.org/x/crypto/bcrypt"
)
func HashPassword(password string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
return string(bytes), err
}
func CheckPasswordHash(password, hash string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
return err == nil
}