pub struct PasswordRedactor;Expand description
Redact passwords with a fixed-length output.
Always outputs ******** regardless of the actual password length.
This prevents leaking information about password length.
use apollo_redaction::Redacted;
use apollo_redaction::strategy::PasswordRedactor;
fn password(input: &str) -> String {
Redacted::<_, PasswordRedactor>::new(input).to_string()
}
assert_eq!(password("short"), "********");
assert_eq!(password("a_very_long_password_123!"), "********");
assert_eq!(password("x"), "********");Trait Implementations§
Source§impl Clone for PasswordRedactor
impl Clone for PasswordRedactor
Source§fn clone(&self) -> PasswordRedactor
fn clone(&self) -> PasswordRedactor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for PasswordRedactor
impl Default for PasswordRedactor
Source§fn default() -> PasswordRedactor
fn default() -> PasswordRedactor
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PasswordRedactor
impl RefUnwindSafe for PasswordRedactor
impl Send for PasswordRedactor
impl Sync for PasswordRedactor
impl Unpin for PasswordRedactor
impl UnsafeUnpin for PasswordRedactor
impl UnwindSafe for PasswordRedactor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more