mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 19:42:27 +08:00
chore(masking): add peek_mut to PeekInterface (#7281)
This commit is contained in:
@ -6,6 +6,9 @@ use crate::Secret;
|
||||
pub trait PeekInterface<S> {
|
||||
/// 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.
|
||||
|
||||
@ -28,6 +28,10 @@ impl PeekInterface<BytesMut> for SecretBytesMut {
|
||||
fn peek(&self) -> &BytesMut {
|
||||
&self.0
|
||||
}
|
||||
|
||||
fn peek_mut(&mut self) -> &mut BytesMut {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for SecretBytesMut {
|
||||
|
||||
@ -95,6 +95,10 @@ where
|
||||
fn peek(&self) -> &SecretValue {
|
||||
&self.inner_secret
|
||||
}
|
||||
|
||||
fn peek_mut(&mut self) -> &mut SecretValue {
|
||||
&mut self.inner_secret
|
||||
}
|
||||
}
|
||||
|
||||
impl<SecretValue, MaskingStrategy> From<SecretValue> for Secret<SecretValue, MaskingStrategy>
|
||||
|
||||
@ -32,6 +32,10 @@ impl<Secret: ZeroizableSecret, MaskingStrategy> PeekInterface<Secret>
|
||||
fn peek(&self) -> &Secret {
|
||||
&self.inner_secret
|
||||
}
|
||||
|
||||
fn peek_mut(&mut self) -> &mut Secret {
|
||||
&mut self.inner_secret
|
||||
}
|
||||
}
|
||||
|
||||
impl<Secret: ZeroizableSecret, MaskingStrategy> From<Secret>
|
||||
|
||||
Reference in New Issue
Block a user