Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Generator refactoring #65

Open
woodruffw opened this issue Feb 13, 2018 · 1 comment
Open

Generator refactoring #65

woodruffw opened this issue Feb 13, 2018 · 1 comment

Comments

@woodruffw
Copy link
Member

KBSecret's generator interface is currently pretty inflexible -- all generators take a format and length, and the current Generator class just uses SecureRandom.

Ideally, generators would be more like record types -- extensible by users, and pluggable.

A mock hierarchy:

KBSecret::Generator::Abstract
  - KBSecret::Generator::Basic # the current `SecureRandom` implementation
  - KBSecret::Generator::Whatever

This would necessitate a configuration change, from:

:generators:
  :default:
    :format: hex
    :length: 16

to:

:generators:
  :default:
    :type: basic
    :options:
      :format: hex
      :length: 16

But this could be checked for, for backwards compatibility.

@woodruffw
Copy link
Member Author

woodruffw commented May 30, 2018

Another idea: move the generator code out of KBSecret, and allow commands like kbsecret new to call an external command that generates the password. This would allow users to leverage the existing password generator ecosystem (pwgen, diceware, etc) and would simplify the codebase.

Pros:

  • Keeps codebase simple
  • Leverages existing tools
  • Conceptually simple and simpler to configure (no more kbsecret generator new?)

Cons:

  • Relies on the presence of external utilities
  • Might make hinting the generator more difficult (e.g., telling it to use at least one number, one symbol, etc.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant