koprogo_api/application/ports/
two_factor_repository.rs1use crate::domain::entities::TwoFactorSecret;
2use async_trait::async_trait;
3use uuid::Uuid;
4
5#[async_trait]
7pub trait TwoFactorRepository: Send + Sync {
8 async fn create(&self, secret: &TwoFactorSecret) -> Result<TwoFactorSecret, String>;
10
11 async fn find_by_user_id(&self, user_id: Uuid) -> Result<Option<TwoFactorSecret>, String>;
13
14 async fn update(&self, secret: &TwoFactorSecret) -> Result<TwoFactorSecret, String>;
16
17 async fn delete(&self, user_id: Uuid) -> Result<(), String>;
19
20 async fn find_needing_reverification(&self) -> Result<Vec<TwoFactorSecret>, String>;
22
23 async fn find_with_low_backup_codes(&self) -> Result<Vec<TwoFactorSecret>, String>;
25}