token

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package token provides functionalities for encryption operations and handling of tokens.

Index

Constants

This section is empty.

Variables

View Source
var EnvKeyAESCipher = "CIPHER"

EnvKeyAESCipher is the environment key name for the AES cipher string.

View Source
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

func GenerateAlphaNumericString(size int) string

GenerateAlphaNumericString generates a random alphanumeric string of the specified size. It uses the tokenize package's GenAlphaNumericString function for the generation.

func NewCipher

func NewCipher(aesSize, cipherSize int) map[string]string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL