feature (middleware): expose gcm encrypt to templating

This commit is contained in:
MickaelK
2024-07-22 22:48:18 +10:00
parent da20ac8b70
commit ae0eb94c61
2 changed files with 6 additions and 2 deletions

View File

@ -30,7 +30,7 @@ func EncryptString(secret string, data string) (string, error) {
if err != nil {
return "", err
}
d, err = encrypt([]byte(secret), d)
d, err = EncryptAESGCM([]byte(secret), d)
if err != nil {
return "", err
}
@ -126,7 +126,7 @@ func QuickString(n int) string {
return string(b)
}
func encrypt(key []byte, plaintext []byte) ([]byte, error) {
func EncryptAESGCM(key []byte, plaintext []byte) ([]byte, error) {
c, err := aes.NewCipher(key)
if err != nil {
return nil, err