Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fortuna] accept only a secret file as argument #1204

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fortuna/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion fortuna/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fortuna"
version = "3.0.2"
version = "3.1.0"
edition = "2021"

[dependencies]
Expand Down
5 changes: 1 addition & 4 deletions fortuna/src/command/register_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ pub async fn register_provider(opts: &RegisterProviderOptions) -> Result<()> {

// Create a new random hash chain.
let random = rand::random::<[u8; 32]>();
let secret = match opts.randomness.load_secret() {
Ok(loaded_secret) => loaded_secret,
Err(_err) => opts.randomness.secret_file.clone(),
};
let secret = opts.randomness.load_secret()?;

let commitment_length = opts.randomness.chain_length;
let mut chain =
Expand Down
6 changes: 1 addition & 5 deletions fortuna/src/command/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ pub async fn run(opts: &RunOptions) -> Result<()> {
struct ApiDoc;

let config = Config::load(&opts.config.config)?;
let secret: String;
match opts.randomness.load_secret() {
Ok(loaded_secret) => secret = loaded_secret,
Err(_err) => secret = opts.randomness.secret_file.clone(),
}
let secret = opts.randomness.load_secret()?;


let mut chains = HashMap::new();
Expand Down
1 change: 0 additions & 1 deletion fortuna/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ pub struct ConfigOptions {
pub struct RandomnessOptions {
/// Path to file containing a secret which is a 64-char hex string.
/// The secret is used for generating new hash chains
/// Or the secret itself. TODO: this will be removed in another PR.
#[arg(long = "secret")]
#[arg(env = "FORTUNA_SECRET")]
pub secret_file: String,
Expand Down
Loading