Add Delegate Signer and wire into Client (#143)

* Add encoded_credential to CovnoOutcome

* Add DelegateSigner

* Add test for DirectV1

* Add support for undecodable credentials

* Add docs

* Clean + fixes

* clippy fixes

* Add unit tests

* Update trait bounds
This commit is contained in:
Jazz Turner-Baggs
2026-06-22 10:38:17 -07:00
committed by GitHub
parent 1c984f442c
commit d02689c764
16 changed files with 468 additions and 137 deletions
+3 -3
View File
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
use anyhow::Result;
use arboard::Clipboard;
use crossbeam_channel::Receiver;
use logos_chat::{ChatClient, DeliveryService, EphemeralRegistry, Event, RegistrationService};
use logos_chat::{ChatClient, EphemeralRegistry, Event, RegistrationService, Transport};
use serde::{Deserialize, Serialize};
use crate::utils::now;
@@ -41,7 +41,7 @@ pub struct AppState {
pub active_chat: Option<String>,
}
pub struct ChatApp<T: DeliveryService, R: RegistrationService = EphemeralRegistry> {
pub struct ChatApp<T: Transport, R: RegistrationService = EphemeralRegistry> {
pub client: ChatClient<T, R>,
events: Receiver<Event>,
pub state: AppState,
@@ -55,7 +55,7 @@ pub struct ChatApp<T: DeliveryService, R: RegistrationService = EphemeralRegistr
impl<T, R> ChatApp<T, R>
where
T: DeliveryService + Send + 'static,
T: Transport,
R: RegistrationService + Send + 'static,
{
pub fn new(
+3 -5
View File
@@ -8,9 +8,7 @@ use std::path::{Path, PathBuf};
use anyhow::{Context, Result};
use clap::{Parser, ValueEnum};
use crossbeam_channel::Receiver;
use logos_chat::{
ChatClient, DeliveryService, Event, HttpRegistry, RegistrationService, StorageConfig, Transport,
};
use logos_chat::{ChatClient, Event, HttpRegistry, RegistrationService, StorageConfig, Transport};
use app::ChatApp;
@@ -132,7 +130,7 @@ fn run<T: Transport>(transport: T, cli: &Cli) -> Result<()> {
fn launch_tui<T, R>(client: ChatClient<T, R>, events: Receiver<Event>, cli: &Cli) -> Result<()>
where
T: DeliveryService + Send + 'static,
T: Transport,
R: RegistrationService + Send + 'static,
{
let mut app = ChatApp::new(client, events, &cli.name, &cli.data)?;
@@ -213,7 +211,7 @@ fn run_logos_delivery(cli: Cli) -> Result<()> {
fn run_app<T, R>(terminal: &mut ui::Tui, app: &mut ChatApp<T, R>) -> Result<()>
where
T: DeliveryService + Send + 'static,
T: Transport,
R: RegistrationService + Send + 'static,
{
loop {
+7 -10
View File
@@ -16,7 +16,7 @@ use ratatui::{
widgets::{Block, Borders, List, ListItem, Paragraph, Wrap},
};
use logos_chat::{DeliveryService, RegistrationService};
use logos_chat::{RegistrationService, Transport};
use crate::app::ChatApp;
@@ -38,7 +38,7 @@ pub fn restore() -> io::Result<()> {
}
/// Draw the UI.
pub fn draw<D: DeliveryService + Send + 'static, R: RegistrationService + Send + 'static>(
pub fn draw<D: Transport, R: RegistrationService + Send + 'static>(
frame: &mut Frame,
app: &ChatApp<D, R>,
) {
@@ -58,7 +58,7 @@ pub fn draw<D: DeliveryService + Send + 'static, R: RegistrationService + Send +
draw_status(frame, app, chunks[3]);
}
fn draw_header<D: DeliveryService + Send + 'static, R: RegistrationService + Send + 'static>(
fn draw_header<D: Transport, R: RegistrationService + Send + 'static>(
frame: &mut Frame,
app: &ChatApp<D, R>,
area: Rect,
@@ -85,7 +85,7 @@ fn draw_header<D: DeliveryService + Send + 'static, R: RegistrationService + Sen
frame.render_widget(header, area);
}
fn draw_messages<D: DeliveryService + Send + 'static, R: RegistrationService + Send + 'static>(
fn draw_messages<D: Transport, R: RegistrationService + Send + 'static>(
frame: &mut Frame,
app: &ChatApp<D, R>,
area: Rect,
@@ -175,7 +175,7 @@ fn draw_messages<D: DeliveryService + Send + 'static, R: RegistrationService + S
frame.render_stateful_widget(messages_widget, area, &mut list_state);
}
fn draw_input<D: DeliveryService + Send + 'static, R: RegistrationService + Send + 'static>(
fn draw_input<D: Transport, R: RegistrationService + Send + 'static>(
frame: &mut Frame,
app: &ChatApp<D, R>,
area: Rect,
@@ -206,7 +206,7 @@ fn draw_input<D: DeliveryService + Send + 'static, R: RegistrationService + Send
frame.set_cursor_position((cursor_x, area.y + 1));
}
fn draw_status<D: DeliveryService + Send + 'static, R: RegistrationService + Send + 'static>(
fn draw_status<D: Transport, R: RegistrationService + Send + 'static>(
frame: &mut Frame,
app: &ChatApp<D, R>,
area: Rect,
@@ -220,10 +220,7 @@ fn draw_status<D: DeliveryService + Send + 'static, R: RegistrationService + Sen
}
/// Handle keyboard events.
pub fn handle_events<
D: DeliveryService + Send + 'static,
R: RegistrationService + Send + 'static,
>(
pub fn handle_events<D: Transport, R: RegistrationService + Send + 'static>(
app: &mut ChatApp<D, R>,
) -> io::Result<bool> {
// Poll for events with a short timeout to allow checking incoming messages