sos_password/
lib.rs

1//! Password generation and helpers for the
2//! [Save Our Secrets](https://saveoursecrets.com) SDK.
3
4pub mod diceware;
5mod error;
6pub mod generator;
7mod memorable;
8
9pub use error::Error;
10pub use memorable::memorable_password;
11
12pub use zxcvbn;
13
14use secrecy::SecretString;
15
16/// Standard memorable password generation.
17///
18/// Uses three words.
19pub fn memorable() -> SecretString {
20    SecretString::new(memorable_password(3).into())
21}
22
23/// Result type for the library.
24pub(crate) type Result<T> = std::result::Result<T, Error>;
25
26/// English vowels.
27#[doc(hidden)]
28pub const VOWELS: &[char] = &['a', 'e', 'i', 'o', 'u'];
29
30/// English consonants.
31#[doc(hidden)]
32pub const CONSONANTS: &[char] = &[
33    'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r',
34    's', 't', 'v', 'w', 'x', 'y', 'z',
35];
36
37/// Numerical digits.
38#[doc(hidden)]
39pub const DIGITS: &[char] =
40    &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];