Struct PlainMessage

Source
pub struct PlainMessage {
Show 13 fields pub id: String, pub typ: String, pub type_: String, pub body: Value, pub from: String, pub to: Vec<String>, pub thid: Option<String>, pub pthid: Option<String>, pub extra_headers: HashMap<String, Value>, pub created_time: Option<u64>, pub expires_time: Option<u64>, pub from_prior: Option<String>, pub attachments: Option<Vec<Attachment>>,
}
Expand description

Wrapper for plain message. Provides helpers for message building and packing/unpacking. Adapted from https://github.com/sicpa-dlab/didcomm-rust/blob/main/src/message/message.rs

Fields§

§id: String

Message id. Must be unique to the sender.

§typ: String

Optional, if present it must be “application/didcomm-plain+json”

§type_: String

Message type attribute value MUST be a valid Message Type URI, that when resolved gives human readable information about the message. The attribute’s value also informs the content of the message, or example the presence of other attributes and how they should be processed.

§body: Value

Message body.

§from: String

Sender identifier. The from attribute MUST be a string that is a valid DID or DID URL (without the fragment component) which identifies the sender of the message.

§to: Vec<String>

Identifier(s) for recipients. MUST be an array of strings where each element is a valid DID or DID URL (without the fragment component) that identifies a member of the message’s intended audience.

§thid: Option<String>

Uniquely identifies the thread that the message belongs to. If not included the id property of the message MUST be treated as the value of the thid.

§pthid: Option<String>

If the message is a child of a thread the pthid will uniquely identify which thread is the parent.

§extra_headers: HashMap<String, Value>

Custom message headers.

§created_time: Option<u64>

The attribute is used for the sender to express when they created the message, expressed in UTC Epoch Seconds (seconds since 1970-01-01T00:00:00Z UTC). This attribute is informative to the recipient, and may be relied on by protocols.

§expires_time: Option<u64>

The expires_time attribute is used for the sender to express when they consider the message to be expired, expressed in UTC Epoch Seconds (seconds since 1970-01-01T00:00:00Z UTC). This attribute signals when the message is considered no longer valid by the sender. When omitted, the message is considered to have no expiration by the sender.

§from_prior: Option<String>

from_prior is a compactly serialized signed JWT containing FromPrior value

§attachments: Option<Vec<Attachment>>

Trait Implementations§

Source§

impl Clone for PlainMessage

Source§

fn clone(&self) -> PlainMessage

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Connectable for PlainMessage

Source§

fn with_connection(&mut self, connect_id: &str) -> &mut Self

Connect this message to a prior Connect message by setting the parent thread ID (pthid). Read more
Source§

fn has_connection(&self) -> bool

Check if this message is connected to a prior Connect message. Read more
Source§

fn connection_id(&self) -> Option<&str>

Get the connection ID if present. Read more
Source§

impl Debug for PlainMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PlainMessage

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for PlainMessage

Source§

fn eq(&self, other: &PlainMessage) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PlainMessage

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TapMessage for PlainMessage

Source§

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

Validates a TAP message. Read more
Source§

fn is_tap_message(&self) -> bool

Checks if this message is a TAP message.
Source§

fn get_tap_type(&self) -> Option<String>

Gets the TAP message type from this message.
Source§

fn body_as<T: TapMessageBody>(&self) -> Result<T>

Extract a specific message body type from this message. Read more
Source§

fn get_all_participants(&self) -> Vec<String>

Get all participant DIDs from this message. Read more
Source§

fn message_type(&self) -> &'static str

Get the message type for this message
Source§

fn thread_id(&self) -> Option<&str>

Get the thread ID for this message
Source§

fn parent_thread_id(&self) -> Option<&str>

Get the parent thread ID for this message
Source§

fn message_id(&self) -> &str

Get the message ID for this message
Source§

fn create_reply<T: TapMessageBody>( &self, body: &T, creator_did: &str, ) -> Result<PlainMessage>

Create a reply to this message. Read more
Source§

impl Eq for PlainMessage

Source§

impl StructuralPartialEq for PlainMessage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,