Skip to content

Architecture

Sepehr0Day edited this page Jun 13, 2026 · 1 revision

Architecture

CaptchaGenerator/
  base.py          Shared file, font and background helpers
  core/
    config.py      CaptchaConfig
    result.py      ChallengeResult
    visual.py      VisualChallenge lifecycle
    renderer.py    Text rendering, styles and difficulty
    drawing.py     Shapes and grid positioning
    colors.py      Named palettes
    noise.py       Noise primitives
  generators/      One module per CAPTCHA

Generation Lifecycle

  1. A generator resolves CaptchaConfig.
  2. It creates or loads source content.
  3. It renders the public challenge asset.
  4. VisualChallenge._save applies hooks and output settings.
  5. It returns a structured ChallengeResult.

Legacy text, audio and image-selection generators inherit BaseCaptchaGenerator and return simpler string or tuple contracts.

Design Rules

  • One generator per module.
  • Shared behavior belongs in core.
  • Answers remain independent from presentation.
  • Metadata documents the UI contract.
  • Config hooks provide customization without subclassing.

Clone this wiki locally