Encryption
This guide will show you how to work with encryption using our security package.
Encrypting
secretKey := []byte("12345678901234567890123456789012")
plaintext := []byte("Hello, world!")
ciphertext, err := security.Encrypt(plaintext, secretKey, nil)
if err != nil {
panic(err)
}
fmt.Println("Encrypted Data:", security.EncodeBase64(ciphertext))
Decrypting
decryptedText, err := security.Decrypt(ciphertext, secretKey)
if err != nil {
panic(err)
}
fmt.Println("Decrypted Data:", string(decryptedText))