survey icon indicating copy to clipboard operation
survey copied to clipboard

Password input without revealing password length

Open quiquelhappy opened this issue 3 years ago • 1 comments

Hello, I'd link to render "", instead of "*" for the password input: similar to what linux does with pretty much every password input (aka invisible password input)

quiquelhappy avatar Oct 15 '21 17:10 quiquelhappy

Hello, thank you for the valid feature request! Right now, it doesn't seem that the Password input prompt allows modifying how the entered password is displayed. If, for example, the * replacement character was configurable, it could be configured using an empty string instead. Contributions to add this functionality are welcome.

In the meantime, I suggest that you make your own password prompt. You can use this package instead of Survey: https://pkg.go.dev/golang.org/x/term#ReadPassword

mislav avatar Oct 18 '21 10:10 mislav

This can now be accomplished by setting the HideCharacter to a zero-width space

AlecAivazis avatar Sep 22 '22 22:09 AlecAivazis

I tried this today and the cursor moves ahead which still reveals the password length.

szh avatar Apr 03 '23 18:04 szh

@szh Thanks for reporting. Sounds like the visual representation is likely going to vary between terminal emulators. You are welcome to open a new issue about that 👍

mislav avatar Apr 03 '23 18:04 mislav

OK. I'll submit a PR for this.

szh avatar Apr 03 '23 19:04 szh