From bcfcc8711fd87772825f682e872f470d0f9b25c3 Mon Sep 17 00:00:00 2001 From: Anton Livaja Date: Sun, 5 May 2024 14:27:10 -0400 Subject: [PATCH] keyforkd: add warning when loading seed with less than 128 bits --- crates/daemon/keyforkd/src/service.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/daemon/keyforkd/src/service.rs b/crates/daemon/keyforkd/src/service.rs index af8b373..cc06a7f 100644 --- a/crates/daemon/keyforkd/src/service.rs +++ b/crates/daemon/keyforkd/src/service.rs @@ -12,7 +12,7 @@ use keyfork_derive_path_data::guess_target; // use keyfork_derive_util::request::{DerivationError, DerivationRequest, DerivationResponse}; use keyforkd_models::{DerivationError, Error, Request, Response}; use tower::Service; -use tracing::info; +use tracing::{info, warn}; // NOTE: All values implemented in Keyforkd must implement Clone with low overhead, either by // using an Arc or by having a small signature. This is because Service takes &mut self. @@ -38,6 +38,9 @@ impl std::fmt::Debug for Keyforkd { impl Keyforkd { /// Create a new instance of Keyfork from a given seed. pub fn new(seed: Vec) -> Self { + if seed.len() < 16 { + warn!("Entropy size is lower than 128 bits: {} bits.", seed.len() * 8); + } Self { seed: Arc::new(seed), } -- 2.40.1