use async_trait::async_trait; use std::collections::HashSet; use crate::domain::{error::Result, types::UserId}; #[async_trait] pub trait TcpBackendHandler: Sync { async fn get_jwt_blacklist(&self) -> anyhow::Result>; async fn create_refresh_token(&self, user: &UserId) -> Result<(String, chrono::Duration)>; async fn check_token(&self, refresh_token_hash: u64, user: &UserId) -> Result; async fn blacklist_jwts(&self, user: &UserId) -> Result>; async fn delete_refresh_token(&self, refresh_token_hash: u64) -> Result<()>; /// Request a token to reset a user's password. /// If the user doesn't exist, returns `Ok(None)`, otherwise `Ok(Some(token))`. async fn start_password_reset(&self, user: &UserId) -> Result>; /// Get the user ID associated with a password reset token. async fn get_user_id_for_password_reset_token(&self, token: &str) -> Result; async fn delete_password_reset_token(&self, token: &str) -> Result<()>; }