Documentation ¶
Index ¶
- func ComparePasswords(storedPassword string, suppliedPassword string) (bool, error)
- func GenerateIDToken(user *model.User, key *rsa.PrivateKey, exp int64) (string, error)
- func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error)
- func GeneratePublicKey(rsaPublicKey *rsa.PublicKey) ([]byte, error)
- func GenerateRefreshToken(uid uuid.UUID, key string, exp int64) (*model.RefreshTokenData, error)
- func HashPassword(password string) (string, error)
- func IsAllowedImageType(mimeType string) bool
- func ObjNameFromURL(imageURL string) (string, error)
- func ValidateIDToken(tokenString string, key *rsa.PublicKey) (*model.IDTokenCustomClaims, error)
- func ValidateRefreshToken(tokenString string, key string) (*model.RefreshTokenCustomClaims, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparePasswords ¶
ComparePasswords get the string password and hashed it with salt get from stored password and compare both hashed passwords
func GenerateIDToken ¶
GenerateIDToken generates an IDToken which is a jwt with myCustomClaims Could call this GenerateIDTokenString, but the signature makes this fairly clear
func GeneratePrivateKey ¶
func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error)
GeneratePrivateKey creates a RSA Private Key of specified byte size
func GeneratePublicKey ¶
GeneratePublicKey take a rsa.PublicKey and return bytes suitable for writing to .pub file returns in the format "ssh-rsa ..."
func GenerateRefreshToken ¶
GenerateRefreshToken creates a refresh token The refresh token stores only the user's ID, a string
func HashPassword ¶
HashPassword receive a string password and hash it with salt
func IsAllowedImageType ¶
IsAllowedImageType determines if image is among types defined in map of allowed images
func ObjNameFromURL ¶
ObjNameFromURL get base image from given url
func ValidateIDToken ¶
ValidateIDToken returns the token's claims if the token is valid
func ValidateRefreshToken ¶
func ValidateRefreshToken(tokenString string, key string) (*model.RefreshTokenCustomClaims, error)
ValidateRefreshToken uses the secret key to validate a refresh token
Types ¶
This section is empty.