Skip to content

Commit 44a2af1

Browse files
Merge branch 'main' of github.com:TransformerOptimus/SuperAGI into add_entrypoint
2 parents 208541d + ea2a0b6 commit 44a2af1

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110
PLAIN_OUTPUT: True
111111
REDIS_URL: "localhost:6379"
112112
IS_TESTING: True
113-
113+
ENCRYPTION_KEY: "abcdefghijklmnopqrstuvwxyz123456"
114+
114115
- name: Upload coverage reports to Codecov
115116
uses: codecov/codecov-action@v3

config_template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ GITHUB_CLIENT_ID:
5555
GITHUB_CLIENT_SECRET:
5656
FRONTEND_URL: "http://localhost:3000"
5757

58-
#ENCRPYTION KEY
59-
ENCRYPTION_KEY: secret
58+
#ENCRPYTION KEY, Replace this with your own key for production
59+
ENCRYPTION_KEY: abcdefghijklmnopqrstuvwxyz123456
6060

6161
#WEAVIATE
6262

superagi/helper/encyption_helper.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import base64
2+
13
from cryptography.fernet import Fernet, InvalidToken, InvalidSignature
24
from superagi.config.config import get_config
35
# Generate a key
@@ -6,9 +8,19 @@
68
key = get_config("ENCRYPTION_KEY")
79
if key is None:
810
raise Exception("Encryption key not found in config file.")
11+
12+
if len(key) != 32:
13+
raise ValueError("Encryption key must be 32 bytes long.")
14+
15+
# Encode the key to UTF-8
916
key = key.encode(
1017
"utf-8"
1118
)
19+
20+
# base64 encode the key
21+
key = base64.urlsafe_b64encode(key)
22+
23+
# Create a cipher suite
1224
cipher_suite = Fernet(key)
1325

1426

0 commit comments

Comments
 (0)