Documentation ¶
Overview ¶
Package token provides functionalities for encryption operations and handling of tokens.
Index ¶
- Variables
- func Detokenize(s string, aesSize, cipherSize int, cipher ...map[string]string) (string, map[string]string, error)
- func GenerateAlphaNumericString(size int) string
- func NewCipher(aesSize, cipherSize int) map[string]string
- func Tokenize(s string, aesSize, cipherSize int, cipher ...map[string]string) (string, map[string]string, error)
Constants ¶
This section is empty.
Variables ¶
var EnvKeyAESCipher = "CIPHER"
EnvKeyAESCipher is the environment key name for the AES cipher string.
var EnvKeyInitializationVector = "IV"
EnvKeyInitializationVector is the environment key name for the initialization vector.
Functions ¶
func Detokenize ¶
func Detokenize(s string, aesSize, cipherSize int, cipher ...map[string]string) (string, map[string]string, error)
Detokenize takes an encrypted string and decryption parameters to revert to the original string. It returns the decrypted string, the cipher used for the decryption, and any error encountered. Parameters: - s: the encrypted string to decrypt - aesSize: the size of the AES key that was used for encryption - cipherSize: the size of the initialization vector that was used for encryption - cipher: optional; an existing cipher map to use for decryption
func GenerateAlphaNumericString ¶
GenerateAlphaNumericString generates a random alphanumeric string of the specified size. It uses the tokenize package's GenAlphaNumericString function for the generation.
func NewCipher ¶
NewCipher generates a new cipher map containing an AES cipher string and an initialization vector. The sizes of the AES key and the initialization vector are specified by the parameters.
func Tokenize ¶
func Tokenize(s string, aesSize, cipherSize int, cipher ...map[string]string) (string, map[string]string, error)
Tokenize takes a string and encryption parameters to generate an encrypted token. It returns the encrypted token, the cipher used for the encryption, and any error encountered. Parameters: - s: the original string to encrypt - aesSize: the size of the AES key to generate - cipherSize: the size of the initialization vector to generate - cipher: optional; an existing cipher map to use for encryption
Types ¶
This section is empty.