Use ZeroingString for password and passpharse in wallet (#2285)

This commit is contained in:
hashmap
2019-01-11 00:58:37 +01:00
committed by Ignotus Peverell
parent 950fa0e496
commit 5cf4d7acfe
4 changed files with 31 additions and 20 deletions
+7
View File
@@ -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;