Skip to content

Commit

Permalink
Include @id on forward message (#502)
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Kovar <[email protected]>

Co-authored-by: Miroslav Kovar <[email protected]>
  • Loading branch information
mirgee and mirgee authored Jun 24, 2022
1 parent 5469f22 commit 47d5813
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions aries_vcx/src/messages/a2a/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ pub mod test_a2a_serialization {
// serialization
let val: Value = serde_json::from_str(&serialized).unwrap();
assert_eq!(val["@type"], Value::String("did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/routing/1.0/forward".into()));
assert_eq!(val["@id"], Value::String("testid".into()));
}

#[test]
Expand Down
5 changes: 5 additions & 0 deletions aries_vcx/src/messages/forward.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use crate::error::prelude::*;
use crate::messages::a2a::MessageId;

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Default)]
pub struct Forward {
#[serde(rename = "@id")]
pub id: MessageId,
pub to: String,
#[serde(rename = "msg")]
pub msg: serde_json::Value,
Expand All @@ -13,6 +16,7 @@ impl Forward {
.map_err(|err| VcxError::from_msg(VcxErrorKind::InvalidState, err))?;

Ok(Forward {
id: MessageId::new(),
to,
msg,
})
Expand All @@ -35,6 +39,7 @@ pub mod tests {

fn _forward() -> Forward {
Forward {
id: MessageId::default(),
to: _to(),
msg: _msg(),
}
Expand Down

0 comments on commit 47d5813

Please sign in to comment.