Skip to content

Cross platform Rust library to read a password in the terminal (Linux, BSD, OSX, Windows).

License

Notifications You must be signed in to change notification settings

DaveLancaster/rpassword

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rustastic Password

Build Status Build status

This Rust package allows you to safely read passwords from standard input in a console application.

You can build the documentation with cargo doc or view it online.

I'd appreciate feedback if you use this library :-)

Usage

Add rpassword as a dependency in Cargo.toml:

[dependencies]
rpassword = "1.0.0"

Use rpassword within your code:

extern crate rpassword;

fn main() {
    // Prompt for a password on STDOUT
    let pass = rpassword::prompt_password_stdout("Password: ").unwrap();
    println!("Your password is {}", pass);

    // Prompt for a password on STDERR
    let pass = rpassword::prompt_password_stderr("Password: ").unwrap();
    println!("Your password is {}", pass);

    // Read a password without prompt
    let pass = rpassword::read_password().unwrap();
    println!("Your password is {}", pass);
}

Contributors

We welcome contribution from everyone. Feel free to open an issue or a pull request at any time.

Check out the unassigned issues to get started. If you have any questions, just let us know and we'll jump in to help.

Here's a list of existing rpassword contributors:

Thank you very much for your help! 😃 ❤️

About

Cross platform Rust library to read a password in the terminal (Linux, BSD, OSX, Windows).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 82.4%
  • Shell 17.6%