Add user management

This commit is contained in:
2026-05-02 14:31:19 +02:00
parent 24ade563db
commit 5997a29d92
20 changed files with 983 additions and 2 deletions
+13
View File
@@ -0,0 +1,13 @@
package security
import "golang.org/x/crypto/bcrypt"
func HashPassword(password string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(password), 14)
return string(bytes), err
}
func CheckPasswordHash(password, hash string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
return err == nil
}