From 98b846ca2fb17f4428a67cd3e50a7c9c39294b20 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Wed, 8 Jan 2025 17:10:40 +0100 Subject: [PATCH 1/3] Release ctaphid-app v0.1.0 --- Cargo.toml | 2 +- app/CHANGELOG.md | 4 ++-- app/Cargo.toml | 2 +- dispatch/Cargo.toml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index aabf24f..8f29ba1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/solokeys/ctaphid-dispatch" [workspace.dependencies] heapless-bytes = "0.3" -trussed-core = "0.1.0-rc.1" +trussed-core = "0.1.0" [patch.crates-io] ctaphid-app.path = "app" diff --git a/app/CHANGELOG.md b/app/CHANGELOG.md index 541c212..1f9129a 100644 --- a/app/CHANGELOG.md +++ b/app/CHANGELOG.md @@ -1,5 +1,5 @@ # Changelog -## [v0.1.0-rc.1](https://github.com/trussed-dev/ctaphid-dispatch/releases/tag/app-v0.1.0-rc.1) (2025-01-08) +## [v0.1.0](https://github.com/trussed-dev/ctaphid-dispatch/releases/tag/app-v0.1.0) (2025-01-08) -- Extract `app` and `command` modules from `ctaphid-dispatch` 0.1 into a separate crate. +Initial release that extracts the `app` and `command` modules from `ctaphid-dispatch` 0.1 into a separate crate. diff --git a/app/Cargo.toml b/app/Cargo.toml index 66e77cb..1a2a651 100644 --- a/app/Cargo.toml +++ b/app/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ctaphid-app" -version = "0.1.0-rc.1" +version = "0.1.0" description = "trait for CTAPHID applications" authors.workspace = true diff --git a/dispatch/Cargo.toml b/dispatch/Cargo.toml index acfb1ab..113c7d7 100644 --- a/dispatch/Cargo.toml +++ b/dispatch/Cargo.toml @@ -9,7 +9,7 @@ license.workspace = true repository.workspace = true [dependencies] -ctaphid-app = "0.1.0-rc.1" +ctaphid-app = "0.1" delog = "0.1" heapless-bytes.workspace = true interchange = "0.3.0" From 753fec94e10f79de0c8731cfd0a175204065d0a7 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Wed, 8 Jan 2025 18:19:00 +0100 Subject: [PATCH 2/3] Cleanup ctaphid-dispatch API This patch flattens the public API of ctaphid-dispatch by making the dispatch and types modules private and re-exporting the relevant types from the root and removes unnecessary re-exports of the types defined by ctaphid-app. --- dispatch/CHANGELOG.md | 1 + dispatch/src/constants.rs | 5 ----- dispatch/src/lib.rs | 14 +++++--------- dispatch/src/types.rs | 14 +------------- 4 files changed, 7 insertions(+), 27 deletions(-) delete mode 100644 dispatch/src/constants.rs diff --git a/dispatch/CHANGELOG.md b/dispatch/CHANGELOG.md index a8e7742..74ff3e6 100644 --- a/dispatch/CHANGELOG.md +++ b/dispatch/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Move the `app` and `command` modules into a separate crate, `ctaphid-app`, and re-export it. - Make `App` trait generic over the response size. - Remove unused `ShortMessage` type. +- Flatten the public module structure and remove unnecessary re-exports. ## [0.1.1] - 2022-08-22 - adjust to `interchange` API change diff --git a/dispatch/src/constants.rs b/dispatch/src/constants.rs deleted file mode 100644 index 4c864d7..0000000 --- a/dispatch/src/constants.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub const PACKET_SIZE: usize = 64; - -// 7609 bytes -pub const MESSAGE_SIZE: usize = PACKET_SIZE - 7 + 128 * (PACKET_SIZE - 5); - diff --git a/dispatch/src/lib.rs b/dispatch/src/lib.rs index bd41888..8f00a84 100644 --- a/dispatch/src/lib.rs +++ b/dispatch/src/lib.rs @@ -13,14 +13,10 @@ extern crate delog; generate_macros!(); -pub mod dispatch; -pub mod types; +mod dispatch; +mod types; -pub mod app { - pub use crate::types::AppResult; - pub use ctaphid_app::{App, Command, Error}; -} +pub use ctaphid_app as app; -pub mod command { - pub use ctaphid_app::{Command, VendorCommand}; -} +pub use dispatch::Dispatch; +pub use types::{Channel, InterchangeResponse, Message, Requester, Responder, MESSAGE_SIZE}; diff --git a/dispatch/src/types.rs b/dispatch/src/types.rs index a8d034b..a7fa6c7 100644 --- a/dispatch/src/types.rs +++ b/dispatch/src/types.rs @@ -1,19 +1,9 @@ +use ctaphid_app::{Command, Error}; use heapless_bytes::Bytes; -pub use ctaphid_app::Error; - -// // 7609 bytes is max message size for ctaphid -// type U6144 = >::Output; -// type U7168 = >::Output; -// pub type U7609 = >::Output; -// pub type U7609 = heapless::consts::U4096; - -// TODO: find reasonable size -// pub type Message = heapless::Vec; pub const MESSAGE_SIZE: usize = 7609; pub type Message = Bytes; -pub type AppResult = core::result::Result<(), Error>; /// Wrapper struct that implements [`Default`][] to be able to use [`response_mut`](interchange::Responder::response_mut) pub struct InterchangeResponse(pub Result); @@ -36,8 +26,6 @@ impl From for Result { } } -pub use crate::command::Command; - pub type Responder<'pipe> = interchange::Responder<'pipe, (Command, Message), InterchangeResponse>; pub type Requester<'pipe> = interchange::Requester<'pipe, (Command, Message), InterchangeResponse>; pub type Channel = interchange::Channel<(Command, Message), InterchangeResponse>; From 20017616a76e3886bb71c9cf01296b535a367468 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Wed, 8 Jan 2025 18:20:46 +0100 Subject: [PATCH 3/3] Release ctaphid-dispatch v0.2.0 --- dispatch/CHANGELOG.md | 4 ++++ dispatch/Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dispatch/CHANGELOG.md b/dispatch/CHANGELOG.md index 74ff3e6..2100ac1 100644 --- a/dispatch/CHANGELOG.md +++ b/dispatch/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +- + +## [0.2.0] - 2025-01-08 + - Optimize stack usage of `Dispatch::poll` - Replace `trussed` dependency with `trussed-core`. - Replace `heapless` dependency with `heapless-bytes`. diff --git a/dispatch/Cargo.toml b/dispatch/Cargo.toml index 113c7d7..131cbff 100644 --- a/dispatch/Cargo.toml +++ b/dispatch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ctaphid-dispatch" -version = "0.1.1" +version = "0.2.0" description = "Dispatch layer after usbd-ctaphid" authors.workspace = true