Skip to main content

Password manager using steganography to embed encrypted credentials in images

Project description

StegVault

Secure password manager using steganography to embed encrypted credentials within images

Python Version License Tests Coverage

StegVault is a full-featured password manager that combines modern cryptography with steganography. It can store either a single password or an entire vault of credentials, all encrypted using battle-tested algorithms (XChaCha20-Poly1305 + Argon2id) and hidden within ordinary PNG or JPEG images.

Latest Features (v0.6.1-beta): Application Layer - Clean architecture with UI-agnostic controllers for CLI/TUI/GUI support!

Features

Core Features

  • ๐Ÿ” Strong Encryption: XChaCha20-Poly1305 AEAD with Argon2id KDF
  • ๐Ÿ–ผ๏ธ Dual Steganography: PNG LSB + JPEG DCT coefficient modification
  • ๐ŸŽฏ Auto-Detection: Automatically detects image format (PNG/JPEG)
  • ๐Ÿ”’ Zero-Knowledge: All operations performed locally, no cloud dependencies
  • โœ… Authenticated: AEAD tag ensures data integrity
  • ๐Ÿงช Well-Tested: 614 unit tests with 92% overall coverage (all passing)
  • โฑ๏ธ User-Friendly: Progress indicators for long operations

Vault Mode

  • ๐Ÿ—„๏ธ Multiple Passwords: Store entire password vault in one image
  • ๐ŸŽฏ Key-Based Access: Retrieve specific passwords by key (e.g., "gmail", "github")
  • ๐Ÿ”‘ Password Generator: Cryptographically secure password generation
  • ๐Ÿ“‹ Rich Metadata: Username, URL, notes, tags, timestamps for each entry
  • ๐Ÿ”„ Dual-Mode: Choose single password OR vault mode
  • โ™ป๏ธ Auto-Detection: Automatically detects format on restore (backward compatible)
  • ๐Ÿ“ค Import/Export: Backup and restore vaults via JSON
  • ๐Ÿ“‹ Clipboard Support: Copy passwords to clipboard with auto-clear
  • ๐Ÿ” TOTP/2FA: Built-in authenticator with QR code support
  • ๐Ÿ›ก๏ธ Password Strength: Realistic validation using zxcvbn with actionable feedback
  • ๐Ÿ” Search & Filter: Find entries by query or filter by tags/URL

Gallery Mode (v0.5.0)

  • ๐Ÿ–ผ๏ธ Multi-Vault Management: Organize multiple vault images in one gallery
  • ๐Ÿ—„๏ธ SQLite Metadata: Centralized database for vault information and entry cache
  • ๐Ÿ” Cross-Vault Search: Search across all vaults simultaneously
  • ๐Ÿท๏ธ Tagging System: Organize vaults with custom tags
  • โšก Fast Search: Cached entry metadata for instant results
  • ๐Ÿ“Š Vault Statistics: Track entry counts, last accessed times
  • ๐Ÿ”„ Auto-Refresh: Update cache when vault contents change

Headless Mode (v0.6.0)

  • ๐Ÿค– JSON Output: Machine-readable output for all critical commands
  • ๐Ÿ“„ Passphrase File: Non-interactive authentication via --passphrase-file
  • ๐ŸŒ Environment Variables: STEGVAULT_PASSPHRASE for CI/CD pipelines
  • ๐Ÿ”ข Exit Codes: Standardized codes (0=success, 1=error, 2=validation)
  • โš™๏ธ Automation-Ready: Perfect for scripts, backups, and deployments
  • ๐Ÿ”— Priority System: Explicit > File > Env > Prompt fallback

Application Layer (v0.6.1)

  • ๐Ÿ—๏ธ Clean Architecture: Separation of business logic from UI layers
  • ๐ŸŽฏ Multi-Interface: Controllers work with CLI, TUI, and future GUI
  • ๐Ÿ“ฆ Structured Results: All operations return typed result objects
  • ๐Ÿงช Easy Testing: No UI framework dependencies in business logic
  • ๐Ÿ”„ Thread-Safe: Designed for concurrent access in GUI applications
  • ๐ŸŽจ Consistent Logic: Same business rules across all interfaces

Quick Start

Installation

# Install from PyPI (recommended)
pip install stegvault

# Or install from source
git clone https://github.com/kalashnikxvxiii-collab/stegvault.git
cd stegvault
pip install -e .

Usage

Mode 1: Single Password (Simple Backup)

1. Check Image Capacity

stegvault check -i myimage.png

2. Create Backup

stegvault backup -i cover.png -o backup.png

3. Restore Password

stegvault restore backup.png

Mode 2: Vault (Multiple Passwords)

Note: All commands work with both PNG and JPEG! Simply use .jpg extension:

stegvault vault create -i cover.jpg -o vault.jpg -k gmail --generate

1. Create Vault with First Entry

stegvault vault create -i cover.png -o vault.png -k gmail --generate
# Automatically generates a secure password for Gmail
# Works with JPEG too: -i cover.jpg -o vault.jpg

2. Add More Passwords

stegvault vault add vault.png -o vault_v2.png -k github -u myusername --generate
stegvault vault add vault_v2.png -o vault_v3.png -k aws

3. Retrieve Specific Password

stegvault vault get vault_v3.png -k gmail
# Output:
# Entry: gmail
# Username: user@gmail.com
# URL: https://gmail.com
# Password: X7k$mP2!qL5@wN

4. List All Keys

stegvault vault list vault_v3.png
# Output:
# Vault contains 3 entries:
#   1. gmail (user@gmail.com)
#   2. github (myusername)
#   3. aws

5. Update Entry

stegvault vault update vault_v3.png -o vault_v4.png -k gmail --password newpass123

6. Export Vault

stegvault vault export vault_v4.png -o backup.json --pretty

7. Import Vault

stegvault vault import backup.json -i cover.png -o restored_vault.png

8. Delete Entry

stegvault vault delete vault_v4.png -o vault_v5.png -k oldservice

9. Copy Password to Clipboard

stegvault vault get vault.png -k gmail --clipboard
# Password copied to clipboard (not displayed on screen)

# Auto-clear clipboard after 30 seconds
stegvault vault get vault.png -k gmail --clipboard --clipboard-timeout 30

10. Setup TOTP/2FA

# Add TOTP secret to entry
stegvault vault add vault.png -o vault_v2.png -k github -u myuser --totp

# Generate TOTP code
stegvault vault totp vault_v2.png -k github
# Output: Current TOTP code for 'github': 123456 (valid for 25 seconds)

# Show QR code for authenticator app
stegvault vault totp vault_v2.png -k github --qr

# Search vault entries
stegvault vault search vault.png --query "github"
# Search specific fields only
stegvault vault search vault.png -q "work" --fields key --fields notes

# Filter entries by tags
stegvault vault filter vault.png --tag work
stegvault vault filter vault.png --tag work --tag email --match-all

# Filter by URL pattern
stegvault vault filter vault.png --url github.com

Gallery Management (v0.5.0)

Manage multiple vaults in one place:

# Initialize gallery database
stegvault gallery init
# Creates ~/.stegvault/gallery.db

# Add vaults to gallery
stegvault gallery add work_vault.png --name work-vault --tag work
stegvault gallery add personal_vault.png --name personal-vault --tag personal

# List all vaults
stegvault gallery list
# Output:
# 2 vault(s) in gallery:
#
# Name: personal-vault
# Path: /path/to/personal_vault.png
# Entries: 5
# Tags: personal
#
# Name: work-vault
# Path: /path/to/work_vault.png
# Entries: 12
# Tags: work

# Search across ALL vaults
stegvault gallery search "github"
# Output:
# Found 2 matching entries:
#
# [work-vault]
# Key: github-work
# Username: work@company.com
# URL: https://github.com
#
# [personal-vault]
# Key: github-personal
# Username: myusername
# URL: https://github.com

# Search in specific vault only
stegvault gallery search "email" --vault work-vault

# Refresh vault metadata after changes
stegvault gallery refresh work-vault

# Remove vault from gallery (doesn't delete the image)
stegvault gallery remove old-vault

Headless Mode (v0.6.0) - Automation & CI/CD

Automation-friendly features for scripts, CI/CD pipelines, and server environments.

JSON Output

All critical commands support --json for machine-readable output:

# Check image capacity with JSON output
stegvault check -i image.png --json
{
  "status": "success",
  "data": {
    "image_path": "image.png",
    "format": "PNG",
    "mode": "RGB",
    "size": {"width": 800, "height": 600},
    "capacity": 18750,
    "max_password_size": 18686
  }
}
# Retrieve password in JSON format
stegvault vault get vault.png -k gmail --passphrase mypass --json
{
  "status": "success",
  "data": {
    "key": "gmail",
    "password": "secret123",
    "username": "user@gmail.com",
    "url": "https://gmail.com",
    "notes": "Personal email",
    "has_totp": true
  }
}
# List vault entries as JSON
stegvault vault list vault.png --passphrase mypass --json
{
  "status": "success",
  "data": {
    "entries": [
      {"key": "gmail", "username": "user@gmail.com", "url": "https://gmail.com", "has_totp": true},
      {"key": "github", "username": "myuser", "url": "https://github.com", "has_totp": false}
    ],
    "entry_count": 2
  }
}

Passphrase from File

Avoid interactive prompts by providing passphrase via file:

# Store passphrase in a secure file
echo "MySecretPassphrase" > ~/.vault_pass
chmod 600 ~/.vault_pass

# Use --passphrase-file to read from file
stegvault vault get vault.png -k gmail --passphrase-file ~/.vault_pass --json

# Works with all vault commands
stegvault vault list vault.png --passphrase-file ~/.vault_pass

Environment Variable

Set STEGVAULT_PASSPHRASE for completely non-interactive operation:

# Export passphrase as environment variable
export STEGVAULT_PASSPHRASE="MySecretPassphrase"

# No passphrase prompt - automatically uses env var
stegvault vault get vault.png -k gmail --json
stegvault vault list vault.png --json

Passphrase Priority

StegVault uses this priority order for passphrases:

  1. Explicit --passphrase (highest priority)
  2. --passphrase-file
  3. STEGVAULT_PASSPHRASE environment variable
  4. Interactive prompt (fallback)
# Explicit passphrase overrides file and env var
stegvault vault get vault.png -k gmail --passphrase "explicit" --json

# File overrides env var
stegvault vault get vault.png -k gmail --passphrase-file ~/.pass --json

# Env var used if no explicit or file
export STEGVAULT_PASSPHRASE="fallback"
stegvault vault get vault.png -k gmail --json

Exit Codes

Standardized exit codes for automation:

  • 0 = Success
  • 1 = Runtime error (wrong passphrase, file not found, decryption error)
  • 2 = Validation error (invalid input, empty passphrase file)
# Check exit code in scripts
stegvault vault get vault.png -k gmail --passphrase-file ~/.pass --json
if [ $? -eq 0 ]; then
    echo "Success"
elif [ $? -eq 1 ]; then
    echo "Runtime error"
elif [ $? -eq 2 ]; then
    echo "Validation error"
fi

Example: CI/CD Pipeline

# .github/workflows/deploy.yml
- name: Retrieve database password
  run: |
    PASSWORD=$(stegvault vault get secrets.png \
      -k db_password \
      --passphrase-file ${{ secrets.VAULT_PASSPHRASE_FILE }} \
      --json | jq -r '.data.password')
    echo "::add-mask::$PASSWORD"
    echo "DB_PASSWORD=$PASSWORD" >> $GITHUB_ENV

- name: Deploy application
  run: ./deploy.sh
  env:
    DB_PASSWORD: ${{ env.DB_PASSWORD }}

Example: Backup Script

#!/bin/bash
# backup_passwords.sh - Automated password backup

set -e  # Exit on error

VAULT_PASS_FILE="$HOME/.vault_pass"
BACKUP_DIR="$HOME/backups"
DATE=$(date +%Y%m%d)

# Verify passphrase file exists
if [ ! -f "$VAULT_PASS_FILE" ]; then
    echo "Error: Passphrase file not found"
    exit 1
fi

# Export vault to JSON
stegvault vault export vault.png \
    -o "$BACKUP_DIR/vault_$DATE.json" \
    --passphrase-file "$VAULT_PASS_FILE" \
    --pretty

# Check exit code
if [ $? -eq 0 ]; then
    echo "Backup created: $BACKUP_DIR/vault_$DATE.json"

    # Get vault statistics
    STATS=$(stegvault vault list vault.png \
        --passphrase-file "$VAULT_PASS_FILE" \
        --json)

    ENTRY_COUNT=$(echo "$STATS" | jq -r '.data.entry_count')
    echo "Backed up $ENTRY_COUNT entries"
else
    echo "Backup failed"
    exit 1
fi

Example: Password Rotation

#!/bin/bash
# rotate_password.sh - Programmatic password rotation

VAULT_FILE="vault.png"
SERVICE="github"
NEW_PASSWORD=$(openssl rand -base64 32)

# Retrieve current password info as JSON
INFO=$(stegvault vault get "$VAULT_FILE" \
    -k "$SERVICE" \
    --passphrase-file ~/.vault_pass \
    --json)

if [ $? -eq 0 ]; then
    USERNAME=$(echo "$INFO" | jq -r '.data.username')

    # Update password via external API (example)
    curl -X POST "https://api.github.com/user/password" \
        -u "$USERNAME:$NEW_PASSWORD"

    # Update vault with new password
    stegvault vault update "$VAULT_FILE" \
        -o "${VAULT_FILE}.new" \
        -k "$SERVICE" \
        --password "$NEW_PASSWORD" \
        --passphrase-file ~/.vault_pass

    mv "${VAULT_FILE}.new" "$VAULT_FILE"
    echo "Password rotated successfully"
fi

How It Works

Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    StegVault Workflow                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

        BACKUP CREATION                 PASSWORD RECOVERY
               โ†“                                โ†“
    1. User Input                    1. Load Stego Image
       โ€ข Master Password                 โ€ข backup.png
       โ€ข Passphrase                      โ€ข Enter Passphrase
       โ€ข Cover Image
                                      2. Extract Payload
    2. Encryption                        โ€ข LSB Extraction
       โ€ข Generate Salt (16B)             โ€ข Sequential Order
       โ€ข Derive Key (Argon2id)           โ€ข Parse Binary Format
       โ€ข Encrypt (XChaCha20)
                                      3. Decryption
    3. Payload Format                    โ€ข Verify AEAD Tag
       โ€ข Magic: "SPW1"                   โ€ข Derive Key (Argon2id)
       โ€ข Salt + Nonce                    โ€ข Decrypt Ciphertext
       โ€ข Ciphertext + Tag
                                      4. Recover Password
    4. LSB Embedding                     โ€ข Display/Save Password
       โ€ข Sequential Pixels
       โ€ข Modify LSB of R,G,B
       โ€ข Save Stego Image

    5. Output: backup.png

Cryptographic Stack

Component Algorithm Parameters
AEAD Cipher XChaCha20-Poly1305 256-bit key, 192-bit nonce
KDF Argon2id 3 iterations, 64MB memory, 4 threads
Salt CSPRNG 128 bits (16 bytes)
Nonce CSPRNG 192 bits (24 bytes)
Tag Poly1305 128 bits (16 bytes)

Payload Format

Binary structure embedded in images:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Offset  โ”‚  Size  โ”‚  Field         โ”‚  Description  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  0       โ”‚  4B    โ”‚  Magic Header  โ”‚  "SPW1"       โ”‚
โ”‚  4       โ”‚  16B   โ”‚  Salt          โ”‚  For Argon2id โ”‚
โ”‚  20      โ”‚  24B   โ”‚  Nonce         โ”‚  For XChaCha20โ”‚
โ”‚  44      โ”‚  4B    โ”‚  CT Length     โ”‚  Big-endian   โ”‚
โ”‚  48      โ”‚  N     โ”‚  Ciphertext    โ”‚  Variable     โ”‚
โ”‚  48+N    โ”‚  16B   โ”‚  AEAD Tag      โ”‚  (appended)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Steganography Techniques

StegVault automatically detects image format and uses the appropriate method:

PNG: LSB (Least Significant Bit) Embedding

  1. Sequential Pixel Ordering: All payload bits stored left-to-right, top-to-bottom for reliability and simplicity
  2. Distributed Embedding: Payload bits spread across R, G, B channels
  3. Minimal Visual Impact: Only LSB modified (imperceptible to human eye)
  4. High Capacity: ~3 bits per pixel (~90KB for 400x600 image)
# Simplified PNG LSB example
for y in range(height):
    for x in range(width):
        for channel in [R, G, B]:
            channel_value = (channel_value & 0xFE) | payload_bit

JPEG: DCT Coefficient Modification

  1. Frequency Domain: Modifies DCT (Discrete Cosine Transform) coefficients in 8x8 blocks
  2. Anti-Shrinkage: Only uses coefficients with |value| > 1 to prevent artifacts
  3. Multi-Channel: Embeds across Y, Cb, Cr channels
  4. Robust: More resistant to JPEG recompression than spatial methods
  5. Lower Capacity: ~1 bit per suitable coefficient (~18KB for 400x600 Q85 image)
# Simplified JPEG DCT example
for block in [Y_blocks, Cb_blocks, Cr_blocks]:
    for coef in block.AC_coefficients:  # Skip DC
        if abs(coef) > 1:  # Anti-shrinkage
            coef_lsb = abs(coef) % 2
            if coef_lsb != payload_bit:
                coef += 1 if coef > 0 else -1

Security Philosophy: Cryptographic strength (XChaCha20-Poly1305 + Argon2id) provides security, not the embedding method

Security Considerations

โœ… Strong Security Features

  • Modern Cryptography: XChaCha20-Poly1305 is a modern AEAD cipher resistant to various attacks
  • Strong KDF: Argon2id winner of Password Hashing Competition, resistant to GPU/ASIC attacks
  • Authenticated Encryption: Poly1305 MAC ensures integrity; tampering detected automatically
  • Cryptographic Security: Security provided by strong cryptography, not by hiding embedding pattern
  • No Key Reuse: Fresh nonce generated for each encryption

โš ๏ธ Limitations & Warnings

  • Not Invisible: Advanced steganalysis may detect embedded data
  • No Deniability: Payload has identifiable magic header
  • Format-Specific:
    • PNG: Use lossless formats only; JPEG recompression destroys LSB data
    • JPEG: More robust against recompression but lower capacity (~20% of PNG)
  • Both Required: Losing either image OR passphrase = permanent data loss
  • Offline Attacks: Attacker with image can attempt brute-force (mitigated by Argon2id)

๐Ÿ”’ Best Practices

  1. Strong Passphrase: Use 16+ character passphrase with mixed case, numbers, symbols
  2. Multiple Backups: Store copies in different locations
  3. PNG Format: Always use PNG (lossless) not JPEG (lossy)
  4. Verify Backups: Test restore process after creating backup
  5. Secure Storage: Protect image files as you would protect passwords

Application Layer (v0.6.1)

StegVault now includes a clean Application Layer that separates business logic from UI concerns. This architecture enables multiple user interfaces (CLI, TUI, GUI) to share the same underlying operations.

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          User Interfaces (UI)               โ”‚
โ”‚  CLI (Click)  โ”‚  TUI (Textual)  โ”‚  GUI (Qt) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
               โ”‚                  โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”
          โ”‚   Application Controllers  โ”‚
          โ”‚  โ€ข CryptoController        โ”‚
          โ”‚  โ€ข VaultController         โ”‚
          โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
               โ”‚                  โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”
          โ”‚    Core Modules            โ”‚
          โ”‚  โ€ข crypto  โ€ข vault  โ€ข stegoโ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Controllers

CryptoController

High-level encryption operations with structured results:

from stegvault.app.controllers import CryptoController

controller = CryptoController()

# Encrypt data
result = controller.encrypt(b"secret data", "passphrase")
if result.success:
    print(f"Salt: {result.salt.hex()}")
    print(f"Nonce: {result.nonce.hex()}")
else:
    print(f"Error: {result.error}")

# Decrypt data
result = controller.decrypt(
    ciphertext, salt, nonce, "passphrase"
)
if result.success:
    print(f"Plaintext: {result.plaintext}")

VaultController

Complete vault CRUD operations:

from stegvault.app.controllers import VaultController

controller = VaultController()

# Create new vault
vault, success, error = controller.create_new_vault(
    key="gmail",
    password="secret123",
    username="user@gmail.com",
    url="https://gmail.com",
    tags=["email", "personal"]
)

# Save to image
result = controller.save_vault(
    vault, "vault.png", "passphrase",
    cover_image="cover.png"
)

# Load from image
result = controller.load_vault("vault.png", "passphrase")
if result.success:
    vault = result.vault

# Get entry
entry_result = controller.get_vault_entry(vault, "gmail")
if entry_result.success:
    print(f"Password: {entry_result.entry.password}")

Benefits

  • UI-Agnostic: Controllers work with any interface (CLI/TUI/GUI)
  • Easy Testing: No need to mock UI frameworks
  • Consistent Logic: Same business rules across all interfaces
  • Thread-Safe: Designed for concurrent access (future GUI)
  • Structured Results: All operations return typed result objects

Result Data Classes

All controller methods return structured results with success/error info:

  • EncryptionResult - Encryption operations (ciphertext, salt, nonce)
  • DecryptionResult - Decryption operations (plaintext)
  • VaultLoadResult - Vault loading (vault object, error)
  • VaultSaveResult - Vault saving (output path, error)
  • EntryResult - Entry retrieval (entry object, error)

Development

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=stegvault --cov-report=html

# Run specific module tests
pytest tests/unit/test_crypto.py -v

Code Quality

# Format code
black stegvault tests

# Type checking
mypy stegvault

Project Structure

stegvault/
โ”œโ”€โ”€ stegvault/           # Source code
โ”‚   โ”œโ”€โ”€ crypto/          # Cryptography (Argon2id + XChaCha20)
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ core.py
โ”‚   โ”œโ”€โ”€ stego/           # Steganography (PNG LSB)
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ png_lsb.py
โ”‚   โ”œโ”€โ”€ utils/           # Payload format handling
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ payload.py
โ”‚   โ”‚   โ””โ”€โ”€ config.py
โ”‚   โ”œโ”€โ”€ vault/           # Password vault management (NEW in v0.4.0)
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ core.py       # Vault and VaultEntry classes
โ”‚   โ”‚   โ”œโ”€โ”€ operations.py # Vault CRUD operations + import
โ”‚   โ”‚   โ”œโ”€โ”€ generator.py  # Password generator
โ”‚   โ”‚   โ””โ”€โ”€ totp.py       # TOTP/2FA support
โ”‚   โ”œโ”€โ”€ batch/           # Batch operations
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ processor.py
โ”‚   โ”œโ”€โ”€ gallery/         # Multi-vault management (v0.5.0)
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ core.py      # Gallery and metadata classes
โ”‚   โ”‚   โ”œโ”€โ”€ db.py        # SQLite database operations
โ”‚   โ”‚   โ”œโ”€โ”€ operations.py # Gallery CRUD operations
โ”‚   โ”‚   โ””โ”€โ”€ search.py    # Cross-vault search
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ cli.py           # Command-line interface
โ”œโ”€โ”€ tests/               # Test suite (346 tests, 78% coverage)
โ”‚   โ”œโ”€โ”€ unit/
โ”‚   โ”‚   โ”œโ”€โ”€ test_crypto.py              # 26 tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_payload.py             # 22 tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_stego.py               # 16 tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_config.py              # 28 tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_batch.py               # 20 tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_vault.py                  # 49 tests (vault module)
โ”‚   โ”‚   โ”œโ”€โ”€ test_cli.py                    # 53 tests (core CLI)
โ”‚   โ”‚   โ”œโ”€โ”€ test_vault_cli.py              # 46 tests (vault CLI + TOTP)
โ”‚   โ”‚   โ”œโ”€โ”€ test_totp.py                   # 19 tests (TOTP/2FA)
โ”‚   โ”‚   โ”œโ”€โ”€ test_password_strength.py      # 24 tests (password validation)
โ”‚   โ”‚   โ”œโ”€โ”€ test_vault_search.py           # 24 tests (search/filter backend)
โ”‚   โ”‚   โ”œโ”€โ”€ test_vault_search_filter_cli.py # 5 tests (search/filter CLI)
โ”‚   โ”‚   โ”œโ”€โ”€ test_vault_update_delete_cli.py # 12 tests (update/delete CLI)
โ”‚   โ”‚   โ””โ”€โ”€ test_gallery.py                # 22 tests (gallery management)
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ docs/                # Documentation
โ”œโ”€โ”€ examples/            # Example images
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ CONTRIBUTING.md
โ”œโ”€โ”€ LICENSE              # MIT License
โ”œโ”€โ”€ README.md            # This file
โ”œโ”€โ”€ ROADMAP.md
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ requirements.txt

Roadmap

See ROADMAP.md for planned features and development timeline.

Coming Soon

  • GUI application (Electron or Qt)
  • JPEG DCT steganography (more robust)
  • Multi-vault operations and search
  • Gallery foundation for multi-file vault management
  • Optional cloud storage integration

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines.

Quick Contribution Guide

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Make changes with tests
  4. Commit (git commit -m 'feat: add amazing feature')
  5. Push (git push origin feature/amazing-feature)
  6. Open Pull Request

License

This project is licensed under the MIT License - see LICENSE file for details.

Disclaimer

StegVault is provided "as-is" for educational and personal use. The authors are not responsible for any data loss or security breaches. Always maintain multiple backups of critical passwords.

Security Notice: While StegVault uses strong cryptography, no system is perfect. This tool is best used as a supplementary backup method alongside traditional password managers.

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stegvault-0.7.0a1.tar.gz (73.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stegvault-0.7.0a1-py3-none-any.whl (78.3 kB view details)

Uploaded Python 3

File details

Details for the file stegvault-0.7.0a1.tar.gz.

File metadata

  • Download URL: stegvault-0.7.0a1.tar.gz
  • Upload date:
  • Size: 73.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stegvault-0.7.0a1.tar.gz
Algorithm Hash digest
SHA256 9425f33661771492edff25b75a105725d83d4255286a7ae29b80e88e81f8762c
MD5 cc535572ee3d39dbcf5b936b51480f9f
BLAKE2b-256 10af67c04ca67c579bfe8199aa5c632b914b39559441207f6ffca65d97eac416

See more details on using hashes here.

File details

Details for the file stegvault-0.7.0a1-py3-none-any.whl.

File metadata

  • Download URL: stegvault-0.7.0a1-py3-none-any.whl
  • Upload date:
  • Size: 78.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stegvault-0.7.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 0246e2900759b0aa256fe0208ac09629b97364ad6cf5cd5296625722f59af9aa
MD5 471c412b044e1569316dbc84340ce986
BLAKE2b-256 b2c7636ed99c1650681ea7c483395cb3a078f6c49c7856f65bda9ab981665769

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page