Remove cost and just use defaultCost
This commit is contained in:
parent
787165b7f1
commit
b52ed21d1d
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user