[fortuna] accept only a secret file as argument (#1204)
* accept file only * pre commit
This commit is contained in:
parent
220e06a62d
commit
3e05edba24
|
@ -1486,7 +1486,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fortuna"
|
name = "fortuna"
|
||||||
version = "3.0.2"
|
version = "3.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum",
|
"axum",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "fortuna"
|
name = "fortuna"
|
||||||
version = "3.0.2"
|
version = "3.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
@ -31,10 +31,7 @@ pub async fn register_provider(opts: &RegisterProviderOptions) -> Result<()> {
|
||||||
|
|
||||||
// Create a new random hash chain.
|
// Create a new random hash chain.
|
||||||
let random = rand::random::<[u8; 32]>();
|
let random = rand::random::<[u8; 32]>();
|
||||||
let secret = match opts.randomness.load_secret() {
|
let secret = opts.randomness.load_secret()?;
|
||||||
Ok(loaded_secret) => loaded_secret,
|
|
||||||
Err(_err) => opts.randomness.secret_file.clone(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let commitment_length = opts.randomness.chain_length;
|
let commitment_length = opts.randomness.chain_length;
|
||||||
let mut chain =
|
let mut chain =
|
||||||
|
|
|
@ -47,11 +47,7 @@ pub async fn run(opts: &RunOptions) -> Result<()> {
|
||||||
struct ApiDoc;
|
struct ApiDoc;
|
||||||
|
|
||||||
let config = Config::load(&opts.config.config)?;
|
let config = Config::load(&opts.config.config)?;
|
||||||
let secret: String;
|
let secret = opts.randomness.load_secret()?;
|
||||||
match opts.randomness.load_secret() {
|
|
||||||
Ok(loaded_secret) => secret = loaded_secret,
|
|
||||||
Err(_err) => secret = opts.randomness.secret_file.clone(),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let mut chains = HashMap::new();
|
let mut chains = HashMap::new();
|
||||||
|
|
|
@ -78,7 +78,6 @@ pub struct ConfigOptions {
|
||||||
pub struct RandomnessOptions {
|
pub struct RandomnessOptions {
|
||||||
/// Path to file containing a secret which is a 64-char hex string.
|
/// Path to file containing a secret which is a 64-char hex string.
|
||||||
/// The secret is used for generating new hash chains
|
/// 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(long = "secret")]
|
||||||
#[arg(env = "FORTUNA_SECRET")]
|
#[arg(env = "FORTUNA_SECRET")]
|
||||||
pub secret_file: String,
|
pub secret_file: String,
|
||||||
|
|
Loading…
Reference in New Issue