bartificer / xkpasswd-js

The official JavaScript port of the Crypt::HSXKPasswd Perl module.
https://bartificer.github.io/xkpasswd-js/
BSD 2-Clause "Simplified" License
62 stars 11 forks source link

Add ability to run core XKPasswd from the command line (enhancement) #70

Open macLurker opened 8 months ago

macLurker commented 8 months ago

@hepabolu noted in another issue that, if we want to automate getting passwords, we should do it from the command line, not the web page.

Please add the ability to get passwords from the command line. Include ability to select:

  1. number of passwords to generate
  2. desired built-in preset config (DEFAULT, WEB32, WEB16, APPLEID, NTLM, SECURITYQ, XKCD)

Output the new passwords to STDOUT or a text file.

hepabolu commented 8 months ago

The intention has been all along to make a separate command line tool from the XKpasswd library, but that works better when all the functionality is there. I prefer to focus on getting the webapp's functionality on par with the old version before focusing on the CLI version.

bbusschots commented 8 months ago

This simple initial CLI proposal makes sense, but I would ask we try keep it as compatible as possible with the Perl CLI's interface: https://github.com/bbusschots/hsxkpasswd/blob/master/bin/hsxkpasswd

Also, to make the code maintainable I feel strongly we should build the CLI on top of a well supported framework for JavaScript CLI apps. I think the following are what we should target:

  1. Commander for the CLI args processing etc
  2. Chalk for colour output
  3. And maybe Conf for config file management

I think we might need to add support for Promises to the core library before we are ready for a CLI.

bbusschots commented 8 months ago

This seems like a good tutorial: https://blog.logrocket.com/creating-a-cli-tool-with-node-js/

eclipseo commented 7 months ago

Is it possible to make a library out of it so people would be able to include it in other projects?

bbusschots commented 7 months ago

Is it possible to make a library out of it so people would be able to include it in other projects?

Definitely — this repo was intended for just the library, but for now it has the web interface in it too to speed up development. Once the site comes out of beta it will be moved to its own repo, and this repo will become just the library. A third repo will also be created for the CLI.