9 releases (5 stable)

2.0.1 Oct 5, 2019
2.0.0 Oct 4, 2019
2.0.0-alpha.5 Oct 29, 2018
2.0.0-alpha.2 Jan 27, 2018
1.2.1 Mar 25, 2017

#462 in Authentication

Download history 33/week @ 2024-03-31

53 downloads per month

MIT license

21KB
181 lines

ttyaskpass

travis-ci crates license docs.rs

ttyaskpass

A safely passphrase prompt library and application, support Chroma-Hash-like colorhash.

usage

library:

use std::io::{ self, Write };
use ttyaskpass::AskPass;


fn main() -> io::Result<()> {
    let mut cli = AskPass::new([0; 32]);
    let pass = cli.askpass("Password:")?;

    let mut stdout = io::stdout();
    write!(&mut stdout, "Your password is ")?;
    stdout.write_all(pass)?;
    stdout.flush()?;

    Ok(())
}

see readme.rs and ttyaskpass.rs.

application:

env SSH_ASKPASS=ttyaskpass ssh-add </dev/null

Dependencies

~7MB
~140K SLoC