SecPaste is a Python library and CLI tool for sharing encrypted content via public pastebin services with zero-knowledge architecture. Features: - Pluggable crypto backends (AES-256-GCM, ChaCha20-Poly1305, Kyber-768) - Pluggable pastebin providers (dpaste.com, extensible) - URL fragment key storage (key never sent to server) - Both CLI and library usage - Post-quantum cryptography support (experimental) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
46 lines
1.0 KiB
Python
46 lines
1.0 KiB
Python
"""Base pastebin provider interface."""
|
|
|
|
from abc import ABC, abstractmethod
|
|
from typing import Optional
|
|
|
|
|
|
class PastebinProvider(ABC):
|
|
"""Abstract base class for pastebin service providers."""
|
|
|
|
@abstractmethod
|
|
def paste(self, content: bytes, **kwargs) -> str:
|
|
"""
|
|
Upload content to the pastebin service.
|
|
|
|
Args:
|
|
content: Raw bytes to upload
|
|
**kwargs: Provider-specific options (e.g., expiration, syntax)
|
|
|
|
Returns:
|
|
The paste ID or URL (without fragment)
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def fetch(self, paste_id: str) -> bytes:
|
|
"""
|
|
Fetch content from the pastebin service.
|
|
|
|
Args:
|
|
paste_id: The paste identifier or URL
|
|
|
|
Returns:
|
|
Raw bytes of the paste content
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_name(self) -> str:
|
|
"""Return the name of this provider."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_base_url(self) -> str:
|
|
"""Return the base URL for this provider."""
|
|
pass
|