Skip to main content

TapMessageBody

Trait TapMessageBody 

Source
pub trait TapMessageBody:
    Serialize
    + DeserializeOwned
    + Send
    + Sync {
    // Required methods
    fn message_type() -> &'static str
       where Self: Sized;
    fn validate(&self) -> Result<()>;

    // Provided methods
    fn to_didcomm(&self, from: &str) -> Result<PlainMessage> { ... }
    fn to_didcomm_with_route<'a, I>(
        &self,
        from: &str,
        to: I,
    ) -> Result<PlainMessage>
       where I: IntoIterator<Item = &'a str> { ... }
    fn from_didcomm(message: &PlainMessage) -> Result<Self>
       where Self: Sized { ... }
}
Expand description

A trait for TAP message body types that can be serialized to and deserialized from DIDComm messages.

Required Methods§

Source

fn message_type() -> &'static str
where Self: Sized,

Get the message type string for this body type.

Source

fn validate(&self) -> Result<()>

Validate the message body.

Provided Methods§

Source

fn to_didcomm(&self, from: &str) -> Result<PlainMessage>

Convert this body to a DIDComm message.

Source

fn to_didcomm_with_route<'a, I>( &self, from: &str, to: I, ) -> Result<PlainMessage>
where I: IntoIterator<Item = &'a str>,

Convert this body to a DIDComm message with a custom routing path.

This method allows specifying an explicit list of recipient DIDs, overriding the automatic extraction of participants from the message body.

§Arguments
  • from - The sender DID
  • to - An iterator of recipient DIDs
§Returns

A new DIDComm message with the specified routing

Source

fn from_didcomm(message: &PlainMessage) -> Result<Self>
where Self: Sized,

Extract this body type from a DIDComm message.

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.

Implementors§