simplify client

This commit is contained in:
2025-12-16 09:23:21 -06:00
parent 5a288d4b08
commit 8f17dff5ad
2 changed files with 7 additions and 7 deletions

View File

@@ -23,7 +23,7 @@ pub struct ClientAppKey<State, S: ServerAPI, R: ClientRepo> {
impl <S: ServerAPI, R: ClientRepo> ClientAppKey<Register,S, R> { impl <S: ServerAPI, R: ClientRepo> ClientAppKey<Register,S, R> {
pub async fn register(self) -> Result<ClientAppKey<Login, S, R>, String> { pub async fn register(self) -> Result<ClientAppKey<Login, S, R>, String> {
self.repo.set_secret_key(&self.email, &self.user_secret_key).await?; // self.repo.set_secret_key(&self.email, &self.user_secret_key).await?;
self.api.register_key(&self.email, &self.user_secret_key).await?; self.api.register_key(&self.email, &self.user_secret_key).await?;
Ok(ClientAppKey { Ok(ClientAppKey {
api: self.api, api: self.api,

View File

@@ -3,10 +3,10 @@ use crate::models::email::Email;
use crate::models::opaque::UserSecretKey; use crate::models::opaque::UserSecretKey;
pub trait ClientRepo { pub trait ClientRepo {
async fn get_secret_key(&self) -> anyhow::Result<UserSecretKey, String>; // async fn get_secret_key(&self) -> anyhow::Result<UserSecretKey, String>;
async fn set_secret_key(&self, email: &Email,user_secret_key: &UserSecretKey) -> anyhow::Result<(),String>; // async fn set_secret_key(&self, email: &Email,user_secret_key: &UserSecretKey) -> anyhow::Result<(),String>;
async fn get_login_data(&self) -> anyhow::Result<CodeLoginData, String>; // async fn get_login_data(&self) -> anyhow::Result<CodeLoginData, String>;
async fn set_login_data(&self, data: CodeLoginData) -> anyhow::Result<(), String>; // async fn set_login_data(&self, data: CodeLoginData) -> anyhow::Result<(), String>;
async fn set_email(&self, email: &Email) -> anyhow::Result<(), String>; // async fn set_email(&self, email: &Email) -> anyhow::Result<(), String>;
async fn get_email(&self) -> anyhow::Result<Email, String>; // async fn get_email(&self) -> anyhow::Result<Email, String>;
} }