Documentation ¶
Index ¶
- Constants
- func BytesToPrivateKey() (*rsa.PrivateKey, error)
- func BytesToPublicKey() (*rsa.PublicKey, error)
- func DecodeAscii85(value string) (string, error)
- func DecodeBase64(value string) (string, error)
- func DecodeSigningKey(rawTx string) (map[string]interface{}, error)
- func Decrypt(value string) (string, error)
- func DecryptWithPrivateKey(ciphertext string) (string, error)
- func EncodeAscii85(value string) string
- func EncodeBase32(value string) string
- func EncodeBase64(value string) string
- func EncodeMD5(value string) string
- func Encrypt(value string) (string, error)
- func EncryptWithPublicKey(msg []byte) (string, error)
- func GenerateHmacSHA256(secret, data, result string) string
- func GenerateScryptValue(value []byte, salt string) ([]byte, error)
- func GetPage(c *gin.Context) int
- func RsaDecryptPKCS1v15(encryptedText string) (string, error)
- func RsaEncryptPKCS1v15(plainText string) (string, error)
- func SendERC20(chainID int64, privateKey, to, contractAddress string, nonce, maxGas uint64, ...) (string, error)
- func SignTransaction(chainID int64, privateKey, to string, nonce, maxGas uint64, value float64, ...) (string, error)
- type Claims
- type PHCryReturnStruct
- type TokenDetails
- func GenerateAccessToken(scope []string, subID, memberCode, username string, expires time.Duration) (*TokenDetails, error)
- func GenerateRefreshToken(scope []string, subID string, expires time.Duration) (*TokenDetails, error)
- func GenerateToken(uuid string, subID string, expires time.Time, scope []string, tokenType string, ...) (*TokenDetails, error)
Constants ¶
const BaseDecimal int64 = 18
BaseDecimal decimal for base token
Variables ¶
This section is empty.
Functions ¶
func BytesToPrivateKey ¶
func BytesToPrivateKey() (*rsa.PrivateKey, error)
BytesToPrivateKey bytes to private key
func BytesToPublicKey ¶
BytesToPublicKey bytes to public key
func DecodeSigningKey ¶
DecodeSigningKey
func DecryptWithPrivateKey ¶
DecryptWithPrivateKey decrypts data with private key [only work with DecryptOAEP]
func EncodeBase64 ¶
EncodeBase64 base64 encryption example output: ZmVmZHNjZmZmZg==
func Encrypt ¶
Encrypt function example output: 31595d35a8f1fe9a3a10712b725e37d370e66ab824f3effe71c03935db68127f
func EncryptWithPublicKey ¶
EncryptWithPublicKey encrypts data with public key [only work with EncryptOAEP]
func GenerateHmacSHA256 ¶
func GenerateScryptValue ¶
func GenerateScrypt. Can refer https://github.com/elithrar/simple-scrypt/blob/master/scrypt.go
func RsaDecryptPKCS1v15 ¶
func RsaDecryptPKCS1v15 will work with DecryptPKCS1v15 can refer more detail in https://gist.github.com/hothero/93c69bbd57001ce0a1997f5dd1ba89f6
func RsaEncryptPKCS1v15 ¶
func RsaEncryptPKCS1v15 will work with EncryptPKCS1v15 can refer more detail in https://gist.github.com/hothero/93c69bbd57001ce0a1997f5dd1ba89f6
Types ¶
type Claims ¶
type Claims struct { jwt.StandardClaims Scope []string `json:"scope"` Data interface{} `json:"data"` }
type PHCryReturnStruct ¶
type TokenDetails ¶
// TokenDetails struct
func GenerateAccessToken ¶
func GenerateAccessToken(scope []string, subID, memberCode, username string, expires time.Duration) (*TokenDetails, error)
GenerateAccessToken generate tokens used for auth
func GenerateRefreshToken ¶
func GenerateRefreshToken(scope []string, subID string, expires time.Duration) (*TokenDetails, error)
GenerateRefreshToken generate tokens used for auth