Skip to content

Commit

Permalink
feat(mediator): Use UnpackMessage struct newly defined in aries
Browse files Browse the repository at this point in the history
Previously using struct defined in vdrtools. Use aries-vcx definition instead.

Signed-off-by: Naian <[email protected]>
  • Loading branch information
nain-F49FF806 committed Sep 27, 2023
1 parent 998d27a commit 3b6393e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 4 additions & 4 deletions mediator/src/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use aries_vcx_core::{
wallet::{
base_wallet::BaseWallet,
indy::{wallet::create_and_open_wallet, IndySdkWallet, WalletConfig},
structs_io::UnpackMessageOutput,
},
WalletHandle,
};
Expand All @@ -22,7 +23,7 @@ use messages::{
AriesMessage,
};

use crate::utils::{prelude::*, structs::UnpackMessage};
use crate::utils::prelude::*;

pub mod utils;
// #[cfg(test)]
Expand Down Expand Up @@ -110,13 +111,12 @@ where
Err("No service to create invite for".to_owned())
}
}
pub async fn unpack_didcomm(&self, didcomm_msg: &[u8]) -> Result<UnpackMessage, String> {
let decrypted_msg = self
pub async fn unpack_didcomm(&self, didcomm_msg: &[u8]) -> Result<UnpackMessageOutput, String> {
let unpacked = self
.wallet
.unpack_message(didcomm_msg)
.await
.expect("Valid didcomm?");
let unpacked: UnpackMessage = serde_json::from_slice(&decrypted_msg).unwrap();
info!("{:#?}", unpacked);
Ok(unpacked)
}
Expand Down
3 changes: 0 additions & 3 deletions mediator/src/utils/structs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
pub type VeriKey = String;
// for documentation see aries-vcx/libvdrtools/src/controllers/crypto.rs
// https://github.com/hyperledger/aries-rfcs/tree/main/features/0019-encryption-envelope#unpack_message-return-values-authcrypt-mode
pub use vdrtools::domain::crypto::pack::UnpackMessage;

0 comments on commit 3b6393e

Please sign in to comment.