pub trait KeyDirectorySource: Send + Sync {
// Required method
fn fetch<'life0, 'life1, 'async_trait>(
&'life0 self,
origin: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<FetchedDirectory, WebBotAuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Available on crate features
auth and web-bot-auth only.Expand description
Resolves a directory origin to its key directory (draft §5.5).
origin is an ASCII-serialised origin such as https://bot.example. Implementations
return WebBotAuthError::DirectoryUnavailable or WebBotAuthError::MalformedDirectory
when no directory can be read, and WebBotAuthError::EgressRefused when policy forbids the
fetch. Spec 3.5 §7.3.
§Example
use std::time::Duration;
use adk_auth::web_bot_auth::{Ed25519SigningKey, InMemoryKeyDirectorySource, KeyDirectory, KeyDirectorySource};
let key = Ed25519SigningKey::generate().unwrap();
let source = InMemoryKeyDirectorySource::new();
source.insert("https://bot.example", KeyDirectory::from_keys([&key]), Some(Duration::from_secs(300))).await;
let fetched = source.fetch("https://bot.example").await.unwrap();
assert!(fetched.directory.find(key.thumbprint()).is_some());Required Methods§
Sourcefn fetch<'life0, 'life1, 'async_trait>(
&'life0 self,
origin: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<FetchedDirectory, WebBotAuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn fetch<'life0, 'life1, 'async_trait>(
&'life0 self,
origin: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<FetchedDirectory, WebBotAuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Fetches the key directory published at origin.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".