Private
Public Access
1
0

client: actually do authentication properly

This commit is contained in:
2025-05-01 01:02:36 -07:00
parent 59cfc8008b
commit fd4c43d585
7 changed files with 105 additions and 74 deletions

View File

@@ -1,13 +1,13 @@
use kordophone::APIInterface;
use kordophone::api::http_client::HTTPAPIClient;
use kordophone::api::http_client::Credentials;
use kordophone::api::InMemoryTokenStore;
use kordophone::api::InMemoryAuthenticationStore;
use anyhow::Result;
use clap::Subcommand;
use crate::printers::{ConversationPrinter, MessagePrinter};
pub fn make_api_client_from_env() -> HTTPAPIClient<InMemoryTokenStore> {
pub fn make_api_client_from_env() -> HTTPAPIClient<InMemoryAuthenticationStore> {
dotenv::dotenv().ok();
// read from env
@@ -22,7 +22,7 @@ pub fn make_api_client_from_env() -> HTTPAPIClient<InMemoryTokenStore> {
.expect("KORDOPHONE_PASSWORD must be set"),
};
HTTPAPIClient::new(base_url.parse().unwrap(), credentials.into(), InMemoryTokenStore::new())
HTTPAPIClient::new(base_url.parse().unwrap(), InMemoryAuthenticationStore::new(Some(credentials)))
}
#[derive(Subcommand)]
@@ -51,7 +51,7 @@ impl Commands {
}
struct ClientCli {
api: HTTPAPIClient<InMemoryTokenStore>,
api: HTTPAPIClient<InMemoryAuthenticationStore>,
}
impl ClientCli {