Wrap more errors
This commit is contained in:
@ -1,6 +1,10 @@
|
||||
package bcrypt
|
||||
|
||||
import "golang.org/x/crypto/bcrypt"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
// Verifier verifys passwords using Bcrypt
|
||||
type Verifier struct {
|
||||
@ -16,7 +20,7 @@ func (bv *Verifier) Verify(password string, hashOnDb string) error {
|
||||
func (bv *Verifier) Hash(password string) (string, error) {
|
||||
hash, err := bcrypt.GenerateFromPassword([]byte(password), bv.cost)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", fmt.Errorf("hash password: %w", err)
|
||||
}
|
||||
|
||||
return string(hash[:]), nil
|
||||
|
Reference in New Issue
Block a user