add passkey support
This commit is contained in:
+30
-2
@@ -2,8 +2,8 @@ use async_trait::async_trait;
|
||||
use sqlx::SqliteConnection;
|
||||
|
||||
use crate::domain::{
|
||||
Category, DomainResult, GroceryList, Item, Meal, MealIngredient, PresenceUser, SessionUser,
|
||||
User,
|
||||
Category, DomainResult, GroceryList, Item, Meal, MealIngredient, Passkey, PresenceUser,
|
||||
SessionUser, User,
|
||||
};
|
||||
|
||||
/// Repositories take `&mut SqliteConnection` (which a `Transaction` derefs to),
|
||||
@@ -27,6 +27,34 @@ pub trait UserRepository: Send + Sync {
|
||||
async fn has_users(&self, txn: &mut SqliteConnection) -> DomainResult<bool>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait PasskeyRepository: Send + Sync {
|
||||
async fn create_passkey(
|
||||
&self,
|
||||
txn: &mut SqliteConnection,
|
||||
user_id: i64,
|
||||
credential_id: String,
|
||||
credential: String,
|
||||
counter: i64,
|
||||
) -> DomainResult<Passkey>;
|
||||
async fn find_by_credential_id(
|
||||
&self,
|
||||
txn: &mut SqliteConnection,
|
||||
credential_id: String,
|
||||
) -> DomainResult<Option<Passkey>>;
|
||||
async fn list_for_user(
|
||||
&self,
|
||||
txn: &mut SqliteConnection,
|
||||
user_id: i64,
|
||||
) -> DomainResult<Vec<Passkey>>;
|
||||
async fn delete_passkey(
|
||||
&self,
|
||||
txn: &mut SqliteConnection,
|
||||
user_id: i64,
|
||||
passkey_id: i64,
|
||||
) -> DomainResult<()>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait SessionRepository: Send + Sync {
|
||||
async fn create_session(
|
||||
|
||||
Reference in New Issue
Block a user