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

@ -382,6 +382,10 @@ func SessionAuthMiddleware(ctx *App, res http.ResponseWriter, req *http.Request)
}
return false
},
"encryptGCM": func(str string, key string) (string, error) {
data, err := EncryptAESGCM([]byte(key), []byte(str))
return base64.StdEncoding.EncodeToString(data), err
},
}).
Parse(str)
mappingToUse[k] = str