Skip to content

Commit 3e05edb

Browse files
author
Dev Kalra
authored
[fortuna] accept only a secret file as argument (#1204)
* accept file only * pre commit
1 parent 220e06a commit 3e05edb

File tree

5 files changed

+4
-12
lines changed

5 files changed

+4
-12
lines changed

fortuna/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fortuna/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fortuna"
3-
version = "3.0.2"
3+
version = "3.1.0"
44
edition = "2021"
55

66
[dependencies]

fortuna/src/command/register_provider.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ pub async fn register_provider(opts: &RegisterProviderOptions) -> Result<()> {
3131

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

3936
let commitment_length = opts.randomness.chain_length;
4037
let mut chain =

fortuna/src/command/run.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ pub async fn run(opts: &RunOptions) -> Result<()> {
4747
struct ApiDoc;
4848

4949
let config = Config::load(&opts.config.config)?;
50-
let secret: String;
51-
match opts.randomness.load_secret() {
52-
Ok(loaded_secret) => secret = loaded_secret,
53-
Err(_err) => secret = opts.randomness.secret_file.clone(),
54-
}
50+
let secret = opts.randomness.load_secret()?;
5551

5652

5753
let mut chains = HashMap::new();

fortuna/src/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub struct ConfigOptions {
7878
pub struct RandomnessOptions {
7979
/// Path to file containing a secret which is a 64-char hex string.
8080
/// The secret is used for generating new hash chains
81-
/// Or the secret itself. TODO: this will be removed in another PR.
8281
#[arg(long = "secret")]
8382
#[arg(env = "FORTUNA_SECRET")]
8483
pub secret_file: String,

0 commit comments

Comments
 (0)