Documentation
¶
Index ¶
- Variables
- func DummyHash() string
- func GetConfig(c *gin.Context) (*config.Config, bool)
- func GetDB(c *gin.Context) (*gorm.DB, bool)
- func GetPaginatedDB(c *gin.Context) (*gorm.DB, bool)
- func GetReady(c *gin.Context) bool
- func HashPassword(password string, salt string) (string, error)
- func RandomHexString(hexLen int) (string, error)
- func RandomPassword(length int, minNumbers, minSpecial int) (string, error)
- func VerifyPassword(password, compareHash string, pwsalt string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DummyHash ¶ added in v1.2.27
func DummyHash() string
DummyHash returns a valid argon2id hash generated with the exact same code path and parameters as real password hashes. Using HashPassword (rather than a hand-crafted format string) guarantees identical salt length, key length, and encoding, which eliminates subtle timing differences in VerifyPassword that could leak whether a user account exists.
func GetConfig ¶ added in v1.2.27
GetConfig extracts the "Config" value from the gin context. On failure it writes an HTTP 500 response and returns nil, false.
func GetDB ¶ added in v1.2.27
GetDB extracts the "DB" value from the gin context. On failure it writes an HTTP 500 response and returns nil, false.
func GetPaginatedDB ¶ added in v1.2.27
GetPaginatedDB extracts the "PaginatedDB" value from the gin context. On failure it writes an HTTP 500 response and returns nil, false.
func GetReady ¶ added in v1.2.31
GetReady extracts the "Ready" flag from the gin context and returns its current value. On failure (missing or wrong type) it returns false.
func RandomHexString ¶ added in v1.2.10
RandomHexString generates a cryptographically random hex string of the given length. The length is the number of hex characters (each character is 4 bits).
Types ¶
This section is empty.