"""Base cryptographic interface for SecPaste.""" from abc import ABC, abstractmethod from typing import Tuple class CipherBackend(ABC): """Abstract base class for cipher implementations.""" @abstractmethod def encrypt(self, plaintext: bytes) -> Tuple[bytes, str]: """ Encrypt plaintext data. Args: plaintext: Raw bytes to encrypt Returns: Tuple of (ciphertext, key) where key is base64url-encoded """ pass @abstractmethod def decrypt(self, ciphertext: bytes, key: str) -> bytes: """ Decrypt ciphertext using the provided key. Args: ciphertext: Encrypted data key: Base64url-encoded encryption key Returns: Decrypted plaintext bytes """ pass @abstractmethod def get_name(self) -> str: """Return the name/identifier of this cipher backend.""" pass