mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Encryption: Convert functions into global variables (#37240)
This commit is contained in:
parent
132e9c74c0
commit
8433def04f
@ -15,7 +15,7 @@ import (
|
|||||||
const saltLength = 8
|
const saltLength = 8
|
||||||
|
|
||||||
// Decrypt decrypts a payload with a given secret.
|
// Decrypt decrypts a payload with a given secret.
|
||||||
func Decrypt(payload []byte, secret string) ([]byte, error) {
|
var Decrypt = func(payload []byte, secret string) ([]byte, error) {
|
||||||
if len(payload) < saltLength {
|
if len(payload) < saltLength {
|
||||||
return nil, fmt.Errorf("unable to compute salt")
|
return nil, fmt.Errorf("unable to compute salt")
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ func Decrypt(payload []byte, secret string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Encrypt encrypts a payload with a given secret.
|
// Encrypt encrypts a payload with a given secret.
|
||||||
func Encrypt(payload []byte, secret string) ([]byte, error) {
|
var Encrypt = func(payload []byte, secret string) ([]byte, error) {
|
||||||
salt, err := GetRandomString(saltLength)
|
salt, err := GetRandomString(saltLength)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user