From 721d1eb5b6d04aa2ae60caab0f2a66ae8369cfb5 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Mon, 21 Oct 2024 22:07:15 +0200 Subject: [PATCH] Update cbor-smol to v0.5.0 --- CHANGELOG.md | 1 + Cargo.toml | 2 +- src/lib.rs | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c33974c24c6..c8b6fb86053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 of being generic over the storage implementation. - Add `nonce` argument to `wrap_key` and `unwrap_key` syscalls. - Use nonce as IV for Aes256Cbc mechanism. +- Updated `cbor-smol` to 0.5.0. ### Fixed diff --git a/Cargo.toml b/Cargo.toml index 90477e8065b..1ac8cfed08f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ sha2 = { version = "0.10", default-features = false } # ours cosey = "0.3" delog = "0.1.0" -cbor-smol = "0.4" +cbor-smol = { version = "0.5", features = ["heapless-bytes-v0-3"] } heapless-bytes = { version = "0.3.0" } interchange = "0.3.0" littlefs2 = "0.4.0" diff --git a/src/lib.rs b/src/lib.rs index 1800550d70e..c84ffe4aea7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,9 +49,17 @@ pub use error::Error; pub use platform::Platform; pub use service::Service; -pub use cbor_smol::{cbor_deserialize, cbor_serialize_bytes}; +pub use cbor_smol::cbor_deserialize; pub use heapless_bytes::Bytes; +pub fn cbor_serialize_bytes( + object: &T, +) -> cbor_smol::Result> { + let mut data = Bytes::new(); + cbor_smol::cbor_serialize_to(object, &mut data)?; + Ok(data) +} + pub(crate) use postcard::from_bytes as postcard_deserialize; pub(crate) fn postcard_serialize_bytes(