keyforkd: hide field seed in std::fmt::Debug implementation
This commit is contained in:
parent
f7c00d11f1
commit
d2965745e8
|
@ -16,14 +16,25 @@ use tracing::info;
|
||||||
|
|
||||||
// NOTE: All values implemented in Keyforkd must implement Clone with low overhead, either by
|
// 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<T> takes &mut self.
|
// using an Arc or by having a small signature. This is because Service<T> takes &mut self.
|
||||||
//
|
|
||||||
|
// TODO: Make `seed` a `secrecy::SecretVec<u8>` so we can readd derive(Debug)
|
||||||
|
|
||||||
/// The Keyfork Service.
|
/// The Keyfork Service.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone)]
|
||||||
pub struct Keyforkd {
|
pub struct Keyforkd {
|
||||||
seed: Arc<Vec<u8>>,
|
seed: Arc<Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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", &"<hidden>")
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Keyforkd {
|
impl Keyforkd {
|
||||||
/// Create a new instance of Keyfork from a given seed.
|
/// Create a new instance of Keyfork from a given seed.
|
||||||
pub fn new(seed: Vec<u8>) -> Self {
|
pub fn new(seed: Vec<u8>) -> Self {
|
||||||
|
|
Loading…
Reference in New Issue