Documentation
¶
Index ¶
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(n int) (string, error)
- func GenerateRandomStringURLSafe(n int) (string, error)
- func NewRedisClient(address string) *redis.Client
- func NewRedisStore(ctx context.Context, client *redis.Client) (*redisstore.RedisStore, error)
- type Claims
- type Config
- type JWT
- type Redis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomStringURLSafe ¶
GenerateRandomStringURLSafe returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func NewRedisClient ¶
func NewRedisClient(address string) *redis.Client
NewRedisClient creates a new redis client
func NewRedisStore ¶
NewRedisStore creates new default RedisStore
Types ¶
type Claims ¶
type Claims struct {
jwt.StandardClaims
ID int `json:"ID"`
Role string `json:"roles"`
RandomToken string `json:"token"`
}
Claims defines the custom JWT claims
type JWT ¶
type JWT struct {
// contains filtered or unexported fields
}
JWT is a JSON web token manager
func NewJWTManager ¶
NewJWTManager returns a new JWT manager
func (*JWT) GetSecretKey ¶
GetSecretKey returns secret key to sign jwt