pub struct DefaultMessagePacker { /* private fields */ }Expand description
Default implementation of the MessagePacker trait.
This implementation uses DIDComm for message packing and unpacking, providing secure communications with support for the different security modes defined in the TAP protocol.
Implementations§
Source§impl DefaultMessagePacker
impl DefaultMessagePacker
Sourcepub fn new(
did_resolver: Arc<dyn SyncDIDResolver>,
secrets_resolver: Arc<dyn DebugSecretsResolver>,
) -> Self
pub fn new( did_resolver: Arc<dyn SyncDIDResolver>, secrets_resolver: Arc<dyn DebugSecretsResolver>, ) -> Self
Create a new DefaultMessagePacker
§Parameters
did_resolver- The DID resolver to use for resolving DIDssecrets_resolver- The secrets resolver to use for cryptographic operations
Sourcepub async fn unpack_message<T: DeserializeOwned + Send>(
&self,
packed: &str,
) -> Result<T>
pub async fn unpack_message<T: DeserializeOwned + Send>( &self, packed: &str, ) -> Result<T>
Unpack a message and parse it to the requested type
Trait Implementations§
Source§impl Debug for DefaultMessagePacker
impl Debug for DefaultMessagePacker
Source§impl MessagePacker for DefaultMessagePacker
impl MessagePacker for DefaultMessagePacker
Source§fn pack_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 (dyn Serialize + Sync),
to: &'life2 str,
from: Option<&'life3 str>,
mode: SecurityMode,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn pack_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 (dyn Serialize + Sync),
to: &'life2 str,
from: Option<&'life3 str>,
mode: SecurityMode,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Pack a message for the specified recipient using DIDComm
Serializes the message, creates a DIDComm message, and applies the appropriate security measures based on the security mode.
§Parameters
message- The message to packto- The DID of the recipientfrom- The DID of the sender, or None for anonymous messagesmode- The security mode to use
§Returns
The packed message as a string
Auto Trait Implementations§
impl Freeze for DefaultMessagePacker
impl !RefUnwindSafe for DefaultMessagePacker
impl Send for DefaultMessagePacker
impl Sync for DefaultMessagePacker
impl Unpin for DefaultMessagePacker
impl !UnwindSafe for DefaultMessagePacker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more