pub struct InMemoryHandler {
pub local: Option<String>,
pub peer: Option<String>,
}Expand description
A simulated transport that authenticates a fixed local-and-peer VID pair.
On the consumer side it reports the configured peer as the transport-authenticated issuer and the configured local party as the transport-authenticated recipient. On the producer side it strips in-band members that match the configured local-as-issuer / peer-as-recipient assignment — modelling the §9.2 item 1 behavior of a transport that conveys authenticated identity end-to-end.
Use it for tests and examples that want to exercise the
TransportHandler contract without standing up a real binding.
Fields§
§local: Option<String>Authenticated identity of the party running this handler.
peer: Option<String>Authenticated identity of the peer this handler is talking to.
Implementations§
Source§impl InMemoryHandler
impl InMemoryHandler
Sourcepub fn new() -> InMemoryHandler
pub fn new() -> InMemoryHandler
Construct a handler with no configured parties (equivalent to
NoopHandler for consumer-side
resolution).
Sourcepub fn with_local(self, vid: impl Into<String>) -> InMemoryHandler
pub fn with_local(self, vid: impl Into<String>) -> InMemoryHandler
Set the local party identity. Builder-style.
Sourcepub fn with_peer(self, vid: impl Into<String>) -> InMemoryHandler
pub fn with_peer(self, vid: impl Into<String>) -> InMemoryHandler
Set the peer party identity. Builder-style.
Trait Implementations§
Source§impl Clone for InMemoryHandler
impl Clone for InMemoryHandler
Source§fn clone(&self) -> InMemoryHandler
fn clone(&self) -> InMemoryHandler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InMemoryHandler
impl Debug for InMemoryHandler
Source§impl Default for InMemoryHandler
impl Default for InMemoryHandler
Source§fn default() -> InMemoryHandler
fn default() -> InMemoryHandler
Source§impl TransportHandler for InMemoryHandler
impl TransportHandler for InMemoryHandler
Source§fn binding_uri(&self) -> &str
fn binding_uri(&self) -> &str
Source§fn derive_parties(&self) -> TransportContext
fn derive_parties(&self) -> TransportContext
Source§fn prepare_outbound<P>(&self, doc: &mut TrustTask<P>)where
P: Serialize,
fn prepare_outbound<P>(&self, doc: &mut TrustTask<P>)where
P: Serialize,
Source§fn resolve_parties<P>(
&self,
doc: &TrustTask<P>,
) -> Result<ResolvedParties, ConsistencyError>
fn resolve_parties<P>( &self, doc: &TrustTask<P>, ) -> Result<ResolvedParties, ConsistencyError>
ResolvedParties for an inbound document. Read moreSource§fn reject<P>(
&self,
doc: &TrustTask<P>,
id: impl Into<String>,
reason: RejectReason,
) -> Option<TrustTask<ErrorPayload>>
fn reject<P>( &self, doc: &TrustTask<P>, id: impl Into<String>, reason: RejectReason, ) -> Option<TrustTask<ErrorPayload>>
trust-task-error response for doc that satisfies the
SPEC.md §8.1 routing rules — most importantly, the rule that under
RejectReason::IdentityMismatch the error MUST address the
transport-authenticated sender and MUST NOT address the contested
in-band issuer. Read more