tsk-19: Service login (#23)

Closes #19

Reviewed-on: phoenix/textsender-auth#23
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2025-11-21 18:42:58 +00:00
committed by phoenix
parent c340693b24
commit 0a00282ba7
9 changed files with 205 additions and 29 deletions
+2 -2
View File
@@ -8,12 +8,12 @@ type HashMash struct {
Password string
}
func (h HashMash) HashPassword() (string, error) {
func (h *HashMash) HashPassword() (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(h.Password), bcrypt.DefaultCost)
return string(bytes), err
}
func (h HashMash) CheckPasswordHash(password string, hash string) bool {
func (h *HashMash) CheckPasswordHash(password string, hash string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
return err == nil
}