Private
Public Access
1
0

daemon: setting foundation for client creation

This commit is contained in:
2025-04-25 20:02:18 -07:00
parent fe32efef2c
commit 82192ffbe5
10 changed files with 210 additions and 27 deletions

View File

@@ -26,3 +26,27 @@ pub trait APIInterface {
async fn authenticate(&mut self, credentials: Credentials) -> Result<JwtToken, Self::Error>;
}
pub trait TokenManagement {
fn get_token(&mut self) -> Option<JwtToken>;
fn set_token(&mut self, token: JwtToken);
}
pub struct InMemoryTokenManagement {
token: Option<JwtToken>,
}
impl InMemoryTokenManagement {
pub fn new() -> Self {
Self { token: None }
}
}
impl TokenManagement for InMemoryTokenManagement {
fn get_token(&mut self) -> Option<JwtToken> {
self.token.clone()
}
fn set_token(&mut self, token: JwtToken) {
self.token = Some(token);
}
}