32 releases (14 stable)

4.0.5 Jan 21, 2020
4.0.3 Dec 5, 2019
4.0.1 Aug 10, 2019
3.0.2 Apr 19, 2019
0.0.2 Mar 4, 2015

#5 in Cryptography

Download history 8283/week @ 2019-12-10 6551/week @ 2019-12-17 3950/week @ 2019-12-24 4641/week @ 2019-12-31 7609/week @ 2020-01-07 7882/week @ 2020-01-14 6968/week @ 2020-01-21 9465/week @ 2020-01-28 8504/week @ 2020-02-04 8418/week @ 2020-02-11 8323/week @ 2020-02-18 8781/week @ 2020-02-25 9244/week @ 2020-03-03 10398/week @ 2020-03-10 9415/week @ 2020-03-17 11274/week @ 2020-03-24

32,241 downloads per month
Used in 153 crates (99 directly)

Apache-2.0

16KB
248 lines

Rustastic Password

Build Status Build status Chat on Discord

rpassword package allows you to safely read passwords in a console application on Linux, OSX and Windows.

Supporting rpassword

rpassword is currently being maintained as a side-project, during nights and weekends, next to my full-time job. I am looking for a way to sustain my work on open source. If you find value in what I do and you would like to contribute, please consider:

Usage

Add rpassword as a dependency in Cargo.toml:

[dependencies]
rpassword = "4.0"

Use rpassword within your code:

extern crate rpassword;

fn main() {
    // Prompt for a password on TTY (safest but not default for backwards compatibility)
    let pass = rpassword::read_password_from_tty(Some("Password: ")).unwrap();
    println!("Your password is {}", pass);
    
    // 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);
}

The full API documentation is available at https://docs.rs/rpassword.

Contributors

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

Here's a list of existing rpassword contributors:

Thank you very much for your help! 😃 ❤️

License

The source code is released under the Apache 2.0 license.

Dependencies

~32KB