From 03dbb973cb9762b0b6ce59d4bdd0d80f5539fb8a Mon Sep 17 00:00:00 2001 From: pezcore Date: Tue, 25 Oct 2022 21:57:52 -0400 Subject: [PATCH 1/2] Fix Mnemonic documentation for supported wordcounts --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 9337e29..49ebc0a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -153,7 +153,7 @@ impl error::Error for Error {} /// mnemonic from all the supported languages. (Languages have to be explicitly enabled using /// the Cargo features.) /// -/// Supported number of words are 12, 18 and 24. +/// Supported number of words are 12, 15, 18, 21, and 24. #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "zeroize", derive(Zeroize, ZeroizeOnDrop))] pub struct Mnemonic { From 593f4767f42b52046fe42af81db97e1f580870a0 Mon Sep 17 00:00:00 2001 From: pezcore Date: Sat, 28 Jan 2023 16:21:43 -0500 Subject: [PATCH 2/2] fix: Disply for Error::BadWordCount This Display description of the BadWordCount variant incorrectly complained stated that the word count is not a multiple of 6. The correct criteria for valid word counts is now that it must be a multiple of 3 between 12 and 24 inclusive, so the Display impl is fixed to be more precise. --- src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 49ebc0a..b21a960 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,7 +120,12 @@ impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Error::BadWordCount(c) => { - write!(f, "mnemonic has a word count that is not a multiple of 6: {}", c,) + write!( + f, + "mnemonic has an invalid word count: {}. Word count must be 12, 15, 18, 21, \ + or 24", + c + ) } Error::UnknownWord(i) => write!(f, "mnemonic contains an unknown word (word {})", i,), Error::BadEntropyBitCount(c) => write!(