Skip to content

Commit

Permalink
Remove manual password input
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseAbram committed Jan 6, 2025
1 parent da8f3f8 commit d1695c3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ test_db_3002

# Keyshare files from the test CLI
crates/test-cli/keyshare-*
.password.*
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ Optionally, you can also run it with detailed logging:
RUST_BACKTRACE=1 ./target/release/entropy -ldebug --dev --rpc-external
```

### Running a TSS server

To run a TSS server you need to first provide a password file. The default password file is ```.password.txt``` you can overwrite this if you want. After the file is created and password added you can run

```sh
./target/release/entropy-tss
```

### Testing

Testing is done via `cargo test`.
Expand Down
20 changes: 9 additions & 11 deletions crates/threshold-signature-server/src/helpers/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,14 @@ pub async fn load_kv_store(
return KvManager::new(root, PasswordMethod::NoPassword.execute().unwrap()).unwrap();
};

let password = if let Some(password_path) = password_path {
std::str::from_utf8(&fs::read(password_path).expect("error reading password file"))
.expect("failed to convert password to string")
.trim()
.to_string()
.into()
} else {
PasswordMethod::Prompt.execute().unwrap()
};

let password = std::str::from_utf8(
&fs::read(password_path.expect("no password path found"))
.expect("error reading password file"),
)
.expect("failed to convert password to string")
.trim()
.to_string()
.into();
// this step takes a long time due to password-based decryption
KvManager::new(root, password).unwrap()
}
Expand Down Expand Up @@ -198,7 +196,7 @@ pub struct StartupArgs {
pub logger: crate::helpers::logger::Instrumentation,

/// The path to a password file
#[arg(short = 'f', long = "password-file")]
#[arg(short = 'f', long = "password-file", default_value = ".password.txt")]
pub password_file: Option<PathBuf>,

/// Set up the key-value store (KVDB), or ensure one already exists, print setup information to
Expand Down

0 comments on commit d1695c3

Please sign in to comment.