Skip to content

Commit e8eb156

Browse files
authored
fix: hide password prompt (#7)
1 parent abd9b2c commit e8eb156

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

Cargo.lock

Lines changed: 22 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ version = "0.1.0"
2626
version = "^4.0.0"
2727
features = ["derive"]
2828

29-
[dependencies.text_io]
30-
version = "^0.1.12"
29+
[dependencies.rpassword]
30+
version = "^7.3.1"
3131

3232
[[bin]]
3333
name = "secured"

src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clap::{Parser, Subcommand};
2+
use rpassword::prompt_password;
23
use std::fs::{metadata, File};
34
use std::io::{Read, Write};
4-
use text_io::read;
55

66
use enclave::{Enclave, EncryptionKey};
77

@@ -122,9 +122,6 @@ fn get_file_as_byte_vec(filename: &String) -> Vec<u8> {
122122
fn get_password_or_prompt(password: Option<String>) -> String {
123123
match password {
124124
Some(password) => password,
125-
None => {
126-
println!("Enter password: ");
127-
read!("{}\n")
128-
}
125+
None => prompt_password("Enter password: ").expect("Unable to read password"),
129126
}
130127
}

0 commit comments

Comments
 (0)