Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidType = errors.New("Input must be either a Serializer or byte slice!") ErrInvalidData = errors.New("Input is invalid!") )
These are the errors to be expected when things go awry during the encryption/cipher creation process
Functions ¶
func DecryptData ¶
func DecryptData(src []byte, dst Serializer) ([]byte, error)
DecryptData takes a destination interface{} and a byte slice and decrypts the bytes into the destination using a GCM cipher block. If dst is not nil, the decrypted data will be passed into the Serializer's Deserialize method. This method returns the decrypted bytes regardless.
func EncryptData ¶
EncryptData takes a value and encrypts it using a GCM cipher block
func GenerateCSRFToken ¶
func GenerateCSRFToken() string
GenerateCSRFToken generates and returns a cryptographically random token for use in cross-site request forgery protection
Types ¶
type Serializer ¶
Serializer is an interface that allows one to encrypt/decrypt data directly from/to a struct
Click to show internal directories.
Click to hide internal directories.