Add --channel-key flag to generate command

- stegasoo generate --channel-key now outputs a 256-bit hex key
- Also added .env.example template for Web UI configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Aaron D. Lee
2026-01-02 21:56:02 -05:00
parent 267547caba
commit 6b1b306f61
3 changed files with 31 additions and 5 deletions

2
.gitignore vendored
View File

@@ -54,7 +54,7 @@ htmlcov/
# Environment # Environment
.env .env
.env.* .env.local
*.log *.log
# Distribution # Distribution

View File

@@ -0,0 +1,15 @@
# Stegasoo Web UI Configuration
# Copy this file to .env and customize
# Authentication (v4.0.2+)
STEGASOO_AUTH_ENABLED=true
STEGASOO_HTTPS_ENABLED=false
STEGASOO_HOSTNAME=localhost
# Channel Key (256-bit hex for private channel isolation)
# Generate with: python -c "import secrets; print(secrets.token_hex(32))"
# Leave empty for public mode
STEGASOO_CHANNEL_KEY=
# Flask settings
FLASK_ENV=production

View File

@@ -398,16 +398,21 @@ def batch_check(ctx, images, recursive):
@click.option( @click.option(
"--pin-length", default=DEFAULT_PIN_LENGTH, help=f"PIN length (default: {DEFAULT_PIN_LENGTH})" "--pin-length", default=DEFAULT_PIN_LENGTH, help=f"PIN length (default: {DEFAULT_PIN_LENGTH})"
) )
@click.option(
"--channel-key", is_flag=True, help="Also generate a 256-bit channel key"
)
@click.pass_context @click.pass_context
def generate(ctx, words, pin_length): def generate(ctx, words, pin_length, channel_key):
""" """
Generate random credentials (passphrase + PIN). Generate random credentials (passphrase + PIN + optional channel key).
Examples: Examples:
stegasoo generate stegasoo generate
stegasoo generate --words 6 --pin-length 8 stegasoo generate --words 6 --pin-length 8
stegasoo generate --channel-key
""" """
import secrets import secrets
@@ -451,11 +456,17 @@ def generate(ctx, words, pin_length):
"pin_length": pin_length, "pin_length": pin_length,
} }
# Generate channel key if requested
if channel_key:
result["channel_key"] = secrets.token_hex(32)
if ctx.obj.get("json"): if ctx.obj.get("json"):
click.echo(json.dumps(result, indent=2)) click.echo(json.dumps(result, indent=2))
else: else:
click.echo(f"Passphrase: {passphrase}") click.echo(f"Passphrase: {passphrase}")
click.echo(f"PIN: {pin}") click.echo(f"PIN: {pin}")
if channel_key:
click.echo(f"Channel Key: {result['channel_key']}")
click.echo("\n⚠️ Save these credentials securely - they cannot be recovered!") click.echo("\n⚠️ Save these credentials securely - they cannot be recovered!")