diff --git a/crates/masking/src/abs.rs b/crates/masking/src/abs.rs index 6501f89c9d..8996db65f2 100644 --- a/crates/masking/src/abs.rs +++ b/crates/masking/src/abs.rs @@ -6,6 +6,9 @@ use crate::Secret; pub trait PeekInterface { /// Only method providing access to the secret value. fn peek(&self) -> &S; + + /// Provide a mutable reference to the inner value. + fn peek_mut(&mut self) -> &mut S; } /// Interface that consumes a option secret and returns the value. diff --git a/crates/masking/src/bytes.rs b/crates/masking/src/bytes.rs index e828f8a78e..07b8c289ad 100644 --- a/crates/masking/src/bytes.rs +++ b/crates/masking/src/bytes.rs @@ -28,6 +28,10 @@ impl PeekInterface for SecretBytesMut { fn peek(&self) -> &BytesMut { &self.0 } + + fn peek_mut(&mut self) -> &mut BytesMut { + &mut self.0 + } } impl fmt::Debug for SecretBytesMut { diff --git a/crates/masking/src/secret.rs b/crates/masking/src/secret.rs index 7f7c18094a..ee65b1c015 100644 --- a/crates/masking/src/secret.rs +++ b/crates/masking/src/secret.rs @@ -95,6 +95,10 @@ where fn peek(&self) -> &SecretValue { &self.inner_secret } + + fn peek_mut(&mut self) -> &mut SecretValue { + &mut self.inner_secret + } } impl From for Secret diff --git a/crates/masking/src/strong_secret.rs b/crates/masking/src/strong_secret.rs index 300b5463d2..43d2c97dfb 100644 --- a/crates/masking/src/strong_secret.rs +++ b/crates/masking/src/strong_secret.rs @@ -32,6 +32,10 @@ impl PeekInterface fn peek(&self) -> &Secret { &self.inner_secret } + + fn peek_mut(&mut self) -> &mut Secret { + &mut self.inner_secret + } } impl From