Use ZeroingString for password and passpharse in wallet (#2285)
This commit is contained in:
committed by
Ignotus Peverell
parent
950fa0e496
commit
5cf4d7acfe
@@ -68,6 +68,7 @@ impl Default for LoggingConfig {
|
||||
use std::ops::Deref;
|
||||
use zeroize::Zeroize;
|
||||
/// Zeroing string, mainly useful for password
|
||||
#[derive(Clone, PartialEq, PartialOrd)]
|
||||
pub struct ZeroingString(String);
|
||||
|
||||
impl Drop for ZeroingString {
|
||||
@@ -82,6 +83,12 @@ impl From<&str> for ZeroingString {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for ZeroingString {
|
||||
fn from(s: String) -> Self {
|
||||
ZeroingString(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for ZeroingString {
|
||||
type Target = str;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user