from cryptography.fernet import Fernet

from config.settings import Settings

class SecretManager:
    settings = Settings()
    fernet = Fernet(settings.FARNET_KEY)
    @classmethod
    def encrypt(cls, data: str) -> str:
        return cls.fernet.encrypt(str(data).encode()).decode()

    @classmethod
    def decrypt(cls, token: str) -> str:
        return cls.fernet.decrypt(token.encode()).decode()