Documentation ¶
Index ¶
- Variables
- func DecryptJWT(key []byte, token string) (string, error)
- func EncryptJWT(key []byte, sub []byte, expiry ...time.Duration) (string, error)
- func GenSpreadSign() string
- func GenerateRandomString(size int, kind ...RandomKind) string
- func GenerateRandomString2(size int, kind int) []byte
- func MarshalJSON(v interface{}) ([]byte, error)
- func SHA256(v, key, salt string) string
- func StructureName(s interface{}) string
- func ToToken(key string, token *WebToken) (string, error)
- func UnmarshalJSON(reader io.Reader, v interface{}) error
- type RandomKind
- type WebToken
Constants ¶
This section is empty.
Variables ¶
View Source
var ExpireTime = time.Hour * 24 * 7
ExpireTime ...
View Source
var ( RandomString = map[RandomKind]string{ RandomNum: "0123456789", RandomLower: "abcdefghijklmnopqrstuvwxyz", RandomUpper: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", RandomLowerNum: "0123456789abcdefghijklmnopqrstuvwxyz", RandomUpperNum: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", RandomAll: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", } )
RandomString defines
Functions ¶
func EncryptJWT ¶
EncryptJWT ...
func GenerateRandomString ¶
func GenerateRandomString(size int, kind ...RandomKind) string
GenerateRandomString 随机字符串
func GenerateRandomString2 ¶
GenerateRandomString2 随机字符串
Types ¶
type RandomKind ¶
type RandomKind int
RandomKind RandomKind
const ( RandomNum RandomKind = iota // 纯数字 RandomLower // 小写字母 RandomUpper // 大写字母 RandomLowerNum // 数字、小写字母 RandomUpperNum // 数字、大写字母 RandomAll // 数字、大小写字母 )
random kinds
Click to show internal directories.
Click to hide internal directories.