Struct tari_utilities::password::SafePassword
source · pub struct SafePassword { /* private fields */ }
Expand description
A representation of a passphrase that zeroizes on drop, prevents display and debug output, and limits access to references
The passphrase can be instantiated from a string or any type that can become a string. It is converted to a byte array, which can be accessed as a mutable or immutable reference. You can serialize and deserialize it transparently.
ⓘ
// Create a safe passphrase
let passphrase = SafePassword::from("my secret passphrase");
// We can also use a string directly
assert_eq!(
passphrase.reveal(),
SafePassword::from("my secret passphrase".to_string()).reveal()
);
Implementations§
Trait Implementations§
source§impl Clone for SafePassword
impl Clone for SafePassword
source§fn clone(&self) -> SafePassword
fn clone(&self) -> SafePassword
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SafePassword
impl Debug for SafePassword
source§impl<'de> Deserialize<'de> for SafePassword
impl<'de> Deserialize<'de> for SafePassword
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl FromStr for SafePassword
impl FromStr for SafePassword
Auto Trait Implementations§
impl RefUnwindSafe for SafePassword
impl Send for SafePassword
impl Sync for SafePassword
impl Unpin for SafePassword
impl UnwindSafe for SafePassword
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
source§impl<T> MessageFormat for Twhere
T: DeserializeOwned + Serialize,
impl<T> MessageFormat for Twhere T: DeserializeOwned + Serialize,
source§fn from_binary(msg: &[u8]) -> Result<T, MessageFormatError>
fn from_binary(msg: &[u8]) -> Result<T, MessageFormatError>
Convert from binary.
source§fn from_base64(msg: &str) -> Result<T, MessageFormatError>
fn from_base64(msg: &str) -> Result<T, MessageFormatError>
Convert from base64.