RustImplementation #23
@@ -18,6 +18,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
from getpass import getpass
|
from getpass import getpass
|
||||||
|
|
||||||
import keyring
|
import keyring
|
||||||
@@ -79,6 +80,20 @@ def retrieve_api_key(service: str, username: str, password: str) -> str:
|
|||||||
aesgcm = AESGCM(key)
|
aesgcm = AESGCM(key)
|
||||||
pt = aesgcm.decrypt(nonce, ct, associated_data=None)
|
pt = aesgcm.decrypt(nonce, ct, associated_data=None)
|
||||||
return pt.decode()
|
return pt.decode()
|
||||||
|
|
||||||
|
logger.debug(f"API key for service '{service}' and user '{username}' stored successfully.")
|
||||||
|
|
||||||
|
print("\n✅ API key stored securely.")
|
||||||
|
print("ℹ️ The program will now exit. Press Enter to continue...")
|
||||||
|
|
||||||
|
try:
|
||||||
|
_ = input()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
_ = None
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def api_key_exists(service: str, username: str) -> bool:
|
def api_key_exists(service: str, username: str) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user