utils

package
v0.0.0-...-dd5d962 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired   = errors.New("Token is expired")
	TokenNotValid  = errors.New("Token not active yet")
	TokenMalformed = errors.New("That's not even a token")
	TokenInvalid   = errors.New("Couldn't handle this token:")
)

Functions

func BcryptCheck

func BcryptCheck(password, hash string) bool

func BcryptHash

func BcryptHash(password string) string

func EncodeMD5

func EncodeMD5(str []byte, b ...byte) string

Types

type CaptchaRedisStore

type CaptchaRedisStore struct {
	Expiration time.Duration
	PreKey     string
	Context    context.Context
}

func NewDefaultCaptchaRedisStore

func NewDefaultCaptchaRedisStore() *CaptchaRedisStore

func (*CaptchaRedisStore) Get

func (rs *CaptchaRedisStore) Get(key string, clear bool) string

func (*CaptchaRedisStore) Set

func (rs *CaptchaRedisStore) Set(id string, value string) error

func (*CaptchaRedisStore) UseWithContext

func (rs *CaptchaRedisStore) UseWithContext(ctx context.Context) base64Captcha.Store

func (*CaptchaRedisStore) Verify

func (rs *CaptchaRedisStore) Verify(id, answer string, clear bool) bool

type JWTUtil

type JWTUtil struct {
	SecretKey   []byte
	ExpiresTime int64
	BufferTime  int64
	Issuer      string
}

func NewJWTUtil

func NewJWTUtil() *JWTUtil

func (*JWTUtil) CreateClaims

func (jwtUtil *JWTUtil) CreateClaims(mobile string, userName string) apiCommon.JWTClaims

func (*JWTUtil) GernerateToken

func (jwtUtil *JWTUtil) GernerateToken(claims apiCommon.JWTClaims) (string, error)

func (*JWTUtil) ParseToken

func (jwtUtil *JWTUtil) ParseToken(tokenString string) (*apiCommon.JWTClaims, error)

func (*JWTUtil) Refresh

func (jwtUtil *JWTUtil) Refresh(oldToken string, claims apiCommon.JWTClaims) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL