From 6bbf3581104ff3efe53acadaf276dcba4a4af778 Mon Sep 17 00:00:00 2001 From: Dave Chen Date: Mon, 9 Oct 2023 17:33:48 +0800 Subject: [PATCH] fix: update to fix compile issue The code is not compilable due to the below error: could not find `sign` in `cose` Signed-off-by: Dave Chen --- src/ear.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ear.rs b/src/ear.rs index 7ec0fca..50c3cc8 100644 --- a/src/ear.rs +++ b/src/ear.rs @@ -18,6 +18,7 @@ use crate::error::Error; use crate::id::VerifierID; use crate::nonce::Nonce; use crate::trust::tier::TrustTier; +use cose::message::CoseMessage; #[allow(clippy::upper_case_acronyms)] enum KeyFormat { @@ -151,7 +152,7 @@ impl Ear { } fn from_cose(token: &[u8], key: &cose::keys::CoseKey) -> Result { - let mut sign1 = cose::sign::CoseSign::new(); + let mut sign1 = CoseMessage::new_sign(); sign1.bytes = token.to_vec(); sign1.init_decoder(None).unwrap(); @@ -290,7 +291,7 @@ impl Ear { ciborium::ser::into_writer(self, &mut payload) .map_err(|e| Error::SignError(e.to_string()))?; - let mut sign1 = cose::sign::CoseSign::new(); + let mut sign1 = CoseMessage::new_sign(); sign1.payload(payload); sign1.header.alg(alg, true, false); @@ -307,7 +308,7 @@ impl Ear { .map_err(|e| Error::SignError(format!("{e:?}")))?; sign1 - .gen_signature(None) + .secure_content(None) .map_err(|e| Error::SignError(format!("{e:?}")))?; sign1 .encode(true)