Skip to content

Commit

Permalink
[fortuna] accept only a secret file as argument (#1204)
Browse files Browse the repository at this point in the history
* accept file only

* pre commit
  • Loading branch information
Dev Kalra authored Jan 8, 2024
1 parent 220e06a commit 3e05edb
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 12 deletions.
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

0 comments on commit 3e05edb

Please sign in to comment.