From 220b03d3ca7fe2c4a882b25855788ea2c8e87871 Mon Sep 17 00:00:00 2001 From: Orual Date: Tue, 7 Oct 2025 23:38:00 -0400 Subject: [PATCH] some niceties for agent session --- crates/jacquard/src/client.rs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/crates/jacquard/src/client.rs b/crates/jacquard/src/client.rs index 99876201..839d6501 100644 --- a/crates/jacquard/src/client.rs +++ b/crates/jacquard/src/client.rs @@ -27,11 +27,6 @@ pub use token::FileAuthStore; use crate::client::credential_session::{CredentialSession, SessionKey}; -pub(crate) const NSID_REFRESH_SESSION: &str = "com.atproto.server.refreshSession"; - -/// Basic client wrapper: reqwest transport + in-memory session store. -pub struct BasicClient(); //AtClient, AuthSession>>); - /// App password session information from `com.atproto.server.createSession` /// /// Contains the access and refresh tokens along with user identity information. @@ -256,3 +251,22 @@ impl XrpcClient for Agent { async move { self.inner.send(request).await } } } + +impl From for Agent { + fn from(inner: A) -> Self { + Self::new(inner) + } +} + +/// Alias for an agent over a credential (app‑password) session. +pub type CredentialAgent = Agent>; +/// Alias for an agent over an OAuth (DPoP) session. +pub type OAuthAgent = Agent>; + +/// BasicClient: in-memory store + public resolver over a credential session. +pub type BasicClient = Agent< + CredentialSession< + MemorySessionStore, + jacquard_identity::PublicResolver, + >, +>; -- 2.51.2