refactor auth_repo to server_app

This commit is contained in:
2025-12-17 12:29:17 -06:00
parent 467f4feadd
commit 3029a41386
20 changed files with 450 additions and 375 deletions

24
src/server/models.rs Normal file
View File

@@ -0,0 +1,24 @@
use uuid::Uuid;
use opaque_ke::ServerLogin;
use crate::server::repository::opaque_repo::{AuthRepoError, OpaqueDatabaseRepo};
use crate::shared::models::opaque::{NKodeCipherSuite, PasswordFile};
pub struct RegCache {
pub session_id: Uuid,
pub identifier: Vec<u8>,
}
pub struct LoginCache {
pub session_id: Uuid,
pub identifiers: Vec<u8>,
pub server_login: ServerLogin<NKodeCipherSuite>,
}
pub trait CredKind {
fn has<R: OpaqueDatabaseRepo>(repo: &R, id: &[u8]) -> bool;
fn get_password_file<R: OpaqueDatabaseRepo>(repo: &R, id: &[u8]) -> Result<PasswordFile, AuthRepoError>;
fn set_password_file<R: OpaqueDatabaseRepo>(repo: &mut R, id: &[u8], pf: PasswordFile) -> Result<(), AuthRepoError>;
fn prereq_for_register<R: OpaqueDatabaseRepo>(_repo: &R, _id: &[u8]) -> Result<(), AuthRepoError> {
Ok(())
}
}