MCPcopy
hub / github.com/apache/devlake / Encrypt

Function Encrypt

backend/core/plugin/plugin_utils.go:36–46  ·  view source on GitHub ↗

TODO: maybe move encryption/decryption into helper? AES + Base64 encryption using ENCRYPTION_SECRET in .env as key

(encryptionSecret, plainText string)

Source from the content-addressed store, hash-verified

34// TODO: maybe move encryption/decryption into helper?
35// AES + Base64 encryption using ENCRYPTION_SECRET in .env as key
36func Encrypt(encryptionSecret, plainText string) (string, errors.Error) {
37 // add suffix to the data part
38 inputBytes := append([]byte(plainText), 123, 110, 100, 100, 116, 102, 125)
39 // perform encryption
40 output, err := AesEncrypt(inputBytes, []byte(encryptionSecret))
41 if err != nil {
42 return plainText, err
43 }
44 // Return the result after Base64 processing
45 return base64.StdEncoding.EncodeToString(output), nil
46}
47
48// Base64 + AES decryption using ENCRYPTION_SECRET in .env as key
49func Decrypt(encryptionSecret, encryptedText string) (string, errors.Error) {

Callers 2

TestEncodeAndDecodeFunction · 0.85
TestEncodeFunction · 0.85

Calls 1

AesEncryptFunction · 0.85

Tested by 2

TestEncodeAndDecodeFunction · 0.68
TestEncodeFunction · 0.68