Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareHashPassword ¶
CompareHashPassword compares a password (plain string) to a hash.
func GenerateHashPassword ¶
GenerateHashPassword generates a hash from a password.
func Preserve ¶
func Preserve(channels []chan struct{})
Preserve is a function that listens for exit signals and closes channels. This allows us to gracefully close the application, within Docker we normally have 10 seconds to close the application before it is forcefully closed. Therefore we can use 'channels' to gracefully close areas of the application. E.g. the API server and DB.
Types ¶
type TokenResponse ¶
type TokenResponse struct { UserID int `json:"user_id,omitempty"` Token string `json:"token"` ExpiresAfter time.Time `json:"expires_after"` }
TokenResponse is the response for a token.
func CreateTokenString ¶
func CreateTokenString(id int) (TokenResponse, error)
CreateTokenString creates a token string for a user using JWT.
func ParseToken ¶
func ParseToken(tokenString string) (TokenResponse, error)
ParseToken parses a token string and returns the token - checking for expiry.
Click to show internal directories.
Click to hide internal directories.