Documentation ¶
Index ¶
- Constants
- Variables
- func AESCbcDecrypter(key, iv, ciphertext string) ([]byte, error)
- func AESCbcEncrypter(key, iv, s string) (string, error)
- func CreateNewClientID(email string) string
- func GenerateAccessToken(clientID, secreteKeyID string, expire int) (string, error)
- func GenerateRandomStringFixedLenght(length, timestamp int64) string
- func GenerateSecretKey(email, clientID, password string, expire int) (string, error)
- func GenerateSecurePassword(password string) (string, error)
- func ValidateAccessToken(token string) (string, bool, error)
- func ValidateAccessTokenFunc(token string) (json.RawMessage, bool)
- func ValidateSecretKey(secretKey string) (bool, error)
- func ValidateSecurePassword(password, hash string) (bool, error)
Constants ¶
View Source
const ( // LetterIdxBits num bits to represent a letter index LetterIdxBits = 6 // LetterIdxMask All 1-bits, as many as letterIdxBits LetterIdxMask = 1<<LetterIdxBits - 1 // LetterIdxMax # of letter indices fitting in 63 bits LetterIdxMax = 63 / LetterIdxBits )
Variables ¶
View Source
var ( // StampLength # lenth stamp StampLength int64 = 12 // LetterBytes random string generate LetterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" )
Functions ¶
func AESCbcDecrypter ¶
AESCbcDecrypter decrypt aes cipher strings
func AESCbcEncrypter ¶
AESCbcEncrypter encrypt strings to aes cipher strings
func CreateNewClientID ¶
CreateNewClientID generate SHA-256 hash string
func GenerateAccessToken ¶
GenerateAccessToken generate SHA-256 hash string expire in seconds
func GenerateRandomStringFixedLenght ¶
GenerateRandomStringFixedLenght doc ...
func GenerateSecretKey ¶
GenerateSecretKey generate SHA-256 hash string expire in seconds
func GenerateSecurePassword ¶
GenerateSecurePassword generate bcrypt password
func ValidateAccessToken ¶
ValidateAccessToken validate token Return the client_id. The bool value indicate whether the token is valid.
func ValidateAccessTokenFunc ¶
func ValidateAccessTokenFunc(token string) (json.RawMessage, bool)
ValidateAccessTokenFunc doc ...
func ValidateSecretKey ¶
ValidateSecretKey validate secret key
func ValidateSecurePassword ¶
ValidateSecurePassword validate user password
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.