Skip to content

Commit

Permalink
Make password infallible by moving validation outside of it, moved Ch…
Browse files Browse the repository at this point in the history
…arSets to BTreeSets and implemented Distribution on them
  • Loading branch information
dani-garcia committed Nov 6, 2023
1 parent 7a7a269 commit f758ada
Show file tree
Hide file tree
Showing 3 changed files with 283 additions and 199 deletions.
5 changes: 3 additions & 2 deletions crates/bitwarden/src/tool/generators/client_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<'a> ClientGenerator<'a> {
/// lowercase: true,
/// uppercase: true,
/// numbers: true,
/// length: Some(20),
/// length: 20,
/// ..Default::default()
/// };
/// let password = Client::new(None).generator().password(input).await.unwrap();
Expand All @@ -36,7 +36,8 @@ impl<'a> ClientGenerator<'a> {
/// }
/// ```
pub async fn password(&self, input: PasswordGeneratorRequest) -> Result<String> {
password(input)
let charset = input.validate_options()?;
Ok(password(charset))
}

pub async fn passphrase(&self, input: PassphraseGeneratorRequest) -> Result<String> {
Expand Down
Loading

0 comments on commit f758ada

Please sign in to comment.