pub trait WitnessClient: Send + Sync {
// Required methods
fn submit_event(
&self,
endpoint: &str,
event: &[u8],
) -> impl Future<Output = Result<Vec<u8>, NetworkError>> + Send;
fn query_receipts(
&self,
endpoint: &str,
prefix: &Prefix,
) -> impl Future<Output = Result<Vec<Vec<u8>>, NetworkError>> + Send;
}Expand description
Submits key events and queries receipts from the witness infrastructure.
Witnesses observe and receipt key events to provide accountability. Implementations handle the transport details; the domain provides serialized events and receives receipts as opaque byte arrays.
Usage:
ⓘ
use auths_core::ports::network::WitnessClient;
async fn witness_inception(client: &dyn WitnessClient, endpoint: &str, event: &[u8]) {
let receipt = client.submit_event(endpoint, event).await.unwrap();
}Required Methods§
Sourcefn submit_event(
&self,
endpoint: &str,
event: &[u8],
) -> impl Future<Output = Result<Vec<u8>, NetworkError>> + Send
fn submit_event( &self, endpoint: &str, event: &[u8], ) -> impl Future<Output = Result<Vec<u8>, NetworkError>> + Send
Submits a serialized key event to a witness and returns the receipt bytes.
Args:
endpoint: The witness endpoint identifier.event: The serialized key event bytes.
Usage:
ⓘ
let receipt = client.submit_event("witness-1.example.com", &event_bytes).await?;Sourcefn query_receipts(
&self,
endpoint: &str,
prefix: &Prefix,
) -> impl Future<Output = Result<Vec<Vec<u8>>, NetworkError>> + Send
fn query_receipts( &self, endpoint: &str, prefix: &Prefix, ) -> impl Future<Output = Result<Vec<Vec<u8>>, NetworkError>> + Send
Queries all receipts a witness holds for the given KERI prefix.
Args:
endpoint: The witness endpoint identifier.prefix: The KERI prefix to query receipts for.
Usage:
ⓘ
let prefix = Prefix::new_unchecked("EAbcdef...".into());
let receipts = client.query_receipts("witness-1.example.com", &prefix).await?;Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.