How laughing-man-dev/stegano-g works
Project Type and Purpose
• This is a browser extension (Chrome/Firefox) that runs entirely client-side.
• Key responsibilities:
– Embedding/extracting hidden data in images (LSB steganography)
– Cryptographic signing, verification, and stamping using Web Crypto API
– UI for user interactions via popup and options pages
File Structure
Top-level:
• manifest.json – declares extension components and permissions
/src:
• background/background.js – the event‐driven background script (core logic: key management, crypto, stego)
• content/content.js – optional content script (page injections, not yet used)
• popup/{popup.html, popup.js, popup.css} – popup UI for user workflows
• options/{options.html, options.js, options.css} – options page for key & settings management
• utils/*.js – helper libraries (steganography, image loading/overlay, keypairs, crypto wrappers)
/testing – sample images and keys for offline testing
Extract Architectural Insights from the README
• Uses Canvas API for image processing
• Uses Web Crypto API for AES-GCM and RSA operations
• Entirely offline, runs in browser sandbox
• Messaging between UI and background (chrome.runtime.sendMessage / onMessage)
Main Components & Their Roles
a. Manifest & Extension Shell
– Entry point: declares background, popup, options, content scripts, permissions (storage, activeTab, etc.)
b. Background Script
– Central coordinator:
• Generates/manages RSA keypairs
• Performs AES encryption/decryption and LSB steganography
• Listens to UI messages, returns results
c. Popup UI
– User initiates actions:
• Choose image, embed/extract data
• Sign or verify content
• Requests background via messaging
d. Options Page
– Manage stored keys, metadata settings, alt-text
e. Content Script (future use)
– Injects UI into web pages, or operates on page images directly
f. Utilities
– LSB functions, image loaders, overlays, keypair storage helper
g. Web APIs (external)
– Canvas API – manipulate pixel data
– Web Crypto API – encryption, signing
h. Testing Assets
– Predefined images & JSON keys to verify integration and data flow
Relationships & Interactions
• User ↔ Popup UI: clicks buttons, chooses files.
• Popup UI ↔ Background: via message passing (chrome.runtime.sendMessage).
• Background ↔ Utils: calls steganography.js, imageOverlay.js, keypairs.js.
• Background ↔ Web Crypto API: for AES-GCM, RSA.
• Background ↔ Canvas API: for pixel‐level manipulation.
• Options UI ↔ Background: same messaging channel for key management.
• Content Script (future) ↔ Background/UI: via messaging or DOM injection.
Architectural Patterns & Principles
• Modular separation: UI logic (popup/options), business logic (background), utility library, data store.
• Event‐driven architecture: background script reacts to messages.
• Single Responsibility: each module focuses on one domain (UI, crypto, stego, key management).