#[non_exhaustive]pub enum ParsePasswordError {
TooShort {
value: usize,
required: usize,
},
LittleEntropy {
value: u64,
required: u64,
},
}
Expand description
This is a compromise. Generally we want to be wordlist-agnostic here. But we can’t ignore that the PGP wordlist is the most common wordlist in use.
- The shortest word in the PGP wordlist is 4 characters long. The longest word is 9 characters. This means we can’t limit to more than 9 bytes here, ‘solo-orca’ is 9 bytes, and we want to allow 2-word codes.
- A 9 character random password is very strong. If it is only comprised of uniformly distributed lowercase ASCII characters, we have an entropy of 26^9 >= 40 bits. This is much more than the default 16 bits we get from two words from the PGP wordlist.
- An emoji contains at least 2 bytes of data. So two emoji are actually about the same security as two words from the PGP wordlist.
We ultimately can’t protect people from making bad choices, as entropy is a very difficult thing. What we can do instead is offer guidance, by printing warnings in case of rather short passwords, and making people choose for themselves whether their privacy is worth it to them choosing longer codes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Trait Implementations§
Source§impl Clone for ParsePasswordError
impl Clone for ParsePasswordError
Source§fn clone(&self) -> ParsePasswordError
fn clone(&self) -> ParsePasswordError
Returns a duplicate 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 ParsePasswordError
impl Debug for ParsePasswordError
Source§impl Display for ParsePasswordError
impl Display for ParsePasswordError
Source§impl Error for ParsePasswordError
impl Error for ParsePasswordError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<ParsePasswordError> for ParseCodeError
impl From<ParsePasswordError> for ParseCodeError
Source§fn from(source: ParsePasswordError) -> Self
fn from(source: ParsePasswordError) -> Self
Converts to this type from the input type.
Source§impl Ord for ParsePasswordError
impl Ord for ParsePasswordError
Source§fn cmp(&self, other: &ParsePasswordError) -> Ordering
fn cmp(&self, other: &ParsePasswordError) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ParsePasswordError
impl PartialEq for ParsePasswordError
Source§impl PartialOrd for ParsePasswordError
impl PartialOrd for ParsePasswordError
impl Copy for ParsePasswordError
impl Eq for ParsePasswordError
impl StructuralPartialEq for ParsePasswordError
Auto Trait Implementations§
impl Freeze for ParsePasswordError
impl RefUnwindSafe for ParsePasswordError
impl Send for ParsePasswordError
impl Sync for ParsePasswordError
impl Unpin for ParsePasswordError
impl UnwindSafe for ParsePasswordError
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