File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ jobs:
110
110
PLAIN_OUTPUT : True
111
111
REDIS_URL : " localhost:6379"
112
112
IS_TESTING : True
113
-
113
+ ENCRYPTION_KEY : " abcdefghijklmnopqrstuvwxyz123456"
114
+
114
115
- name : Upload coverage reports to Codecov
115
116
uses : codecov/codecov-action@v3
Original file line number Diff line number Diff line change @@ -55,8 +55,8 @@ GITHUB_CLIENT_ID:
55
55
GITHUB_CLIENT_SECRET :
56
56
FRONTEND_URL : " http://localhost:3000"
57
57
58
- # ENCRPYTION KEY
59
- ENCRYPTION_KEY : secret
58
+ # ENCRPYTION KEY, Replace this with your own key for production
59
+ ENCRYPTION_KEY : abcdefghijklmnopqrstuvwxyz123456
60
60
61
61
# WEAVIATE
62
62
Original file line number Diff line number Diff line change
1
+ import base64
2
+
1
3
from cryptography .fernet import Fernet , InvalidToken , InvalidSignature
2
4
from superagi .config .config import get_config
3
5
# Generate a key
6
8
key = get_config ("ENCRYPTION_KEY" )
7
9
if key is None :
8
10
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
9
16
key = key .encode (
10
17
"utf-8"
11
18
)
19
+
20
+ # base64 encode the key
21
+ key = base64 .urlsafe_b64encode (key )
22
+
23
+ # Create a cipher suite
12
24
cipher_suite = Fernet (key )
13
25
14
26
You can’t perform that action at this time.
0 commit comments