Remove cost and just use defaultCost

This commit is contained in:
Jan Bader 2022-02-20 20:42:07 +00:00
parent 787165b7f1
commit b52ed21d1d

View File

@ -7,9 +7,7 @@ import (
)
// Verifier verifys passwords using Bcrypt.
type Verifier struct {
cost int
}
type Verifier struct{}
// Verify verifys a Password.
func (bv *Verifier) Verify(password string, hashOnDB string) error {
@ -23,7 +21,7 @@ func (bv *Verifier) Verify(password string, hashOnDB string) error {
// Hash calculates a hash to be stored on the database.
func (bv *Verifier) Hash(password string) (string, error) {
hash, err := bcrypt.GenerateFromPassword([]byte(password), bv.cost)
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
if err != nil {
return "", fmt.Errorf("hash password: %w", err)
}