Use `zeroize_derive` feature instead of impl zeroize
This commit is contained in:
parent
a298344178
commit
bb0f63298a
|
@ -46,7 +46,7 @@ rand_core = "0.4.0"
|
|||
unicode-normalization = { version = "=0.1.9", optional = true }
|
||||
rand = { version = "0.6.0", optional = true }
|
||||
serde = { version = "1.0", default-features = false, optional = true }
|
||||
zeroize = {version = "1.2", optional = true}
|
||||
zeroize = {version = "1.2", features = ["zeroize_derive"], optional = true}
|
||||
|
||||
[dev-dependencies]
|
||||
rand = { version = "0.6.0", optional = false }
|
||||
|
|
|
@ -55,6 +55,12 @@ pub enum Language {
|
|||
Spanish,
|
||||
}
|
||||
|
||||
impl Default for Language {
|
||||
fn default() -> Self {
|
||||
Language::English
|
||||
}
|
||||
}
|
||||
|
||||
impl Language {
|
||||
/// The list of supported languages.
|
||||
/// Language support is managed by compile features.
|
||||
|
|
|
@ -157,6 +157,7 @@ impl error::Error for Error {}
|
|||
///
|
||||
/// Supported number of words are 12, 18 and 24.
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[cfg_attr(feature = "zeroize", derive(Zeroize), zeroize(drop))]
|
||||
pub struct Mnemonic {
|
||||
/// The language the mnemonic.
|
||||
lang: Language,
|
||||
|
@ -166,11 +167,7 @@ pub struct Mnemonic {
|
|||
}
|
||||
|
||||
#[cfg(feature = "zeroize")]
|
||||
impl Zeroize for Mnemonic {
|
||||
fn zeroize(&mut self) {
|
||||
self.words.zeroize()
|
||||
}
|
||||
}
|
||||
impl zeroize::DefaultIsZeroes for Language {}
|
||||
|
||||
serde_string_impl!(Mnemonic, "a BIP-39 Mnemonic Code");
|
||||
|
||||
|
|
Loading…
Reference in New Issue