Documentation
¶
Index ¶
- Constants
- Variables
- func FormatUUID(buf []byte) (string, error)
- func GenBetterGUID() string
- func GenKsuid() string
- func GenSid() string
- func GenSonyflake() string
- func GenUlid() string
- func GenXid() string
- func GenerateRandomBytes(size int) ([]byte, error)
- func GenerateRandomKey6() string
- func GenerateRandomKey16() string
- func GenerateRandomKey20() string
- func GenerateUUID() (string, error)
- func GetMD5Base64(bytes []byte) (base64Value string)
- func GetMd5String(s string) string
- func GetUUID() (uuidHex string)
- func New() string
- func NewShort() string
- func NextStrToken() string
- func NextToken() int64
- func ParseUUID(uuid string) ([]byte, error)
- func RandStringBytes(n int) string
- func SetPassword(password string, salt string) (verify string, err error)
- func UniqueId() string
- type CustomClaims
- type CustomToken
- type ID
- type IdWorker
- type Payload
- type UUID
Constants ¶
View Source
const ( Issuer = "utilInfo" Secret = "utilInfo" )
View Source
const ( ClaimsTypeRefresh = "RefreshToken" ClaimsTypeAccess = "AccessToken" )
View Source
const (
TokenTypeBearer = "bearer"
)
Variables ¶
View Source
var X gen
Functions ¶
func FormatUUID ¶
func GenBetterGUID ¶
func GenBetterGUID() string
func GenSonyflake ¶
func GenSonyflake() string
func GenerateRandomBytes ¶
GenerateRandomBytes is used to generate random bytes of given size.
func GenerateUUID ¶
GenerateUUID is used to generate a random UUID
func GetMD5Base64 ¶
func GetMd5String ¶
func NextStrToken ¶
func NextStrToken() string
func RandStringBytes ¶
func SetPassword ¶
SetPassword 根据明文密码和加盐值生成密码
Types ¶
type CustomClaims ¶
type CustomClaims struct {
Type string
*Payload
jwt.RegisteredClaims
}
func VerifyToken ¶
func VerifyToken(token string, claimsType string) (*CustomClaims, error)
type CustomToken ¶
type CustomToken struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresTime time.Time `json:"expires_time"`
RefreshToken string `json:"refresh_token"`
Payload *Payload `json:"payload"`
}
func GenerateToken ¶
func GenerateToken(payload *Payload, accessTokenExpiresTime, refreshTokenExpiresTime time.Duration) (*CustomToken, error)
type IdWorker ¶
type IdWorker struct {
// contains filtered or unexported fields
}
func (*IdWorker) InitIdWorker ¶
Click to show internal directories.
Click to hide internal directories.