Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions auth-service/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auth-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ reqwest = { version = "0.12.24", default-features = false, features = ["json", "
fake = "=4.4.0"
quickcheck = "1.0.3"
quickcheck_macros = "1.1.0"
wiremock = "0.6.5"
wiremock = "0.6.5"
23 changes: 15 additions & 8 deletions auth-service/src/domain/data_stores.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ use rand::Rng;
use secrecy::{ExposeSecret, SecretString};
use thiserror::Error;

use super::{Email, Password, User};
use super::{Email, User};

#[async_trait::async_trait]
pub trait UserStore {
async fn add_user(&mut self, user: User) -> Result<(), UserStoreError>;
async fn get_user(&self, email: &Email) -> Result<User, UserStoreError>;
async fn validate_user(&self, email: &Email, password: &Password)
-> Result<(), UserStoreError>;
async fn validate_user(
&self,
email: &Email,
raw_password: &SecretString,
) -> Result<(), UserStoreError>;
}

#[derive(Debug, Error)]
Expand Down Expand Up @@ -101,9 +104,9 @@ impl LoginAttemptId {

impl Default for LoginAttemptId {
fn default() -> Self {
Self(
SecretString::new(uuid::Uuid::new_v4().to_string().into_boxed_str())
)
Self(SecretString::new(
uuid::Uuid::new_v4().to_string().into_boxed_str(),
))
}
}

Expand Down Expand Up @@ -135,8 +138,12 @@ impl TwoFACode {

impl Default for TwoFACode {
fn default() -> Self {
Self(SecretString::new(rand::rng().
random_range(100_000..=999_999).to_string().into_boxed_str()))
Self(SecretString::new(
rand::rng()
.random_range(100_000..=999_999)
.to_string()
.into_boxed_str(),
))
}
}

Expand Down
3 changes: 1 addition & 2 deletions auth-service/src/domain/email.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::hash::Hash;

use color_eyre::eyre::{eyre, Result};
use secrecy::{ExposeSecret, SecretString};
use std::hash::Hash;
use validator::ValidateEmail;

#[derive(Debug, Clone)]
Expand Down
Loading