diff --git a/Cargo.lock b/Cargo.lock index 8ecab0db47..9889f1a9da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2156,7 +2156,6 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", - "serde", ] [[package]] @@ -2167,7 +2166,6 @@ checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", "hashbrown 0.14.1", - "serde", ] [[package]] @@ -2684,7 +2682,6 @@ dependencies = [ "messages_macros", "serde", "serde_json", - "serde_with", "shared_vcx", "strum 0.24.1", "strum_macros 0.24.3", @@ -3707,35 +3704,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_with" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" -dependencies = [ - "base64", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.0.2", - "serde", - "serde_json", - "serde_with_macros", - "time 0.3.20", -] - -[[package]] -name = "serde_with_macros" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" -dependencies = [ - "darling 0.20.3", - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "sha1" version = "0.10.6" diff --git a/messages/Cargo.toml b/messages/Cargo.toml index 32de39aa03..21dd89d643 100644 --- a/messages/Cargo.toml +++ b/messages/Cargo.toml @@ -25,4 +25,3 @@ messages_macros = { path = "../messages_macros" } diddoc_legacy = { path = "../diddoc_legacy" } shared_vcx = { path = "../shared_vcx" } did_parser = { path = "../did_parser" } -serde_with = { version = "3.4.0", features = ["base64"] } diff --git a/messages/src/msg_fields/protocols/pickup/delivery.rs b/messages/src/msg_fields/protocols/pickup/delivery.rs index 5e42a74940..6e8726a650 100644 --- a/messages/src/msg_fields/protocols/pickup/delivery.rs +++ b/messages/src/msg_fields/protocols/pickup/delivery.rs @@ -1,9 +1,8 @@ use serde::{Deserialize, Serialize}; -use serde_with::{base64::Base64, serde_as}; use typed_builder::TypedBuilder; use crate::{ - decorators::{thread::Thread, transport::Transport}, + decorators::{attachment::Attachment, thread::Thread, transport::Transport}, msg_parts::MsgParts, }; @@ -15,21 +14,7 @@ pub struct DeliveryContent { #[serde(skip_serializing_if = "Option::is_none")] pub recipient_key: Option, #[serde(rename = "~attach")] - pub attach: Vec, -} - -#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] -pub struct DeliveryAttach { - #[serde(rename = "@id")] - pub id: String, - pub data: DeliveryAttachData, -} - -#[serde_as] -#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] -pub struct DeliveryAttachData { - #[serde_as(as = "Base64")] - pub base64: Vec, + pub attach: Vec, } #[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] @@ -52,7 +37,12 @@ mod tests { use super::*; use crate::{ - decorators::thread::Thread, misc::test_utils, msg_types::protocols::pickup::PickupTypeV2_0, + decorators::{ + attachment::{AttachmentData, AttachmentType}, + thread::Thread, + }, + misc::test_utils, + msg_types::protocols::pickup::PickupTypeV2_0, }; #[test] fn test_delivery() { @@ -72,9 +62,13 @@ mod tests { }] } ); - let attach = DeliveryAttach::builder() + let attach = Attachment::builder() .id("".to_owned()) - .data(DeliveryAttachData::builder().base64("".into()).build()) + .data( + AttachmentData::builder() + .content(AttachmentType::Base64("".into())) + .build(), + ) .build(); let content = DeliveryContent::builder() .recipient_key("".to_owned())