yitsushi/totp-cli

Possibility to pass password as an argument

Closed this issue · 6 comments

Would be nice to be possible to pass the password as an argument, example:
totp-cli generate xpto xpto -password

How would it work and what would it do?

Oh you mean the unlock password? No, that would promote a bad security practice.

If you really want to skip typing the password, you can pipe into the command:

❯ age \
  --encrypt \
  --armor \
  --recipient age15velesv0zwpsc5w0n4da5tv64u9fzuhl8hjpvdmeayjg00fdf4wsxl834c \
  > "${HOME}/.config/totp-cli/totp-password.age"
myapssword
^D

❯ age --decrypt --identity ~/.age/efertone.txt ~/.config/totp-cli/totp-password.age | totp-cli list
Password: ***
....list of namespaces

Added a note about it in the readme: https://github.com/yitsushi/totp-cli#about-the-password

@BrunoKrugel: Was that your requested feature? If not, please give a bit more description what would you see when you add a password Flag.

Yes it was, thanks for the response

@BrunoKrugel : As a follow-up: now you can set TOTP_PASS without using stdin. Still don't recommend it, but it is possible now. Available with v1.5.0.

Hi @yitsushi , thanks for the heads up, I was able to make a workaround without passing the password, using the fish shell I made a little script:

function vpn
 set otp (totp-cli generate . .)
 vpn-login -o --otp-code $otp
end

So, after running the script, I just need to type the password and its done.