mirror of
https://github.com/Viren070/MediaFusion.git
synced 2025-12-01 23:21:11 +01:00
crypto: Remove legacy userdata decryption handling
This commit is contained in:
+1
-15
@@ -131,7 +131,7 @@ class CryptoUtils:
|
||||
try:
|
||||
# Handle legacy format (no prefix)
|
||||
if not secret_str.startswith((DIRECT_PREFIX, REDIS_PREFIX)):
|
||||
return decrypt_legacy_user_data(secret_str)
|
||||
raise ValueError("Invalid user data")
|
||||
|
||||
prefix = secret_str[:2]
|
||||
data = secret_str[2:]
|
||||
@@ -212,20 +212,6 @@ def decrypt_text(secret_str: str, secret_key: str | bytes) -> str:
|
||||
return decrypted_data.decode("utf-8")
|
||||
|
||||
|
||||
def decrypt_legacy_user_data(secret_str: str | None = None) -> UserData:
|
||||
"""Legacy decryption function for existing user configs"""
|
||||
if not secret_str:
|
||||
return UserData()
|
||||
|
||||
try:
|
||||
decrypted_data = decrypt_text(secret_str, SECRET_KEY)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to decrypt legacy user data: {e}")
|
||||
raise ValueError("Invalid user data")
|
||||
user_data = UserData.model_validate_json(decrypted_data)
|
||||
return user_data
|
||||
|
||||
|
||||
def get_text_hash(text: str, full_hash: bool = False) -> str:
|
||||
hash_str = hashlib.sha256(text.encode()).hexdigest()
|
||||
return hash_str if full_hash else hash_str[:10]
|
||||
|
||||
Reference in New Issue
Block a user