diff --git a/rust/signed_doc/examples/cat-signed-doc.rs b/rust/signed_doc/examples/cat-signed-doc.rs index dce556657..60afc770e 100644 --- a/rust/signed_doc/examples/cat-signed-doc.rs +++ b/rust/signed_doc/examples/cat-signed-doc.rs @@ -21,8 +21,6 @@ enum Cli { Inspect { /// Path to the fully formed (should has at least one signature) COSE document cose_sign: PathBuf, - /// Path to the json schema (Draft 7) to validate document against it - doc_schema: PathBuf, }, } @@ -30,10 +28,7 @@ impl Cli { /// Execute Cli command fn exec(self) -> anyhow::Result<()> { match self { - Self::Inspect { - cose_sign, - doc_schema: _, - } => { + Self::Inspect { cose_sign } => { // let mut cose_file = File::open(cose_sign)?; let mut cose_file_bytes = Vec::new(); @@ -48,6 +43,7 @@ impl Cli { fn main() { println!("Catalyst Signed Document"); + println!("------------------------"); if let Err(err) = Cli::parse().exec() { println!("{err}"); } diff --git a/rust/signed_doc/examples/mk_signed_doc.rs b/rust/signed_doc/examples/mk_signed_doc.rs index c891fac3e..a78a3206e 100644 --- a/rust/signed_doc/examples/mk_signed_doc.rs +++ b/rust/signed_doc/examples/mk_signed_doc.rs @@ -84,7 +84,7 @@ fn decode_cbor_uuid(val: &coset::cbor::Value) -> anyhow::Result { fn encode_cbor_document_ref(doc_ref: &DocumentRef) -> coset::cbor::Value { match doc_ref { DocumentRef::Latest { id } => encode_cbor_uuid(id), - DocumentRef::WithVer { id, ver } => { + DocumentRef::WithVer(id, ver) => { coset::cbor::Value::Array(vec![encode_cbor_uuid(id), encode_cbor_uuid(ver)]) }, } @@ -101,7 +101,7 @@ fn decode_cbor_document_ref(val: &coset::cbor::Value) -> anyhow::Result) -> Result<(), std::fmt::Error> { writeln!(f, "{}", self.inner.metadata)?; - writeln!(f, "JSON Payload {:#}", self.inner.payload)?; + writeln!(f, "JSON Payload {:#}\n", self.inner.payload)?; writeln!(f, "Signatures [")?; for signature in &self.inner.signatures { - writeln!(f, " {:#}", hex::encode(signature.signature.as_slice()))?; + writeln!(f, " 0x{:#}", hex::encode(signature.signature.as_slice()))?; } - writeln!(f, "]")?; + writeln!(f, "]\n")?; writeln!(f, "Content Errors [")?; for error in &self.inner.content_errors { writeln!(f, " {error:#}")?; @@ -116,12 +116,8 @@ pub enum DocumentRef { id: uuid::Uuid, }, /// Reference to the specific document version - WithVer { - /// Document ID UUID - id: uuid::Uuid, - /// Document Version UUID - ver: uuid::Uuid, - }, + /// Document ID UUID, Document Ver UUID + WithVer(uuid::Uuid, uuid::Uuid), } // Do this instead of `new` if we are converting a single parameter into a struct/type we @@ -249,7 +245,7 @@ fn decode_cbor_document_ref(val: &coset::cbor::Value) -> anyhow::Result