Trying to add jwt shit but failing cause im tired
This commit is contained in:
2
internal/auth/jwt.go
Normal file
2
internal/auth/jwt.go
Normal file
@@ -0,0 +1,2 @@
|
||||
package auth
|
||||
|
@@ -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
|
||||
}
|
Reference in New Issue
Block a user