返回提交历史
Modified
g4f/gui/server/crypto.py
+2
-1
XFEstudio/gpt4free
Fix unittests
dc98d0cb
代码差异
1 个文件
+2
-1
@@ -12,7 +12,6 @@ from ...cookies import get_cookies_dir
12
12
def create_or_read_keys() -> tuple[RSAPrivateKey, RSAPublicKey]:
13
13
private_key_file = os.path.join(get_cookies_dir(), "private_key.pem")
14
14
public_key_file = os.path.join(get_cookies_dir(), "public_key.pem")
15
os.makedirs(os.path.dirname(private_key_file), exist_ok=True)
16
15
17
16
if os.path.isfile(private_key_file) and os.path.isfile(public_key_file):
18
17
# Read private key
@@ -47,6 +46,8 @@ def create_or_read_keys() -> tuple[RSAPrivateKey, RSAPublicKey]:
47
46
format=serialization.PublicFormat.SubjectPublicKeyInfo
48
47
)
49
48
49
os.makedirs(os.path.dirname(private_key_file), exist_ok=True)
50
50
51
# Write the private key PEM to a file
51
52
with open(private_key_file, 'wb') as f:
52
53
f.write(private_key_pem)