Return own error

This commit is contained in:
Jan Bader 2022-02-19 22:04:35 +00:00
parent 558fddc139
commit b0175542f1

View File

@ -13,7 +13,12 @@ type Verifier struct {
// Verify verifys a Password.
func (bv *Verifier) Verify(password string, hashOnDB string) error {
return bcrypt.CompareHashAndPassword([]byte(hashOnDB), []byte(password))
err := bcrypt.CompareHashAndPassword([]byte(hashOnDB), []byte(password))
if err != nil {
return fmt.Errorf("verify password: %w", err)
}
return nil
}
// Hash calculates a hash to be stored on the database.