unjs / consola

🐨 Elegant Console Logger for Node.js and Browser
Other
6.12k stars 175 forks source link

Mask / disable sensitive input characters #192

Open Eckhardt-D opened 1 year ago

Eckhardt-D commented 1 year ago

Describe the feature

As a user, if I'm prompted to enter a sensitive string like a password, apiKey etc. I want to be able to paste / type it without stdout echoing it back to me. Like with the -s flag in bash's read. Or stty.

I see there is an exported password type, so perhaps already in development?

API changes suggestions:

add secureText as a type option to the prompt method.

Additional information

georgzoeller commented 1 year ago

you could look at a library like redact-pii for that

pi0 commented 1 year ago

I like such idea very much. We might need to make it opt-in as non breaking change also probably a similar alternative of rework of redact-pii without lodash dependency and maintained.