namespace Codex.Dal.Services;

/// <summary>
/// Service for encrypting and decrypting sensitive data (API keys, tokens, etc.).
/// Uses AES-256 encryption with random IVs for security.
/// </summary>
public interface IEncryptionService
{
    /// <summary>
    /// Encrypts plain text using AES-256 encryption.
    /// The IV is randomly generated and prepended to the ciphertext.
    /// </summary>
    /// <param name="plainText">The text to encrypt</param>
    /// <returns>Base64-encoded encrypted data (IV + ciphertext)</returns>
    string Encrypt(string plainText);

    /// <summary>
    /// Decrypts encrypted text that was encrypted using the Encrypt method.
    /// Extracts the IV from the beginning of the encrypted data.
    /// </summary>
    /// <param name="encryptedText">Base64-encoded encrypted data (IV + ciphertext)</param>
    /// <returns>Decrypted plain text</returns>
    string Decrypt(string encryptedText);
}
