Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BCrypt = &bcryptPasswordEncoder{}
Functions ¶
func RegisterPasswordEncoder ¶
func RegisterPasswordEncoder(name string, encoder PasswordEncoder)
RegisterPasswordEncoder makes a PasswordEncoder available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.
Types ¶
type PasswordEncoder ¶
type PasswordEncoder interface { Gensalt() (salt string, err error) /** * Encode the raw password. Generally, a good encoding algorithm applies a SHA-1 or * greater hash combined with an 8-byte or greater randomly generated salt. */ Encode(password string, salt ...string) (encodedPassword string, err error) /** * Matches verify the encoded password obtained from storage matches the submitted raw * password after it too is encoded. Returns true if the passwords match, false if * they do not. The stored password itself is never decoded. * * @param password the raw password to encode and match * @param salt the encoded password or encodedPassword from storage to compare with * @return true if the raw password, after encoding, matches the encoded password from * storage */ Matches(password, salt string) (ok bool, err error) }
PasswordEncoder interface for encoding passwords.
func GetPasswordEncoder ¶
func GetPasswordEncoder(name string) (encoder PasswordEncoder, ok bool)
GetPasswordEncoder returns a register PasswordEncoder
Click to show internal directories.
Click to hide internal directories.