RC 1.1.1
This commit is contained in:
+16
-14
@@ -32,6 +32,8 @@ SALT_SIZE = 16 # 128-bit Salt
|
||||
NONCE_SIZE = 12 # AES-GCM
|
||||
KEY_SIZE = 32 # AES-256
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _derive_key(password: bytes, salt: bytes) -> bytes:
|
||||
kdf = PBKDF2HMAC(
|
||||
@@ -66,6 +68,20 @@ def store_api_key(service: str, username: str, api_key: str, password: str):
|
||||
b64 = base64.b64encode(blob).decode()
|
||||
keyring.set_password(service, username, b64)
|
||||
|
||||
|
||||
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 retrieve_api_key(service: str, username: str, password: str) -> str:
|
||||
configure_keyring_backend()
|
||||
@@ -80,20 +96,6 @@ def retrieve_api_key(service: str, username: str, password: str) -> str:
|
||||
aesgcm = AESGCM(key)
|
||||
pt = aesgcm.decrypt(nonce, ct, associated_data=None)
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user