Skip to content

Commit f70e104

Browse files
committed
return encrypted data if !must_decrypt, even if there is no private key set
1 parent 59bdab0 commit f70e104

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/stacks/helpers/crypto.py

+6
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ def decrypt(data, private_key_path=os.getenv("STACKS_PRIVATE_KEY_PATH"), must_de
100100
string_encrypted_base64,
101101
) = data.removeprefix("ENC[").removesuffix("]").split(";")
102102

103+
if not private_key_path:
104+
if must_decrypt:
105+
raise Exception("please set the STACKS_PRIVATE_KEY_PATH environment variable")
106+
else:
107+
return data
108+
103109
private_key_paths = private_key_path.split(",")
104110
for i in range(len(private_key_paths)):
105111
with open(private_key_paths[i], "rb") as f:

0 commit comments

Comments
 (0)