From d2965745e8ec2f031b86f0fbdd25a10ba52a6429 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 17 Jan 2024 20:45:04 -0500 Subject: [PATCH] keyforkd: hide field seed in std::fmt::Debug implementation --- crates/daemon/keyforkd/src/service.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/daemon/keyforkd/src/service.rs b/crates/daemon/keyforkd/src/service.rs index 31b5485..1b4058b 100644 --- a/crates/daemon/keyforkd/src/service.rs +++ b/crates/daemon/keyforkd/src/service.rs @@ -16,14 +16,25 @@ use tracing::info; // 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. -// + +// TODO: Make `seed` a `secrecy::SecretVec` so we can readd derive(Debug) /// The Keyfork Service. -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct Keyforkd { seed: Arc>, } +impl std::fmt::Debug for Keyforkd { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + // Bind data from self, to ensure we capture all values if we add more later. + let Keyforkd { seed: _ } = self; + f.debug_struct("Keyforkd") + .field("seed", &"") + .finish() + } +} + impl Keyforkd { /// Create a new instance of Keyfork from a given seed. pub fn new(seed: Vec) -> Self {