from app.core.config import settings


# def key_iv_from_settings():
#     """
#     Derives the AES key and IV from the settings.
#     Raises RuntimeError if the settings are not valid hex strings.
#     """
#     try:
#         key = bytes.fromhex(settings.AES_KEY)
#         iv = bytes.fromhex(settings.AES_IV)
#         return key, iv
#     except ValueError:
#         raise RuntimeError("AES_KEY/AES_IV must be hex strings in environment")

# def key_iv_from_settings():
#     """
#     Derives the AES key and IV from settings (hex strings).
#     Raises RuntimeError if they are not valid hex.
#     """
#     try:
#         key = bytes.fromhex(settings.AES_KEY)
#         iv = bytes.fromhex(settings.AES_IV)
#         # if len(iv) != 16:
#         #     raise RuntimeError("AES_IV must be 16 bytes for AES-CBC")
#         # if len(key) not in (16, 24, 32):
#         #     raise RuntimeError("AES_KEY must be 16, 24, or 32 bytes long")
#         return key, iv
#     except ValueError:
#         raise RuntimeError("AES_KEY/AES_IV must be valid hex strings in environment")