@@ -11,7 +11,7 @@ mod document_version;
1111
1212pub use additional_fields:: AdditionalFields ;
1313use anyhow:: anyhow;
14- pub use catalyst_types:: uuid:: { V4 as UuidV4 , V7 as UuidV7 } ;
14+ pub use catalyst_types:: uuid:: { CborContext , V4 as UuidV4 , V7 as UuidV7 } ;
1515pub use content_encoding:: ContentEncoding ;
1616pub use content_type:: ContentType ;
1717use coset:: CborSerializable ;
@@ -221,23 +221,26 @@ fn cose_protected_header_find(
221221}
222222
223223/// Convert from `minicbor` into `coset::cbor::Value`.
224- pub ( crate ) fn encode_cbor_value < T : minicbor:: encode:: Encode < ( ) > > (
224+ pub ( crate ) fn encode_cbor_value < T : minicbor:: encode:: Encode < CborContext > > (
225225 value : T ,
226226) -> anyhow:: Result < coset:: cbor:: Value > {
227227 let mut cbor_bytes = Vec :: new ( ) ;
228- minicbor:: encode ( value, & mut cbor_bytes)
228+ minicbor:: encode_with ( value, & mut cbor_bytes, & mut CborContext :: Tagged )
229229 . map_err ( |e| anyhow:: anyhow!( "Unable to encode CBOR value, err: {e}" ) ) ?;
230230 coset:: cbor:: Value :: from_slice ( & cbor_bytes)
231231 . map_err ( |e| anyhow:: anyhow!( "Invalid CBOR value, err: {e}" ) )
232232}
233233
234234/// Convert `coset::cbor::Value` into `UuidV4`.
235- pub ( crate ) fn decode_cbor_uuid < T : for < ' a > minicbor:: decode:: Decode < ' a , ( ) > + From < uuid:: Uuid > > (
235+ pub ( crate ) fn decode_cbor_uuid <
236+ T : for < ' a > minicbor:: decode:: Decode < ' a , CborContext > + From < uuid:: Uuid > ,
237+ > (
236238 value : coset:: cbor:: Value ,
237239) -> anyhow:: Result < T > {
238240 match value. to_vec ( ) {
239241 Ok ( cbor_value) => {
240- minicbor:: decode ( & cbor_value) . map_err ( |e| anyhow ! ( "Invalid UUID, err: {e}" ) )
242+ minicbor:: decode_with ( & cbor_value, & mut CborContext :: Tagged )
243+ . map_err ( |e| anyhow ! ( "Invalid UUID, err: {e}" ) )
241244 } ,
242245 Err ( e) => anyhow:: bail!( "Invalid CBOR value, err: {e}" ) ,
243246 }
0 commit comments