Documentation ¶
Index ¶
- func ComparePasswords(pwHash string, plain []byte) bool
- func CreateJWT(secret string, userID int, expiresInSeconds int) (string, error)
- func GenerateSessionID() (string, error)
- func HashPassword(pw string) (string, error)
- func ValidateJWT(tokenString string, secret string) (jwt.MapClaims, error)
- func ValidateSession(s types.Session) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparePasswords ¶
func GenerateSessionID ¶
Creates a 32-byte (256-bit) long unique session IDs using rand.Read() Returns it and saves it to the database. with P(n) approx. 1 - e^(-4.32*10^-42) probabilyt for a collision and should therefore be reliable for this use case.
Ensuring uniqueness is important to enable storing IDs as map keys for O(1) lookups in most cases.
func HashPassword ¶
func ValidateJWT ¶
func ValidateSession ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.