Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidCredentials = errors.New("invalid credentials")
)
Functions ¶
This section is empty.
Types ¶
type HashPassword ¶
type HashPassword interface { HashPassword(password string) (string, error) ComparePassword(hashPassword string, password string) error }
func NewHashingPassword ¶
func NewHashingPassword() HashPassword
NewHashingPassword initializes a new Hashing instance for hashing and comparing passwords.
Returns:
- HashPassword: The initialized Hashing instance.
type Hashing ¶
type Hashing struct{}
func (Hashing) ComparePassword ¶
ComparePassword takes a hashed password and a plaintext password and returns an error if the passwords do not match.
Parameters:
- hashPassword: The hashed password to compare against (string)
- password: The plaintext password to compare to the hashed password (string)
Returns:
- error: nil if the passwords match, otherwise an error (error)
func (Hashing) HashPassword ¶
HashPassword takes a plaintext password and returns a hashed version of the password. The hashed password is a string that can be safely stored in a database or other secure storage.
Parameters:
- password: The plaintext password to be hashed (string)
Returns:
- string: The hashed version of the password (string)
- error: Any error encountered while hashing the password (error)
Click to show internal directories.
Click to hide internal directories.