Expand description
A tiny library for reading passwords without displaying them on the terminal. Works on Unix-like OSes and Windows.
§Usage
Read a password:
let passwd = readpass::from_tty()?;If you want to display a prompt, print it to stdout or stderr before reading:
use std::io::{self, Write};
write!(io::stderr(), "Please enter a password: ")?;
let passwd = readpass::from_tty()?;Strings returned by readpass are wrapped in Zeroizing
to ensure the password is zeroized from memory after it’s Dropped.
Functions§
- from_
tty - Reads a password from the TTY.