mvt icon indicating copy to clipboard operation
mvt copied to clipboard

Show characters typed in decrypt-backup

Open nimrod-a opened this issue 1 year ago • 3 comments

This PR addresses the improvement request to show characters typed in decrypt-backup as asterisks (*), so that people can follow the characters they typed (#581)

The rich library currently used by MVT does seem to support this feature.

password = Prompt.ask("Enter backup password", password=True) # rich library

The builtin password support of the library leads to the characters being completely hidden.

Using the popular promt_toolkit instead:

prompt('Enter backup password: ', is_password=True) # 
# > Enter backup password: *******

When the is_password=True flag has been given, the input is replaced by asterisks (* characters).

The downside is that another library is used for password inputs. However, this is a fairly simple solution for the issue.

Alternatively, one could also try and write a custom password prompt using the rich library.

nimrod-a avatar Jan 06 '25 11:01 nimrod-a

Hi, thanks for your contribution. This would be a useful feature but it requires an additional library prompt_toolkit. We are trying to limit external libraries used by MVT, so I am not sure a library is worth adding only for it. I am keeping this open tho in case others have different opinions.

Te-k avatar Jun 06 '25 21:06 Te-k

Understandable. Maybe the rich library will implement a customization for the password prompt, one could consider adding it as a feature request.

nimrod-a avatar Jun 07 '25 19:06 nimrod-a

Discussion in the rich project regarding this feature here: https://github.com/Textualize/rich/discussions/3726

besendorf avatar Jun 20 '25 09:06 besendorf