Documentation
¶
Index ¶
- func ComparePasswordAndHash(password, encodedHash string) (match bool, err error)
- func DecryptAES(encryptedinput string, secret string) string
- func EncryptToAES(input string, secret string) string
- func GenerateFromPassword(password string) (encodedHash string, err error)
- func GenerateRandomSecret() string
- func GenerateToken(username string) (string, error)
- func TokenCheck(next http.Handler) http.Handler
- func ValidateToken(token *string) (bool, error)
- type Claims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparePasswordAndHash ¶ added in v1.1.0
ComparePasswordAndHash Compares the input password and the previously generated hash and checks if plain password matches the encrypted password
func DecryptAES ¶ added in v1.1.0
DecryptAES decrypts a encrypted aes string data to plain text
func EncryptToAES ¶ added in v1.1.0
EncryptToAES encrypts the given plain text data to encrypted string
func GenerateFromPassword ¶ added in v1.1.0
GenerateFromPassword generates a argon2 hash on the input password
func GenerateRandomSecret ¶ added in v1.1.0
func GenerateRandomSecret() string
GenerateRandomSecret generates a random 32 byte secret to use for encryption
func GenerateToken ¶
GenerateToken generates a JWT token with a configured token secret
func TokenCheck ¶
TokenCheck Middleware to secure endpoints
func ValidateToken ¶
ValidateToken validates an input token and tries to renew a token if close to expiring
Types ¶
type Claims ¶
type Claims struct {
Username string `json:"username"`
jwt.StandardClaims
}
Claims jwt claims container
Click to show internal directories.
Click to hide internal directories.