Skip to content

feat(generator): Add stateless/deterministic password derivation mode #145

@dinesh-git17

Description

@dinesh-git17

Problem Statement

Users who prefer a stateless password management approach currently have no option in PassFX. Some users don't want to store passwords at all - they want to derive them deterministically from a master password + identifier combination.

Use cases:

  • Users paranoid about vault file storage/sync
  • Need consistent passwords across devices with zero sync infrastructure
  • Minimal attack surface preference (no database to breach)
  • Backup/recovery simplicity (nothing to back up except remembering the master password)

Proposed Solution

Add a Derived Mode to the existing password generator screen as an alternative to the current random generation:

Generator Screen
├── Random Mode (current)      → generates random passwords/passphrases
└── Derived Mode (new)         → deterministic from master + identifier

API Design

def derive_password(
    master_password: str,
    identifier: str,           # e.g., "myemail@gmail.com" or "YouTube2025"
    salt: bytes,               # from ~/.passfx/salt (already exists)
    length: int = 20,
    charset: Literal["special", "alnum", "numeric", "alpha"] = "special",
    version: int = 1,          # increment to rotate same identifier
) -> str:
    """Deterministically derive password from inputs."""

UI Changes

  • Toggle switch in generator screen: Random / Derived
  • When Derived mode selected:
    • Master password input (uses current vault master password or separate input)
    • Identifier input field (memorable label)
    • Version number spinner (default 1)
    • Existing charset and length options work as-is
  • Clear warning: "If you forget the exact identifier or version, this password is unrecoverable"

Cryptographic Implementation

  • PBKDF2-HMAC-SHA256 with 480,000 iterations (matching existing KDF parameters)
  • Use existing salt from ~/.passfx/salt
  • Proper entropy-preserving mapping from derived bytes to character set
  • All operations via cryptography library and secrets module

Alternatives Considered

  1. Separate standalone tool - Rejected; better UX to integrate into existing generator
  2. Replace vault entirely - Rejected; vault needed for metadata, arbitrary credentials, import/export
  3. Store derived password settings in vault - Could optionally save identifier/version/charset as a "recipe" without storing the actual password

Feature Area

Password Generator

Scope / Impact

Medium (new functionality, moderate changes)

Acceptance Criteria

  • Generator screen has toggle between Random and Derived modes
  • Derived mode accepts identifier, version, length, charset inputs
  • Same inputs always produce identical output (deterministic)
  • Uses PBKDF2-HMAC-SHA256 with 480k iterations
  • Clear UI warning about unrecoverability
  • Copy to clipboard works for derived passwords
  • Unit tests cover derivation function with known test vectors
  • No derived passwords or identifiers logged

Security Considerations

Strengths:

  • Nothing stored = nothing to steal (for derived passwords)
  • Attacker needs master password AND exact identifier AND version
  • High iteration count makes brute force impractical

Risks to mitigate:

  • Users forgetting identifiers (UI must warn clearly)
  • Master password compromise affects ALL derived passwords (same as vault, but no rotation path)
  • Side-channel: identifier input could leak via keyloggers (same risk as any input)

Implementation requirements:

  • Must use secrets module, never random
  • Must use cryptography library PBKDF2
  • Must not log identifiers or derived passwords
  • Constant-time comparison if any verification needed

Additional Context

Feature inspired by stateless password managers like LessPass, Master Password, and Spectre. This would give PassFX users the option to use either paradigm (or both) within the same tool.

Reference discussion: Reddit thread suggesting deterministic generation as alternative to vault storage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions