utils

package
v0.0.0-...-8336b8e Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger()

Types

type Claims

type Claims struct {
	ID       int64  `json:"id"`
	Username string `json:"username"`
	jwt.RegisteredClaims
}

type Crypto

type Crypto struct {
	Options *password.Options
}

func Default

func Default() *Crypto

func NewPWD

func NewPWD(saltLen, iterations, keyLen int, fn func() hash.Hash) *Crypto

func (*Crypto) GenPassword

func (p *Crypto) GenPassword(rawPwd string) string

func (*Crypto) Verify

func (p *Crypto) Verify(rawPwd, encodedPwd string) bool

type CustomJWT

type CustomJWT struct {
	SigningKey []byte
}

func NewCustomJWT

func NewCustomJWT(signingKey []byte) *CustomJWT

func (*CustomJWT) GenerateToken

func (j *CustomJWT) GenerateToken(claims *Claims) (string, error)

GenerateToken generate token by claims

func (*CustomJWT) ParseToken

func (j *CustomJWT) ParseToken(tokenString string) (*Claims, error)

ParseToken parse token by token string

func (*CustomJWT) RefreshToken

func (j *CustomJWT) RefreshToken(tokenString string) (string, error)

RefreshToken refresh token by token string

type EmailCodeService

type EmailCodeService struct {
	To      string `json:"to"`
	Code    string `json:"code"`
	Subject string `json:"subject"`
}

func NewEmailCodeService

func NewEmailCodeService(to, code, subject string) *EmailCodeService

func (*EmailCodeService) SendCode

func (e *EmailCodeService) SendCode() error

Jump to

Keyboard shortcuts

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