Change summary
src/ecaps2.rs | 12 ++++++++++++
1 file changed, 12 insertions(+)
Detailed changes
@@ -4,6 +4,7 @@ extern crate blake2;
use disco::{Feature, Identity, Disco};
use data_forms::DataForm;
+use hashes;
use hashes::{Hash, parse_hash};
use minidom::Element;
@@ -38,6 +39,17 @@ pub fn parse_ecaps2(root: &Element) -> Result<ECaps2, Error> {
})
}
+pub fn serialise(ecaps2: &ECaps2) -> Element {
+ let mut c = Element::builder("c")
+ .ns(ns::ECAPS2)
+ .build();
+ for hash in ecaps2.hashes.clone() {
+ let hash_elem = hashes::serialise(&hash);
+ c.append_child(hash_elem);
+ }
+ c
+}
+
fn compute_item(field: &str) -> Vec<u8> {
let mut bytes = field.as_bytes().to_vec();
bytes.push(0x1f);