Documentation ¶
Index ¶
- func Decrypt(encryptedPhrase, secreteKey string) (plainPhrase string, err error)
- func Encrypt(plainPhrase, secreteKey string) (encryptedPhrase string, err error)
- func RandBytes(len int) (randomBytes []byte, err error)
- func RandBytesNoErr(len int) []byte
- func RandDigits(len int) (string, error)
- func RandDigitsNoErr(len int) string
- func RandString(len int) (randomString string, err error)
- func RandStringNoErr(len int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt extracts the text from the base64 encoded encrypted string using the secrete key and initialization vector used to encrypt the text
plainPhrase - is a plain text extracted from an encrypted text
valid - true if plainPhrase is a valid base64 string. It's false if plainPhrase is not a valid base64 string
func Encrypt ¶
Encrypt encrypts plainPhrase using the given secrete key and initialization vector(iv). Then returns an encrypted base64 URL-encoded string.
func RandBytes ¶
RandBytes generates a random []byte of length len
(Very handy for creating initiliazation vectors but you are not limited to!). It returns any raised error
func RandBytesNoErr ¶ added in v1.1.2
RandBytes generates a random []byte of length len
(Very handy for creating initiliazation vectors but you are not limited to!). It doesn't return any error but panics when encounters error
func RandDigits ¶
RandDigits generates secure random digits(0-9) which can be used for anything from generating OTP to verification codes. It returns any raised error
func RandDigitsNoErr ¶ added in v1.1.2
RandDigits generates secure random digits(0-9) which can be used for anything from generating OTP to verification codes. It doesn't return any error but panics when encounters error
func RandString ¶
RandString generates a random base64 URL-encoded string of length len. It returns any raised error
func RandStringNoErr ¶ added in v1.1.2
RandString generates a random base64 URL-encoded string of length len. It doesn't return any error but panics when encounters error
Types ¶
This section is empty.