co_didcomm/messages/
out_of_band.rs1use super::{AttachmentBuilder, Message, MessageType};
2use crate::Result;
3
4impl Message {
5 pub fn as_out_of_band_invitation(
13 mut self,
14 body: impl AsRef<[u8]>,
15 attachments: Option<Vec<AttachmentBuilder>>,
16 ) -> Result<Self> {
17 self.jwm_header.typ = MessageType::DidCommRaw;
18 self.didcomm_header.m_type = serde_json::to_value(&MessageType::DidCommInvitation)
19 .unwrap()
20 .as_str()
21 .unwrap()
22 .to_string();
23 if let Some(attachments) = attachments {
24 for attachment in attachments {
25 self.append_attachment(attachment);
26 }
27 }
28 self.body(std::str::from_utf8(body.as_ref()).unwrap())
29 }
30}